Thursday, December 16, 2010

Song from a stolen heart

Hey! Girl,
I forgot to blink my eyes, coz of ur grace
A thousand dreams.
A thousands nights shall melt
Its only U, coming and going
Bring back my eyes, that u have stolen!

Oh Girl.I cant get u out of my mind
my life....giving away is right

I'll b a shadow on the paths that you go
Hooohhh. will be the breeze that shall flutter your dress
My day beings with your speech your sight
It shakes my days my nights!
Whether we part or join together
Half of my heart will be yours
Your joy your sorrows is mine
You've become a part of me

Oh! you beauty of a female , in an orchard of golden flowers.
the humming birds unite mate in love.
They are playing the flute of love for her aint that the girl
My beautiful girl , my beautiful girl

The moon in the sky,
which is vanishing...
Don't stay just there
You gotta come beside me
One look of your or just a glance
I will survive with that will start breathing.

Wednesday, December 8, 2010

The Journey till now

Date 3rd Dec 2010 Time 2:30 AM Location : 6345
Now you would be thinking what is this is this time or date ??? was there any tragedy that occurred on that day ???? :-) but no this is time at which I have started writing this blog as I am a half sleepy but I don't want to sleep so thought crossed my mind to write about some thing and it ended in writing about the journey till now in train number 6345 .
Travelling in train is usual for Mumbaikars , getting pissed off in the Mumbai local train crowd with no space to breath and as the station arrives the commuter becomes a object who moves along with the person trying to get down .One doesn't have to iron their cloth , just get in the train with a wrinkled cloth and you will get out with a much better iron cloth(still having few wrinkles) without any charge .
As all things have their good and bad sides , travelling in train also has some good side and the best one is when one has to travel a long distance . I would prefer using train for that for many good reasons , though the time taken is a bit to much in todays world but hey you need to give yourself some time for relaxing , as todays fast world no one gets time for them self .Travelling through train is the best as it slows down the world around  you of course after switching off your mobile phones :-) ) .
In my childhood when I used to go for a long trip it used to take around 3 days to reach the destination , now this has been reduced to 22 hours (Who says India is not progressing?? It is !!! ).It used to be the best time , we used to have our vacation almost a month long and this 3 day journey train used to be our playground .
I still remember the days when Me and my brother used to go to take a walk in the boogie to check out the other kids in the group so that we can play cricket in the small space that is available between the seats .
We used to ask our parents to close the doors and start playing ....it was the best time now when I think about it I start laughing.
When I grew a little older there was a incident where my neighbor was none other than my Hindi teacher , and I was really afraid of her as she looked like a devil .In my class she asked the students to read a lesson para by para and when my turn came I had a bet with by friend sitting beside me that I would make the whole class laugh and he said that it is not possible in the presence of this Mam , when my turn came to stand up and read the paragraph the I read lakdi as ladki . I didn't realize that I did it and I was continuing to read the rest of the paragraph but when I looked up I saw that the whole class was laughing and Mam was completely red eyed and she was coming towards me with a big stick I wont write the rest of the story but from that moment I was frightened of her . Now when I saw the same Mam travelling with us believe me I just ran from there and through out the trip I was atleast 3-4 blocks away from that place .
As of now I have a dozen of friends whom I have met in 6345 and still in contact , we make sure that atleast once in a year we meet up .
The best one happened today while I am writing this blog , a guy came into our boggie as I was the only person who was not asleep this guy came in and asked if he could sit here for few minutes as he is going back towards home and the train will take an hour to reach there . I said that its not a problem he can accompany and relax till the time his stop arrives . After few minutes when he got settled down we started having a conversation as to who he was ??.... as soon as I came to know that he is a Defense guy posted in Siachen I was keen to know how they lived their life out there ?? with firing all the time ?? not sure whether they would be able to see the faces of their family ?? I had many more questions and atleast I didn't know how the time flied . It was really good one hour that passed by .When his stop arrived as a good citizen I helped him get his luggage and he was really happy to see a helping hand for him...the best part came in when I also got down from the train just to say him good bye he continued to have a conversation and back of the mind I was thinking its almost 4:00 in the morning and he is still having a conversation . His wife , kids , parents wont have slept the night waiting for him as he was coming back home after 2 year.I stopped my thinking and interupted our conversation and asked him to leave for home and there are people waiting for him for more than a year..they are more important  at the moment !! While he was leaving he gave me his contact details and told me to contact him and asked me to contact him when ever I go to north ... he owes me !! I happily accepted it and when I came back to my seat I was thinking are there these kind of people still living in this world !!!!!

So travelling in train has been a good for me as I got to meet from lovely persons and make really good friends....I call them as MY GIFTED FRIENDS as in todays where do you meet people and have a conversation when one doesn't have time for them self .

Sunday, November 21, 2010

Creating OFFLINE Web Application

I think that this is the coolest feature of the lot that HTML 5 supports . Recollect the days when you have an important work that needs to be done online like a document that needs to be shared with the client/colleagues in the middle of night and you have no other option in your hand rather than contacting the service provider to have a look into the network problem in your local system , wake up in middle of your sleep and check for the network is up or not and once the network is up send across the document to the client/colleague in a mail.
Times have changed !!!!Now you have an option to update your document that is available online update it even if the network is down , once the network is up your document gets updated online automatically with word to word change that you have made in your document while the network was down .
Thinking how is it possible????We have live example in front of us…Google Online Doc…
The basic idea that goes in building such a application is store the changes made by the user in local memory and once the network is up , update the server with the latest/updated document .
That’s what HTML5 brings to developers as well as online users table ….isn’t it cool.

As you read further you will get to know more idea on how this is implemented and what the logic that is put in to implement this.

Basic Concept of Working OFFLINE
The first time that you visit any Offline enabled site the server tells the browser the file that are required to make it available offline , once all the necessary files are downloaded  on users local system you can view the site even if you are not connected to internet .

Now comes the technical part

There are number of browser supported properties that can be made use of to build an offline web application some of them are explained below
1)    Does browser support Offline cache
applicationCache
à This property is available if the browser supports Offline Web applications , this property is available in the global window object , incase of the browser doesn’t support offline web applications this property will be undefined.


I will start of explaining with the properties that were used for building this demo application at my end.
As the browser doesn’t know which files are required to build an offline web application so one can create a manifest file that will hold the names of the files that are required by the browser to access the web application offline . You can specify files like Javascript , CSS , HTML , Images in this manifest file .You can link this manifest file to your HTML page in below format
<html manifest="cache.manifest">

Now you would be thinking why do we need to do this ???
Well the answer is all browsers have some kind of caching mechanism in place, but to be honest, they don't always work. When you open the site on your system after a while(like after rebooting the system,…) and click the Back button in the browser hoping to see the previous page that was opened. However, as you are not connected to the internet and the browser didn't cache the page properly, you are unable to view that page. You then click the Forward button thinking that at least that page will load, but it doesn't. You need to reconnect to the internet to be able to view the pages.
Until HTML 4, the only work around was that the user has to save each page individually. HTML 5, provides a smarter solution. While building the site, the developer can specify the files that the browser should cache. In fact, on each page, you can specify which documents should be cached. So, even if you refresh the page when you are offline, the page will still load correctly.
Note that the MIME-TYPE of this manifest file should be text/cache-manifest .There are more details that the manifest file contains but I wil take that in next blog as right now we will concentrate on our main course.
2)    Detecting ONLINE/OFFLINE
onLine
à Developer can make use of this JavaScript property to detect the status of connection(ONLINE/OFFLINE) , this property is supported by most of the browsers and it returns TRUE if it is online and FALSE in case it is offline.
Fire Fox also provides online and offline event that the developer can make use of and attach handlers for it.

             /*This function will return true if browser is in ONLINE mode and will
                Return false if it is OFFLINE */
function checkStatus()
{
                        return navigator.onLine;
            }

OR

             /* Using handlers */
window.addEventListener("online", function(){
 .../*action to be performed*/ ….
}); 
window.addEventListener("offline", function() {
.../*action to be performed*/ ….
});

The data storage area that we are going to discuss out here is a simple DOM storage for saving data in offline mode.DOM allows us to store data as string and the data stroed in DOM object can be shared across tabs , between browser sessions
The properties that can be made use of for storing and retrieving data are as below

sessionStorage : This property can be made us of for storing data for the duration of session . This session lasts as long as the browser is
                            open, opening a new tab or windows causes a new session to be created .

localStorage      : This property can be made use of for storing data for a longer period . The data is not destroyed even when the user closes
                            the browser or turns of the system .

Above property can be made use of in below format
window.sessionStorage.setItem(“Key”, “Value”);
           
The setters and getters that we get while using the sessionStorage property are as below
setItem(string key , string value ) …. when data needs to be added or updated
getItem(string key)                        …. when we need to retrieve data from memory               
removetem(string key)                 …. when we need to delete any entry from memory
clear()                                            …. when we need to clear memory


Before I put an end to this I would like to summarize it
The most important things that one must remember while developing Offline Web Applications are storing user inputs , creating manifest file , and keep a check on the connection changes .

Sunday, October 31, 2010

some things are special

Because of your beauty, there's rain in my summers
because of your dreams, there are waves in my heart
when you swing your hands as you speak
there's a storn in my heart

when love happens, there's a naughtiness in one's eyes
I acted a bit, suffered a bit, and enjoyed the time.

because of your eyes
my step falters, my eyes wander
what is this new yearning?
even if it hurts, the heart wants more

w/o a word, look at me
let your moments get longer
without thinking, close your eyes
let the intimacy continue

In my mornings, I should wake up looking at your face
In my evenings, I should fall on your lap and end my day

Saturday, October 30, 2010

Socket Direct Protocol

SDP is a wire protocol to support stream sockets networking over IB. It utilizes features such as RDMA for high performance data transfers and provides higher performance and lower latency compared to IP encapsulation over IB (IPoIB). A long standing request has been to add implementation-specific support to the JDK to make it easy to use SDP in Java Language applications. As SDP provides a streams sockets interfaces it can be made transparent to applications using java.net.Socket/ServerSocket and of course the stream-oriented SelectableChannels and AsynchronousChannels in the channels package.
The simple solution in jdk7 uses a configuration file with rules to indicate the endpoints that are connected to the IB fabric for when SDP should be used. When a java.net.Socket or java.nio.channels.SocketChannel binds or connects to an address that is an endpoint on the IB fabric then the socket is converted to use the SDP protocol. The solution can be thought of a kind of built-in interposer library and using an interposer library is an alternative way of doing this.

There are two types of rules, as follows:


A "bind" rule indicates that the SDP protocol transport should be used when a TCP socket binds to an address and port that match the rule.
A "connect" rule indicates that the SDP protocol transport should be used when an unbound TCP socket attempts to connect to an address and port that match the rule.
A rule has the following form:


("bind"|"connect")1*LWSP-char(hostname|ipaddress)["/"prefix])1*LWSP-char("*"|port)["-"("*"|port)]



The first keyword indicates whether the rule is a bind or a connect rule. The next token specifies either a host name or a literal IP address. When you specify a literal IP address, you can also specify a prefix, which indicates an IP address range. The third and final token is a port number or a range of port numbers.


Consider the following notation in this sample configuration file:


# Use SDP when binding to 192.168.1.1
bind 192.168.1.1 *


# Use SDP when connecting to all application services on 192.168.1.*
connect 192.168.1.0/24     1024-*



The first rule in the sample file specifies that SDP is used for any port (*) on the local IP address 192.168.1.1. You would add a bind rule for each local address assigned to an InfiniBand adaptor. (An InfiniBand adaptor is the equivalent of a network interface card (NIC) for InfiniBand.) If you had several IB adaptors, you would use a bind rule for each address that is assigned to those adaptors.


The second rule in the sample file specifies that whenever connecting to 192.168.1.* and the target port is 1024 or greater, SDP is used. The prefix on the IP address /24 indicates that the first 24 bits of the 32-bit IP address should match the specified address. Each portion of the IP address uses 8 bits, so 24 bits indicates that the IP address should match 192.168.1 and the final byte can be any value. The -* notation on the port token specifies "and above." A range of ports, such as 1024—2056, would also be valid and would include the end points of the specified range.


The final rules in the sample file specify a host name (hpccluster), first with the port assigned to an http server (80) and then with the port assigned to a MySQL database (3306). Unlike a literal IP address, a host name can translate into multiple addresses. When you specify a host name, it matches all addresses that the host name is registered to in the name service.

Once the configuration file is created we simply specify it when running the application, 
     eg:$ java -Dcom.sun.sdp.conf=sdp.conf -Djava.net.preferIPv4Stack=true MyApplication
Note that this example also sets the java.net.preferIPv4Stack property. The Java Runtime always uses IPv6 sockets if IPv6 is enabled. The Solaris implementation of SDP supports IPv6 addresses but currently doesn't support IPv4-mapped IPv6 addresses (::ffff:192.168.1.1 for example). For now this means setting the property so that all sockets are IPv4 sockets.



To test that SDP is enabled, use the sdpadm(1M) command:
% /usr/sbin/sdpadm status
SDP is Enabled
Other commands you might find useful are ib(7D), ibd(7D), and sdp(7D).


You can use the grep command to search the /etc/path_to_inst file for the string "ibd" to view a list of IB adaptors that are supported on your network.

new tune

C  C          C E  D          C   E  D      B  B  B  C C  C  E  D        
C  C  E  D         E  F   D C  C  E  D  
C C  E  D            B  B  B         C
B  C  D  G   G   A             F  E  D
F  G   G   G  G       D  E   F   E   F
E   G   G   G   G              D   E   F   E  F
A   C’  B  G                 G   A   A   F
E   F  A                    G  F   E   D
E   E           E   F         G   G        
G   A   G   F   E D  E           E   E   E  G            
F   E E  E               G   G   G   G          
C’   B   G   F E   F              
A  G   G G  A                  
B   C’  C’  C’   C’            G   A              
F   G   B   B   C’   C’  C’  B      
G   A   G   G   G   A  B   A                  
F  F   G   A   G D   D   E  G          
F   G   F   G   D

Info on 64-bit processors

Without a scientific set of benchmarks this one is really hard to measure. Some people think one distribution "feels" faster than another while others disagree. Suffice to say that no one has yet to prove scientifically that the 64-bit versions of Linux available today are significantly faster in performance than their 32-bit counterparts. Most "64-bit" versions of software are actually just recompiled versions of the 32-bit code, with no optimization that would take advantage of the new features these chips offer and perhaps boost performance. If you're looking to use 64-bit because you think it will be a major improvement in speed, I would reconsider.
 Not all software runs on 64-bit Linux. Although there have been 64-bit native Linux distributions for several years (a year before Microsoft Windows XP64, but I digress), the software community has yet to fully embrace the technology. As of the time this post was written, there is no 64-bit version of the Macromedia Flash Plug-in for your web browser, for instance. WINE and the Java VM have been known to cause problems on some 64-bit installations as well. Not all hardware has 64-bit drivers yet. The two major display card manufacturers do have X86_64 versions of their drivers, but they are sadly the exception rather than the norm.
If you plan on using a machine that has more than 4GB of RAM, you'll need to use the 64-bit version of your distribution because 32-bit operating systems are only able to handle up to 4GB, maximum*. There's just not enough memory addresses for more. This is usually not a problem for desktop users, but it might be a concern for servers or high-end workstations. 
 As Apple Computer has proven in recent years, there's an awful lot people will do just because something looks or feels "cool". This is perhaps the one reason why some people choose to run 64-bit Linux: it's a neat idea. To some people the idea of running a 64-bit native** operating system on their 64-bit CPU is just too cool to pass up. These people understand the drawbacks to running a bleeding-edge system and accept the extra work involved. 
Although 64-bit Linux distributions are now by and large on-par with their 32-bit brethren, they do not yet surpass them in performance. You're not running at as much of a deficit with 64-bit two years later, but you still don't quite have an advantage either. Now, I think, rather than strongly suggesting 32-bit I could say either will work, but neither has any significant advantage over the other. It's more a matter of personal preference.
Detail info on this can be gathered from :: http://en.wikipedia.org/wiki/64-bit

Sunday, October 24, 2010

HTLML 5 WEB SOCKETS

I have been reading a lot about HTML5 & the features that it brings to the developer table , one of the main area in which I have been digging in is to learn about Web sockets . So I thought of sharing the details that I have got to learn about it .
What are Web Sockets ?
                Web Sockets feature that comes with HTML 5 is a new proposal that full-duplex, bi-directional client-server interaction over a single TCP connection. The main goal of this proposal are as below
[a] Increase in Web Server connection
[b] Simplifying the AJAX code

Before explaining about the above points I would like to explain about the other applications that support this functionality but in a much trickier way.

The other applications that I have came to know is COMET which in practice in most often implemented through AJAX and long polling. COMET makes use of  technique of server push using standard browser functionality. With LONG POLLING, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. Once the information becomes available (or after a suitable timeout), a complete response is sent to the client.
The above information tough provided won’t be sufficient enough for explaining about the LONG POLLING & COMET one can refer the links to get more idea on the same.

Now the techniques that is mentioned above are a kind of hacks as it makes use of AJAX , pooling as this would mean multiple AJAX request being send from the client to the server & keeping that connection open by using long pooling technique to get real time data.

Web Socket supports a much simpler interface that enables client and the server sends messages to each other in a much simpler way.

Google’s Chrome browser already provides WebSockets and developers can expect to see the technology in other browsers in 2010

A  simple way to check whether the browser supports Web Socket is by using the below code
if("WebSocket" in window)


HTML5 web socket example 

Step 1: Create a WebSocket with a valid URL

Creating a new websocket connection to a web socket server
var newWebSocket = new WebSocket("ws://abc.xyz.com");
ws:// è web socket connection
wss:// è secured web socket connection
Default port for
WebSockets è 81
secure WebSocket è 815.
Now comes the times to attaché few callback functions
newWebSocket.onopen = function(evt) {
alert("Connection open..."); 
};
 
newWebSocket.onmessage = function(evt) {
 
alert( "Updated data : " + evt.data);
 
};

newWebSocket.onclose = function(evt) {
alert("Connection closed."); 
};

Step 3: Send and Receive Data
To send a message to the server, simply call the postMessage method on the webocket with the content you wish to send to the server.
stockTickerWebSocket.postMessage("hi there);
This will send the message to the server. Any message coming from the server will be delivered to the onmessage callback registered above
When completed, call the disconnect() method to close the WebSocket connection.
newWebSocket.disconnect();
As demonstrated in the example above, there are no HTTP requests made to the server from the client side to retrieve data, instead the data was pushed to the client from the server - when it becomes available.
When a new WebSocket connection is established the browser opens an HTTP connection to the server first and then negotiates with the server to upgrade the connection to a dedicated and persistent WebSocket connection. This process automatically sets up a tunnel through to the server  passing through all network agents (proxies, routers, and firewalls) in the middle (very much like HTTPS establishing a secure, endtoend connection), solving numerous issues that the various Comet programming techniques encountered. 


So this is it ,  a very basic understanding for the Web Sockets feature that HTML 5 provides will be posting more updates on this and the other features in the near future.