This note is for a trick to use Q and E to escape characters for regular expression. You will find it very useful when you do string substitution and your pattern contains characters like slashes or backslashes .
Author: devonenote
-
Perl Add Directory to Path
Say you have a directory d:bin and you want to add it to path environment at the beginning of your Perl script. Following code will do the trick.
my $dir="d:\bin";
$ENV{PATH}.=";$dir";Then $dir will be included in new $ENV{PATH}
-
Manual Uninstall Windows Desktop Search
Here is how to uninstall Windows Desktop Search (WDS) as it is not visible in add-remove programs
Manual uninstall Windows Desktop Search 3
- Click on the Start Menu, then Run.
- Type cmd in the box and click OK. This will bring up the command line.
- Type the following and press enter
%windir%$NtUninstallKB917013$spuninstspuninst.exe /q /promptrestart
- A box will now appear to confirm the WDS has been uninstalled and asks you to restart. Once you have restarted the PC WDS will be gone.
-
Visual Studio Themes and Color Schemes
I just came cross this site http://studiostyles.info/ which provides Visual Studio color schemes for free download. All color schemas work for both Visual Studio 2008 and 2010. Every schema has screenshots so you can see how it looks like before downloading it.
You can follow following steps to import the color schema into Visual Studio.
- In Visual Studio, choose Tools > Import and Export Settings
- Choose Import Selected Environment Settings and select whether you want to back up your existing settings or not
- Click Browse… to choose the file you downloaded.
- You get a choice which settings you want to import – choose all of them since the file only contains color settings and won’t touch your other VS settings.
- Click Finish and you’ll see the new colors.
Note: if you save the file to My Documents > Visual Studio 2010 > Settings, you’ll have quick access to choose the settings file in step 3 above.
-
Perl Redirect Command Output
In Perl, you can execute external commands using system() or “. However, system and “ does not redirect command output to console and this results people who runs your perl script can’t see it. This also make debug much harder. Perl does not have a build in switch that equals to batch scripts’ “@echo on”, however this can be worked around by creating a ExecuteCommand subroutine.
sub ExecuteCommand {
my $cmd= $_;
my @cmdoutput = `$cmd`;
for $line (@cmdoutput) {
print $line;
}Now just change your code from system($command) or `$command` to ExecuteCommand($command) and you will see all command output are redirected to console. (more…)
-
How to Validate URL in C#
I searched google for how to validate URL in C# and most results say using a regular expression. Eventually I found Uri.TryCreate which is a built in method in C# to check if a string is a valid URL
Uri uri = null;
if (!Uri.TryCreate(url, UriKind.Absolute, out uri) || null == uri)
{
//Invalid URL
return false;
}
Reference:
http://msdn.microsoft.com/en-us/library/ms131572(v=VS.90).aspx
-
Exceed Office 2010 Trial Period
Office 2010 can be run for 30 days for free before needing to be active, or you will start seeing activation notification dialog. If you want to exceed the 30 days free trial during evaluation, you will need to rearm your Office 2010.
To rearm Office 2010, type in the following from an elevated command prompt:
“C:Program FilesCommon FilesMicrosoft sharedOfficeSoftwareProtectionPlatformOSPPREARM.EXE”
-
Office 2010 Upgrade, 32 or 64 bit?
Office 2010 is the first release of Office that contains 64 bit edition. It’s recommended to install the 32 bit version Office 2010 due to compatibility issues however if you still want to try 64 bit version keep these in mind.
- 32 bit version works on both 32 bit and 64 bit windows operation systems. But 64 bit version Office 2010 must be installed on 64 bit windows operation systems.
- You can’t upgrade from 32 bit Office 2007 to 64 bit Office 2010 directly, you have to uninstall existing 32 bit Office products prior to install 64 bit Office 2010. (It’s okay to upgrade Office 2007 to 32 bit Office 2010 on either 32 bit or 64 bit operation systems)
- You can’t run 64bit and 32bit office products side by side. For example, you can’t have side by side installation of 32 bit OneNote 2010 and 64 bit Outlook 2010
- Some of 32bit Office Add-Ins might not work on 64 bit Office 2010.
-
Error 1731 During Office 2010 Installation
When you upgrade Office 2010 from BETA to RTM, you might get Error 1731 the source installation package for the product Microsoft Office Office 64-bit Components 2010 is out of sync with the client package as shown in this screenshot.
-
WordPress 3.0 Beta 2 Released
WordPress team has announced WordPress 3.0 beta 2 is shipped. It seems that release candidate will be coming very soon.
Things to test in 3.0 beta 2
- Revised menu user interface
- Changes to the WordPress exporter and importer to make it more flexible
WordPress 3.0 changes
Check out my previous post WordPress 3.0 Features. I will keep updating there.
Note: it’s recommended not try beta version WordPress on production site.