Wednesday 26 February 2014

Getting Started with Node JS

NodeJS is one of the most popular server side (& client side) JavaScript framework to create robust, fast, scalable applications. It supports an event-driven (see wiki) approach, and has flexible non-blocking I/O models that make it easy to support a wide range of data-intensive apps running across different platforms or devices.

Here I am going to share how to get it installed, running and creating a first 'Hello World' app.

NodeJS Installation

Once Node has been installed , open the command prompt and type ' node ' as shown below




This shows that Node has been installed successfully.

Lets create a basic Hello World app.
  • Create a JavaScript file in any folder on your machine
  • Copy below code
 console.log("Hello World");
 console.log ( "Hello World".length );


  • Open command in that location and run this command   node filename.js
  • It will execute the JavaScript code in the filename.js file and will show results on screen


 As you can see, it executed JavaScript script and as per the first line of the script it shown the Hello World and on the second line we have used a JavaScript string length property to find the length of an string. 

In the next tutorial, I will explain how to create a running http server to serve http requests. (either coming from desktop browser or mobile device).

Tuesday 28 January 2014

Mobile App - Remember Life after Death

Have recently launched another free Mobile App. The App is about remember our death. Remembering our death everyday kicks out bad habits from us like greediness, selfishness, and other bad nature. It makes us think that we all have to go one day and we all human beings are equal and everyone has equal rights, so lets treat everyone equally.

Remember Life after Death (in Urdu Lang)



Mobile App - Proof of Beard Sunnah

I developed another Free Mobile App. It contains numerous Ahaadis and Quranic verses to explain that having beard is a Sunnah of Prophet Muhammad Salaih Allah WaSalam.

Proof of Beard Sunnah


Mobile App - Manzil

In my free time, I have started creating some FREE Mobile Apps. The first one has been downloaded by 4000+ users within tows months only! This encouraged me to create Mobile Apps.

Manzil -  Daily Verses



Thursday 23 January 2014

Worklight project - won IBM Impact 2013 Mobile Innovation Award

Its been long time to write a blog. I was busy on multiple mobile projects - specially IBM Worklight ones.

It was great experience when we received IBM Impact 2013 Mobile Innovation Award for one of our best Worklight project.

I would like to write some blog posts sharing my experience with rest of the Worklight community here.


Sunday 12 June 2011

Firefox in Urdu

Do you wanna Firefox in your Urdu Language ? You come to the right place. Here I am listing the steps to join us translating/Localizing FireFox in Urdu.

In Case, you wanna to kick off a new Localization (another Lang:) go here.

For Urdu, we already have a good dedicated Team localizing Firefox & similar products.

You wanna join URDU Team ? - just follow below steps.
  • Join Mozilla Dev group - subscribe here: https://lists.mozilla.org/listinfo/dev-l10n
  • After above subscription you can send your queries to dev-l10n@lists.mozilla.org
  • For Firefox localization, we prefer to use Narro - an easy & quick solution
  • Register on Narro: https://l10n.mozilla.org/narro
  • and finally let us know to assign you proper modification rights (contact us: withabdulahad[at]{gmail}[.][com]
Let me briefly tell you about Narro - to encourage your enthusiasm for Firefox in URDU.

Narro is a handy web-based translation tool that is available to localizers to translate Firefox. With Narro, you can translate Mozilla applications online, export files with the same source structure as Mozilla code in a zip archive, or generate a .XPI file that can be installed locally for testing.


You can manage your localized products easily online.


Sentence to sentence translation makes it easy & quick solution. To write URDU scripts, you can use Gmail or Google Translate and then copying it in the mentioned field of the corresponding Text item.

Once you have done some translation, you can easily export them as Zip or .xpi file to test locally. ( .xip is Firefox extension file)

In order to test, you need to be able to change the locale of your browser to see your work. Install either the Locale Switcher or the Quick Locale Switcher add-on. This will allow you to shift between the present UI of your Firefox browser and the testable .xpi export from Narro.

Once you have exported your file, lets say an .xpi file, open it with Firefox. Once Firefox recognize the .xpi file it will re-start to take effect. And then use any of the above mentioned Local Switcher to switch to URDU language. Hurray, your browser is in URDU Lang!!.



It would be better for you to go through these sites at least once to know how the localization process take effect and works.

Monday 28 March 2011

EGL Video Demos Part 4

EGL Modernization Demo - Creating iPhone Application

EGL Video Demos Part 3

EGL Modernization Demo - Modernizing iSeries Boats Application

EGL Video Demo Part 2

EGL Modernization Demo - Modernizing iSeries CellDail Application

EGL Video Demos Part 1

EGL Modernization Demo - Modernizing iSeries Flight400 Application.

EGL Video Tutorials

I am creating EGL Video Tutorial for newbies to quick learn IBM's Enterprise Generation Language (EGL).

First I am casting few EGL demos to present some of the cool EGL features.

In these demos some of the RPG programs existing on the IBM's iSeries machine are modernized using EGL.


Friday 18 March 2011

EGL Best Practices

Best performance practices for Java run time are:
  • Use string type for all text
  • Do not use structured records (records with a fixed storage layout)


Best performance practices for COBOL

  • Use char or mbChar text type for applications used with a single national language or Unicode text type for multinational applications
  • Use static, fixed length arrays in structured records
  • Do not use libraries for small functions that are frequently invoked

Performance practices common to all run time environments:

  • Use libraries instead of called programs for shared subroutines
  • If your application needs to access several fields in a record in a dynamic array, copy the record to a single record variable rather than referencing individual record fields with an array index.

Saturday 13 November 2010

HTML5 - Storing Data on the Client

Using HTML5, you can save data on clients (browsers) in two ways.
  • localStorage - This stores data with no time limit.
  • sessionStorage - This stores data for one session only।
How to create and access a localStorage:

<script type=“text/javascript”>
localStorage.firstname="Abdul";
localStorage.lastname="Ahad";
document.write( localStorage.firstname + " " + localStorage.lastname);
</script>

The following example counts the number of times a user has visited a page:

<script type="text/javascript">
if (localStorage.pagecount)
{
localStorage.pagecount=Number(localStorage.pagecount) +1;
}
else
{
localStorage.pagecount=1;
}
document.write("Visits "+ localStorage.pagecount + " time(s).");
</script>

The sessionStorage method stores the data for one session. The data is deleted when the user closes the browser window.

<script type="text/javascript">
sessionStorage.firstname="Abdul";
sessionStorage.lastname="Ahad";
document.write( sessionStorage.firstname + " " + sessionStorage.lastname);
</script>

The following example counts the number of times a user has visited a page, in the current session:

<script type="text/javascript">
if (sessionStorage.pagecount)
{
sessionStorage.pagecount=Number(sessionStorage.pagecount) +1;
}
else
{
sessionStorage.pagecount=1;
}
document.write("Visits "+sessionStorage.pagecount+" time(s) this session.");
</script>

Thursday 23 September 2010

First HTML 5 example

HTML5 is a standard for structuring and presenting content on the World Wide Web. The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash and Microsoft Silverlight.

Here I am writting a sigle line of code (HTML5) to embed a video in your html page.

<html>
<body>

<video id="v1" src="http://htmlfive.appspot.com/media/billyBrowsers.ogg" controls></video>

</body>
</html>

simple video editor running in Safari

HTML5 specifies scripting application programming interfaces (APIs), some of them are;

  • The canvas element for immediate mode 2D drawing. See Canvas 2D API Specification 1.0 specification
  • Timed media playback
  • Offline storage database (offline web applications)
  • Document editing
  • Drag-and-drop
  • Cross-document messaging
  • Browser history management
  • MIME type and protocol handler registration.
  • Microdata
  • Geolocation
  • Web SQL Database, a local SQL Database
  • The Indexed Database API, a indexed hierarchical key-value store (formerly WebSimpleDB)

Thursday 5 August 2010

Compose Urdu emails using Gmail

Gmail helps you write emails in URDU or in other languages very easily. Follow below steps to compose emails in your own languages.

(1) Login to Gmail
(2) Select Settings














(3) Select the Urdu character on the upper left part in the email message box. Then start writing Urdu using phonetic English (roman English) and Gmail will automatically converts words into Urdu.

Saturday 15 May 2010

Google Translation into Urdu

Google translation helps everyday users a lot in understanding different languages dialogs.

Now Google has included Urdu translation and letting you translate 57 languages into Urdu & back.

Thursday 15 October 2009

Arabic Proverbs (Advice)

Arabic Proverbs (Advice)
  • اترك الشر يتركك
    • Literal meaning: Leave evil, it will leave you.

  • اتق الأحمق أن تصحبه إنما الأحمق كالثوب الخلق كلما رقعت منه جانبا صفقته الريح وهنا فانخرق
    • Literal meaning: Be aware of the idiot, for he is like an old dress. Every time you patch it, the wind will tear it back again.

  • اتق شر الحليم إذا غضب
    • Literal: Beware of the level-headed when he is angry.

  • اجتنب مصاحبة الكذاب فإن اضطررت إليه فلا تُصَدِّقْهُ
    • Literal: Avoid the company of a liar. And if you can't avoid him, don't believe him.

Tuesday 13 October 2009

How to add a simple Google Maps

During working on EGL Web 2.0 I had a need to add a Google map on a RUI page. Well, I found a very simple & an interesting way to add a Google map onto your web page without any understanding of Google Map API or don't even have to sign up for an API key.

Google helps you by providing a Wizard through which it generates a chuck of code to use in a page.

Through Wizard, there are three steps to add a Google Map onto a page.
  1. Go to the Wizard page and follow the three simple steps.
  2. Copy and paste the generated code into your own web page.

    Cut the code into two pieces. The bit that looks something like this can be placed anywhere on your page.

    <div id="mapsearch">
    <span style="margin:10px;padding:4px;">Loading...</span>
    </div>

    The rest of the code should be placed just before the at the bottom of your page.

  3. Double-click your page to test it, then upload it to your website.
The page will be look like this












There is another more simpler way than this one is to go to http://maps.google.com/ site and search/locate you desired location, when the map comes up then go to the Link anchor ( Link) on the right side of the map, click on it & copy the "Paste HTML to embed in website" to use in a web page or copy the "Paste link in email or IM" to share map via email or IM.

The map would look like the below one.

Thursday 8 October 2009

Enterprise Generation Language

EGL (Enterprise Generation Language) is a high level, modern business oriented programming language, designed by IBM to be platform independent. EGL is similar in syntax to other common languages so it can be learned by application developers with similar previous programming background. EGL application development abstractions shield programmers from the technical interfaces of systems and middleware allowing them to focus on building business functionality. EGL applications and services are written, tested and debugged at the EGL source level, and once they are satisfactorily functionally tested they can be compiled into COBOL, Java, or JavaScript code to support deployment of business applications that can run in any of the following environments:
  • Microsoft Windows, Linux, UNIX running JVM, for example in the context of a Java EE servlet container (IBM WebSphere Application Server, Apache Tomcat, GlassFish)
  • IBM System z: CICS Transaction Server, IMS, z/OS Batch, UNIX System Services, WebSphere Application Server, z/VSE, Linux
  • IBM System i: IBM i5/OS, IBM WebSphere Application Server
  • Internet Explorer, Firefox, Safari browsers for Ajax rich web applications.
Web 2.0 & SOA are built-in in EGL, it simplifies development by hiding the complexities of Ajax, JavaScript, Rest, and SOAP from the developer.

EGL programming tools are available as an Eclipse
EGL community site is very useful site to learn, discuss, ask, answer & share info & issues.

Monday 10 August 2009

Book Review - JSF Complete Reference

Recently I read a book on JSF named "JSF Complete Reference " written by Chris Schalk & Ed Burn.

The book presents in depth knowledge about JSF. It starts from how JSF works & why it was developed and went through to more advance level of custom component development. I would personally suggest all JSF newbies to grab this book ASAP.

Friday 17 April 2009

Java /J2EE Free Source site

I have seen a lot of good stuff on the below site.

http://www.java-source.net/

It has categorized Open Source Java based frameworks and ready to use components like PDF libraries, Mail clients, XML GUI toolkits, blogs, network servers etc. What I like about this website is its ease of use, nice clean design and good categorization.

Tuesday 10 March 2009

Sistechean Alumni

Now a days I ma trying to build up website dedicated to Sistechean only. Where all those friends who remained(or are)the part of Sistech will be brought together.

I have got a free web-hosting domain named 110mb.com . It offers 110 MB of data storage capacity with PHP5, Apache free of cost. But for MySQL or other advance features you have to pay for it! That's a way to catch a cow.

Well, Sistechean Alumni , Lets have a start !

Thursday 24 January 2008

New Java 5 Features - Part 2

Printf
If you have worked on C language then you would be familiar with Printf statement. Now you can use it in java also.

See the below example

package testnewfeatures;

public class Test_PrintfStatement {

public static void main(String[] args) {
int a = 10;
String str = "Pakistan";

System.out.printf("Value of a = %d ", a );

System.out.println();

System.out.printf("How are you ? Welcome to %s ", str );

//For more details of these Formate Specifiers
//see java.util.Formatter


}
}


Variable Arguments

Public void setSomething(Object ... args) {
// . . . . .
}

Var-args
is the way to make one method able to handle more than one type of arguments. In past we were creating separate methods for each argument type.

check out below example.

package testnewfeatures;
// Testing Variable Arguments feature
public class Test_Var_Arg {

public static void main(String[] args) {
String[] names = {"Asim","Faisal","Qasim"};

oldMethod( names );
newMethod( names );
newMethod( "A","B","C","D","E","F","......Z" );

empInfo("Asim","Programmer",15000,1000);

}
// Old (Ver 1.1 - to - 1.4) method of Method Declaration
public static void oldMethod(String[] args) {
for ( String argValue : args) {
System.out.println( argValue );
}
}
// New (Ver 1.5 or Simply Java 5) method of Method Declaration
// It mush be the LAST argument
public static void newMethod(String ... args) {
for ( String argValue : args) {
System.out.println( argValue );
}
}

public static void empInfo(Object ... values) {
Object[] tempObj = {"Name","Designation",10000,500};

System.arraycopy(values,0,tempObj,0,values.length);

System.out.printf("Name = %s \nDesignation = %s \nBasic Salary = %d " +
"\nTax Deduction = %d", tempObj );
}

}


Generics
In a nutshell, generics allows java programmers to pass types as arguments to classes just as values are passed to methods.

String custName = (String) myList.getFirst(); ⁄⁄ without generics
String custName = myList.getFirst(); ⁄⁄ with generics

In the first example above we had to perform casting.
But in the second example we do not require this(casting) anymore. Because when we are going to create an object then we have to specify what type of object it will handle/support.

LinkedList<> myList = new LinkedList &ltString>();

See the examples given below.

Example 1:-

package testnewfeatures;
import java.util.Vector;
import java.util.Enumeration;
public class TestGenerics {

public static void main(String[] args) {
// Old way -- vect will accept Collection
Vector vect = new Vector();
vect.add("Hello");
vect.add(12345);
vect.add(12.123);
System.out.println("Old method of using Collection");
for (Enumeration enu = vect.elements(); enu.hasMoreElements(); ) {
System.out.println( enu.nextElement() );
}

//We are forcing vetString to accept ONLY one type

Vector &ltString> vetString = new Vector &ltString>();
//Now vetString will only accept STRING values

vetString.add("Hello");
vetString.add("Everybody");
vetString.add("How are you?");

for (Enumeration enu = vetString.elements(); enu.hasMoreElements(); ) {
System.out.println( enu.nextElement() );
}
}

}

Example 2:-
package testnewfeatures;

import java.util.Vector;
import java.util.Enumeration;

public class UsingOwnGenericeClass {

public static void main(String[] args) {
GenericOrientedClass &ltinteger> intObj = new GenericOrientedClass &ltinteger>(100);
System.out.println( intObj.getValue() );

GenericOrientedClass &ltString> strObj = new GenericOrientedClass &ltString>("Hello World");
System.out.println( strObj.getValue() );

GenericOrientedClass &ltObject> objObj = new GenericOrientedClass &ltObject>("Hi this is Object Class string");
System.out.println( objObj.getValue() );

//Generics only Works with OBJECTS NOT with Primitives
//GenericOrientedClass &ltint> objObj = new GenericOrientedClass &ltint>(10);

}

}
class GenericOrientedClass&lttempname> {
private TempName str;

public GenericOrientedClass(TempName defaultValue){
str = defaultValue;
}

public void setValue(TempName s){
str = s;
}
public TempName getValue(){
return str;
}

}


New Java 5 Features - Part 1

Java Ver 1.5 or simply Java 5 came with some new features. These new features were added to facilitate a programmer not for the enhancement in JVM performance anymore.

Below i will describe few of them with some pretty examples. Hope you will find them helpful.

Autoboxing : - Just think automatically wrapping primitives into corresponding objects (i.e Integer,Boolean etc)

Check the example given below.

package testnewfeatures;

public class TestAutoBoxing {

public static void main(String[] args) {
int a = 10;
// old method of wrapping Primitive to Corresponding type Obj
Integer intObj1 = new Integer(a);
//new method of AutoBoxing - just created for programmer's ease NOT for a better performance
Integer intObj2 = a;

boolean bol = true;

System.out.println("\t Value of intObj1 = " + intObj1 );

System.out.println("\t Value of intObj2 = " + intObj2 );

if (bol) {
System.out.println("\t This is the Old way of Conditional-Cheack = " + bol );
}

Boolean bolObj = new Boolean(true);

// If requires ONLY Boolean Primitive but here we have given a Boolean Object
// Actually Java 5 automatically 'unbox' this for you.
if (bolObj) {
System.out.println("\t This is the NEW way of Conditional-Cheack = " + bolObj );
}
}

}



Scanners

Scanner are introduced to make new java programmers happy when they like to get some inputs from the system. Before this you were supposed to create a stream object and wrap it around another stream object & then you will have a chance to get a single input!.

Check the example given below.

package testnewfeatures;

import java.util.Scanner;

public class TestScanner {

public static void main(String[] args) {
String name = null;
int age = 0;
java.util.Scanner keyboard = new java.util.Scanner(System.in);


System.out.println("Please enter your Name ");
name = keyboard.nextLine();

System.out.println("Now enter you Age");
age = keyboard.nextInt();

System.out.println("Your Name is = " + name + "\nYour Age is = " + age);

System.out.println("Now reading a File from a drive \n" );
try {

String fileText = "";

java.util.Scanner readFile = new java.util.Scanner(new java.io.File("D:\\NetBeansProjetcs\\TestNewFeatures\\src\\testnewfeatures\\InputFile.txt"));

while (readFile.hasNextLine()) {
fileText += readFile.nextLine() + "\n";
}

System.out.println (fileText);
}
catch (Exception ex) {
ex.printStackTrace();
}

}

}


Static Import

If you want to use some properties or fields more then once then use Static Import one time and use only the created shortcuts on the remaining places.

Check the example given below.

package testnewfeatures;

import static java.lang.System.out;

public class TestStaticImport {

public static void main(String[] args) {


System.out.println("This is normal way to print something" );

out.println("This is the new way to print something" );
out.println("Here we have only 'Statically imported System.out' ");
out.println("so from now on we need no more ' System.out ' association.");

}

}



Monday 21 January 2008

Personal Training Material

I cam across a website where any one can find different articles regarding Personal Trainings to effectively improve professional life.

Here on the following link you will get it.
http://www.4shared.com/dir/4427129/defc974e/Training.html