How to write a CURSOR loop over multiple databases in MSSQL 2000

•September 27, 2007 • Leave a Comment

I sure lot of people might want to use the script where they would want to loop over multiple databases sitting on a Single server. In my case, I had to check for  a Login Record  in all the databases since the person left the company and we wanted to disable his/her access. SO I wrote simple CURSOR script in MSSQL 2000. Hope this help to someone.  

[sql]USE master

DECLARE db_names CURSOR FOR
SELECT name from sysdatabases
— Where Clause, Enable if you want to filter out some databases.
–where name like ‘databaseIwantName_%’ and name not like ‘databaseIdontwantName’

DECLARE @db_name varchar(100)
DECLARE @QueryString NVARCHAR(500)
DECLARE @UpdateString NVARCHAR(500)

OPEN db_names
FETCH NEXT FROM db_names INTO
@db_name
WHILE @@FETCH_STATUS = 0
BEGIN
–PRINT @db_nam
–In My case I used tbl_logins to do multiple select .
SET @QueryString = ‘Select * from ‘ + @db_name + ‘..logins where login like ”%loginname%” ‘
EXEC sp_executesql @QueryString

IF @@RowCount > 0
BEGIN
— This gives the database name if there are any record found with the select state ran above
PRINT @db_name
END

–Similarly you can also have any Insert/Update Query IN a Loop.See example below
–In My case I used tbl_logins to do multiple Update At Once.
–SET @UpdateString = ‘update ‘ + @db_name + ‘..tbllogins set password = ”account_blocked_out”, security_level = 0, approved = 0 where login like ”%loginname%”’
–PRINT @UpdateString
–EXEC sp_executesql @UpdateString

FETCH NEXT FROM db_names INTO
@db_name
END

CLOSE db_names
DEALLOCATE db_names

[/sql]

 This is something written quick. Here is the Code for your Download. I am sure you can tune it better and if you do, please let me know . I would love to see your Ideas.

 Thanks

Troubleshooting Random null null Error in Coldfusion MX

•September 14, 2007 • Leave a Comment

I have been looking so much for this error in Coldfusion MX  but could not find any solution to my problem. null null is a very vague exception error which gets thrown once in a while. Below are the steps I did to troubleshoot and one of them did the solved the problem.

 1) Apply this hot fix from Adobe.

2) Increase the JVM Heap Size. (I increased it  from 512 to 800)

3) Make sure your SELECT query does not pass any corrupt data. It might also be the very cause to  throw the exception error.Turning off query caching signifigantly increased the number of errors, so it seems to be something in the JDBC drivers.

4) Check to see if you have methods that accept parameters passed by reference(like getimagesize()) . Make sure you use right script language for example getimagesize uses VBSCRIPT not JSCRIPT. ( For me this was the case. I removed this method and it stopped the error completely).

List of Some Free Online Channels Available for Free !

•July 8, 2007 • 6 Comments

Enjoy !

Click Here !

Some Windows Run Commands

•January 8, 2007 • 1 Comment

I thought it would be beneficial to my blog readers to show some of the Windows RUN Commands which will take you directly to the place you want to go !

 To Access.. – Run Command
Accessibility Controls – access.cpl
Add Hardware Wizard – hdwwiz.cpl
Add/Remove Programs – appwiz.cpl
Administrative Tools – control admintools
Automatic Updates – wuaucpl.cpl
Bluetooth Transfer Wizard – fsquirt
Calculator – calc
Certificate Manager – certmgr.msc
Character Map – charmap
Check Disk Utility – chkdsk
Clipboard Viewer – clipbrd
Command Prompt – cmd
Component Services – dcomcnfg
Computer Management – compmgmt.msc
Date and Time Properties – timedate.cpl
DDE Shares – ddeshare
Device Manager – devmgmt.msc
Direct X Control Panel (If Installed)* – directx.cpl
Direct X Troubleshooter – dxdiag
Disk Cleanup Utility – cleanmgr
Disk Defragment – dfrg.msc
Disk Management – diskmgmt.msc
Disk Partition Manager – diskpart
Display Properties – control desktop
Display Properties – desk.cpl
Display Properties (w/Appearance Tab Preselected) – control color
Dr. Watson System Troubleshooting Utility – drwtsn32
Driver Verifier Utility – verifier
Event Viewer – eventvwr.msc
File Signature Verification Tool – sigverif
Findfast – findfast.cpl
Folders Properties – control folders
Fonts – control fonts
Fonts Folder – fonts
Free Cell Card Game – freecell
Game Controllers – joy.cpl
Group Policy Editor (XP Prof) – gpedit.msc
Hearts Card Game – mshearts
Iexpress Wizard – iexpress
Indexing Service – ciadv.msc
Internet Properties – inetcpl.cpl
IP Configuration (Display Connection Configuration) – ipconfig /all
IP Configuration (Display DNS Cache Contents) – ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) – ipconfig /flushdns
IP Configuration (Release All Connections) – ipconfig /release
IP Configuration (Renew All Connections) – ipconfig /renew
IP Configuration (Refreshes DHCP & Re – Registers DNS) – ipconfig /registerdns
IP Configuration (Display DHCP Class ID) – ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) – ipconfig /setclassid
Java Control Panel (If Installed) – jpicpl32.cpl
Java Control Panel (If Installed) – javaws
Keyboard Properties – control keyboard
Local Security Settings – secpol.msc
Local Users and Groups – lusrmgr.msc
Logs You Out Of Windows – logoff
Microsoft Chat – winchat
Minesweeper Game – winmine
Mouse Properties – control mouse
Mouse Properties – main.cpl
Network Connections – control netconnections
Network Connections – ncpa.cpl
Network Setup Wizard – netsetup.cpl
Notepad – notepad
Nview Desktop Manager (If Installed) – nvtuicpl.cpl
Object Packager – packager
ODBC Data Source Administrator – odbccp32.cpl
On Screen Keyboard – osk
Opens AC3 Filter (If Installed) – ac3filter.cpl
Password Properties – password.cpl
Performance Monitor – perfmon.msc
Performance Monitor – perfmon
Phone and Modem Options – telephon.cpl
Power Configuration – powercfg.cpl
Printers and Faxes – control printers
Printers Folder – printers
Private Character Editor – eudcedit
Quicktime (If Installed) – QuickTime.cpl
Regional Settings – intl.cpl
Registry Editor – regedit
Registry Editor – regedit32
Remote Desktop – mstsc
Removable Storage – ntmsmgr.msc
Removable Storage Operator Requests – ntmsoprq.msc
Resultant Set of Policy (XP Prof) – rsop.msc
Scanners and Cameras – sticpl.cpl
Scheduled Tasks – control schedtasks
Security Center – wscui.cpl
Services – services.msc
Shared Folders – fsmgmt.msc
Shuts Down Windows – shutdown
Sounds and Audio – mmsys.cpl
Spider Solitare Card Game – spider
SQL Client Configuration – cliconfg
System Configuration Editor – sysedit
System Configuration Utility – msconfig
System File Checker Utility (Scan Immediately) – sfc /scannow
System File Checker Utility (Scan Once At Next Boot) – sfc /scanonce
System File Checker Utility (Scan On Every Boot) – sfc /scanboot
System File Checker Utility (Return to Default Setting) – sfc /revert
System File Checker Utility (Purge File Cache) – sfc /purgecache
System File Checker Utility (Set Cache Size to size x) – sfc /cachesize=x
System Properties – sysdm.cpl
Task Manager – taskmgr
Telnet Client – telnet
User Account Management – nusrmgr.cpl
Utility Manager – utilman
Windows Firewall – firewall.cpl
Windows Magnifier – magnify
Windows Management Infrastructure – wmimgmt.msc
Windows System Security Tool – syskey
Windows Update Launches – wupdmgr
Windows XP Tour Wizard – tourstart
Wordpad – write

Windows Vista Release Candidate 1 is Now Available

•September 11, 2006 • 2 Comments

I just Recieved this email from Microsoft. Thought would share with you guys !

Just to inform you that the final major pre-release of Windows Vista – Release Candidate 1 (RC1) – is now available for download for CPP participants. Please use the links below to access the download site, and install this release as soon as possible. (If you ordered a DVD kit for Beta 2 you will receive a new DVD kit containing RC1 in approximately 2-4 weeks.)

Important Information about Windows Vista RC1 . We remind you that RC1 is pre-release software and you should not run this on production or mission-critical PCs. Support will be limited to newsgroups, and you may have to do a clean install to move from this release to the final release of Windows Vista.

. You may upgrade an existing installation of Windows Vista Beta 2 or Windows XP to this release. However you will have to do a clean install if you want to get back to a previous configuration.

. Before upgrading from Beta 2 to RC1, please install any Critical Updates from Windows Update for Beta 2. Go to Start, All Programs, Windows Update, and click the “Check for Updates” button.

. Please close any open applications before beginning an upgrade. During installation we recommend you have an active Internet connection and choose to “Go online to get the latest updates for installation.”

. Installing RC1 requires a valid Microsoft Product Key. You should use the same Product Key that was provided to you (and sent in email) when you registered for Beta 2 in June. For your convenience, your Product Key is included here:
“XXXXXX”

. Due to the size of the download we recommend you use the download manager provided as it will allow you to resume the download if your Internet connection is interrupted during the process.

. As with Beta 2, the download for RC1 is an ISO file. After you complete the download you will need to burn a DVD to install RC1. For more information, including DVD-burning instructions, program information, and feedback links, please refer to the Customer Preview Program start page.

. To help you explore Windows Vista, we have created a list of tasks for you to try. To access the list and provide feedback on your experience, visit the Windows Vista Scenario Voting site. Windows Vista Scenario Voting

Please use these links to access the download:

English: http://download.windowsvista.com/preview/rc1/en/download.htm

German: http://download.windowsvista.com/preview/rc1/de/download.htm

Japanese: http://download.windowsvista.com/preview/rc1/jp/download.htm

[tags]microsoft[/tags]

Hiding Address Bar on Page Load Using JavaScript

•August 10, 2006 • 33 Comments

 Today , I was playing around of ways of how you can Hide an Address/Tool Bar on a Page Reload. I looked at couple of solutions on the net but nothing seems to be available for IE and Firefox working together. Then I figured it out a way to work it out for both. This is the code I used, to solve my problem.     
 
[js]

function openWindow(){
var browser=navigator.appName;
if (browser==”Microsoft Internet Explorer”)
{
window.opener=self;

}
window.open(‘filename.htm’,’null’,’width=900,height=750,
toolbar=no,scrollbars=no,location=no,resizable =yes’);
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height-100);
self.close();
}

[/js] 


[html]

If the window does not open, please turn off the pop-up blocker for this site and click"> here

[/html]
Basically , its invoking two functions when the page is being loaded.
--This will take care of closing the browser in Firefox:v>onload=“window.open(‘’,’_parent’,’‘);openWindow()”> If you simply use the this line onload="openWindow()"  , then the window will not close automatically in Firefox  

 

Edit : A lot of people are having problem implementing this code, may be because of the quote not displaying correctly. To make the life little easier, I have zipped up the code and can be dowloaded from HERE

You can Also Demo it at  http://rahmansaher.com/poper.html

Listen to music while charging iPod

•July 25, 2006 • 15 Comments

Like many others, I had the same curiosity of how could I keep my IPOD charging while playing videos from IPOD to my TV. This is very necessary if you are watching a 3 hrs movie. Apple gave this simple steps which absolutely works . I would recommend this while watching the movies on TV. But, I think it would be a good idea to revert back to the Autamatic Updates once you are done wathcing.In thatsense, it will atleastkeep you IPOD and your ITUNES in synch.. Just my 2 Cents 🙂

Learn how you can play songs from iPod while it is charging.

You can charge iPod using the Apple iPod Power Adapter or you can charge iPod by connecting it to your computer using the FireWire cable. Windows computers and Macintosh computers (with Mac OS X 10.3.4 and later) can also use the high-power USB 2.0 cable with the iPod mini.

When charging iPod using the iPod Power Adapter you can play music just as if the charger was not connected.

When using a cable connected to your computer, though, iPod’s buttons no longer work, and iPod’s display does not show the standard menu. Instead, only a FireWire icon or the message “Do not disconnect” appears on the display. Despite this, you can still play songs from iPod through your computer. Follow these steps:

1. Connect iPod to your computer using the included FireWire cable.
2. Open iTunes, if necessary.
3. Select iPod in the Source list.
4. Click the iPod Options button in the bottom right corner of the iTunes window.
5. Click to enable the “Manually manage songs and playlists” option.
6. Click OK.

You should now be able to select any song from iPod and play it through the computer.