Skip to content

Category Archives: Programming/Code

Singleton Toast

19-May-11

On Android you may have experienced delayed toasts or overlapping toasts. This causes the toasts being displayed with irrelevant context/activity (e.g. user may have pressed backed, or previous toast is still overriding new one, or when too many toasts are displayed on screen). Consider the code below. It defines a single function for toast, that [...]

ProxySwitcher – My First Firefox Extension

10-Jan-10

At IITK we have two Internet proxy-servers. Sometimes, one server goes down and we are required to switch to another by navigating to Tools > Options > Advanced > Network > Settings. With Firefox, I tried to simplify this effort with following extension – one click proxy switcher! Once installed, you will see IITK’s Proxy [...]

Split Pascalcase String

11-Sep-09

Do you ever need to split a camel case or pascal case string to a set of words? This can be achieved simply by regular expressions in Java as well as C#. The following code is for Java: String camelCase = “StructuralDesignPattern”; StringBuffer label = new StringBuffer(camelCase + 10); java.util.regex.Pattern p = java.util.regex.Pattern.compile(“[A-Z][a-z]+”); java.util.regex.Matcher m [...]

Handicapped Software

25-Jul-09

[ This post is about software's disability to meet users' expectations. I know you have developed lots of software/applications over your career! Have you ever evaluated them on disability index? No, then read on. "You" = refers to our typical "software engineer" ] Ever heard someone saying “this software sucks”… I love such moments. It [...]

Unreachable code Error or Warning?

08-Jul-09

In Java, unreachable code is treated as compilation error. What do you think? Isn’t making it warning would have made developers’ life simpler? Of course you can write – if( true )    return; What if you could simply write return. This helps in testing a function quickly. As a good programming practice we always remove [...]

Setting up SDB for MySQL

21-Jun-09

Jena is a semantic web framework implemented in Java. It allows you to store/query/inference RDF/RDSF/OWL triples. In Jena a set of triples (in RDF) are called Model or stored within Model object. By default Jena creates in-memory models, but this is not suitable if you have pretty large set of triples to process. Here comes [...]

Lucene StopWords

27-May-09

Lucene is a open-source high performance full-text search engine and has libraries for almost all well known languages (Java, C#, PHP, Python, C). This post is about describing StopWords for a full-text search engine (Lucene). ( Lucene can also be used to index database table rows. The advantage for having Lucene search instead of (database [...]

Proposal for WordPress Summer of Code

02-Apr-09

Requirements: Create a suite of plug-ins for event planning, tie it into WordPress MU/BuddyPress/bbPress, and create a community organizing platform for open source release. Using WordCamp.org as the test case, the resulting site would include functionality for registration, calendaring, additional roles/permissions, extended profiles, directories (vendors, participants, etc), discussion and messaging, coordination around things like carpooling [...]

Fun with Yahoo Media Player!

08-Feb-09

A quick way to insert music in your site: Create hyper-links for few MP3 files Insert following script code to your page <script type=”text/javascript” src=”http://mediaplayer.yahoo.com/js”></script> You are done! Yahoo! Media Player will be loaded and it will make all media links clickable Here are few of my favorite tracks. Use the play button to listen. [...]

Concept Maps for sharing knowledge

31-Dec-08

A concept map is a graph to organize (domain) knowledge. It’s a way of representing concepts (entity/act/idea/process) and relationship between them. It is developed to facilitate learning and knowledge sharing among humans. Here is a simple concept map describing myself. The concept maps are quite similar to RDF Graphs, where we can explain entities and [...]