Thursday, June 25, 2009

Regular Expression to search for time duration

How to find the following time string in a text file?
(09:00 -12:00)

Try regular expression:
\((\d{1,2}:\d{1,2}.*\d{1,2}:\w*)\)

Imagine you are trying to remove the time from this sting "meet up with friends (09:00 - 12:00)"

Code:
string result = System.Text.RegularExpressions.Regex.Replace("meet up with friends (09:00 - 12:00)", @"\((\d{1,2}:\d{1,2}.*\d{1,2}:\w*)\)",string.Empty)

Result:
result = "meet up with friends" is produced.

Friday, June 12, 2009

Google Search Tips

There is plenty of little shortcuts we could produce better search results via Google.

Dictionary search
Syntax= define:
Type define: constituency for example.


Unit Conversion
Examples:
10 EUR in GBP
25 miles in km

Weather report:
tokyo weather
london weather

Search on a particular website
Syntax= site:
transformers site: www.imdb.com

Find related site
related: msdn.microsoft.com

Find pages that has links to a specific site
link:http://www.bbcnews.co.uk

Display a cache version of your website by Google
cache:www.zippie.net

Find Info about a page
info:www.fgsman.org.uk

Google group search
author:Mark Russinovich insubject:"process debugging"

Find word widgets but has to contains red or blue keyword
widgets (red OR blue)

Return results based on specific file type
intitle:j2ee visual tutorial filetype:pdf
service oriented architecture filetype:pdf site:edu

Search all words in title
allintitle: msdn .net framework 4

Search any words contains 2009 in url
intitle:msdn .net inurl:2009

Friday, June 05, 2009

How to find referenced table in MS SQL 2005?

SELECT so.name
FROM sysobjects so INNER JOIN
sysreferences sr ON so.id = sr.rkeyid
WHERE (so.type = 'U') AND (sr.fkeyid = OBJECT_ID('Customer'))

Result:
name
CustomerGroup
CustomerCountry
Rating
CustomerType

How to edit a pdf file?

What do you normally use to edit a pdf file? Adobe Acrobat? Or create/edit the document in Microsoft Word and save it as pdf document?

Why not check out Foxit PdfEdit? A light weight pdf editor.

More information from this site.

Try 6 months free license by clicking on the link below.

Wikipedia or Wiktionary

Most of us know what is Wikipedia - free online encyclopedia contributed by everybody. Is there an equivalent of online dictionary? Yes. Wiktionary.

How to use it?
  1. Navigate to the site Wiktionary.
  2. Type in your word and the drop down appears (depicted below). Select and click search.

Thursday, June 04, 2009

How to insert code snippet in Visual Studio

Have you ever wonder how to insert a piece of code without typing it all? Visual Studio IntelliSense code snippet will do it for you.

For example, to use a foreach loop snippet. Simply type in foreach and press the TAB key twice.