Wednesday, 5 May 2010

How to prevent Browser Close



First, some clarifications of my requirements:

  1. To prevent the user from closing browser or tab (both are treated similarly).
  2. Note that browser close is different from browser exit. Browser close is done using the "X" button, while browser exit is done using File>Close or Alt+F4 keys.
  3. JS can only catch browser close event.
  4. URL refresh was also to be treated as close.
  5. However, navigation using anchor, buttons or any other DHTML was to be ignored.
  6. Tested on IE8 and Firefox 3.5.

Monday, 7 September 2009

Single Word Suggest Oracle

* This is kind of a data dictionary for the type ahead search box providing suggestions.

This is kind of a data dictionary for the type ahead search box providing suggestions.

This file is similar to the class MultiWordSuggestOracle provided by GWT. The behaviour of the GWT class was different from what was needed. Extending the class was not an option since many methods were private. Also member variables were private without any getters or setters.

The name Single Word Handler explains the purpose of class. Normally all characters are used in matching.

Tuesday, 11 August 2009

Performance/ Optimization Tips

General


1. When testing for memory or timings, the first open of a document after bouncing server, always takes huge amount of resources. Hence this one should be ignored for the time being. But you should look into it atleast once to see if the first open can also be optimized.
2. When unsure of the results, perform the same scenario about 10 times to reach a conclusion

Accessibility links

W3ORG Specs:


  1. Quick Tips - http://www.w3.org/WAI/quicktips/
  2. Live Regions - http://www.w3.org/TR/aria-state/
  3. Eg of Live Regions: - http://www.alistapart.com/articles/waiariahttp://accessibleajax.clcworld.net/
  4. RIA - http://www.w3.org/TR/aria-roadmap/
  5. Report on WAI Markup for AJAX Live Regions - http://developer.mozilla.org/en/docs/AJAX:WAI_ARIA_Live_Regions
  6. ARIA Reference Implementation - http://test.cita.uiuc.edu//aria/

Shortest code to read entire file

I don't remember where I had read this, but this in undoubtedly the smallest piece of code for reading the whole file.
Scanner loScanner = new Scanner(new File("C://Fazeel-C//MSS//workspace//FastTreeProj//src//sample//JSONs.txt"));
loScanner.useDelimiter("\\Z");
String wholeFile = loScanner.next();       
loScanner.close();

Monday, 2 June 2008

Migration Certificate for Mumbai University

Migration Certificate is required when you take up a course in a different University from the one you last studied.


The following steps outline the procedure for obtaining a migration certificate from Mumbai University. The procedure would mostly be different for other universities.



Monday, 5 May 2008

Learning Java before C/C++

Well there is absolutely no reason why you can't learn Java without knowing the other two. It would require more effort, but nevertheless is still easier. In fact, learning C/C++ is much more difficult.

No wonder nowadays, there is an increasing tendency to directly learn Java. But it there a problem in this? I always felt so.

Learning OOPS concepts through Java is possible; but do you think you can visualize the concepts to the extent you can with C++. Also basic CS stuff like Data Structures, Searching, Sorting is better understood through these languages than Java.

When I read Joel On Software's post about this, it made 100% sense to me. You can read it at:
http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html