August 24th, 2009 — 5:40am
Today I came across an online tool that allows you to see the screenshot of pages in the google search result. You can give it a try at “Veesual.com”


While I found the concept to be interesting, I was wondering what could be the use of looking at screenshots of pages in search result. What matters to me is getting a list of relevant search results. A thumbnail of a particular page in search result won’t help me in determining how relevant that page is to my search.
However, I do see one use for getting search results along with thumbnails. It can be used to come up with ideas for designing web-sites for a particular theme. You can search on Veesual using a keyword that describes the theme of your site and then take a quick look at the design of pages in the result. This can help you to come up with your own web-page design.
Do let me know if you can think of some more applications of Veesual.com
Comment » | My Thoughts, Tips
August 9th, 2009 — 4:06pm
Consider the following class in C#
public class Person
{
private string name;
private int age;
public string Name{
get {return name;}
set { name = value; }
}
public int Age{
get {return age;}
set { age = value; }
}
}
If I want to set the value of Name and Age property on the instance of Person class, I’ll need to refer to that instance for every property I need to set in the code. For example:
var person = new Person();
person.Name = "Super Man";
person.Age = 30;
It would have been great if C# had an equivalent of VB’s “With..End” statement, where we could refer to the instance of Person class only once and then refer to properties only.
Today, I came across this post “mucking about with hashes…“, which shows how C# lambdas could be used as hashes. Using this concept, I implemented a simple extension method that simulates the behavior of VB’s “With..End” statement to some extent.
Here is the code for extension method:
public static class MetaExtensions
{
public static void Set(this object obj,params Func<string,object>[] hash){
foreach(Func<string,object> member in hash){
var propertyName = member.Method.GetParameters()[0].Name;
var propertyValue = member(string.Empty);
obj.GetType()
.GetProperty(propertyName)
.SetValue(obj,propertyValue,null);
};
}
}
Using this extension method, we can set the value of properties on instance of Person class as follows:
var person = new Person();
person.Set(
Name => "Super Man",
Age => 30
);
Isn’t that cool?
7 comments » | Programming, Tips
August 6th, 2009 — 3:47pm
Yesterday I installed and activated Blass2 theme for this blog. I liked this theme as it was very simple and free from any extra graphics. After installing the theme, I discovered that “SyntaxHighlighter Evolved” plugin which I use to display code segments, was not working. I searched for other themes which are similar to blass2 and can run syntaxhighlighter plugin, but couldn’t find anything better. Finally, this is how I fixed it.
To fix it, I had to edit ‘footer.php’ of Blass2 theme using inbuilt theme editor of Wordpress (Appearance > Editor). The original ‘footer.php’ looked like this:
<div id="footer">
<p>© <?php echo date("Y")?> <!-- Please leave this line intact --><?php if (is_home()) : ?><?php bloginfo('name'); ?> | Theme <a href="http://1000ff.de/wordpress-theme-blass-english-version/">Blass</a> by <a href="http://1000ff.de/">1000ff</a><?php else : ?>Theme Blass by 1000ff<?php endif; ?> | Powered by <a href="http://wordpress.org/">WordPress</a></p>
</div>
To fix the plugin, you need to add a call to ‘wp_footer’ function in ‘footer.php’.
<div id="footer">
<p>© <?php echo date("Y")?> <!-- Please leave this line intact --><?php if (is_home()) : ?><?php bloginfo('name'); ?> | Theme <a href="http://1000ff.de/wordpress-theme-blass-english-version/">Blass</a> by <a href="http://1000ff.de/">1000ff</a><?php else : ?>Theme Blass by 1000ff<?php endif; ?> | Powered by <a href="http://wordpress.org/">WordPress</a></p>
<?php wp_footer() ?>
</div>
After making this change, syntaxhighlighter plugin started working again.
1 comment » | Tips
August 5th, 2009 — 11:19am
If we want to share a file or photos while chatting with our friends on internet using IM tools like GTalk, we use file sharing services available online. These services allow us to upload a file to their servers and give us a link which we can share with our friends. But what if you are a developer and want to share a small piece of code with your friend? You are left with following choices:
- Paste it in your chat: I know most of us do this when we quickly want to share the code. However, its annoying as it becomes unreadable and makes your code look as if its obfuscated
- Email: This approach is better compared to previous approach, however the recipient wil need to manually compile the code and run it if he wants to know the output.
I won’t say these approaches are useless. But I would like to have a place, where I can put my code fragment and then share it using a link. I can use this link in my gtalk status, chat or even in twitter posts.
Luckily, there is a site called “codepad” that allows us to do exactly the same thing. It allows us to share a piece of code using a small url.
You can try it now at “http://codepad.org/” or take a look at this example code posted by me at “http://codepad.org/XZpSNngW”
Finally, one thing I would like to see is support for C# code.
4 comments » | My Thoughts, Technologies, Tips
February 11th, 2009 — 10:14am
It is really embarrassing to send an email with an attachment and actually forgetting to attach the file you were supposed to mail along, isn’t it? In my case, I often forget to attach files to emails if I’m typing it in hurry. Sometimes, I even end up receiving replies from recipients of those emails requesting me to eat food instead of attachments. I don’t know about you, but for me this is really embarrassing!!!!!!
Luckily, today I came across a feature in Gmail Labs, which helps you to identify missing attachments as soon as you press send button. This small functionality in Gmail warns you if you have written something like “I’m attaching” or “I am attaching” or “I have attached” in your message body and you haven’t actually attached any file. I’m not sure if it is capable of identifying any other patterns in email text which suggests that you wanted to attach something. However, I tested for above 3 patterns and I’m good with it.
To enable this feature, you will need to login to your Gmail account. Then go to Settings -> Labs, and enable ‘Forgotten Attachment Detector’. Don’t forget to click on ‘Save changes’ after that.
I would like to thank Mr. Jonathan K, for creating this useful feature in Gmail lab. It is definitely an important feature for me, and for many other people who like to eat attachments instead of food.
2 comments » | My Thoughts, Technologies, Tips
October 28th, 2008 — 5:20am
We had an application written in C# .Net, which used to communicate with Alfresco Enterprise Document/Content Management System. The application was using Alfresco’s NTLM component for authenticating users against their AD (Active Directory) user account.
The application worked perfectly while we were testing it on Windows XP system. However, on Windows 2003 64 Bit system, the application started failing as it could not authenticate users on alfresco server using NTLM.
So we had a situation where NTLM authentication used to fail only when our application was running on Windows 2003 Operating System. We tried disabling “Internet Explorer Enhanced Security Configuration”, but it didn’t help. Finally, after spending a lot of time on Google, we came across following article on Microsoft Knowledge Base:
“You may experience authentication issues when you access a network-attached storage device after you upgrade to Windows Server 2008, to Windows Vista, to Windows Server 2003, or to Windows XP“
This article talks about configuring the system to use appropriate NTLM version. In our Windows 2003 system, the value of “lmcompatibilitylevel” (Under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA subkey) was set to 2. We just changed this value to 1, and the client application started working properly in Windows 2003 system as well.
If you are also facing a similar issue on Windows 2003, then you can try the solution mentioned here. If setting the value of “lmcompatibilitylevel” to 1 makes no difference, then change this value to 0, which is the default value of “lmcompatibilitylevel” in Windows XP.
Comment » | Technologies, Tips
October 27th, 2008 — 7:55am
Most of the time, while trying to replace a substring in a given string, either all its occurrences or just the first one, java programmers tend to use ‘replaceAll’ and ‘replaceFirst’ methods provided by String class in Java. Java programmers like to use these methods to replace substrings as compared to ‘replace’ method of String class because of different reasons like:
- ‘replaceAll’ and ‘replaceFirst’ methods use regular expressions instead of character sequence. It is pre-assumed most of the time that using these methods will allow us to replace a given pattern in future, instead of just replacing a substring.
- ‘replaceAll’ and ‘replaceFirst’ methods are named such that they clarify the intent of their execution.
However, while using these methods, we need to be very careful while providing the string value which would replace a given substring or a pattern. Let’s understand why with the following example:
Run the following java code:
public class StringReplace {
public static void main(String[] args){
String stringValue = "test1 test2 test1 test3";
String replaceValue = "test";
stringValue = stringValue.replaceAll("test1", replaceValue);
System.out.print(stringValue);
}
}
This code works properly. But now try running the same code by changing the value of variable ‘replaceValue’ as:
String replaceValue = "$100";
This would result in an exception of type ‘IndexOutOfBoundException’. This is because the ‘$’ symbol is used to identify a group from the regular expression which is the first parameter of ‘replaceAll’ or ‘replaceFirst’ method. We can solve this problem by:
- Using ‘replace’ method: This would be the good choice if you want to replace a string literal and not a pattern.
- Escaping ‘$’ symbol: If you need to a use regular expression, and your pattern has no groups identified, then you can escape any group identification symbols from your replace string as shown below:
String replaceValue = java.util.regex.Matcher.quoteReplacement("$100");
Comment » | Programming, Tips
June 29th, 2008 — 9:03am

Here’s an oldie but a goodie. Confounded by trying to track down fancy-looking WordPress themes? Check out this Web-
based theme editor that lets you tweak every nook and cranny of a theme then spit it back to your server to go live. You can add columns, change fonts and backgrounds, even throw in a customizable tag cloud–all with no coding experience required. All you need is a little creativity and some working knowledge of drop-down menus.
While some WordPress themes have excellent built-in support for doing this right from the WordPress dashboard,
many more don’t, and trying to figure out all the little things like text color is made far easier with a WYSIWYG editor than with WordPress’ built-in editing tools.
Advanced users can throw in graphics or design elements they’ve hosted elsewhere on their server (as long
as it’s got a URL to link up to), and when all is said and done each bit of the theme can be grabbed as an individual file to whatever theme you’re currently using. This is an easy way to try out new fonts and colors without making a mess out of your existing style.css file.
Source: Web Development
2 comments » | Tips
January 8th, 2008 — 7:20am
Every software developer knows the importance of his or her own mind. Well, I feel that software development itself is an excellent mind game where an active mind can help you to drive the design and development of your software effectively.
If you are involved in the development of software for a domain where requirements keep changing every second, a developer needs to come up with new and new ideas to prevent the development process from stalling. To think of new ideas, you need to keep your mind focused on the problem which is difficult if your mind is not active.
To keep your mind active all the time, you basically need to keep it engaged in some activities so that your mind won’t have to stay idle. Let’s look at some activities that can keep your mind active and engaged for most of the time.
1. Reading: Everybody knows the importance of reading. Apart from keeping your mind engaged, it also helps you to learn new concepts, and to come up with some new ideas. You could read literature on almost any topic. Normally, whenever I get tired after long hours of software development, I like to read some story books or newspaper. It distracts my mind for a short time from the puzzles I was trying to solve while coding and thus, making it fresh again after some time.
2. Writing: Some people think that writing is generally a physical exercise. Just try to write some original articles or essays and you will come to know how much you need to think. But what to write? You can keep your personal diary where you can write your daily experience or a weblog where you can post your thoughts or ideas which could help others. If can even try to write your own poems or songs even if you haven’t written one before.
3. Playing mind games: Games like chess or sudoku are quite challenging by nature. You can even play these games without moving away from your computer (lol). Don’t worry if you are not expert in chess or sudoku as we are trying to play just for the sake of keeping our mind engaged.
4. Observing mother nature: If you are really bored of reading, writing or even playing then you can just hang out in some nice garden and appreciate the beautify of our mother nature. Trust me, it works!!!!! Once when I was struggling to come up with an algorithm to write one game, Alan had advised me to go out and look at birds and trees. I listened to his advice and soon after that, my problem was solved.
Here I’ve mentioned the activities that I follow to keep my mind active. Sometimes, I even do meditation for around 10 minutes. Don’t just limit yourself to these activities for keeping your mind engaged. Do whatever you like but make sure that your mind won’t stay idle.
Comment » | My Thoughts, Tips
December 30th, 2007 — 6:00am
Fring is an application for mobile phones that allows you to make calls using VoIP. Yesterday I decided to try it out myself. I had mentioned in one of my post that it is possible to make free calls with fring if you have access to public Wi-Fi hotspots, but in Goa, there are no such public Wi-Fi hotspots. On the other hand, my Nokia N72 doesn’t have support for Wi-Fi networks. So I had to rely on GPRS connection.
If you refer to Fring website, it mentions that the application is compatible with Symbian from version 8 to 9.2. Thus it can work on my Nokia N72. I activated Airtel GPRS service on my handset and downloaded fring directly on my mobile from its site.
After installation, fring asked me to register as a new user. Then, I had to select one VoIP service provider from Skype, MSN Messenger, ICQ, SIP, Google Talk, Twitter, Yahoo and AIM. I have been using skype for long time to make VoIP calls so I selected Skype. After that, fring asked me to login to my skype account with skype screen name and password. That’s it!!!! Now fring was ready for use on my handset.
Fring presented me with list of contacts which were taken from my phone book and skype contact list. From here I could have called my friends who were online on Skype at that point of time. If you try to call a person from your phone book, then you will be presented with options of either Direct GSM call or SkypeOut call.
I wanted to try out fring by making a real call. So I requested my father to call me from skype. Soon, my cell started ringing and Fring showed me that the call is from my father. I was able to talk to my father normally without any problems.
But one thing I noticed is that, I was not able to hear my father’s voice instantaneously. There was a small time gap so I felt as if I’m using a walkie-talkie.
If you want to call your friends at a very cheap rate then should try out fring yourself. Hopefully in near future, just like broadband, the number of public Wi-Fi hotspots in India will increase and then people will be able to use applications like Fring with better voice quality.
13 comments » | Technologies, Tips