Get table or view name by search column name keyword


Here is the script:

SELECT c.object_id,
     WHEN OBJECTPROPERTY(c.object_id, 'isTable') = 1
     THEN 'Yes' ELSE 'No' END AS IsTable,
     WHEN OBJECTPROPERTY(c.object_id, 'isView')  = 1
     THEN 'Yes' ELSE 'No' END AS IsView,
 OBJECT_SCHEMA_NAME(c.object_id) AS SchemaName,
 OBJECT_NAME(c.object_id) AS TableName, AS ColumnName
 FROM sys.columns c
 WHERE LIKE '%MyColumnName%'

Microsoft SQL Server – Search specified column or table in all database at a DB Server



In a development environment normally there are multiple databases installed at one DB Server, and there is a system store procedure called: “sp_msforeachdb” can help us to search a specified column or table easily in these different databases(or other tasks need to be done in different DBs), and here are the sample script:

Search a specified column name in all database at a DB Server

-- Search a specified column name in all database at a DB Server
''[''+ "?" +''].[''+SCHEMA_NAME(schema_id)+''].['''']''
as "Full table name",
"?" AS DBName,
SCHEMA_NAME(schema_id) AS Schema_Name, AS Table_Name, AS Column_Name
FROM [?].sys.tables AS t
INNER JOIN [?].sys.columns col ON t.OBJECT_ID = col.OBJECT_ID
WHERE like ''%ColumnName_search_keyword%''
ORDER BY schema_name, table_name; '

Search a specified table name in all databases at a DB Server

-- Search a specified table name in all databases at a DB Server
''[''+ "?" +''].[''+SCHEMA_NAME(schema_id)+''].['''']''
as "Full Table Name",
"?" AS DBName,
SCHEMA_NAME(schema_id) AS Schema_Name, AS Table_Name
FROM [?].sys.tables AS t
WHERE like ''%tablename_search_keyword%'';'

GitHub Tips


, ,

  1. Config GitHub with Putty/Pageant
    1. Install Putty from here, run PuTTY.exe and create a new SSH session to “’ and save it
    2. Run PUTTYGEN.EXE generate a pair of public/priviate key pair, copy the public key content to a text file(like ‘yourpublickey.txt’), save the private key to a text file(like ‘yourprivatekey.ppk’) at the same folder(like: c:\ssh)
    3. Create a shortcut of Pageant.exe with parameter like this: ‘C:\Putty\PAGEANT.EXE c:\ssh\yourprivatekey.ppk’
    4. Run the Pageant.exe shortcut, the pageant should be run successfully with a system tray icon
    5. Install git from here, in my case, with the following configuration choices:
      • Select components window: choose all defaults
      • Adjusting your PATH environment window: Run Git and included Unix tools from the Windows Command Prompt(which by using all cygwin tools)
      • Choosing the SSH executable window: Use (tortoise) Plink and indicate the PLINK.EXE path
      • Configuring the line ending conversions window: Checkout as-is, commit as-is
    6. Sign up a new account at or sign in with your existing account, add ssh-key by using the content of ‘yourpublickey.txt’
    7. Now open ‘git bash'(Which installed at step E), and you should be able to run all git commands now
  2. GitHub Tips
    1. Review last commit in current branch
      1. git show -1
      2. git log -1

Very useful windows shortcuts which can run from command line or explorer


Run commands

Calc – Calculator
Cfgwiz32 – ISDN Configuration Wizard
Charmap – Character Map
Chkdisk – Repair damaged files
Cleanmgr – Cleans up hard drives
Clipbrd – Windows Clipboard viewer
Cmd – Opens a new Command Window (cmd.exe)
Control – Displays Control Panel
Dcomcnfg – DCOM user security
Debug – Assembly language programming tool
Defrag – Defragmentation tool
Drwatson – Records programs crash & snapshots
Dxdiag – DirectX Diagnostic Utility
Explorer – Windows Explorer
Fontview – Graphical font viewer
Ftp – ftp.exe program
Hostname – Returns Computer’s name
Ipconfig – Displays IP configuration for all network adapters
Jview – Microsoft Command-line Loader for Java classes
MMC – Microsoft Management Console
Msconfig – Configuration to edit startup files
Msinfo32 – Microsoft System Information Utility
Nbtstat – Displays stats and current connections using NetBios over TCP/IP
Netstat – Displays all active network connections
Nslookup – Returns your local DNS server
Odbcad32 – ODBC Data Source Administrator
Ping – Sends data to a specified host/IP
Regedit – registry Editor
Regsvr32 – register/de-register DLL/OCX/ActiveX
Regwiz – Reistration wizard
Sfc /scannow – Sytem File Checker
Sndrec32 – Sound Recorder
Sndvol32 – Volume control for soundcard
Sysedit – Edit system startup files (config.sys, autoexec.bat, win.ini, etc.)
Systeminfo – display various system information in text console
Taskmgr – Task manager
Telnet – Telnet program
Taskkill – kill processes using command line interface
Tskill – reduced version of Taskkill from Windows XP Home
Tracert – Traces and displays all paths required to reach an internet host
Winchat – simple chat program for Windows networks
Winipcfg – Displays IP configuration

Management Consoles

certmgr.msc – Certificate Manager
ciadv.msc – Indexing Service
compmgmt.msc – Computer management
devmgmt.msc – Device Manager
dfrg.msc – Defragment
diskmgmt.msc – Disk Management
fsmgmt.msc – Folder Sharing Management
eventvwr.msc – Event Viewer
gpedit.msc – Group Policy -XP Pro only
iis.msc – Internet Information Services
lusrmgr.msc – Local Users and Groups
mscorcfg.msc – Net configurations
ntmsmgr.msc – Removable Storage
perfmon.msc – Performance Manager
secpol.msc – Local Security Policy
services.msc – System Services
wmimgmt.msc – Windows Management

Control Panel Shortcuts

access.cpl – Accessibility Options
hdwwiz.cpl – Add New Hardware Wizard
appwiz.cpl – dd/Remove Programs
timedate.cpl – Date and Time Properties
desk.cpl – Display Properties
inetcpl.cpl – Internet Properties
joy.cpl – Joystick Properties
main.cpl keboard – Keyboard Properties
main.cpl – Mouse Properties
ncpa.cpl – Network Connections
ncpl.cpl – Network Properties
telephon.cpl – Phone and Modem options
powercfg.cpl – Power Management
intl.cpl – Regional settings
mmsys.cpl sounds – Sound Properties
mmsys.cpl – Sounds and Audio Device Properties
sysdm.cpl – System Properties
nusrmgr.cpl – User settings
firewall.cpl – Firewall Settings (sp2)
wscui.cpl – Security Center (sp2)

Windows Environment Commands

%ALLUSERSPROFILE% – Open the All User’s Profile
%HomeDrive% – Opens your home drive e.g. C:\
%UserProfile% – Opens you User’s Profile
%temp% Opens – temporary file Folder
%systemroot% – Opens Windows folder

Wupdmgr – Takes you to Microsoft Windows Update

If Microsoft Office installed:

winword – Microsoft Word
excel – Microsoft Excel
powerpnt – Microsoft PowerPoint
msaccess – Microsoft Access
outlook – Microsoft Outlook
ois – Microsoft Picture Manager

Credit belongs to: this post from superuser

Microsoft Pairwise Testing Tool: PICT


, , ,

When a massive conditions combined together and impossible to test all combinations, there is a testing method called pairwise testing(also known as All-pairs testing) we can use to test these possible combinations in a certain way.

In order to test all-paired combinations, we need to have a tool to generate the test data, by far my favorite tool is Microsoft PICT command line tool, and here is an article introduced the concept very clearly

This is a light-weight all pairs generating tool and it’s pretty easy to use, only for windows platform though.

Unable to start VirtualBox after upgraded from 4.1.12 to 4.2.18


, , , ,

I have a Ubuntu virtualbox vm which is on virtualbox version 4.1.12, today I have upgraded to the newest version 4.2.18, and then the vm won’t be able to start, check the VBoxSVC.log(at “%HOMEDRIVE%%HOMEPATH%\.VirtualBox\” found out the following errors like:

ERROR [COM]: aRC=VBOX_E_OBJECT_NOT_FOUND (0x80bb0001) aIID={29989373-b111-4654-8493-2e1176cba890} aComponent={Medium} aText={Property ‘Special/GUI/Hints’ does not exist}, preserve=false

Dig the internet a little bit, seems related to the Guest Additions, revert the vm to previous saved snapshot(which still works), upgrade the Guest Additions from 4.1.12 to 4.2.8, reboot, the vm works again

Cool website( can transfer regex to graphic chart


, ,

I used to create a test case related a US SSN text field data validation, there is a Regex(Regexp or Regular Expression):

"^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$"

which defined the input validation, I figured it out at the beginning, but after one month later when I look back the documentation, there is only “!@#$%%^” in my head.

And here is a very cool site ( could transfer the Regex to a much easier understandable graphic chart like this:


Update: forgot to mention, the expression need to be in JavaScript style

Export Google Reader feeds Step by Step


, , , , , , , , , ,

I guess everyone already knew that Google Reader Service will be terminated by July, so I just created this step by step instructions to export all my feeds for backup through Google Takeout service(hope this one won’t be terminated :P)

Here it is:

  1. Navigate to Google Reader SettingsGoogle Reader Export Feeds Step by Step 01
  2. Select “Import/Export” tab, then choose “Download your data through Takeout”Google Reader Export Feeds Step by Step 02
  3. Then will be redirected to takeout page with reader data generatingGoogle Reader Export Feeds Step by Step 03
  4. Wait the process reach 100%, then click “Create Archive”Google Reader Export Feeds Step by Step 04
  5. Now the Reader data can be downloaded as a zip fileGoogle Reader Export Feeds Step by Step 05
  6. The zip file should include all reader data you haveGoogle Reader Export Feeds Step by Step 06

Now you’ll be able to import your reader feeds to an alternative like feedly

Selenium Tips


, ,

Mark a few Selenium tips:

  1. Generate and Store current date in “YYYYMMDD” format

    And the javascript code is here:

    javascript{ d=new Date(); d.getFullYear().toString()+((d.getMonth()+1)<10?"0"+(d.getMonth()+1).toString():(d.getMonth()+1))+(d.getDate()<10?"0"+d.getDate().toString():d.getDate().toString()); }
  2. Override Untrusted SSL Self Certificates