Monday, December 3, 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 Market Share Comments
Chrome 33-39%
Firefox 24-26%
IE 20-22%
Opera 10%
Safari 3% negligible among non technologist
Mobile Safari 2%



In the OS audience share there were few surprises. Windows is still holding a good market share around 86 to 89% but i noticed that Android is coming up strongly with a market share of 3% that is similar to the market share for Linux users. So basically as many people who uses Linux desktops/ laptops uses an Android based mobile device. And I have noticed a constant growth in its market share. While Nokia, Blackberry, iPad, HTC are still popular but among my website the audiences didn't  seemed to use them a lot while surfing or using my site. Although all my sites are mobile enabled/ready.

I hope this data would be useful to people who don't get heavy traffic on their websites :)

Tuesday, November 27, 2012

Do multiple launches in Eclipse with single click.

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 console.

All the best experimenting!

Tuesday, August 14, 2012

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 listener. The SecurityModels class is a static class. And when we add user to the ids given, it overrides the previous user. So the right way to add USM user is:

USM usm = (USM) SecurityModels.getInstance().getSecurityModel(
new Integer32(USM.SECURITY_MODEL_USM));
if (usm == null) {
usm = new USM(SecurityProtocols.getInstance(), new OctetString(
MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(usm);
}

UsmUser myuser = new UsmUser(new OctetString(USERNAME), AuthMD5.ID,
new OctetString(PASSWORD), null, null);
usm.addUser(new OctetString(USERNAME), myuser);


With this we way don't override the USMUser and our code works fine. Woila! This discovery took a huge amount of my time. Hope it helps someone.

Sunday, June 24, 2012

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.

Thursday, February 23, 2012

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;}
  }

Tuesday, February 21, 2012

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 that compiler can create a function pointer map or whatever it creates and point correct function pointer for various derived types.

This is done in the following way:


class a
{
   virtual public void display() 
   {
     Console.WriteLine("A");
   }
}

class b:a
{
   override 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:
B
B

I hope this helps a few java developer to understand c#.
So, what i figured out from this is C# gives us a slight more flexibility for overriding a function with new but I am not yet sure will i like to use it? And if yes, a very good usecase for it.


Tuesday, February 7, 2012

Facebook Hidden Messages Folder

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 messages will go into an Other folder where you can look at them separately.

If someone you know isn't on Facebook, that person's email will initially go into the Other folder. You can easily move that conversation into the Inbox, and all the future conversations with that friend will show up there.

You can also change your account settings to be even more limited and bounce any emails that aren't exclusively from friends.
This kind of message control is pretty unprecedented and people have been wanting to do this with email (and phone calls) for a long time. Messages reverses the approach to preventing unwanted contact. Instead of having to worry about your email address getting out, you're now in control of who can actually reach you.
 Apparently, this feature has been there since November 25th,2010 atleast. Wonder how i never bothered to click or even notice that Other link.

I am preety sure, by now you would have gon to check out your messages folder, so I can blabber a bit which is mainly my own observation.
On UX side of it, as the Other button is rightly less acessible as it is supposed to have unimportant messages, but i guess its too less. So how to solve it?
  • As soon as we click on Messages button, my eye balls are fixed on messages and I usually don't care about whats there on the left side, so a good approach can be having a button near New Messages on the top of the page, so that it would be hard to reach and one level down in the accessibility ladder.
  • A better descriptive name for others, may be a simple Un-Important would work more for me.
  • Have something like user-defined folders, etc before or after others , than the left section would catch more eye-balls. With just one sub-folder its tough to notice.
These are just a quick ideas which I can get. I am confident the UX engineers at facebook can come up with much better placement.

Thursday, February 2, 2012

junglee.com Review

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 flipkart. Than how is it a product search engine if it can't search from the entire internet.

JC: There you go, you are already pointing fingers, wait a while, we are still in beta and we already have over "1.2 crore products and 14,000 brands" and hundreds of retailers. Give us some time, either we would kill them or else we would add them to our database.

Me: Oh, okie, so there is a plan out there. Sounds interesting. What is onething that I should love about you?

JC: The website easy to use, clutterless, single column design. Our site has taken inspirations from mobile sites and brought its simplicity and make sure it looks the same on all platforms. We have a huge search bar on top which reminds you of the purpose and lots of reviews and prices below that makes it easier for you to make your informed choice.

Me: Okie, so you are not selling products, than how does Amazon gains out of it. How will you earn?

JC: Thats a smart question, to answer that let me ask you one question. What the toughest things about selling. Can you list them?

Me: Ummm, to find customers, to find customer who actually want a product, to decide the price to offer him so that he can't decline, hmmm thats all i can think of.

JC: Are you a marketing guy? You just nailed it. So what junglee does is that make customers who wants to buy something, come over here instead of junglee looking for them. Than he searches for the product and sees the prices. We show him the prices from all the sites including amazon, if its available ;). We know what he wants, we know the prices offered by the competitors so we know the price to offer. Right now we just show handful of products from Amazon, but eventually when we would have a bigger presence in your country than we can push more products to him(and her -- we are not sexist) .

Me: Smart, so basically this is how you are trying to kill?

JC: Yes, kind of and moreover with the amount of real time data and our IITian Business and Data Analyst, we are sure to kill the competitions.

Me: If this is your plan? Than why are competitors tying up with you?

JC: This is the undercover business model, but actually we are like Justdial or Sulekha, we are just generating more leads for them. Why would they miss such an opportunity.

Me: Smart!! Is there any way I can compare prices from flipkart and infibeam on junglee?

JC: There are some smart people like Amit who has written some tools for it. You can know more about it over here.

Me: Thank you, that was quite insightful. All the best.