Contact Us

If you are interested in our services leave your contact details below and our sales representatives will contact you.

The organization which you represent
Email address we will use to contact you
Longer contact form…
 
  • About

    mFabrik Blog is about mobile and web software development, open source and Linux. We tell exciting tales where business, technology, web and mobile convergence.

    Creative Commons License
    This work is licensed under a Creative Commons Attribution 3.0 Unported License.

domgen – Creating HTML with Javascript without DOM API




Tired of using Javascript DOM API for generating HTML dynamically? Meet domgen. domgen is a tool for easy dynamic content generation via Javascript. It generates DOM elements from dictionary specification similar to HTML and eliminates the need for cumbersome DOM Javascript API.

domgen uses a simple specification to generate the HTML. In some cases it’s more reliable to use DOM API to generate HTML instead of using innerHTML. We have had problems especially with iPhone when using innerHTML.
See for example http://pastebin.com/LLk3J0iH or google “iPhone innerHTML” for more info. In fact, innerHTML is not even part of the HTML standard even though it exists on every browser.

So if you want to add dynamic HTML properly, you should use the Javascript DOM API. Consider the following short HTML where the contents inside body had to be generated:

<body>
    <div id="mydiv">my div</div>
</body>

Using Javascript DOM API:

// Get the body tag
var body = document.getElementsByTagName("body")[0];
// Create 'div' element
var mydiv = document.createElement("div");
mydiv.setAttribute("id", "mydiv");
mydiv.innerText = "my div";
// Attach the div to body
body.appendChild(mydiv);

And using domgen:

var spec = [
    'div',
    {
        id : 'mydiv',
        _innerText : 'my div'
    }
];
domgen.generate( domgen.get("body")[0], spec);
// or with jQuery
domgen.generate( $("body")[0], spec);

To me, domgen seems a lot easier to read and work with. Get code and more examples here: https://bitbucket.org/mfabrik/domgen


Leave a Comment

Market statistics: “Out with the Paper Shopping List, in with the Smartphone”




We, mobile and internet professionals, too often follow only news and stats etc. of our own industry and thus can’t see signs of market and other developments outside our core businesses until those signs becomes actions and acts and then we start furiously tries to catch up and to dive – sometimes too late – into sea of new opportunities. Uh, that was long complex sentence and I’m not sure if I can even follow it ;) ..

Anyway, one of my colleagues forwarded me one press release from the Nielsen, one of the leading companies providing market research and statistics. Forwarded press release was very far from the ones I usually read but the kind of I should be following and reading even more than mobile and internet industry related ones.

In Nielsen Company’s Retail 2015 Forecast (shortly: about the future development of consumer packaged goods industry, ie physical things and stuff we do buy) press release (and in the report itself) one of the major conclusions and predictions is that catchy sentence I am using as title of this posting: “Out with the Paper Shopping List, in with the Smartphone.”.

By 2015, as Nielsen predicts, smartphones will be primary enabler of consumer shopping engagements. To say it more simple way: people will use mobile phones (smartphones) to search for the information, compare prices and use other services to make decisions before purchases as well as help them to shop better, cheaper and easier. And naturally to shop (=buy) too.

When been talking with clients, retail companies have been very interesting about the possibilities with mobile phones and mobile internet, and applications too, but still pondering if the services what they want can be “fitted” into mobile phones. Sometimes them cannot, but isn’t retail companies’ web sites basically about publishing information? Of their services and products, including texts, images, videos. Simple basic digital content added with purchasing possibilities.

Adding puchasing possibilities (possibility to pay by using commonly used payment methods) is not so big deal anymore and even more complex services, like customer’s account management etc., can be completed fairly straight forwarded way without losing the usability in the mobile phone. Technology and users are there, and  consumers are willing to shop!, but retailers are not yet, in this mobile internet space… some will be soon ;)

Wanna get your shop or store into the hands of the consumers? There’s only one right answer and when you have figured it out, give us a call


Leave a Comment

Plone 4 released – the best open source CMS of 2010?




The long awaited version 4 of enterprise grade Plone CMS has been released.

Vote Plone 4 release news on reddit.

Yeah, yeah… it is a linkadvertisement :)

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


2 Comments

Testing if hostname is numeric IPv4




I had to resort this hack when testing a hybrid web/mobile site which uses site hostname based device discrimination. In production mode we can have m.yoursite.com and www.yoursite.com hostnames. However, when running the site locally, on your development computer and in LAN this does not work very well: one cannot spoof hostnames for web browsers in devices like iPhone/iPod/other mobile phone unless you install a DNS server. And installing a DNS server for LAN is something you don’t want to do…

So, I figured out that I can use  hostname spoofing on desktop computers (/etc/hosts file) and I always access the site via numeric IP (IPv4 over ethernet) when testing over WLAN on mobile devices.

  • The site is rendered in web mode when it is being accessed via textual hostname (localhost, yourpcname)
  • The site is rendered in mobile mode when it is being accessed via IPv4 numeric hostname (127.0.0.1, 196.168.200.1)

And,… dadaa,… here is my magical code to test whether hostname is numeric IPv4. I couldn’t find a ready function from Python standard library

import re

ipv4_regex_source = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
ipv4_regex = re.compile(ipv4_regex_source)

def is_numeric_ipv4(str):
    """

http://answers.oreilly.com/topic/318-how-to-match-ipv4-addresses-with-regular-expressions/

    @param str: Hostname as a string.

    @return: True if the given string is numeric IPv4 address
    """
    # ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
    return ipv4_regex.match(str)

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


2 Comments

UIScrollView & setContentOffset random scrolling on iOS 4




We encountered a nasty bug with UIScrollView while porting app to iOS 4. The following code worked just fine on old iPhone versions:

// Update view with new content
[self updateContent:...]

// We want the view to be on top every time the it is shown
[scrollView setContentOffset:CGPointMake(0,0) animated:NO];

// And set the correct size to enable scrolling.
// contentHeight is updated when setting the content of subviews.
[scrollView setContentSize:CGSizeMake(self.view.frame.size.width, contentheight)];

No problems. But on iOS 4 the UIScrollView decided to do something fancy and scroll to random position depending on where it was left when the view was hidden the last time. After spending expensive manpower to solve the issue by trying numerous ways to tell the scrollView to go to top using setContentOffset, the final solution was simple yet very different what one might think: to fix this we had to set the contentSize to zero before updating any of the content.

// Need to do this on iOS 4 or the view scrolls to random position
[scrollView setContentSize:CGSizeMake(0,0)];

// Update view with new content
[self updateContent:...]

// We want the view to be on top every time it is shown
[scrollView setContentOffset:CGPointMake(0,0) animated:NO];

// And set the correct size to enable scrolling.
// contentHeight is updated when setting the content of subviews.
[scrollView setContentSize:CGSizeMake(self.view.frame.size.width, contentheight)];

Hopefully there is more logical way to update scrollview’s content without being scrolled around.


Leave a Comment

Xcode and iPhone simulator: The application won’t launch




This is another migration issue from iOS 3.x to iOS 4.x projects.

The application does not launch in XCode when running Simulator – Debug. Instead it dies (SIGABRT) before entering main().

#0     0x91a02ef6 in __kill
#1     0x91a02ee8 in kill$UNIX2003
#2     0x91a9562d in raise
#3     0x91aab6e4 in abort
#4     0x0245e8c9 in __springboard_unimplemented
#5     0x0246d6b2 in mcount
#6     0x00002298 in main at main.m:11

The answer lies here. mcount() function is profiling function. Profiling is available only on iPhone device build. The setting “Generate Profile Code” somehow gets into foobar state when you migrate the project from older XCode. Note the setting is present under both Project and Target settings so you might need to fix it under the both sections.

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


Leave a Comment

Open source contribution agreement template




We are looking for creating contribution agreements for few new open source projects. IANAL, but hiring a real lawyer is freaking expensive.

The thing is that we, us a company, want to guarantee that all code coming into the project is “clean”. We also want to guarantee our right to change the license in the future (GPL -> BSD, GPL -> Apache, etc.)

Thus far, the best free, as in freedom and in beer, contribution agreement template we have found is Sun Contribution Agreement 1.5 which is available under  Creative Commons Attribution-Share Alike 3.0 license. It is at least used by high profile Phonegap project (Nitobi as the company) if you don’t count OpenSolaris anymore as open source project.

IANAL, but if I understood correctly, the agreement basically says

  • the company can do whatever it wish with your contributions (joint ownership)
  • the company is entitled to release your contributions under open source license – perfect for GPL’ed projects. The exact wording is terms. Any contribution we make available under any license will also be made available under a suitable FSF (Free Software Foundation) or OSI (Open Source Initiative) approved license.

Since I couldn’t find the orignal document in editable form (PDF was the best I could get) I made OpenOffice.org ODS document out of it with easily replaceable identification information.

Comments welcome.

The agreement text pasted below.

YOURPROJECT Contributor Agreement

These terms apply to your contribution of materials to the YOURCOMPANY ("us"/"our"), and set out the intellectual property rights you grant to us in the contributed materials.  If this contribution is on behalf of a company, the term "you" will also mean the company you identify below. If you agree to be bound by these terms, fill in the information requested below and provide your signature. 

Read this agreement carefully before signing. 

1.  The term "contribution" means any source code, object code, patch, tool, sample, graphic, specification, manual, documentation, or any other material posted or submitted by you to the project. 

2.  With respect to any worldwide copyrights, or copyright applications and registrations, in your contribution: 

you assign to us joint ownership through this document, and to the extent that such assignment is or becomes invalid, ineffective or unenforceable, through this document you grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free, unrestricted license to exercise all rights under those copyrights. This includes, at our option, the right to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements;
you agree that each of us can do all things in relation to your contribution as if each of us were the sole owners, and if one of us makes a derivative work of your contribution, the one who makes the derivative work (or has it made) will be the sole owner of that derivative work;
you agree that you will not assert any moral rights in your contribution against us, our licensees or transferees;
you agree that we may register a copyright in your contribution and exercise all ownership rights associated with it; and
you agree that neither of us has any duty to consult with, obtain the consent of, pay, or give an accounting to the other for any use or distribution of your contribution. 

3.  With respect to any patents you own, or that you can license without payment to any third party, through this document you grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free license to: 

make, have made, use, sell, offer to sell, import, and otherwise transfer your contribution in whole or in part, alone or in combination with or included in any product, work or materials arising out of the project to which your contribution was submitted, and
at our option, to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements. 

4.  Except as set out above, you keep all right, title, and interest in your contribution.  The rights that you grant to us under these terms are effective on the date you first submitted a contribution to us, even if your submission took place before the date you sign these terms. Any contribution we make available under any license will also be made available under a Free Culture (as defined by http://freedomdefined.org)  or Free Software/Open Source licence (as defined and approved by the Free Software Foundation or the Open Source Initiative).

5.  With respect to your contribution, you represent that it is an original work and that you can legally grant the rights set out in these terms; 

it does not to the best of your knowledge violate any third party's copyrights, trademarks, patents, or other intellectual property rights; and
you are authorized to sign this contract on behalf of your company (if identified below). 

6.  The place of performance is the registered seat of

	YOURCOMPANYNAME
	YOURCOMPANYADDRESS1
	YOURCOMPANYADDRESS2
	YOURCOUNTRY
	YOURCOMPANYBUSINESSID	

Any disputes concerning this agreement including the issue of its valid conclusion and its pre and past contractual effects are exclusively decided by the competent court in YOURHOMECITY, YOURCOUNTRY or, at our discretion, also by the competent court is whose district you may have your residence, your registered seat, an establishment or assets.

If available, please list your YOURPROJECT username(s) for the YOURPROJECT systems.

Username(s): __________________________________________________________________

_______________________________________________________________________________

Your contact information (Please print clearly) 

Your name: ____________________________________________________________________

Your company's name (if applicable): __________________________________________

Mailing address: ______________________________________________________________

Telephone, Fax and Email: _____________________________________________________

Your signature: _______________________________________________________________

Date: _________________________________________________________________________

To complete this agreement:
email a scanned copy of a signed agreement to
fax a signed copy to + .....; or
post a signed copy to:

	YOURCOPMANYNAME
	YOURCOMPANYADDRESS1
	YOURCOMPANYADDRESS2
	YOURCOUNTRY

This agreement is based on version 1.5 of the Sun Contributor Agreement, which
can be found at:

http://www.sun.com/software/opensource/contributor_agreement.jsp

This document is licensed under a Creative Commons Attribution-Share Alike 3.0
Unported License http://creativecommons.org/licenses/by-sa/3.0

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


8 Comments

How people perceive Plone outside Plone community




Our company does business with multiple CMS systems, like Joomla, Plone and Drupal.  They all have their advantages, they all have their disadvantages. We do not want to make CMS a religion. It’s a tool. You can argue with the client which tool is a right job for a task. Joomla is lightweight solution for non-critical systems, Plone is good with lots of content, editors and workflows flying around. etc. etc.

I had this curious piece on conversation on #joomla channel on freenode. Though it is an individual case, I hope it will bring some light to the fact how people perceive Plone outside Plone community and what Plone should to do fix it.

I think it would be beneficial for Plone to finally close mailman for the site administration / user support and move to real web forums / Google Groups / whatever which would be usable.

Also, there is an example how unprofessionalism is not good for the community.

[20:23:29] x: Biggest problem so far is finding competent ("I will deliver on this schedule) joomla consulting experts. Second biggest problem is security, our site has been hacked 3 times in the past 6 months
[20:25:18] me: have you considered any alternative CMS with better security track record?
[20:25:50] x: moo: we moved from Plone to Joomla. 3 years on Plone with no hacks.
[20:26:04] x: Problem with plone is no forums with email support
[20:26:21] me: you pay for support
[20:26:30] z: did you do basic joomla security guidelines?
[20:26:39] me: also check http://plone.org/support
[20:26:40]  Title: Support options for Plone — Plone CMS: Open Source Content Management (at plone.org)
[20:26:51] x: moo: I'm fine with paying for support. We're paying SiteGround $200-$300/month on average when you add the support costs.
[20:26:58] z: ie using a key to access admin, changing default sql prefix
[20:27:01] AngryPerson: who cares about plone
[20:27:10] AngryPerson: its an ancient cms thats clearly past its time
[20:27:20] AngryPerson: its only privately supported with little community support
[20:28:34] AngryPerson: Moo^_^: why are you even in here?
[20:28:40] AngryPerson: you just want to piss on joomla?
[20:28:43] me: we do business on drupal, joomla and plone
[20:28:48] me: different tool for different job
[20:28:51] -*- y shrugs
[20:29:01] AngryPerson: just seems to me like you want to push ppl away from joomla
[20:29:11] x: z: After 6 months I'm still a Joomla noob. I need a consulting services company that will do the security patching, maintenance, service on the site, and host it.
[20:29:25] me: not true
[20:29:36] AngryPerson: Moo^_^: well regardless of what you say, tahts how it seems to me
[20:29:54] z: actually I've had good luck just following a few blog posts
[20:30:10] me: I don't defend myself, as I don't want to engage such a conversation with you
[20:30:22] AngryPerson: thats good, why dont you fuck off too
[20:30:22] <-* jools has kicked y from #joomla (Please watch your language) [20:30:22] --> y (dgdf@unaffiliated/anti-mttr/x-9384728) has joined #joomla
[20:30:27] z: nothing is impervious, but you drastically reduce your attractiveness to hackers by a few simple steps
[20:30:32] AngryPerson: stop giving ppl your shitty advice

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


7 Comments

Why people hate Adobe (and have now headache with sports-tracker.com)?




sportstracker.nokia.com was a GPS based sports tracking service for Nokia phones. Around a year ago it spun off as independent company, which was a good move if you really want to develop your service business. Now sports-tracker.com has launched a new website. You can upload your runs and photos there and share your sports results through social media.

It was delightful to see the new site opened and having the features been missing so long time ago. However, I was not totally happy with what I saw.

The whole new site is built on top of Adobe Flash run-time technologies. There are no traditional web pages per se.

The problem is that full page Flash is resource hog. In the picture above you see that opening this web site in my Safari web browser spikes CPU to 100% usage – and it actually stays there indefinitely (note: on front page, see remarks below). This means that my computer is working to barely survive under the stress caused by this one web site – and my computer is powerful iMac. This means that if I have this site open background in my web browser my laptop battery would die very very fast. This means that all programs I try to simultaneously use on my computer become sluggish.

I assume that when sports-tracker.com was spun off from Nokia they contracted some digital advertisiment agency to built the new site for them. Digital advertisement agencies are often, not always, companies focused on the brand and visual appearance. They love to work with Flash because it gives good authoring tools to build nice looking, bling bling filled, animations.  Flash is a great tool for animations. Flash is a great tool for building browser based games. However, it is not good for building the whole web site where the user experience criteria could include 1) the site actually to responds to clicks 2) the site does not bring down to the whole computer. The decision makers probably drink cool-aid “hey let’s built the site with the Adobe’s latest tools – have you seen the demos how coooooool they look like”.

The thing is, I want to just see my sports tracking results. I don’t care whether the diagrams have blurred drop shadows with state of the art Web 3.0 mouse over effects. Now I can enjoy the effects, points for the artistic leader for that, but doing the actual task, accessing my sports results, have become irritating task to do. Things respond sloooow – that’s the main reason. In-flash scrolls bars have noticeable lag.

There exists an uncanny valley how normal web sites behave and how 100% Flash site behave. My right click does not work. I cannot right click a link and open it in new tab. I cannot right click a link to copy it to my friend. I cannot access the site on my N900 web browser (which even has Flash). I coudn’t even send feedback to sports-tracker.com team without first installing a desktop email client, as the email address cannot be copied from Flash to web mail. Text boxes are little different.

I cannot hold my horses to see Adobe conquering mobile phones with Flash and doing the same thing for mobile browsing experience it has now done for sports-tracker.com.

The site is not bad. Usability guidelines have been followed carefully when building the site. The developers seem to have gone into great details to make the operations smooth as possible. For example, URL fragment identifies are used to make sure bookmarking works even though Flash is present on the site. Social media features, not present in old sport tracker, are finally there. The results of design decision to built the whole site on Flash, instead of using Flash for some components only, might not have been seen by the time this decision was taken.

When Nokia Sports Tracker was first introduced 3-4 years ago with the first Series 60 GPS phones it was ahead of the competition. Wow effect had no limits – can you really do that with your mobile phone – in real-time and live?

It is funny how time passes.

It is definitely possible to build a sports tracking site, which looks cool, but does not have issues mentioned here.

Note: With little more research it seems that CPU usage stays 100% is specific to front page only and it has issues of not winding down action when you move away from your browser. However, rendering of other pages still uses vast amount of CPU, causing lag you do not see when opening web pages. The background CPU consumption on sports-tracker.com page is aroud 8% per tab when should be 0%.

Note 2: I am using the latest 10.1  Flash Player.

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


2 Comments

Setting Google Apps hosted email as your browser’s default email client for mailto protocol




Would it be nice that when you click email link (maito) in your browser you could directly send email from your organizations’s Google Apps hosted service? (Google Apps is GMail + Google Docs for corporate/organizations with own domain name).

Here are instructions how to achieve it.

Firefox

Follow instructions by Steve Novoselac.

Opera

Here are instructions for Opera 10:

  • You have file webmailproviders.ini where web mail backends are lsited
  • This file is located in Applications/Opera (you need to right click and choose Show package contents) and Resources/defaults/webmailproviders.ini (on OSX, for Windows Linux follow the instruction links below)
  • Add the email provider description as below. Note that you need to change Google Apps domain name to your link. After saving the file you need to restart opera. You don’t need icon if you don’t have one.
  • Then restart Opera, choose Preferences -> Advanced -> Programs -> mailto -> your email account.
[DOMAIN_NAME]
ID=8
URL=https://mail.google.com/hosted/DOMAIN_NAME?extsrc=mailto&url=%s
ICON=https://mail.google.com/favicon.ico

Web mailto in OperaWiki

More HTTP links to trigger email send for various email providers

Read our blog  Subscribe mFabrik blog in a reader Follow us on Twitter Mikko Ohtamaa on LinkedIn


Leave a Comment

Next Page →