Wednesday, December 3, 2008

A Threading Query

Consider the following block of code…
 
//Csharp code snippet..
Line 1: Thread t = new Thread (Go);    // Assume Go is some static method
Line 2: t.Start();
Line 3: t.Join();                      // Wait (block) calling thread until thread t ends 
//End 
 
- In calling thread at line 1 we created a thread object.
- On Line 2 we started the thread t.
- Then on line 3 we are calling Join() method of Thread t which serves the other way around. 
   I mean if you think logically t.Join() causes the calling thread to wait untill thread T  completes.
   The join() method is a busy waiting technique… i.e. The main thread is engaged in a continuous
   loop checking for thread t.IsAlive property to be false. t.Join() syntax is also an invalidation of an
   important OOP concept, “Encapsulation”… i.e. in t.Join() we are actually blocking Main thread
   instead of working on Thread t.
 
I don’t know how many of you agree that logically it should be the other way around (i.e. One
should be calling Thread.CurrentThread.Join(t) instead of t.Join()).
 
Any one thinks of a reason why the Thread.Join() method was implemented like this??

Friday, November 28, 2008

Surface Computing

Many of us might have heard the term Surface Computing and for those who didn’t, “Its the term for the use of a specialized computer GUI in which traditional user Interface elements are replaced by everyday objects. Instead of a keyboard and mouse, the user interacts directly with a touch-sensitive screen.” Hence a surface computer is a computer that interacts with the user through the surface of an ordinary object, rather than through a monitor and keyboard.

 Suface Computer GUI  

Earlier work in this area was done at the University of Toronto, Alias Research, and MIT. However Recent minor innovations in the surface computing field are attributed to Apple, Inc and to Microsoft Corporation. Apple had demonstrated surface computing interfaces intended for professional use since 2006, with no expected product release date. Microsoft unveiled plans for the Microsoft Surface in May 2007. The Microsoft Surface (code name Milan) seems to be closer to production. Finally, there is Linux surface computing software aswell, called Linux MPX.

The Surface is a horizontal display on a table-like form. Somewhat similar to the iPhone, the Surface has a screen that can incorporate multiple touches and thus uses them to navigate multimedia content. Unlike the iPhone, which uses fingers’ electrical properties to detect touch, the Surface utilizes a system of infrared cameras to detect input. Uploading digital files only requires each object (e.g. a Bluetooth-enabled digital camera) to be placed on the Surface. People can physically move around the picture across the screen with their hands, or even shrink or enlarge them. This could be the next generation of KIOSK. Below is the diagram from Microsoft Surface (Codename Milan).

 Microsoft Surface IllustrationMicrosoft Surface

1. MultiTouch Screen: This is the multitouch screen display. The Surface is so far advanced than we could imagine that it can recognize objects by their shapes or by reading coded “domino” tags when placed on the table.

2. Infrared: Used for collection input/s. When objects touch the tabletop, the light reflects back and is picked up by multiple infrared cameras. 

3. CPU: Surface uses many of the same components found in everyday desktop computers.

4. Projector: These are set of projectors inside to display images. 

references: http://www.microsoft.com/surface/index.html  

Tuesday, November 25, 2008

Brain Teaser # 1

Three people check into a hotel. They pay Rs 3000 to the manager and go to their room. The manager suddenly remembers that the room rate is Rs 2500 and gives Rs 500 to the bellboy to return to the people. On the way to the room the bellboy reasons that Rs 500 would be difficult to share among three people so he pockets Rs 200 and gives Rs 100 to each person. Now each person paid Rs 1000 and got back Rs 100. So they paid Rs 900 each, totalling Rs 2700. The bellboy has Rs 200, totalling Rs 2900. Where is the missing Rs 100?

Monday, November 24, 2008

Behind every CLOUD is another CLOUD

As we all know we are entering into cloud era where to build an application like Youtube, mySpaces, etc an individual does not have to worry about massive infrastructure to serve millions of user requests, data centers, database space, memory, scalability and moreover administration and maintenance of such a big infrastructure. Amazon, Google and Microsoft have provided us these infrastructure for minimal cost and with application platform to build such big applications.

Amazon is in cloud business for quite long time with its Amazon Web Services, S3 (Simple Storage Service), EC2 (Elastic Compute Cloud) and SQS (Simple Queue Service) services, Google have provided this platform few moths back with its GAE (Google App Engine) and BigTable for Data Storage and now Microsoft came up with its Windows Azure, Live Services, .Net Services, SQL Services, Dynamics CRM Services, etc. Now an individual or small firms can easily access world level ground to compete with old big giants. Good thing is that Google and Microsoft have provided these services initially free to a certain limit so any one can start building such application right now without any constraint

Below is an article explaining the advantage of cloud war to Asian software firms and individuals.

http://www.zdnetasia.com/news/software/0,39044164,62048490,00.htm

Monday, November 17, 2008

Stack Overflow

Just have heard the news on my official blog and in case if you have missed the news as well, let me break news of one of the most important development on the cyberspace: Jeff Atwood (of CodingHorror.com) and Joel Spolsky (of joelonsoftware) have teamed up and launched Stack Overflow last month. It’s a must visit site for all developers. It can save you several hours since people people are quite fast at responding to your queries. And the most important aspect is the reputation and badge system of the website.

Friday, October 24, 2008

Android (Syntactically: An automaton that resembles a human being)

Not another humonoid, zombie or a Star Trek character (like Commander Data) . Infact it is a software platform and operating system for mobile devices, based on the Linux kernel, developed by Google and later by the Open Handset Alliance (a business alliance of 34 hardware, software and telecom firms including Google, HTC, Intel, Motorola, Qualcomm, Samsung, LG, T-Mobile, Nvidia and Wind River Systems to develop open standards for mobile devices). The Open Handset Alliance was formed on 05th November 2007 on the same day when Android was unveiled.

Android Transition:

1. In July 2005, Google acquired Android, Inc., a small startup company based in Palo Alto, CA. At the time, little was known about the functions of Android, Inc. other than they made software for mobile phones. So the fuss began that Google was planning to enter the mobile phone market, although it was unclear what function it might perform in that market.

2. A Googler team lead name Rubin, developed a Linux-based mobile device OS which promissed to provide a flexible, upgradeable system. And you know they keep their promisses, don’t you . This was marketed to handset makers and carriers. By then Google have already developed a series of softwares and made contracts with a series of hardware vendors which was a point of interests for many carriers.

3. As a consequence every one else went banana and the noises get louder that Google wanted its search and applications on mobile phones and it was working hard to deliver that (Guess, what was your reaction if you were working in mobile development arena and out of no where a reputed company like Google started offering an open source mobile development platform to vendors and carriers. Aaaaaahhhh you could have uttered loudly).

4. In September 2007 Google filed many patents applications for mobile platform.

5. On 5th November 2007 Open Handset Alliance (OHA) was founded and OHA also introduced its first product, “Android”.

6. In September 2008 the first phone running Google Android was demonstrated by T-Mobile, it was the
“T-Mobile G1″ and it was enthusiastically approved. Several vendors have now shown interests in implementing Google Android in their handsets.

7. In February and May 2008 Google unveiled a few prototypes Androids featuring many Google applications.

8. On 21st October 2008, Google threw open the entire source code of Android which was not available earlier.

9. From 22nd October 2008 to onwards T-Mobile’s G1 the first Android powered commercial smart phone is available to consumers for purchase for about $176 per phone.

Software Development Kit (Android SDK):

Android SDK includes debugger, libraries, handset emulator, documentation, sample code, and tutorials. Currently supported development platforms include:

1. x86-based computers running Linux (any Linux Distribution)
2. Mac OS X 10.4.8 or later
3. Windows XP or Vista

Pre-Req includes Java Development Kit, Apache Ant, and Python 2.2 or later. The officially supported integrated development environment (IDE) is Eclipse (3.2 or later) using the Android Development Tools (ADT) Plugin, though developers may use any text editor to edit Java and XML files then use command line tools to create, build and debug Android applications.

A preview release of the Android software development kit (SDK) was released on 12th November 2007 and on 18th August 2008 the Android 0.9 SDK beta was released providing an updated and extended API, improved development tools and an updated design for the home screen and finally on 23rd September 2008 the Android 1.0 SDK (Release 1) was released.

On 21st October 2008 Android went open source. However it’s been criticized by not completely open source since some hardware specific parts remains proprietry and are not considered part of the platform. However, Google has since announced that all parts of the OS will be released under the Apache License where applicable and under the GPL elsewhere. Google’s applications that interact with Google’s systems, such as their email service, are not open source.

There is a bit for Android critics, at least for now software installed by users must be written in Java and will not have access to lower level device APIs. However there is a pitfall which is the compatibility issue among Java applications written for non Android platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME so I guess you are clever enough to understands what does it implies because Google will certainly hate to admit or even to mention it.

Important Links:

This virtual space is not enough to cover what packages with android so I’ll strongly suggest you guys to spear some time and read about what this new platform has to offer.

Android Home
SDK Download
Documentation & Tutorial
Developers Discussion Group
Open Source Android
Android Source Code
Android Blog
T-Mobile G1

Wednesday, September 3, 2008

Google Chrome, the fast and the furious



Google has launched its browser, Google Chrome Beta. Currently it is available for Windows (Vista/XP) users but you can signup on the download page to follow when Mac and Linux versions are available.

Like the Google homepage, Google Chrome is clean and fast having a simple user interface which always is the highlight of Google products. The installer is available as a bootstraper and automatically install and run the google chrome after clicking on install button.

After installing it, don’t just underestimate it because of it’s simple design. Many of its features are not obvious in first look. The highlight of the Google Chrome as google have claimed are:

01. Open source.
02. Design from scratch to support latest browsing needs.
03. Simple and clean design.
04. Faster Browsing, faster Searching, faster Scripting engine/s.
05. Minimum loading time.
06. More stability and crash resistance.
07. Multiprocess support (A single process for a signle tab having multithreading support with in each process) with process isolation controlled by Chrome Process Manager (e.g. for script execution engine, plugins, email etc). This is one of the reason why it’s so fast since most of the browser follow the single process or single thread in a single process model where for example if a browser is running javascript can’t do any thing and stay idle until the script execution engine returns control back to the browser. Most of the time the reason behind browser crashes is a blocking call to scripting engine. Consider the situation where the scripting engine crashes or hangs and didn’t return back control to the browser.
08. It has a new feature called Incognito Windows. Pages that you view in this window won’t appear in your browser history or search history, and they won’t leave other traces, like cookies, on your computer after you close the incognito window.
09. It has a view source feature with syntax highlighting and line number with incremental search support.
10. JavaScript debugger and JavaScript Console with intellisense support for Javascript.

I’m sure by now you want to quit reading this and wanna try Google Chrome your self. So happy surfing..

Monday, September 1, 2008

Locate32 By Janne Huttenen for Windows 32/64 bit platforms


Current Built: 3.1 Rc2 (3.1.8.8030) release 2
Supported platforms: Windows 98/ME/NT4/2000/XP/Vista
Project's home: http://www.locate32.net/
References: http://www.locate32.net/

Locate32 is an open source file indexing and location utility. It is similar to those we found in Unix or Linux based platforms i.e. UpdateDb and Locate. The tool can be downloaded from project's home. The 32 in the name Locate32 is only a convention and doesn't imply the limitation of its being available only for 32 bit file system. The 64 bit version is also available with the same name and can be downloaded from project's home. The source code for Locate32 is written in C++ and is available for the version 3.0.7.7010 and earlier.

Locate32 provides almost instant access by maintaining repositories of your drive/s directory structure and utilizing this info in search queries. The search responses are non blocking and keep changing while you type in your search keywords. At present a single thread is available for a search query to process.

The utility provides you a windows standard search dialogue like GUI and a command line utility with options to maintain multiple databases of directory structures. The GUI part (Locate32.exe) can be customized through options as a task bar resident program.

The console based utility is Locate.exe and Updtdb32.exe. To use the console commands, use console windows and navigate to the location of Locate32.exe then type Locate -h or Updtdb32 -h to learn more about the set of commands and switches available in console mode. At any time you can provide the Locate32 containing directory path in windows path environment variable for instant access to console commands.

The Locate32 Utility consists of three major parts.

a) Database/s:

The database is maintained on flat file system and use to store the information about the directory structure of your computer, this database is then utilized by the Locate32 search engine.

The default database is files.dbs and its default location is at logged in user's Application Data\Locate32 folder. However this can be cofigured to a location of your own choice. You can also maintain multiple databases at a time and can switch in between them quite easily using GUI's file menu. The database file extension doesn't dictate the format of data storage.

You can add, update, remove, imort, export and perform many other operations on databases by using Options >> Settings menu item then choosing Databases tab page. To update the stored directory structure in a specific databases you can choose File >> Update Database >> and choosing your required database from the sub menu. For performing search using a specific database use File >> Find using database menu option. In the presented dialogue you can check mark on multiple databases to run a search against them.

Besides all the benifits of Locate32 over windows search; its major draw back comes in when a change in file system of your computer is occured (e.g. Addition, location updation, renaming and deletion of files on your computer). Since database is not synchronized with winodws file system, you need to manually update the Database. The utility which does this in GUI and console mode is updtdb32.exe.

b) DB updation application:

The updtdb32.exe is the Locate32's database updation engine. The same tool is utilized by both the GUI and by sending direct commands in console mode. On it's first run the Locate32 need to establish a database of the computer file system. This implies that the database is currently empty and you need to invoke updtdb32.exe by double clicking on it. Simillarly after adding, updating new databases you need to manually run updtdb32.exe for the changes to take effect.

c) DB search application:

The search can be performed from Locate32.exe a dialogue based GUI and from command line by using Locate.exe. The interface is very simillar to windows standard search dialogue. However once the database is updated the search response is far better then windows, almost instantly.

Like the windows search Locate32's search dialogue provide three tabs i.e. on first tab search can be performed by file name and location. On the second search result can be modified by specifying size and date ranges (e.g. from starting size to ending file size and from an interval of file new then or files older then criteria). The advance tab provides more options to modify the search results.

d) Import/Export settings tool:

Another tool with the name SetTool.exe is available for importing and exporting application wide settings using text files.

There is much to Locate32 then this short review. We recomnd this as a plus utility for your windows based computers. However with a few integration with windows file system this can be a must have utility for a PC running MS Windows platform.