Saturday, September 13, 2008

Google's ajax search api

This api is available for quiet a long period of time, but i noticed this api today only. After going through couple of blog posts and search api homepage, i feel like writing a blog entry about this api is really worth. One of the striking thing with this api is, this api can give you an aggregation of various search options available in the google homepage. Its a kind of all in one shot. This api can crawl through web searches of various flavours including * Web * Local search * Video * News * Image * Books * Patents It is very simple to incorporate this ajax search api into the web page. We can call the appropriate javascript method will give you the search result in json. Include the script src url and load the script using google.load("search","1") Create a GSearchControl instance and call the predefined method. searchControl.addSearcher(new GlocalSearch()); // Local search searchControl.addSearcher(new GwebSearch()); // Web search searchControl.addSearcher(new GvideoSearch()); // Video search searchControl.addSearcher(new GblogSearch()); // Blog search searchControl.addSearcher(new GnewsSearch()); // News search searchControl.addSearcher(new GimageSearch()); // Image search searchControl.addSearcher(new GbookSearch()); // Book search GSearchControl can control the draw modes also, it can display search results in Linear mode (GSearchControl.DRAW_MODE_LINEAR) or Tabbed mode (GSearchControl.DRAW_MODE_TABBED) These are some of the exciting features. But still more inside this set of API. Do read the - documentation section in google

Monday, September 8, 2008

Yet another browser!!!

Yes its a fact, Google is coming up with a new browser named as Chrome. Its going to be real buzz soon - will this be an end of Firefox era? I'm afraid :(. The google analytics report says that the 8.6% of the internet users are hitting the internet apps from Chrome browser. This is defenitely not a small amount of users. At this point of time most of the people will be downloading this software and testing this application. I believe google can really grab the browser market with their simplicity. Some of the real addons google team says about this browser when compare with other browsers are
  • Well designed to execute todays applications (web2.0)
  • This browser can load javascript faster than other browsers
  • Loading of components to the browser is multi-threaded. (All the other browsers load content single threaded. For eg:- if the browser is loading javascript, it won't do any other set of operation) Google addressed this as one of the major enhancement as this is going to increase web2.0 apps performance drastically, because of this asynchronus architecture
  • Tabbed browsing
  • One of the interesting feature - If the browser crashes while loading one of the webpage due to some bug (either in code or in browser code) it wont crash the entire browser, just the tab will be crashed. User can continue using all other tabs (Great feature isn't)
  • Each tab will be addressed in diffrent memory space. When ever we close a tab, the memory will be freed up and the total process is going to end
  • From google chrome's task manager user will be knowing how much memory a particular website is taking to load (All the tabs, plugins are run as seperate process)
  • Webkit is the renedering engine google used for renedring the webpages
  • The url bar offers not only visited url's, but also search suggestions, popular sites, ranked sites that you have not visited and more interestingly, you can search over the url bar history.
  • The home page browser is going to change, The new browser is going to give users a tab which contains the most recently visitied 9 pages and a search engine towards the right of the screen
  • This browser can work in read-only mode also. If the user do not want to save any of his/her visited url's cache etc on to the hard disk, user can do this if they start the browser in read only mode (Cool one)
  • Chrome can automatically detect malwares and can block the further actions of these malwares. Chrome code can block this malware to a particular tab and once we close that tab, the malware will also go off with out much harm
  • The entire user experience is sandboxed. Sandboxed security is enabled to the users and plugin
  • When we login to a phishing website, chrome can really warn us. This is available with the help of google search engine crawling logics. Anybody can make use of this feature as this is a Public API from google (Now gmail warns emails from phishing websites. Might be the same feature)
  • And the last but not the least "Open Source" - like all other google apps. (I hope google won't come up with a paid version which can give X times faster). The entire browser code is available in the internet
Google has not released a Linux version of this browser yet, I'm eagerly waiting for that to come up. I'm praying that they won't tell users to run the application using wine (Like they disappointed Linux user when release Picasa). I hope google will come up with a Linux compiled chrome. The entire scraps i have taken from this finely readable help approach from google. I really like this simplicity google. My hats off to you folks.

Monday, September 1, 2008

Collections class inside java.util

The utility class contains static methods that operate or return collections. Some of the useful static methods for developers daily use
  • sort – Collections.sort
  • binarySerach – List should be sorted first before invoking the search
  • reverse – Reverse the order of elements
  • swap – Swaps elements at the specified positions in the list
  • copy – Copies all the elements from one list to another
  • min – Returns the minimum element in the collection. Elements should implement Comparable (Overloaded method available which accepts a Comparator as the second argument)
  • max – Returns the maximum element in the collection. Elements should implement Comparable (Overloaded method available which accepts Comparator as the second argument)
  • replaceAll – Replaces all the occurrences of one specified value in a list with another
  • unmodifiableCollection – Returns an unmodifiable view of the collection. UnSupportedOperation exception will be thrown in any attempt to modify the returned collection. (UnModifiable List, Set and Map are also available)
  • synchronizedCollection – Returns a synchronized (thread-safe collection). (Synchronized Set, List and Map are also available) Its is very important to note that the end user who is doing the iteration over the collection has to manually do the synchronize.
  • checkedCollection – This is one of the useful method if programmers are not using java1.5. This will returns a dynamically typesafe view of the specified collection. An attempt to insert an element of the wrong type will result in a immediate ClassCastException (Checked List, Set and Map are also available)
  • singleton – Returns an immutable set containing only the specified object (Singleton List and Map are also available).
  • disjoint – Returns true if two specified collections have no elements in common
  • addAll – Adds all the specified elements to the specified collection