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.

Yahoo Messenger And Windows MSN Messenger Together !

•July 13, 2006 • 5 Comments

Today , I was able to add my Hotmail Contacts to my Yahoo Messenger. You can Also do the same from MSN Messenger. All you need to have is the latest Beta Versions of Messenger and then you should be good to go.

Windows Vista Beta 2

•June 9, 2006 • Leave a Comment

Windows Vista Beta 2 is now Ready for Download. Those of you are interested in checking out this OS can download it from HERE

Š

Some Windows Shortcut Tips !

•May 10, 2006 • Leave a Comment

Press Win+L to switch to the Welcome screen.

Press Win+L to lock your workstation.

You can switch users without going through the Welcome screen: From Task Manager, go to the Users tab, right-click a user, and select Connect.

Hold down the shift key in the shutdown dialog to change “Stand By” to “Hibernate”. Or just press H to hibernate instantly. You can even use the Power Control Panel to configure your power button to hibernate.

To disable the password when resuming from standby or hibernation, open the Power Control Panel and uncheck “Prompt for password after returning from standby” on the Advanced tab.

You can rename multiple files all at once: Select a group of files, right-click the first file, and select “Rename”. Type in a name for the first file, and the rest will follow.

Hold down the shift key when switching to thumbnail view to hide the file names. Do it again to bring them back.

When dragging a file in Explorer, you can control the operation that will be performed when you release the mouse button:

Hold the Control key to force a Copy.

Hold the Shift key to force a Move.

Hold the Alt key to force a Create Shortcut.

If you create a file called Folder.jpg, that image will be used as the thumbnail for the folder. What’s more, that image will also be used as the album art in Windows Media Player for all media files in that folder.

From the View Menu, select “Choose Details” to select which file properties should be shown in the Explorer window. To sort by a file property, check its name in the “Choose Details” in order to make that property available in the “Arrange Icons by” menu.

To display the volume control icon in the taskbar, go to the Sounds and Audio Devices Control Panel and select “Place volume icon in the taskbar”.

Hold down the shift key when deleting a file to delete it immediately instead of placing it in the Recycle Bin. Files deleted in this way cannot be restored.

If you hold down the shift key while clicking “No” in a Confirm File Operation dialog, the response will be interpreted as “No to All”.

To save a document with an extension other than the one a program wants to use, enclose the entire name in quotation marks. For example, if you run Notepad and save a file under the name Dr.Z it will actually be saved under the name Dr.Z.txt. But if you type “Dr.Z” then the document will be saved under the name Dr.Z. Note that a document so-named cannot be opened via double-clicking since the extension is no longer “.txt”.

Put a shortcut to your favorite editor in your Send To folder and it will appear in your “Send To” menu. You can then right-click any file and send it to your editor.

Ctrl+Shift+Escape will launch Task Manager.

To arrange two windows side-by-side, switch to the first window, then hold the Control key while right-clicking the taskbar button of the second window. Select “Tile Vertically”.

To close several windows at once, hold down the Control key while clicking on the taskbar buttons of each window. Once you have selected all the windows you want to close, right-click the last button you selected and pick “Close Group”.
—–
You can turn a folder into a desktop toolbar by dragging the icon of the desired folder to the edge of the screen. You can then turn it into a floating toolbar by dragging it from the edge of the screen into the middle of the screen. (It helps if you minimize all application windows first.)

You can turn a folder into a taskbar toolbar.

First, unlock your taskbar.

Next, drag the icon of the desired folder to the space between the taskbar buttons and the clock. (Wait for the no-entry cursor to change to an arrow. It’s a very tiny space; you will have to hunt for it.)

You can rearrange and resize the taskbar toolbar you just created.

You can even turn the taskbar toolbar into a menu by resizing it until only its name is visible.

In the Address Bar, type “microsoft” and hit Ctrl+Enter. Internet Explorer automatically inserts the “http://www/.” and “.com” for you.

To remove an AutoComplete entry from a Web form, highlight the item in the AutoComplete dropdown and press the Delete key.

To remove all Web form AutoComplete entries, go to the Internet Explorer Tools menu, select Internet Options, Content, AutoComplete, then press the “Clear Forms” button.

To organize your Favorites in Explorer instead of using the Organize Favorites dialog, hold the shift key while selecting “Organize Favorites” from the Favorites menu of an Explorer window.

You can organize your Favorites by dragging the items around your Favorites menu.

Alternatively, you can open the Favorites pane and hold the Alt key while pressing the up and down arrows to change the order of your Favorites.

To run Internet Explorer fullscreen, press F11. Do it again to return to normal mode.

If your “Printers and Faxes” folder is empty, you can hide the “Printers and Faxes” icon when viewed from other computers by stopping the Print Spooler service.

To add or remove columns from Details mode, select Choose Details from the View menu, or just right-click the column header bar.

In Internet Explorer, hold the Shift key while turning the mouse wheel to go forwards or backwards.

In Internet Explorer, hold the Shift key while clicking on a link to open the Web page in a new window.

In Internet Explorer, type Ctrl+D to add the current page to your Favorites.

This and many more keyboard shortcuts can be found by going to Internet Explorer, clicking the Help menu, then selecting Contents and Index. From the table of contents, open Accessibility and click “Using Internet Explorer keyboard shortcuts”.

In some applications (such as Internet Explorer), holding the Control key while turning the mouse wheel will change the font size.

To shut down via Remote Desktop, click the Start button, then type Alt+F4. Copyright @ Microsoft

Continue reading ‘Some Windows Shortcut Tips !’