Posts

Showing posts from August, 2009

SQL Server Hidden Gems Perhaps

If you ever wanted to get name of all the databases on your server, you can use this query

In SQL Server 2000, select name from master..sysdatabases

In SQL Server 2005, select name from sys.databases

:-)

ColdFusion CFID CFTOKEN Get lastvisit timecreated from CGLOBAL

I had a recent need to get information of CFID & CFTOKEN to see how many records we have in our datasource for CDATA, CGLOBAL and also from which date i.e. Last Min date to Last Max date the CGLOBAL table has values for. So I wrote this short query and then finally i cast the column as datetime so we can sort by date otherwise the sort will occur by string.

select cast( substring(data, charindex('ts',data) + 4 , 19) as datetime) as 'lastvisit' ,
cast( substring(data, charindex('ts',data,charindex('ts',data)+4 ) + 4 , 19) as datetime) as 'timecreated', lvisit from cglobal

where charindex('ts',data) gets the first occurrence and len('2009-08-18 22:36:55') gives you an idea of how many characters you need to extract and turns out its 19 characters.

Link to how ColdFusion Purges Client Variables

Hope this helps someone.

ColdFusion Optimization Performance tuning

SQL Server Hidden Gem - How to get next value of Identity for a column in a table

Hi,

This is very nice tip if you ever wanted to find the next value of identity column without doing an insert, I repeat without doing an Insert.

Lets say you have a table named company. Then you would use this command

SELECT IDENT_CURRENT('company') + IDENT_INCR('company')

where IDENT_CURRENT gives the current or last identity value used by that table and IDENT_INCR gives the increment you/anyone had set during creation of table. It could 1, 2 etc depending on your logic.

The other way of finding next value of identity is after an insert statement by using SCOPE_IDENTITY(). You would add 1 or 2 and so on depending on the autoincrement setting you used during the table creation.

Hope this helps.

Spread The MAX Widget Around, Win Cool Prizes

Image

Unable to RDP. Enable Disable Microsoft Terminal Services Client Control mstscax.dll

Image
So today i.e. Aug 17 2009 I was not able to remote desktop to my work computer from home. I am on WinXP Pro SP 2 with Internet Explorer 7 and I was able to remote desktop earlier without any issues.

Today, I was getting the popup message saying you need to install active x control. See below



I knew this had to do with Microsoft Terminal Services Client Control mstscax.dll and you need to enable it for RDP to work. For some reason, Internet Explorer 7, in its manage or enable disable add on feature wont show the Microsoft Terminal Services Client Control mstscax.dll. Here is a way to make it available so you can enable it.

1. When you get the pop up to install active X control as pop up , you get 2 options, Run and Dont run (install or dont install basically). I selected Dont Install. I will tell you later why I picked dont install, so hang on to that thought ;-).

2. Once I selected dont install, I got an small alert box or message info in yellow box from Internet explorer saying click…

Dalcha v/s Hawks. Aug 1 2009. Final.

After 3 weeks of thrilling and exciting games, it's the Hawks who won the CPL trophy. Like any other league game, this match was no different and the Hawks had to work hard to win the finals as the Dalcha's pushed them to the limit. We witnessed Ujwal's semi final performance which was unbelievable and in the finals, it was his counterpart Sagar, who performed brilliantly, to lead the Hawks to a famous victory.

The Hawks started with Sashi and Bhavin. Binnoy opened the bowling and gave only 5 runs of the first over. Sashi got out going for a big shot and Vinay joined Bhavin at the crease. Bhavin hit a six and four of consecutive balls and Hawks were looking good again with 16 for 1 after 2 overs. Vinay who played brilliantly in the semi final, couldnt get it going as He was not given any room by some fiery bowling from Binnoy. Kareem bowled well in the next over and got another wicket, this time of Vinay who made 5. Ujwal brought himself into the attack and got the prize wi…

Birthday Cake using Coldfusion & SQL Server

Image
So, I made this cake for one of my colleagues at work, M.J. , and I was thinking what to write on the cake.

After a while, I got this idea of why not write something which she does, i.e. write queries every now and then.

So, I wrote a CFQuery tag for her on the birthday cake.



ColdFusion is the way to go, pretty much, in normal life too. ;-)

Blazers v/s Hawks. Aug 1 2009. Semi Final 2.

Who is the man, you ask and I say, Bhavin. Fantastic, Amazing, and Brilliant, at his best; He has performed in every game and He didnt dissapoint his team in the Semi Final against Blazers. He stood tall again and his innings along with Vinays power hitting, made the difference to the game. Before I go into the match details, one more thing, I would like to add. For some reason, I forgot to give credit to star batsman Vinay, for his beautiful innings on the opening day when He scored 30 plus. When I wrote Preview for Semi Final 2, I wrote about him as one of the danger batsman to watch out for and also updated the bulletin page for that game.

The Blazers won the toss and elected to field first, which I guess most captains did in CPL and won 90% of the games. So nothing wrong with that. Sashi and Bhavin opened the innings and Ravi Bachala bowled the first over. He gave only 8 runs and it was a decent start. The Hawks started carefully and by end of 4, they were 36 for 1, with Sashi gone…

Veterans v/s Dalcha. Aug 1 2009. Semi Final 1.

The word Ujwal means bright or you can say shining. Indeed, true to its meaning, Captain Ujwal shined when his team needed the most. He remained calm and cool and bowled probably the best over of the tournament, when it looked like they were going home early from the party.

Radha won the toss and elected to field first which was no surprise as the field was wet and conditions suited the team batting second. Ashish opened the batting with Harsha. Ashish started the proceedings with a big six over squre leg region in the very first over as 9 runs came of it. Good start right. Radha gave debutant Ramesh, who was a last minute addition, the 2nd over. What does Amchi Mumbai boy Ashish do? Well, He saw the first ball and defended it. Next ball, He whacked it way over long on for a big six. But next ball He tried again but this time it took an edge and He was caught behind by Keeper Rajesh. Another wicket fell in same fashion in the same over. End of over 2, Dalcha were 17 for 2, out of which…