Posts

Showing posts from 2012

Browser and OS Audience Share

Recently I was analyzing the data from the reports from few of my blogs and websites, to understand the how the usage of different browsers are spread among different audience profile. But data didnt give any major suprises in the browser landscape. All the blogs and websites had majority Chrome users which was lowest at 33% and highest till 39%. Firefox user base was constant around 24 to 26%. Almost all the reports have IE users around 20-22%. Opera seemed to be having a fairly good market share these days around 10%. Safari had some surprises based on profiles , in case of technology enthusiasts it had a market share of around 3% but almost all other places it was less then 1%. But Mobile Safari seemed to have a constant audience base of around 2% almost across all profiles. Other browsers which people are using these days are UCBrowser(i guess mainly on Java based smartphones), IEMobile, NokiaBrowser, Dolfin, Maxthon but with negligible audience base. Browser

Do multiple launches in Eclipse with single click.

Image
Many a times we need to launch multiple launch configuration in eclipse one by one or after waiting for sometime. This usually tend to waste a lot of time due to multiple clicks. Like debugging projects over maven or GWT, we often have to first launch our maven target and then attach a debugger to a particular port. There is a simple way to automate this. We need Launch Group option to do that. To install this option  one need to install "C/C++ Development Tools" from the CDT (see eclipse.org/cdt/downloads.php ) - this single package is enough, no other CDT packages are needed and this won't disturb the Java environment either. Then you can have "Launch Groups", for any kind of project, including Java projects.  For my maven build plus remote debugger i had to give maven build target launch a post launch action delay of 16 seconds and the remote debugger a post launch action of  "wait till termination" so that sysout comes on the default

SmartGWT Calendar widget scroll to Current Time in month view

The calendar widget of smartgwt is quite powerful. But it lacks one important functionality, that is, scroll to the current time in case of month view. But this feature can easily be enabled by working on the Workday feature which smartGWT calendar widget supports. I wrote a simple function to achieve the same: private void scrollToCurrentTime() { int[] workDays = new int[1]; Date now = new Date(); workDays[0] = now.getDay(); int currentHour = now.getHours(); now.setHours(currentHour-1); String start = DateTimeFormat.getFormat( PredefinedFormat.TIME_SHORT).format(now); now.setHours(currentHour+7); String end = DateTimeFormat.getFormat( PredefinedFormat.TIME_SHORT).format(now); calendar.setWorkdays(workDays); calendar.setWorkdayStart(start); calendar.setWorkdayEnd(end); calendar.setScrollToWorkday(true); calendar.setShowWorkday(true); }

Correct way to use SNMP4J in concurrent environment.

SNMP4J is one of the most popular Java library for SNMP (Simple Network Management Protocol) operartions. Its quite powerful and easy to use. But it seriously lacks a good documentation.  In my project at work, which is a concurrent environment, I faced a funny problem. I was using a simple snmp trap listener code as shared in the java docs and in numerous amount of blogs. But, the listener use to stop working after a while. Little more debugging and I figured out that it use to stop working only after somewhere else in the code someone has used the same library for SNMP get operation. Then, i went ahead googling to see if anyone else has ever faced a similar problem. But in vain! Checked the bug list on SNMP4J to see if any such similar issue exists. No luck again! Then I decided to understant the scenario properly and started reading the SNMP4J java source code and Bazinga!! The very basic source code share with the documentation gives us a wrong implementation of the trap li

How to hide a html5/flash video, so that it does not reloads when its again made visible?

Have you ever faced a problem where once you 4hide an html5 or flash video by setting the visibility:none or simply using jquery $('#div-video-container').hide() and then doing a $('#div-video-container').show() actually reloading the video. Which means you would loose the position where you actually paused the video on hide. This behavior is seen mostly on firefox. I recently faced the problem, and after lots of googling also I never got a solution which can work across all the browsers and be simple. Then finally i devised my own solution. The simplest hack can be to lower the z-index of the div and introduce a newer div over it of higher z-index. Make sure this new div does'nt have a transparent background else the the video element would still be seen. I hope this would be helpful.

Annotation in C# for mapping JsonProperty to a variable

If for some reason you are .NET Framework 2.0 and using Newtonsoft.Json libray than this is gonna be very useful. You have a case where your Json property contains a '-' sign, than obviously you can't have a C# variable to map the same as variable naming scheme does not allow - signs. I recently faced a similar problem and spent hours googling to figure out how to do it in .net 2.0 but all the efforts were in vain. Than after a lot of hit and trial and reading source files I hit this annotation JsonProperty("my-name") and hurray it worked. Just to provide a small example usage: JSON: {"my-name" : "Biplav"} C# snippet: public class Name {    private String m_my_name;    [JsonProperty("my-name")]    public String my_name    {       get { return m_my_name;}       set  { m_my_name = value;}   }

How function overriding is different in C# from Java?

If you are moving from Java to C#, than this is one thing which you would find very funny. Suppose you wrote the following code: class a {    public void display()     {      Console.WriteLine("A");    } } class b:a {    new public void display()    {     Console.WriteLine("B");    }  } And did something like: A a = new B(); a.display(); B b = new B(); b.display(); The output would be: A B Although we expect here that as we have overriden display in B, so the display of B must be called. But this assumption is incorrect as we have reserved reference for A, so the C# compiler won't know that B can override display function. Hence we need to tell the compiler that there is a possibility that display can be overriden in derived classes and please check for it. To do so we would have to define the baseclass function which can be overriden as virtual and than use override keyword in all the derived classes. So tha

Facebook Hidden Messages Folder

Image
I did'nt notice this till now, and there are chances that you might not have too. There is a hidden(not exactly) messages folder on facebook where all the messages from you non-friends go to. To reach this folder, first click on messages on the left-hand bar and than click on the others just below it. You might discover lots of messages from various contact since you have been on facebook. I was suprised to see that there were no. of messages/events from the pages i follow, which I would have loved to read and attend but now its too late :(. On doing a little more research about this simple feature on Facebook, this is what i found on there blog The Social Inbox It seems wrong that an email message from your best friend gets sandwiched between a bill and a bank statement. It's not that those other messages aren't important, but one of them is more meaningful. With new Messages, your Inbox will only contain messages from your friends and their friends. All other m

junglee.com Review

Image
Many of you would have seen junglee.com and would be wondering what so special about it? I was doing the same, till i had this unofficial interview with Junglee.com (JC). Read along: Me: What is junglee.com ? JC: I would like to describe ourself in one word, Product Search Engine, rather it became three. Me: I can search on Google and find my product. Whats so special? JC: Okie we have a product comparator. We would devoid you of the pain of going to various websites and comparing the prices and reading the reviews before you buy anything! Me: Ahh!Now you are speaking sense. So you are advanced version of yellow pages. So, do i get the cheapest products over here? JC: Yes and No. Me: What do you mean "yes and no"? JC: Technically, it lists prices from most of the online and offline stores in India. So you can get the cheapest price. But it does not have the prices from flipkart.com and infibeam.com .  Me: What, I usually buy all my books from flipka