Wednesday, September 01, 2010

Visio | Copy Foreground and Background

In Visio when you select all shapes and do Ctrl + C (Copy), it only copies the foreground. To include the background in the copied shape, follow these steps:
  1. Click on an empty space to deselect all
  2. Select Edit -> Select by type...
  3. Click None and OK
  4. Select Edit -> Copy Drawing
Now the background will be included in the copied diagram.

Friday, June 25, 2010

Firefox | Selecting Cells or Columns in Table

If you are interested in selecting individual cells or a column from a table on a website, Firefox provides a quick way to do that... Just CTRL+Click the cells or column to select the data required. Saved me lot of time when I was collecting data for my project :)

Tuesday, June 22, 2010

Create Table of Contents in Visio

For a project of ours, we were creating visio files with many flowcharts in it. One feature we found missing was to create Table of Contents. So I searched online for a macro to do that for me and I found one here http://www.welie.com/visio/index.php. I modified it a little bit so that it works top down and creates ToC in FIRST page. The updated macro can be downloaded from here http://sites.google.com/site/davendraupreti/uploads/Hyperlinked_ToC_macro.vss.
When executed, the macro...
  1. Deletes any exisiting content
  2. Creates ToC headers
  3. Creates ToC Content with page number
  4. Copies the ToC Content to clipboard, in case you want to copy it in a mail and send it to PM :)
This is how the ToC looks like
If you want, you can customise the macro to suit your needs. Please feel free to comment if you find any bugs :)

Tuesday, May 04, 2010

Table of Contents in Visio

Got this nice macro for generating Table of Contents in visio file, not sure why Microsoft has not included it by default.

The URL for the macro is http://stephenturbek.com/2007/04/automatically-create-table-of-contents.html

Friday, December 11, 2009

Visio Tip #2: Export text from Visio

There are situations when we want to export text from Visio diagram. For e.g. the other day I wanted to export sever Name and IP addresses from a physical diagram. I hoped to find something like Save As text etc. But then I stumbled on this blog http://kenfallon.com/?tag=visio-export-text. Copying the steps here in case link dont work
  • Visio 2003 go to Tools -> Reports.
  • Visio 2007 go to Data -> Reports.

These instructions are for Visio 2007.

  • Make a new report and select Shapes on All pages or Shapes on the current page.
  • Then select only (you may want to Show all properties to make sure nothing else is checked)
  • Give it a Title e.g: Text Only Report
  • Give it a Name e.g: Text_Only_Report
  • Then select run and export it to either Excel, HTML, Visio Shape or XML

In the future when you want to extract text all you need to do is run Data -> Reports select Text_Only_Report and press Run.

Visio Tip # 1 : Reduce size of file

Sometime during the course of time, the size of Visio increases manyfold, sometime reaching upto 6-10 MB. Even if you zip it, there is not much help. But there are some options for reducing file size suggested by Microsoft. You can find them at this URL http://support.microsoft.com/kb/305025. The suggestions are to
  • Remove unused shapes in the local stencil.
  • Configure Visio to save the drawing with out a preview picture.
  • Reduce the number of grouped shapes.
  • Convert duplicate shapes to a single master shape.
  • Do not save your diagram as a XML for Visio drawing

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).