Saturday, September 19, 2009

Enable online status in Outlook 2007?

Outlook 2007 has a option to Display online status next to person's name.


There might be a scenario that once you install Outlook and Communicator, this option is greyed out. To fix this issue update registry as follows:

HKCU\Software\Microsoft\Office\12.0\common\personamenu\enabled=1
HKCU\Software\Microsoft\Office\12.0\Outlook\IM\EnablePresence=1

Friday, August 28, 2009

Power Commands for VS2008

Have you ever need a command to expand or collapse a project or solution in VS2008? Or what about right click a file and missingg the option to open in Explorer?

You can get some of such cool commands after installing Power Commands for VS2008. These additional commands are really useful in day 2 day development life. Not sure why they are not pre installed with VS2008 :)

The cool commands can be downloaded from http://code.msdn.microsoft.com/PowerCommands.

Wednesday, August 05, 2009

Displaying Multiple Clocks / Timezone in Vista

No need to download and install third party utilities to display multiple clocks in Vista. Here are the steps to display multiple watch

  • Click on time in System tray
  • Click on "Change date and time settings..."
  • Click on "Additional Clocks" tab
  • Enable additional clocks by checking "Show this clock" checkbox
  • Select the timezone for the clock, and click OK

Hover over the time on system tray and now you will see time from second watch as well :)

Wednesday, July 22, 2009

JavaScript library | BBC Glow

BBC Glow is available as open source JavaScript framework library (http://www.bbc.co.uk/glow/). This is the same library which is being used for their website. According to BBC sources, none of the existing libraries (including jQuery and YUI) met their standards and guidelines (browser support being prime concern).

Article on Ajaxian - http://ajaxian.com/archives/ouh-shiny-bbcs-glow-is-finally-out

Friday, May 29, 2009

Overload missing for AsyncWaitHandle.WaitOne()

We recently faced an issue where a developer used overload of WaitOne() method as follows:

AsyncWaitHandle.WaitOne(timeout)

But this code failed on other machines because there was no overload available with one parameter. After some analysis we figured out that it was because .Net 3.5 SP1 was not installed on other machines. Seems two new overloads were added as part of SP1, namely

public virtual bool WaitOne(System.TimeSpan timeout)
public virtual bool WaitOne(int millisecondsTimeout)


In case you want to avoid this issue and maintain backward compatibility, use AsyncWaitHandle.WaitOne(timeout, false); which is effectively same as AsyncWaitHandle.WaitOne(timeout);

Sunday, March 29, 2009

Testing Flock

This is my first blog entry from Flock. Flock is labeled as Social Web Browser and is based on Firefox3. I wanted to test the blogging Capabilities if it. This is a bold text

List
  1. List item
  2. List item
  3. List item
  4. List item
Here's an image. My Photo

--- End of test ---
Blogged with the Flock Browser

Tuesday, January 20, 2009

Add '+' or '-' before float value using ToString()

Assuming you want the sign of the number to be displayed rather than an arbitrary '+', then try the following:

a.ToString("+#.###;-#.###;0");

Where 'a' is your variable. This is a format string with sections,separated by semi-colons. The first section (+#.###) applies topositive numbers, the second (-#.###) applies to negative numbers andthe last applies to zero.

Wednesday, December 17, 2008

How To Delete cookie written by ASP.NET (server side) from JavaScript (client side)

If you write cookie from ASP.Net code behind and try to delete from JavaScript client side, you may notice that even when you set the expire day to past, it is not actually deleting the cookie. The reason being cookie string used in JavaScript to delete it must match EXACTLY with the cookie string sent by ASP.NET to save it.
ASP.Net sends cookie as

login=myloginvalue; expires=gmtdate; path=/

So if you have to delete it, You have to write the following JavaScript to delete the cookie:

var expires = new Date();
expires.setUTCFullYear(expires.getUTCFullYear() - 1);
document.cookie = 'login=; expires=' + expires.toUTCString() + '; path=/';

This works with both IE and Firefox. Thanks to Henri to post this solution :)

Monday, December 15, 2008

Unit test your JavaScript

JsUnit (http://www.jsunit.net/) is a great tool for unit testing your JavaScript code. Te best part is that it can be integrated with build process for continuos integration. This helps to identify the errors at a early stage of development rather than waiting till the code has reached QA.

QUnit (http://docs.jquery.com/QUnit) is another unit testing from jQuery stable. All jQuery libraries are tested using qUnit. I have not yet included this as part of build but as per their documentation it can be integrated into browser automation tools like Selenium or Mercury.

Friday, November 28, 2008

Move ahead XML and JSON - Here comes BISON

In case you have a webservice/AJAX application which relies on sharing big chunk of data and you want to improve the communication time, one option is to reduce the payload. We generally used to use JSON rather than XML for this. As part of our new development we figured out that even JSON can be too much for us. Then there comes BISON (Binary Interchange Standard and Object Notation). I would suggest you to have a look at it :)

http://www.kaijaeger.com/articles/introducing-bison-binary-interchange-standard.html

Friday, October 31, 2008

Analyzing IIS log files

AWStats is an open source free tool that can be used to analyze IIS log files. It can be downloaded from http://awstats.sourceforge.net/

Setup

  1. Perl is a prerequisite for AWStats. A version of this can be downloaded from http://www.activestate.com/Products/activeperl/index.mhtml. This tool also adds perl command to PATH environment variable
  2. Download AWStats from http://awstats.sourceforge.net/#DOWNLOAD
  3. Install AWStats to your hard disk (say D:\Program Files\AWStats)
  4. Create a folder for AWStats on your hard disk. It will be used as web deployment folder for AWStats (say C:\Inetpub\wwwroot\awstats)
  5. Copy D:\Program Files\AWStats\wwwroot\*.* to C:\Inetpub\wwwroot\awstats\
  6. Make a copy of C:\Inetpub\wwwroot\awstats\cgi-bin\awstats.model.conf and name it as C:\Inetpub\wwwroot\awstats\cgi-bin\awstats.mysite.conf where mysite is domain of the website (it can be anything though)
  7. Edit awstats.mysite.conf and set following properties
  • LogFile="D:\Production Log\39\ex081030.log" (path to log file being analyzed)
  • LogFormat="date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken" (This format can be copied from IIS log file. Open log file in text editor and copy from this line at top #Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
  • SiteDomain=www.mysite.com
  • There are other properties which can be customized. Refer to doc in D:\Program Files\AWStats\docs
  1. On command prompt enter following commands

    perl awstats.pl -config=mysite -update
    perl awstats.pl -config=mysite -output -staticlinks > awstats.mysite.html
    perl awstats.pl -config=mysite -output=alldomains -staticlinks > awstats.mysite.alldomains.html
    perl awstats.pl -config=mysite -output=allhosts -staticlinks > awstats.mysite.allhosts.html
    perl awstats.pl -config=mysite -output=lasthosts -staticlinks > awstats.mysite.lasthosts.html
    perl awstats.pl -config=mysite -output=unknownip -staticlinks > awstats.mysite.unknownip.html
    perl awstats.pl -config=mysite -output=alllogins -staticlinks > awstats.mysite.alllogins.html
    perl awstats.pl -config=mysite -output=lastlogins -staticlinks > awstats.mysite.lastlogins.html
    perl awstats.pl -config=mysite -output=allrobots -staticlinks > awstats.mysite.allrobots.html
    perl awstats.pl -config=mysite -output=lastrobots -staticlinks > awstats.mysite.lastrobots.html
    perl awstats.pl -config=mysite -output=urldetail -staticlinks > awstats.mysite.urldetail.html
    perl awstats.pl -config=mysite -output=urlentry -staticlinks > awstats.mysite.urlentry.html
    perl awstats.pl -config=mysite -output=urlexit -staticlinks > awstats.mysite.urlexit.html
    perl awstats.pl -config=mysite -output=browserdetail -staticlinks > awstats.mysite.browserdetail.html
    perl awstats.pl -config=mysite -output=osdetail -staticlinks > awstats.mysite.osdetail.html
    perl awstats.pl -config=mysite -output=unknownbrowser -staticlinks > awstats.mysite.unknownbrowser.html
    perl awstats.pl -config=mysite -output=unknownos -staticlinks > awstats.mysite.unknownos.html
    perl awstats.pl -config=mysite -output=refererse -staticlinks > awstats.mysite.refererse.html
    perl awstats.pl -config=mysite -output=refererpages -staticlinks > awstats.mysite.refererpages.html
    perl awstats.pl -config=mysite -output=keyphrases -staticlinks > awstats.mysite.keyphrases.html
    perl awstats.pl -config=mysite -output=keywords -staticlinks > awstats.mysite.keywords.html
    perl awstats.pl -config=mysite -output=errors404 -staticlinks > awstats.mysite.errors404.html


    I prefer to create a batch file with all these commands and pass site name as parameter.

    Once executed, it will create multiple .html files in C:\Inetpub\wwwroot\awstats\cgi-bin (provided you have not configured any other path in awstats.mysite.conf). Open http://localhost/.../awstats.mysite.html (depends on where you created web deployment folder) which is the index page and you are done.
    Hope this helps when you have to analyze log files next time :)

Tuesday, October 07, 2008

LIVE Data Update (.Net)

What if you want to update data on webpage real time? The exisitng option is "PULL" where client polls server for updates and when retrieved it updates data on page. This works but issues
  1. There is a lag between data update and data refresh and this depends on delay between each refresh call.
  2. Unnecessary load on server and network even though there is no data update.
PUSH technolgy is around for ages but somehow it is not mapped to Web based applications. Reason being that Web is inherently server-client model. Client asks, server serves.
But the scenario is changing. HTML 5 is coming up with Web-Sockets and Server-Sent Events (http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html).

But what if you want to implement PUSH implementation now?
Well. you have couple of options:
1. COMET - Works but is not scalable as it relies on keeping a thread open on the server till client closes the connection. Not feasible for high volume websites.
2. http://www.themidnightcoders.com/weborb/dotnet/
3. http://www.lightstreamer.com/

Hope this helps you in your next project :)

Thursday, October 02, 2008

Which cell to buy....

Well finally i made up my mind to say bye-bye to my old Nokia 6030 and go for a Biz Class cell phone (a big leap of faith for me). Many a times I really think - do I need a big phone and then my brain says - comeon, you need to show off man ;)
But the problem was not to make up my mind. Problem is to select a phone. There are so many choices that uffffffffff, which one to go for.
The other problem is upcoming cellphones. they are hyped so much that i am not sure if i should wait for their launch or not.
Someone has said true - "Mobile and wife, if u wait for sometime you could get a better model ;)"

Anyway my confusion is between these:
Blackberry Bold
HTC Diamond
Samsung Omnia
Apple IPod 3G

Upcoming models
HTC Google Android Based
Blackberry Thunder
Well if someone can suggest something on this subject, I am eager to listen. But please do not suggest any other model. I am somehow leaning towards Omnia as Blacberry is too business and iphone has too many limitations. But someone said about Omnia, hey that is Samsung :)

Thursday, September 04, 2008

All softwares crash one day...

... and so does Google Chrome. In an article on the Securiteam site, Rishi Narang from Evilfingers says a crash can occur without user interaction. If a user is provided a malicious link with an undefined handler followed by a special character, Chrome crashes...

You can read more details at http://evilfingers.com/advisory/google_chrome_poc.php. There is a demo link on the page. If you click on it, chrome crashes (and with all tabs).

Tuesday, September 02, 2008

Google Chrome is out...

Finally the browser we all were waiting for is out. Google Chrome is available for download at http://www.google.com/chrome. The features are highlighted here http://www.google.com/chrome/intl/en-GB/features.html and the complete story is here http://www.google.com/googlebooks/chrome/. But while you are at it, don't forget to get your hands on IE8 beta 2 http://www.microsoft.com/windows/internet-explorer/beta/.

Saturday, August 23, 2008

iPhone 3G is OUT...

... BUT is it worth it's hype? Priced at >30K is it really worth? The touch and feel feature is very nice but that's because it's a new concept (not anymore though). But an enterprise user needs more than that. Some cool feature missing from the new 3G are:
  1. It has no video recording option iPhone will disappoint you here.. This is quite surprising since video recording feature is today found in most cell phones, even those at the lower end.
  2. It has 2 mega pixel (MP) cameras. Flash and optical zoom are missing too. Despite a 2 mega pixel camera -- belie that number and turn out quite clear.
  3. One cannot simply forward a text message. Users can only send text messages or snapshots via email. Also, don't think of sending a SMS to multiple contacts as iPhone has no option for that either.
  4. Lack of multimedia messaging controls and voice dialing. It lacks support for voice-recognition to let users dial verbally
  5. No cut, copy-and-paste. Imagine you cannot even select a line of text to delete it. And how bad can it be living without copy and paste option. Especially when you want to post a URL in your blog! How tedious it would be to jot it down, word by painful word.
  6. It lacks support for multi-select. It will give users a tough time deleting every email one by one as they cannot delete mails in bulk. Same goes for photo albums. Users have to delete the same too one by one
  7. All you heavy phone users, you cannot change an iPhone battery. You will have to send it to an Apple outlet for this. Imagine how troublesome it would be to live without your phone for 2-3 days. And that is an optimistic estimate of the time that you may spend twiddling your thumbs!
  8. iPhone offers no support for wireless modem. You may pay heavy data charges to activate Internet on your iPhone, but you cannot connect it to your PC and browse when you are at home.
  9. iPhone can't sync with Bluetooth stereo or in-car Bluetooth hands free. It lacks A2DP on Bluetooth. A2DP audio devices, such as stereo Bluetooth headsets, offer high quality listening ability.
  10. you cannot share MP3, images and video files via Bluetooth, half the fun is gone.
  11. In case you wish to see those multimedia files that require Flash, you will have to do away with them. There is no support for Adobe Flash in 3G iPhone. Though, Adobe says it is working on iPhone Flash.
  12. iPhone offers You Tube support. But how? Here's a catch. Users cannot get all You Tube video, but only a few selected ones that have been rolled out for the Apple-favored H.264 video codec. So, this means you can't go on sharing your videos.
  13. please do remember, unlike the true Push platform enjoyed by Blackberry, the iPhone email client does not work in true Push fashion, but is more of a "pull" mail.
  14. Last, but not the least, be aware that as a customer you are unlikely to get much support from the operators in setting up your haloed iPhone. And since setting it up would be essential to use a number of features.
  15. Sending out the cool pics you shoot through iPhone's excellent 2 mega pixel camera will be a challenge unless you have set up the email accounts.
There might be some more features missing that you may wish for. So please invest your money wisely. Read the reviews online. Identify your needs and see if iPhone satisfies all of them. Its a big investment for many people so use brain and not heart.

And if you awant to show off and flaunt it, go ahead ;)...(Remeber the ad... Nice phone...)

Thursday, June 26, 2008

JavaScript | Print all properties of Object

To Print all properties of an object in JavaScript, use for-in as follows:


<script language="Javascript">
var obj = new Object(); //Create new object
obj["firstName"]="Davendra"; //Assign property firstName with value Davendra
obj["lastName"]="Upreti"; //Assign property lastName with value Upreti
var str=""; //variable which will hold property values
for(prop in obj)
{
str+=prop + " value :"+ obj[prop]+"\n"; //Concate prop and its value from object
}
alert(str); //Show all properties and its value
</script>

Monday, May 12, 2008

Multiple websites on XP

XP Pro IIS Admin is a free tool for using on Windows 2000/XP Pro. It allows you to create multiple websites and easily switch between those websites. Without this utility on Windows 2000/XP Professional, only one website can be created.

You can get it here: http://jetstat.com/iisadmin/

Wednesday, April 30, 2008

Not able to map Network Drive? Read on..

Ever got this problem while mapping a network drive:

The network folder specified is currently mapped using a different user name and password.To connect using a different user name and password, first disconnect any existing mappings to this network share.

And when you see your network mappings, strangely the drive is not mapped :(

Well, the solution is old reliable DOS commands. here it goes:

> net use
> net use \\SharedDrive /delete

net use command displays a list of all mapped drive. there will be a IPC$ mapping for the drive you want to connect to. Just delete the sharing and then you will be able to connect to the server.

FYI: The Inter-Process Communication (IPC) share or ipc$ is a network share on computers running Microsoft Windows. This share is used to facilitate communication between processes and computers, often to exchange authentication data between computers.

Wednesday, April 11, 2007

HTML Table Sort

Many a times we have a table populated with data and we want to sort on a specific column. It doesn't makes sense to hit the server for data that we already have. The solution is to use DOM to sort the data and repopulate table using JavaScript. There are a number of such scripts available on net and a simple Google search returns a lot of results. For e.g. try searching for "HTML table sorting". One very simple to use script is available at http://webfx.eae.net/dhtml/sortabletable/sortabletable.html.