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

Tags

,

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
sp_msforeachdb
'SELECT
''[''+ "?" +''].[''+SCHEMA_NAME(schema_id)+''].[''+t.name+'']''
as "Full table name",
"?" AS DBName,
SCHEMA_NAME(schema_id) AS Schema_Name,
t.name AS Table_Name,
col.name AS Column_Name
FROM [?].sys.tables AS t
INNER JOIN [?].sys.columns col ON t.OBJECT_ID = col.OBJECT_ID
WHERE col.name 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
sp_msforeachdb
'SELECT
''[''+ "?" +''].[''+SCHEMA_NAME(schema_id)+''].[''+t.name+'']''
as "Full Table Name",
"?" AS DBName,
SCHEMA_NAME(schema_id) AS Schema_Name,
t.name AS Table_Name
FROM [?].sys.tables AS t
WHERE t.name like ''%tablename_search_keyword%'';'

GitHub Tips

Tags

, ,

  1. Config GitHub with Putty/Pageant
    1. Install Putty from here, run PuTTY.exe and create a new SSH session to “github.com’ 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 github.com 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

 

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

Tags

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

Tags

, , ,

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

Tags

, , , ,

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(regexper.com) can transfer regex to graphic chart

Tags

, ,

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 (http://www.regexper.com/) could transfer the Regex to a much easier understandable graphic chart like this:
Image

Cool

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

Export Google Reader feeds Step by Step

Tags

, , , , , , , , , ,

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

Tags

, ,

Mark a few Selenium tips:

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

    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

Config sharing clipboard between guest Ubuntu 13.04 (Raring Ringtail) and host Windows 2008 R2

Tags

, ,

After finished installation of Ubuntu 13.04(Raring Ringtail) in VirtualBox, found out that by default the clipboard is not shared between the host(Windows Server 2008 R2) and the guest(Ubuntu 13.04 Raring Ringtail)

Here are the fix steps:

  1. In VirtualBox guest window, navigate to: Devices -> “Install guest additions…”, finish the installation
  2. Now navigate to: Machine -> Settings -> General Tab -> Advanced tab -> Now should appear “Shared Clipboard” option, select “Bidirectional”, click “OK”

Now should be able to copy/paste text between the guest and the host

Add Customized Workitem(like: Change Request) to Requirement Category in Team Foundation Server 2012

Tags

, , , , , ,

By default, After you created a project in Microsoft Team Foundation Server 2012, “Requirement Categor” only contains “User Story” as its member, then when you attempt to “Add existing requirements to a test plan”, only the “User Story” workitem will be acceptable.

In most case, when there is Change Request issued to the team, QA will need to have test case associated with it as well, which expect to add Change Request as requirement and can be added to a test plan.

We can achieve this by the following steps(need to obtain TFS administration permission first):

  1. Export Work Item Type Categories to a xml file:
    run the following command form “Developer Command Prompt for VS2012″:

    c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE>witadmin exportcategories /collection:http://TFSServer:8080/tfs/yourcollection /p:myproject /f:myproject-original.xml
    	
  2. Modify the xml file and add Change Request as member of Requirement Category, which should like this:
    <CATEGORY name="Requirement Category" refname="Microsoft.RequirementCategory">
      <DEFAULTWORKITEMTYPE name="User Story"/>
      <WORKITEMTYPE name="Change Request"/>
    </CATEGORY>
    

    and save the modified xml as “myproject-modified.xml”

  3. Import the modified Work Item Type Categories xml file back to the project:
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE>witadmin importcategories /collection:http://TFSServer:8080/tfs/yourcollection /p:myproject /f:myproject-modified.xml
    

Restart your Test Manager 2012, you should be able to add Change Request to a test plan now

Reference: Customize the Categories for Work Item Types [witadmin]

Follow

Get every new post delivered to your Inbox.