27 September 2014

Clickity click! The days of double-clicks are long gone

I thought of writing this blog post when I saw my efficient colleague Sheshabhargavan double-clicking away at super-speed on his PC :-) 

Remember the time you first handled a mouse? Most of us would, as we were quite old by the time we started using a computer (unlike today's generation, who wouldn't remember using a mouse at age two. Well, now they have touch-screens. Who needs a mouse?)

For us, it was an interesting process, clicking some item and our mentor/friend telling us "click it once more...no no...click it twice, quickly. It's a double-click"....and we learnt the amazing way of opening a folder shown on the GUI of Windows 95. T'was much easier and better looking than typing cd directoryName at the MS-DOS command prompt (of course as programmers now, we prefer the Linux terminal more than the GUI, but that's a different story).

With the advent of Windows XP, along with the much better start menu, came the feature of single clicks. Many people found it a boon, but many others simply refused to adopt it, because if for example, a dialog box opened up for them to select a few files in the dialog box with the mouse...


...the act of single-clicking a file, would select the file and the dialog box would disappear. It wouldn't give them the chance to select multiple files. Little did they know, that they could select multiple files by keeping the Ctrl key pressed during file selection.


Why single click?


Reason 1. You're putting lesser strain on your muscles. Try it right now. Do a single click and see how much more relaxed your forearm muscles are, than when you have to tense your muscles to do two clicks in quick succession. Quicker trip to RSI, I guess. Ever tried using the mouse with your other hand?
These would be the muscles involved (Images are from Wikipedia. If any medical people find this info could be made more correct, please let me know)

The extensor indicis:

The extensor carpi radialis:
The extensor digitorum:


Reason 2:  Using keyboard shortcuts are much faster, most of the time. For example, using Ctrl+C, Ctrl+V is faster for copy-paste than right clicking and selecting menu options. You can even navigate through Windows Explorer using the tab key and the keyboard arrows. Then use the letter keys to reach filenames beginning with that letter. Also try pressing F11 to make your browser go to full-screen (press it again to get it back). Prepare to be surprised at the number of shortcuts available. There's an even better comparison of keyboard shortcuts for various operating systems, on Wikipedia.


Reason 3: This one is trivial, but you'd basically increase the life of your mouse button if 1/3 of your clicks are eliminated. Every device/machine goes through a fatigue test. Which means, that your mouse has very likely been tested for how many clicks it will be able to sustain.


Shifting from double clicks to single clicks
In XP, the setting is here. For Windows Vista, 7 and 8, it's here. In folder options, selecting the "underline icon titles only when I point at them" option makes your icons look neater.


Bonus info

By the way, did you know that your mouse has a middle button too? Yes, the mouse scroll wheel is also a button. Press it downward and see. This button can be used to activate a nice mouse-move scroll feature in browsers.

Don't click it

Also, some really innovative people at the institute for interactive research, created don't click it, in a Flash interface, where you can operate the menus without having to click them. A challenge from me - try using the website menus without (apart from the first necessary click) clicking on it a single time. It's fun! :-)


20 September 2014

Google gives us a free survey form tool

Sometime back, some of the best free survey tools available were Lime Survey, Survey Monkey and Survey Expression. Lime survey being a very good choice, as it's open source (GPL) and allows you to download the tool and install it on your server. I've personally used it and found the interface to be intuitive. Results can be exported to a spreadsheet and you can view the submitted results in the database and even edit them.

The new kid on the block, is Google's survey forms. Why would anyone continue using other tools for which you have to pay to be able to export the results into a spreadsheet or to use advanced features, when Google provides it for free?

Go to Google Drive
Say no thanks to this


If you're using the older version of Drive, click the red "Create" button. Else, it's the "New" button.
And this is what you can do with forms:


It's got Google's nimble, minimal UI look and feel (which I love) and form options as shown in the image below.


The "Advanced settings" for each question also allows you to specify data validation and shuffling of options (these are options that other softwares will charge you for).

Try a sample form. Tell me about N Recursions
Here's a form I created. Tell me what you like about this blog :-)

Data monitoring
Some creators will allow you to edit your entries even after you've entered them (I skipped that option).
I wouldn't be surprised if Google's algorithms would be monitoring data entered into the forms. This is the one bane of free services. They collect and monitor your data and behavioural patterns. Lime Survey comes to the rescue here, because you can install it on your own server and send out survey links. Nobody other than you monitors the survey data.

Neat, appropriately coloured UI
Most of us Engineers, aren't taught anything about colours and UI. Most people have this concept that they have to use some colour or the other, and end up using what only they like. Many times it turns out to be a weird bunch of colours to others who look at it.
Notice that Google forms use bright colours only where necessary. Only where the User's attention needs to be drawn to. Everywhere else, it's a grey colour.

To persons untrained on colour, grey seems like a very boring choice. Actually it isn't. It's one of the best, un-intrusive options available. If you'd like to learn more, there's some colour theory and the colour wheel.

More options
Oh by the way,  Google forms also allows you to add images and videos.


You can specify if you want the results in a spreadsheet or retained in the form itself.


Best of all, there are themes too:



And once your respondents are done, they can see the results of the survey and some statistics too, in the form of graphs.

Go ahead and create a survey of your own.

16 September 2014

2+2 = 5

Yup, it's actually possible to have 2+2=5. Or any other small number.

Interestingly, some JVM's have an Integer cache, where the numbers ranging from -128 to +127 are stored because they're assumed to be used more frequently and so that the Integer class can function with better memory efficiency (a rather interesting set of functions available in the Integer class. Have a look under the hood).

So if you write some code like this:
import java.lang.reflect.Field;

public class Main
{
    public static void main(String[] args) throws Exception
    {
        Class cache = Integer.class.getDeclaredClasses()[0];
        Field c = cache.getDeclaredField("cache");
        c.setAccessible(true);
        Integer[] array = (Integer[]) c.get(cache);
        System.out.println(array[255]);
        System.out.println(array[0]);
        System.out.println("-----------");       
        array[132] = array[133];

        System.out.printf("%d", 2 + 2);
    }
}
You can build from the commandline using
gedit Main.java;
javac Main.java;
java -cp /folder/containing/the/class/file/ Main

Where position 132 is where 4 is located and is being overwritten by the number in position 133, which is 5, the last printf will output 5. Rather cool, isn't it? :)
It's like tinkering with the foundations of the universe or DNA.

Why caching?
It puzzled me. What memory efficiency were they trying to achieve with caching?
Turns out that when you store a primitive datatype like int in an Integer class (called a boxing conversion), it's better for low-memory machines to have the integer use up only 8 bits, instead of the usual 16 bits. The cache helps in this storage of 8 bits, if we go with the assumption that numbers from -128 to +127 are the most frequently used integers. If integers beyond that range needs to be used, then the Integer class would automatically store them in a 16 bit memory location.

You can see this phenomenon in another piece of code (which works only if the specific JVM has implemented the cache):
 
Integer a = 1000, b = 1000;  
System.out.println(a == b); // outputs false  
Integer c = 100, d = 100;  
System.out.println(c == d); // outputs true
 

01 September 2014

LOL

Continued from the previous LOL page.


Baby crying
share with this link



Footpath use
share with this link

Continued in the next LOL page