Thoughts about coding and books

How to hire a freelancer – 10 lessons learnt

These days everybody are full of ideas but no time to make these happen. Same here, I have great business ideas every a few weeks but while working full-time on my day job I have hard time to implement these on my own and all my friends are also very busy.

I decided to try out the www.getacoder.com service to find affordable quality help to my projects and so far I have not been disappointed while following the below steps.

1. Write down IN DETAIL what you want to be done.

Before posting a job to www.getacoder.com make sure you have as detailed as possible overview of your requirements. This is called BRD – Business Requirement Document. This must list everything like, user must be able to register, user must be able to login etc. Programmers can take this doc and can implement every feature step by step. Read more about How to hire a freelancer – 10 lessons learnt

Basic PhoneGap Android app from scratch step-by-step

This tutorial assumes that you have eclipse which is set up for regular android development and you can create new android projects. Phonegap files are now named cordova

  1. Create new Android project in eclipse.
  2. Download package and extract cordova-2.6.0.jar  from zip file from http://phonegap.com/download/
  3. Add cordova-2.6.0.jar to your projects build path. In eclipse open project properties > Java Build Path > Add Jars
  4. Change main Activity superclass to DroidGap
  5. Replace setContentView(R.layout.main); with super.loadUrl(“file:///android_asset/www/index.html”);
  6. Create folder xml into the project res folder. Add there plugins.xml and cordova.xml from the package you download before.
  7. Add into AndroidManifest.xml <uses-permission android:name=”android.permission.INTERNET” /> and     <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
  8. Create folder www into projects assets folder.
  9. Add index.html file into assets/www. File content is regular HMTL.

By now you can already run the program. Next steps are starting to use PhoneGap special HTML5 features and try accessing hardware. If It fails to run then make sure you have logcat view activated in eclipse or try in linux commandline: Read more about Basic PhoneGap Android app from scratch step-by-step

PhoneGap performance measurement results

I was wondering how much is loss in performance is one would write application in PhoneGap and javascript instead of native code. I wrote 2 very basic programs one in android and second in PhoneGap. This program did standard busy looping and common string operation indexOf in the for loop. One interesting issue i found is that when you use body onload and do not finish in time then you will get error “Application Error: The connection to the server was unsuccessful. (file:///android_asset/www/index.html)”

3 different loop times were measured in javascript and native android java. Examlpe Code in Android  was : Read more about PhoneGap performance measurement results

Identity ‘signupBean’ does not reference a MethodExpression instance

Problem itself is simple. JSF h:commandButton or h:commadLink is pressed and error below happens.

javax.el.ELException: /index.xhtml @12,78 action="#{signupBean}": Identity 'signupBean' does not reference a MethodExpression instance, returned type: com.project.beans.SignupBean

If you see something similar then you have typo in your code. In your commandButton/commandLink is missing bean method specification.

<h:commandButton value="Login with gmail" action="#{signupBean}"></h:commandButton>

must be replaced with

<h:commandButton value="Login with gmail" action="#{signupBean.signup}"></h:commandButton>

Full stack trace to follow  Read more about Identity ‘signupBean’ does not reference a MethodExpression instance

Get callback working in Scribe and OAuth

I was developing LinkedIn API and had some trouble getting callback working after getting user authentication from LinkedIn. I even had configured “OAuth Redirect URL:” in application settings, adding oauth_callback to redirect when asking user authorization did not help either. I kept getting OOB eg out-of-band style authentication where user must manually type in theRead more about Get callback working in Scribe and OAuth[…]

Ajax menu navigation in JSF with OpenFaces

Problem: Webpage must change body contents fast without reloading whole page when user clicks link in menu. Solution: It can be achieved using OpenFaces o:layeredPane component. In menu can be used commandLinks surrounded with form. Commandlinks include f:param which sends to server what contents must be displayed. When clicking link then browser sends ajax requestRead more about Ajax menu navigation in JSF with OpenFaces[…]

f:ajax not working in JSF

Problem is that in JavaServer Faces application ajax request are just not working. o:ajax in openfaces nor f:ajax in plain JSF 2.0 is not sending any requests to server. For testing can be used simple echo application. <h:form> <h:inputText value=”#{ajaxTestBean.testValue}” > <f:ajax event=”keyup” render=”text”/> </h:inputText> <h:outputText id=”text” value=”#{ajaxTestBean.testValue}” /> </h:form> Normally this should work withoutRead more about f:ajax not working in JSF[…]