Manage your passwords

Another program from my ‘Must Have’ folder. KeePass stores all my privata logins in a safe, secure encrypted file. It’s open-source, so it’s free as well. The features I love the most are the quick search text box as well as the macro play-back. For example I simply need to navigate to my VSS entry on KeePass and press Ctrl+V to have it run a macro that starts VSS Admin and logs me into the server. This is how the macro looks:

Auto-Type:@r{DELAY 500}{APPACTIVATE Run}{URL}{ENTER}{DELAY 1000}{APPACTIVATE Log On To Visual SourceSafe Database}{PASSWORD}{ENTER}

KeePass

KeePass is very secure, even when the data is loaded into memory it is kept encrypted. Read all about it and get it from here.

Manage your passwords

Office 2007 UI Licensing

Microsoft this week announced the licensing of the Office 2007 User Interface (i.e. the Ribbon bar) to the partner community. The licensing is royalty free, anyone who wants to develop an application with the new UI needs to sign up on the web.

I didn’t really believe that Microsoft would let every Tom, Dick and Harry copy their new patented UI. Reading into the article you find the catch though ‘The license is available for applications on any platform, except for applications that compete directly with the five Office applications’. There you have it. The master stroke. The Open Office guys who have been aping Microsoft Office for so long are stuck in an island now. Unless they can out-innovate on the user interface these guys are pretty much stuck in the 1990’s UI world.

Office 2007 UI Licensing

XML Notepad 2007

Have I been living under a rock? This is one heck of a tool. No more XML Spy for me.

XML Notepad 2007

  • Incremental search (CTRL+I) in both tree and text views, so that as you type it navigates to the most matched node.
  • Cut/copy/paste with full namespace support in a simple interoperable XML format.
  • Drag/drop support for easy manipulation of the tree, even across different instances of XML Notepad and from the file system.
  • Infinite undo/redo for all edit operations.
  • In-place, pop-up, multi-line editing of large text node values and IntelliSense based on expected elements and attributes.
  • Configurable fonts and colors via the options dialog.
  • Full find/replace dialog with support for regex and XPath expressions.
  • Good performance on large XML documents (loading a 3 MB document in about one second).
  • Instant XML schema validation while you edit with errors and warnings shown in the task list window.
  • Support for custom editors for date, dateTime, time, and color datatypes.
  • HTML viewer for displaying XSLT transformation results.
  • Built-in XML Diff tool.

[Article] [Download]

XML Notepad 2007

SQL query optimization

Wow. Two SQL posts on the same day.

The SQL query processing team blog is quite a gem. I wonder how I missed this.

The query processing team – query optimization & execution – providing tips, tricks, advice and answers to frequently-asked questions in a continued effort to make your queries run faster and smoother in SQL Server.

BTW: I consider this short article a must read for everyone who writes a SELECT query. The reason is that we never learn about the query optimizer in school when learning about databases.

Let me prove this to you. My best friend Shasheendra wrote this code the other day and it stumped me. Imagine this, you want to insert 10,000 rows into a temporary table.  Let’s say we can take two approaches. The first one is to simply write 10,000 inserts the second could be to insert the entries into a table with a single field with the 10,000 being comma delimited. Then parse the string and insert each row at a time.

Which do you think runs faster? No hurries, just take a look at the code and then scroll down to see the time comparison.

Approach 1:

Write 10,000 insert statements. Like this

CREATE TABLE #filetab (filename varchar(256))

CREATE CLUSTERED INDEX IX_filetab ON #filetab (filename)

INSERT INTO #filetab VALUES (‘dummy’)

INSERT INTO #filetab VALUES (‘ed7d1eda-025b-41be-b8b4-523dc9d53ece’)

INSERT INTO #filetab VALUES (‘b61abf2e-3252-423c-9ad7-cc63cb5e51bc’)

INSERT INTO #filetab VALUES (‘4224b7f8-120a-447b-a8ae-63cefce78255’)

….(10,000 entries)…

INSERT INTO #filetab VALUES (‘7f38bed5-be32-42c8-986f-20b3c78950ad’)

SELECT COUNT(*) FROM #filetab

DROP TABLE #filetab

GO

Approach 2:

DECLARE @filelisttab TABLE (filelist text)

CREATE TABLE #filetab (filename varchar(256))

CREATE CLUSTERED INDEX IX_filetab ON #filetab (filename)

INSERT INTO @filelisttab (filelist) VALUES (‘dummy,ed7d1eda-025b-41be-b8b4-523dc9d53ece,b61abf2e ….(10,000 comma seperated entries)…,7f38bed5-be32-42c8-986f-20b3c78950ad’)

DECLARE @i int, @l int, @tl int

SET @i = 1

SELECT @tl = DATALENGTH(filelist) FROM @filelisttab

WHILE (@i < @tl)

BEGIN

    DECLARE @filename Varchar(256)

    DECLARE @nextcommat int

    SELECT @filename = SUBSTRING(filelist, @i, 128) FROM @filelisttab — Use 128 character read buffer!

    SET @nextcommat = CHARINDEX(‘,’, @filename)

    SET @l = CASE @nextcommat WHEN 0 THEN 128 ELSE (@nextcommat1) END

    SET @filename = SUBSTRING(@filename, 1, @l)

    IF (LEN(@filename)>0) INSERT INTO #filetab (filename) VALUES (@filename)

    SET @i = @i + @l + 1

END

SELECT COUNT(*) FROM #filetab

DROP TABLE #filetab

Query1.sql (722 KB)

Query2.sql (401 KB)

 

If you don’t believe me, you can download the two sql statements and try running them on your machine. These scripts create a temporary table, insert data and then drop the table.

Query 1 : First run 2 min 48 seconds, second run 2 min 28 seconds

Query 2:  First run 9 seconds, second run 5 seconds

And here I was thinking all these days that I knew all the basics on SQL query optimization.

SQL query optimization

Publishing your SQL Server 2005 database?

Ever wanted to MySQL feature that let’s you script out a database (including the data) when working with SQL Server?

Fear no more the Database Publishing Wizard is here to help.

The Database Publishing Wizard enables the deployment of SQL Server 2005 databases into a hosted environment on either a SQL Server 2000 or 2005 server. It generates a SQL script file which can be used to recreate the database in shared hosting environments where the only connectivity to a server is through a web-based control panel with a scripting window.

The Database Publishing Wizard is currently a command line tool, though future releases will add a graphical user interface.

Get the download from here. Keep in mind that it’s still a CTP and is being developed actively.

Publishing your SQL Server 2005 database?

Outlook Shortcuts

I spend a lot of time in Outlook and I’ve found these shortcuts to be invaluable.

  • Ctrl+Shift+M : Open a new email window
  • Ctrl+Enter   : Send the email that you’ve typed
  • Ctrl+Shift+I : Navigate to the Inbox from other folders
  • Ctrl+R       : Reply to an email
  • Ctrl+Shit+R  : Reply All
  • Ctrl+Shift+V : Move an email to another folder
Outlook Shortcuts