jump to navigation

Delete Lines Having Specific Words Using Notepad++ August 6, 2014

Posted by Bilal in Tips & Tricks.
Tags: ,
add a comment

Lets take an example of a custom logging system by avoiding the complexities of hooking in Windows Event Log. Sometimes we came across a situation where we need to log an event just for temporary information but it is not required to be recorded permanently. After a specific period we review the log file and keep a clean separate copy. We want to remove all the FOR INFORMATION blocks and keep the required text. For huge files, it is very tiresome and total wastage of time.

Notepad++ is a very simple yet extremely powerful text editor. Actually it is much more than a text editor, it has existed for long and still being updated on regular basis. Above all its an open-source freeware. The product review of Notepad++ is not the topic of the post, I shall try to explain it in a single line:

The comparison of Notepad++ to (windows) Notepad is similar to the comparison of Internet Explorer 6 to Firefox

Yes, its expandable like Firefox. You can get a lot of plugins to ease your task. A plugin manager is included in Notepad++ and you can get up-to-date information about the plugins from there.

Notepad++ With Plugin Manager

Notepad++ With Plugin Manager

So, back to our main point, removing duplicate data. Notepad++ allows an extending Find and Replace dialog:

Notepad++ Find & Replace Dialog

Notepad++ Find & Replace Dialog

The default behavior of the Find & Replace dialog is similar to the native windows experience. To go beyond that, there are other option. At the bottom of dialog is the option named Regular expression. Regular expression means a combination of characters that form a pattern. You can read more on this Wikipedia page.

In our case, we are going to use regular expressions to find the required data that meets our search pattern. Lets have a look on the most simple case.

Sample Log 1

The log file contains the repeated message Failure sending mail. which could be due to the broken link to the SMTP Server or the error with SMTS itself or any other reason. Now, this message is required for information only and we do not want to preserve it. Consider a log file of thousands of record which is revised quarterly ( or any other period ) having a huge number of records.

Now, our requirement are

  • Delete the message Failure sending mail.
  • Delete the time stamp associated with it       AND
  • Clear the blank row created after removing the text

To achieve this goal, we will open the Replace dialog (  Ctrl + H shortcut also works here ), select the Regular Expression mode, keep the replace area blank ( we want to remove the rows) and mention this expression in the find area:

(.*)(Failure sending mail.)\r\n

Parentheses ( ) are not compulsory, they have been used for readability. The expression has three parts

  1. (.*)
  2. (Failure sending mail.)
  3. \r\n

The first part specifies all the text, second part species the redundant message text and the last part specify the carriage return and line feed. \r\n are special characters that mark the end of the line. Their detail is beyond the scope of the article. You can check them individually on their referenced wiki pages. When these three parts are combined the search criteria becomes

Search for all the text before the redundant message and it should be at the end of line.

Lets have a look on a little complex case:

Sample Log 2

In our first regular expression we specified the condition that the redundant message should be at the end of line. Now, row 18, 21 and 25, although containing the same text, does not meet the search criteria. For this kind of situation we update our regular expression:

(.*)(Failure sending mail.)(.*)\r\n

Here, we have revise the search criteria and added another blind search expression after the redundant message. Now, our search criteria will cover both type of the redundant messages.

It is just a very tiny touch to the power of regular expression. Using the syntax of regular expressions, we can make as many combinations as we need. An extensive and simple getting started guide for regular expression is available here.

Please remember, the expressions used in the examples are one of the possible methods to achieve the desired goal. Other combinations can be built to achieve the same goal.


Microsoft OpenDoor Expo Jeddah 2010 November 13, 2010

Posted by Bilal in .NET, General, Microsoft, Tech News, Tips & Tricks, Updates, Windows.
Tags: , , , , , , , , , , , , , ,
1 comment so far

Microsoft OpenDoor 2010 Saudi Arabia took place in two cities Riyadh (2nd and 3rd Nov) and Jeddah (7th Nov) at Intercontinental Hotel. It was the first time that Microsoft CEO, Steve Ballmer visited KSA and delivered the Key Note but his visit was limited to one day and it was in Riyadh only.

The registration was web based and no registration fee was mentioned. I happen to know about Professional Developer Conference (PDC) that used to have separate registration fee for students and professionals. Anyhow, for this expo, a bar code was issued to each participant against his Windows Live ID.

The Expo started with the keynote of Developer & Platform group Manager
Adel Al-Massarani about Cloud Computing and Abdurrahman Al-Qahtani
Manager Windows Phone Group, about the new Windows Phone 7. It was followed by the presentation of the Platinum Sponsors

Mobily was also a platinum sponsor but they are already making too much advertisement through different mediums. No time was given to the Gold Sponsors. All of the sponsors have their stalls in the lobby where attendees can easily get their information.

After that there were three options to go:

  • Track A for IT Professional
  • Track B for Developers
  • Track C for Technical Managers

Each track was taking place in separate hall. Attendees had full choice to attend any of the tracks at any time as per their taste.

I joined the Track B (Developers). It started with a presentation of Mohamad Halbi about Windows Azure Platform, the cloud service operating system. It was a brief but comprehensive overview of the Azure Platform right from the start to a live working demo. He showed how windows Cloud could be utilized to get a cost effective and reliable performance.

It was followed by lunch and prayer break.

The next session was about Microsoft Web platform by Abdurrahman Al-Qahtani. He demonstrated about the new Web Platform and also gave some working demonstrations.

After a break of about 15 min, the stage was conquered by Jerry Yasir about the advanced features in Microsoft Excel 2010 and its interaction with Microsoft Sharepoint 2010. He showed how we can get the graphical representation of data and its distribution/sharing with other people through SharePoint.

Then there was prayer break. Refreshment was available in the side room that can be utilized by anybody at any time.

Last session of the track was about Visual Studio 2010 from Architecture Point of view by Abdurrahman Al-Qahtani. He should that how the advanced tools in VS 2010 can help in understanding/designing the architecture of a system graphically using UML.

In the last, there was a combined closing session of all the tracks in which winners were selected through a lucky draw. Gifts include 3 web-cameras and 1 XBOX 360 and another set of 2 web-cameras and 1 Xbox360 for the female participants.

And so, a wonderful Expo by Microsoft came to an end. We wish to see more such events in the near future by international companies like Microsoft, Google, Apple, etc… Also, we expect to see Steve Ballmer in Jeddah next year.


This slideshow requires JavaScript.

The language of this installation package is not supported by your system. October 12, 2010

Posted by Bilal in Microsoft, Tips & Tricks.
Tags: , , , ,

Yesterday I downloaded the Office 2010 trail and tried to install. Previously I have used the Beta1 also in its early days. After re-installing the Window I stick to the Office 2007 because I was facing some issues in the beta so I prefer to wait for the stable version.

The direct installation attempt was not successful because even after uninstalling the Office 2007 there were still some components (like office connector for WLM 2011) that were required to be removed. To avoid the delay in extraction each time then getting the error of still some components remaining for uninstall, I extracted the exe file (ProfessionalPlus.exe) with WinZip. After  fully remove the required components, I executed the installer from the extracted files and I got a new error:

office language error

It was really strange for me because I clearly remember selecting the language as English. I cross checked the language of my system but I could not find the gap.

After googling the issue I came to know that the cause of this error is the extraction method. Why it is so, it does not make any logic.

The result for the issue is fully explained HERE.

Some Visual Studio ShortCut Keys January 31, 2010

Posted by Bilal in .NET, Keyboard Shortcuts, Tips & Tricks, Visual Studio 2005, Visual Studio 2008.
Tags: , , ,



F3 Finds the next occurrence of the previous search text.
F5 Start debugging
F7 Jump to code behind file from .aspx files
F8 Moves the cursor to the next item, such as a task in the Task List window or a search match in the Find Results window. Each time you press F8, you move to the next item in the list.
F9 Toggle breakpoint
F12 Go to definition of identifier under cursor
Ctrl+F5 Start without debugging
Ctrl+F2 Jump to the Navigation Bar (hit TAB to get to the right side)
Ctrl+F3 Find word under cursor
Ctrl+TAB Toggle between windows in Visual Studio
Ctrl+I Incremental search (this is way better than Ctrl+F)
Ctrl+J Force IntelliSense for field members
Ctrl+C (with nothing selected) Copy whole line
Ctrl+Enter Open line above line cursor is on
Ctrl-X or Ctrl-L (with nothing selected) Cut whole line
Ctrl+] Bounce cursor between matching parentheses/brackets/braces
Ctrl+PageDown Toggle between Design and Source views in .aspx files
Alt+W, L Close all windows
Ctrl+K, Ctrl+C Comment out selection
Ctrl+K, Ctrl+U Uncomment selection
Ctrl+K, Ctrl+D Format document
Ctrl+K, Ctrl+X Insert snippet (or just type in the snippet name and hit TAB, TAB)
Ctrl+K, Ctrl+S Surround selected lines with snippet
Ctrl+K, Ctrl+K Toggle bookmark on/off
Ctrl+K, Ctrl+P Jump to previous bookmark
Ctrl+K, Ctrl+N Jump to next bookmark
Ctrl+M, Ctrl+M Open/close current fold
Ctrl+M, Ctrl+O Fold all methods
Ctrl+R, Ctrl+R Enables or disables word wrap in an editor.
Ctrl+Shift+B Build solution
Ctrl+Shift+C Displays the Class View window
Ctrl+Shift+Enter Open line below line cursor is on
Ctrl+Shift+F Global Search
Ctrl+Shift+F9 Delete all breakpoints
Ctrl+Alt+A Displays the Command window, which allows you to type commands that manipulate the IDE.
Ctrl+Alt+I Displays the Immediate window, where you can evaluate expressions and execute individual commands.
Ctrl+Alt+K Displays the Task List window where you customize, categorize and manage tasks, comments, shortcuts, warnings and error messages.
Ctrl+Alt+L Open the Solution Explorer (to find your file after you just closed them all)
Ctrl+Alt+T View Document Outline
Ctrl+Alt+0 Displays the Output window to view status messages at run time
Ctrl+Alt+R Open browser within VS.NET
Ctrl+Alt+U Displays the Modules window, which allows you to view the .dll or .exe files used by the program. In multiprocess debugging, you can right-click and select Show Modules for all Programs.
Ctrl+Alt+X Open Toolbox
Shift+Alt+Enter View editor in full screen mode

Source: http://virendrablogs.blogspot.com/2009/12/visual-studio-list-of-some-shortcut.html

Missing Items in Visual Studio 2005 Menu February 22, 2009

Posted by Bilal in .NET, C#, Microsoft, SQL Server 2005, Tips & Tricks, VB, Visual Studio 2005.
Tags: , , , , , ,
1 comment so far

I noticed some missing menu items in the VS2005 (like clean, rebuild, and many others) but i continued by using the commands from other locations; until I got stucked!  I wanted to export a form as a template but the Export was not available in the File menu.
The details of my environment are:

Since, I installed Resharper for the first time, the first option that came to my mind is that its due to Resharper. I tried to explore different options in the Resharper and VS specially the Key Mapping but no result. I was only left with the option to uninstall Resharper and I did it. But to my surprise, the problem was still there.
In such a situation, I call my rescue agent GooGle. The first suggestion provided by the agent worked well and my problem was solved.
I had installed SQL Server 2005 for the first time (initially, I was using SQL 2000 as per client requirements) but I don’t considered it bcoz it’s a Microsoft product and it was least expected to interfere in the scenario. I was WRONG. This problem occurred due to a bug in it.

Here is the solution provided by Microsoft.

Hope it will also solve your problem if u faced such an issue.

Firefox 3.0 – Download Day – Set a Guinness World Record June 18, 2008

Posted by Bilal in Firefox, Tech News, Tips & Tricks, Updates.
Tags: , , , , ,
add a comment
With more than 15,000 improvements, Firefox 3 is faster, safer and smarter than ever before.
Waiting for what….? Download Now.
Want to know some Tips & Trick about new Firefox??
Download Day is here!
Set a Guinness World Record
Enjoy a Better Web
Mozilla is organizing a “Download Day” to promote Firefox 3.0 and set a Guinness World Record for the most downloaded software in 24 hours. Sounds like a good deal, right? All you have to do to help us set the record for the most software downloaded in 24 hours is get Firefox 3 now – it’s that easy. We’re not asking you to swallow a sword or to balance 30 spoons on your face, although that would be kind of awesome.
Please download Firefox 3 by 11:16 a.m. PDT (18:16 UTC) on June 18, 2008. That’s 11:16 a.m. in Mountain View, 2:16 p.m. in Toronto, 3:16 p.m. in Rio de Janeiro, 8:16 p.m. in Paris, Madrid, Berlin, Rome and Warsaw, 10:16 p.m. in Moscow, and June 19, 2008 at 2:16 a.m. in Beijing, 3:16 a.m. in Tokyo and in Lahore Thursday 12:15 a.m.
Do we have to reach a specific number of downloads in order to set the record?
This is the first record attempt of its kind so there is no set number. We’d really like to outdo the number of Firefox 2 downloads on its launch day, which was 1.6 million. Let’s shoot for 5 million–the sky is the limit!
Go ahead…. Download Now
STILL Not Ready to download ………………??? Want some more details, okay check this:

120 Run Commands In Windows XP May 31, 2008

Posted by Bilal in Tips & Tricks, Windows, XP.
Tags: , ,
1 comment so far

Click the “Start” button and then “Run” to open up the window where you can write the following commands called as “Run” commands in XP.

Accessibility Controls – access.cpl

Accessibility Wizard – accwiz

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

Control Panel – control

Date and Time Properties – timedate.cpl

DDE Shares – ddeshare

Device Manager – devmgmt.msc

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

Dr. Watson System Troubleshooting Utility – drwtsn32

Driver Verifier Utility – verifier

Event Viewer – eventvwr.msc

Files and Settings Transfer Tool – migwiz

File Signature Verification Tool – sigverif

Findfast – findfast.cpl

Firefox – firefox

Folders Properties – control folders

Fonts – control fonts

Fonts Folder – fonts

Free Cell Card Game – freecell

Game Controllers – joy.cpl

Group Policy Editor (for xp professional) – gpedit.msc

Hearts Card Game – mshearts

Help and Support – helpctr

HyperTerminal – hypertrm

Iexpress Wizard – iexpress

Indexing Service – ciadv.msc

Internet Connection Wizard – icwconn1

Internet Explorer – iexplore

Internet Properties – inetcpl.cpl

Keyboard Properties – control keyboard

Local Security Settings – secpol.msc

Local Users and Groups – lusrmgr.msc

Logs You Out Of Windows – logoff

Malicious Software Removal Tool – mrt

Microsoft Chat – winchat

Microsoft Movie Maker – moviemk

Microsoft Paint – mspaint

Microsoft Syncronization Tool – mobsync

Minesweeper Game – winmine

Mouse Properties – control mouse

Mouse Properties – main.cpl

Netmeeting – conf

Network Connections – control netconnections

Network Connections – ncpa.cpl

Network Setup Wizard – netsetup.cpl

Notepad notepad

Object Packager – packager

ODBC Data Source Administrator – odbccp32.cpl

On Screen Keyboard – osk

Outlook Express – msimn

Paint – pbrush

Password Properties – password.cpl

Performance Monitor – perfmon.msc

Performance Monitor – perfmon

Phone and Modem Options – telephon.cpl

Phone Dialer – dialer

Pinball Game – pinball

Power Configuration – powercfg.cpl

Printers and Faxes – control printers

Printers Folder – printers

Regional Settings – intl.cpl

Registry Editor – regedit

Registry Editor – regedit32

Remote Access Phonebook – rasphone

Remote Desktop – mstsc

Removable Storage – ntmsmgr.msc

Removable Storage Operator Requests – ntmsoprq.msc

Resultant Set of Policy (for xp professional) – 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 Information – msinfo32

System Properties – sysdm.cpl

Task Manager – taskmgr

TCP Tester – tcptest

Telnet Client – telnet

User Account Management – nusrmgr.cpl

Utility Manager – utilman

Windows Address Book – wab

Windows Address Book Import Utility – wabmig

Windows Explorer – explorer

Windows Firewall – firewall.cpl

Windows Magnifier – magnify

Windows Management Infrastructure – wmimgmt.msc

Windows Media Player – wmplayer

Windows Messenger – msmsgs

Windows System Security Tool – syskey

Windows Update Launches – wupdmgr

Windows Version – winver

Windows XP Tour Wizard – tourstart

Wordpad – write

sendto – Open SendTo folder in XP

msinfo32 – System Information

control userpasswords2 – Local machine accounts

Source: Takveen