Tuesday, December 28, 2010

Journey to an Unknown Land

1 2 Next

It all started a decade ago. One of my friends asked me to send a copy of my CV to a company in an oversees country. I did that and accomplished a telephone interview successfully in few days. A journey to an unknown land began in a new year.

Life was not terribly bad in Dhaka as a Software Engineer. The software industry in Bangladesh was in the infant stage at that time and was aiming for boom. My income was distinguishably over the average and daily life was pretty cool with regular Adda among friends. Parents were just 2-3 hours of travelling distance and some family members could be reach in few minutes.

My assignments at the job were very unique experience. Still like others in the developing countries, I was eager to move to some developed countries, partly to achieve more professional challenges and partly to earn more. There are rarely few people in these countries who are not touched by the colorful life of developed world as seen in Hollywood movies.

The journey took place on 14th January, 2010. The first step in the unknown land on January 15 was a shock. The minus temperate was an unbelievable experience in the life. The 200 km trip by car was terribly beautiful. The highway looked like a dream and the roadside cities were organized and  disciplined comparable to those  only found in fairytale.


It was a dream come true!!!

Wednesday, August 18, 2010

Open Source Projects

Following is a list of open source projects that I initiated and programmed:

  1. Universal Virtual FS Editor
  2. Flexible Registration
  3. JavaScript 2D/3D chart
  4. Syntax Highlighter (YASH)
  5. Salat Times (Firefox add-on)
  6. C++/Java/C#
  7. Keen Social (discontinued)

Monday, May 17, 2010

Developing Firefox Extensions

  1. Create a development profile: 


    You need to install several extensions which may slow down firefox performance. So create a separate development profile using the following steps-
    • Open command prompt
    • [Firefox Installation Directory]\firefox.exe -no-remote -P
    • Create a new profile.
    • Start firefox next time with the command: [Firefox Installation Directory]\firefox.exe -no-remote -P [new profile name]

  2. Install some useful extensions: Firebug is the most useful one.


  3. Set some developer preferences: Type about:config in the address bar. Set or add, if do not already exist, the following properties:


    • javascript.options.showInConsole = true.
    • nglayout.debug.disable_xul_cache = true.
    • browser.dom.window.dump.enabled = true.
    • javascript.options.strict = true.
    • extensions.logging.enabled = true.
    • dom.report_all_js_exceptions = true.


  4. Directory structure: Different from usual programming frameworks, Firefox extension has a predefined directory structure for files. The browser will look in specified folder when it needs a file for e.g. installation, preference or visual overlays.


    • For new extension: Use the wizard in http://ted.mielczarek.org/code/mozilla/extensionwiz/. Copy the contents of the generated zip file into [Profile]\extensions\] folder. It is a folder with the name of your desired extension name. Rename this folder name into the extension ID from install.rdf or use some unique name like an e-mail address. Restart firefox. Your add-on should appear in the browser. Check Tools->Add-ons if your extension is listed there.
    • Existing extension: Copy extension into the [Profile]\extensions\] folder. Remember the filename or sub-folder for the extension must be same as the extension ID in install.rdf or a unique name like an e-mail address.

References:
  1. Building an extension: https://developer.mozilla.org/en/Building_an_Extension
  2. Setting up development environment: https://developer.mozilla.org/en/Setting_up_extension_development_environment
  3. Creating a status bar extension: https://developer.mozilla.org/en/Creating_a_status_bar_extension
  4. http://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/
  5. http://www.slideshare.net/littlebtc/ext-0509
  6. http://www.slideshare.net/robnyman/how-to-write-your-first-firefox-extensio?src=related_normal&rel=530642
  7. http://www.rietta.com/firefox/Tutorial/overview.html

Tuesday, May 11, 2010

How to contribute to Salattimes firefox extension?

Analogous to my previous post this post describes how to check-in/check-out the firefox add-on project salattimes from google code server.
  1. Check-out: You need a subversion client to check-in/check-out code from the SubVersion source control server. Windows users should download TortoiseSVN from http://tortoisesvn.net/downloads. Linux and MacOS users should google to find the appropriate client.

    Windows users just right-click on explorer in your development directory and then click "SVN Checkout...". The following dialog will appear.




  2. If you click "OK", a dialog box will appear to provide username/password. You can now start programming.

    Non-windows users might need the following command on the console:
    svn co https://uvfseditor.svn.sourceforge.net/svnroot/uvfseditor uvfseditor
The rest is same as the previous post.

How to contribute to UVFSEditor?

Last few days, several programmers are accepted to join the development efforts of UVFSEditor. In this post, I will briefly write the steps necessary to involve in the development.
  1. Check-out: You need a subversion client to check-in/check-out code from the SubVersion source control server. Windows users should download TortoiseSVN from http://tortoisesvn.net/downloads. Linux and MacOS users should google to find the appropriate client.

    Windows users just right-click on explorer in your development directory and then click "SVN Checkout...". The following dialog will appear.




  2. If you click "OK", a dialog box will appear to provide username/password. You can now start programming.

    Non-windows users might need the following command on the console:












    svn co https://uvfseditor.svn.sourceforge.net/svnroot/uvfseditor uvfseditor

  3. Check-in/Commit:



  4. First of all, be careful, don't check-in until you are absolutely sure what you are checking-in does not break the existing code.

    Right click the file or folder you want to check-in. The following context menu should appear:

    First click "SVN Update", then click right mouse button again and click "SVN Commit...". The following dialog should show up:

    Write an appropriate message on the "Message:" box and click ok.



    You must write a message describing the changes you have made.

    Now you are ready for UVFSEditor development!!!
  5. Development: You need Visual Studio 2008 to develop (e.g. you can also use MonoDevelop), but the UVFSEditor will run only under Windows OS. Open the UVFSEditor.sln solution and compile. To understand the code hierarchy, first look at "UVirtualFileSystem" project. You will find there classes which resemble classes in System.IO package. The classes in "DotNetFileSystem" and "OleStructuredFileSystem" are inherited from those in "UVirtualFileSystem". The "UniversalHexEditorLib" implements a extremely flexible hex viewer as a .Net control. "UVFSEditor" is the main application project which implements a GUI and glue all libraries together.

    The "uvfsEditorSetup" projects creates an MSI installation package for the end users.
  6. Forum:There is a development forum under the following URL: https://sourceforge.net/projects/uvfseditor/forums/forum/1142984. You need to log on to access this forum. You should communicate with each other over this forum.

Monday, May 10, 2010

Too much to learn for Programming? - Execution environment

There are many popular languages for programming and to learn only a subset of them from scratch is a nightmare. The fact that each language needs some tuning on each platforms makes it more complex. Therefore, programming concepts should be learnt first on an abstract level and adapt those concepts to specific platform when need. A programmer should have fair level of concepts on the following areas to master any programming language as well as leverage knowledge transfer to other programming languages:
  1. Execution environment
  2. Memory Architecture and Allocation/Deallocation
  3. Object Model
  4. Algorithms, Complexity and Data Structure
  5. Language Syntax
  6. Compilation & Linking
  7. Packaging and Deployment
Next few days, I will briefly explain each of these areas and today start with the first one – execution environment.

EXECUTION ENVIRONMENT

Execution environment (EE) is a layer over the hardware on top of which your programs run. It is very often the operating system, but could also be other platforms like virtual machine (JVM or CLR) or even browser (e.g JavaScript) or other applications (e.g. VBA on office application). Your program must have one or more target platforms. Software targeting for one platform may not run on a different platform.

There are various constrains of EE e.g. OS version (32/64-bit) compatibility, requirement of certain run-time libraries etc, some supporting libraries. Some software are OS agnostic, but depends on some other execution environment layer over OS. Java and .Net programs are the best examples of such runtime environment. It is important to understand the inner workings of an execution environment if you want to be expert programmer. How EE understands your file, loads it and what information your executable file must provide so that EE is able to load it.

An example will make it clear. Windows OS considers a file executable if it has some specific extensions (e.g. .exe, .bat, .com etc.). But when the OS starts to load the file, it looks if the file has certain information at predefined location to set up the correct execution environment (DOS, Win32/64, WOW64 ). The .exe executable file is mostly of the portable file (PE) format which is derived from Common Object File Format (COFF). Let's examine the steps in brief that windows OS pass through to load an executable file:

  1. Validate parameters and flags that the shell (or programmatic CreateProcess call) specifies.
  2. Open image file (.exe).
  3. Create a process.
  4. Create initial thread.
  5. Perform other initialization.
  6. Execute initial thread.
  7. Load required DLLs and start execution of initial thread.
  8. Eventually the entry point function (main/wmain/_tmain for console and WinMain for GUI application) is executed.
So this is a fair amount of work for the OS to load and run an executable file.

The process is much different for a so called platform independent programs. During compilation a .Net compatible compiler adds reference to the MSCorEE.dll which is referred as Microsoft .NET Runtime Execution Engine to the generated PE or PE+ (for 64-bit) executable file. The steps for loading and running a .Net image are roughly described below:
  1. 1..6 of the native image load described above.
  2. Loads MSCorEE.dll in the process address space.
  3. The initial threads starts executing calling a method in MSCorEE.dll which initializes CLR, loads EXE assembly and then calls its entry point method.
The process is more straight forward for scripting code. The host application is responsible for providing memory and object model to the script code. The capability of script programs is also more restrictive than native and VM programs. For JavaScript code, the browser has a JavaScript engine which parses, loads, and executes the code.

Friday, April 16, 2010

Good feeling with Visual Studio 2010

I have been using visual studio 2010 from beta 1. The slick WPF based user interface was nice to play with but it was terribly slow. It became even worse in beta 2. Things were getting better after the release candidate. I downloaded the final version on the next day of release.

Still slower than Visual Studio 2008...

Wednesday, March 17, 2010

Internet Explorer 9 embracing HTML 5, GPU acceleration

Internet Explorer 9 embracing HTML 5, GPU acceleration - AfterDawn: "rounded". At last Microsoft has come to the table. While other browsers have already implemented major features of HTML5, Internet Explorer was very much silent.

Sunday, March 14, 2010

Friday, January 01, 2010

New version of FlexRegister is available

Do you want to register/unregister any COM capable libraries right-away from windows explorer. You can download the new version of FlexRegister from the project web site hosted at http://flexregister.sourceforge.net. The source code can be viewed online from subversion repository at http://flexregister.svn.sourceforge.net/viewvc/flexregister/

A simple summary is written in  Flexible Register.txt file. An example vbscript file to register all COM libraries in a directory and its subdirectories recursively is added.

Universal Virtual File System Editor has been released

A new version of UVFSEditor has been released. You need visual studio 2008 to compile the source.

 - Features for End-Users:

  • Open a file on hex/oct/binary/decimal/ascii/utf-8/custom editor.
  • byte/int/double/float/long value at some byte position
  • Open a compound file (.doc, .xls etc) and view the storage and stream hierarchy. View contents of a file on the hex editor.
  • Open a folder from file system and view the folder-file hierarchy. View contents of a file on hex editor
  • Create/rename/delete file/folder/storage/stream at specified location
  • Copy-Paste items from one location to other location e.g. from a compound file to regular file system and vice-versa.
- Features for Developers:
  • The hex editor is programmed as a .Net control, similar to the prior version of these project where hex editor was an AcitveX control. The control can be added to any .Net compatible container. Developers can add this control in their own application.
  • A virtual file system can be defined for any structured file format which can be represented as a hierarchy (e.g. file-folder). It's possible to view this file on the uvfseditor.

You can view the details from project page at http://uvfseditor.sourceforge.net or download the binary installation from http://sourceforge.net/project/platformdownload.php?group_id=135846. The source code can be browsed from subversion repository at http://uvfseditor.svn.sourceforge.net/viewvc/uvfseditor/.