bored

As I got bored of blog theme, so I have changed it once again.🙂

anyways , there are lot of thoughts that have been acculmated in my head, and wanted to be scattered out. I will see when I get enough time to spit them out. Until then , enjoy the life : ).

Resurrection!

Finally I got some time to rant again over this blog. Although I wasn’t really busy during this whole duration, but I didn’t get anything particular to blog about.

Just to update all of my beloved readers, about the things happened in between my last and this post. Well I have stated my MS Computer Science (finally) at George Mason University, begining this fall, bought a psp few  months  back and successfully moded it. I intend to write about my admission process in another blog entry, so wait for it.

what else, oh yes, I have also started cooking  ,(well if you  count ,turning the switch of rice cooker as cooking).  :D

see you then.

Google- paranoid about computer safety

😀

Well , another long vacation ends up here.

Googling, has now become a verb , meaning to search on Google. Google has recently added a new feature in which it also looks for malicious code on the websites while crawling and indexing them, and in case google found one, it will notify it in the search results that “This site may be harm your computer.”  you might have seen this message , but I guess, it appears in the search very rarely , only if the website contents have been compromised .

Well, well, I have been googling for the last 10 minutes and thats what I am getting in every search. (this is just one of them)

This site may harm your computer.Google search result displaying “This site may harm your computer.” for every result.

Something has gone wrong into the indexes datastore at google, or it might be the code interpreting the value for indication of harmful website, totally opposite of what it actually meant.😀

using UITypeEditor on Winform with a Generic Type Editor

If you are a developer, than I guess Property Grid isn’t a stranger to you. Property grid  has been used in win form designer to manipulate the properties of the selected object in the designer. Property Grid can also be used as control to use on your own form , to give user a compact way to manipulate properties( It is not available in the tool box , you will need to add it by using choose item option in Visual Studio). Property Grid has an interesting feature , it can show Type specific editor if one is available . e.g editing a color value will result in opening a color box, similarly for font and other types. If you want to have an editor for your custom data type , then you can implement a UITypeEditor and bind it to the target type using attirbute.

Some times you don’t use the whole Property Grid , but only want to display a certain type editor on your form, e.g you want to give user , option to edit a font , and want to utilize the font editor . How this can be achieved? Well, its simple , all you need to do is implement the IWindowFormsEditorService interface and provide a form or control to host the uitype editor.😀

I came across a very insightful article on DevX about implementing these requirements. Emmanuel Tissandier has not only explained the underlying architecture of UITypeEditor  but also impelement a control which can be used to host any UITypeEditor, and so you can have a generice type editor.

Article can be accessed here:  Build A Property Editor That Can Edit Any .Net Type

regards

Regular Expression : Escaping Meta Characters within character classes

Many of us have written applications where we have used regular expression for different tasks, like validation , parsing and other related task. Regular Experssion is quite a powerful tool, and has been available in most of the programming languages that are used today (either natively supported or by using libraries).

Usually in a regular expression ‘\’ is used as a the escape sequence (it may be different for different languages , I am using C# convention), to escape meta characters. Regular Expression also support a construct called ‘character classes’ ,which can be roughly taken as a set of characters. There are some pre-defined character classes like \d \w \s etc. and if you need a more customized version you can define your own using Square brackets notation ‘[]’.

The world inside the square brackets is much different than the one outside.  Inside the brackets , there are only two meta characters, ‘^’ and ‘-‘; even an opening bracket ‘[‘, asterisk ‘*’ , plus sign ‘+’ are not considered as meta inside []. Furthermore , [] has no escape sequence within them. Now what you will do if you want to have ‘^’ , ‘-‘  and ‘]’ inside a character class.

Well these characters are escaped using particular placement within brackets.

One key syntactic difference is that the backslash is NOT a metacharacter in a POSIX bracket expression. So in POSIX, the regular expression [\d] matches a \ or a d. To match a ], put it as the first character after the opening [ or the negating ^. To match a -, put it right before the closing ]. To match a ^, put it before the final literal – or the closing ]. Put together, []\d^-] matches ], \, d, ^ or -.

source :http://www.regular-expressions.info/posixbrackets.html

Problem Solved .😀

By the way , this web site gives a good introduction about Regular Expressions.

regards

Faraz

Some Articles

well..🙂

I am back after a loooonnnng vacation.😀. I have been really busy during that period (if activity of wasting time is cosidered as a task😛

Just to start with something, here are some of articles that I have read during my so called vacations.

  • Natural Number Comparer:

Have you ever noticed , how Windows XP Explorer sorts files in a directory by file name.  It does an intelligent sorting by considering the file names and also take into account if there is digit in the file name. e.g file1.txt , file2.txt and file10.txt . Ordinary string sorting places  these 2 strings as file1.txt ,file10.txt, file2.txt, which isn’t the right order. XP sees these strings differently and sort them in almost correct orderi.i.e file1.txt, file2.txt and file10.txt.

This type of sorting might be required in other applications as well. Pascal Ganaye has written an execellent article on Natural Number Comprarer .

  • Colors:

Nice article on Manipulating Colors in .Net by Guillaume Leparmentier in which he discussed the different color models and their inter-conversion. Very informtive!!!

  • Cab File Manipulation:

Often you need good compression and archiving APIs, so why not use the Microsoft’s own cab file implementation. Thats exactly what Elmue has done and explained in his article Cabinet File : Compression and Extraction.

Do you recognize the building in the photo?? ;)

Well I don’t know what to say ,😀, Just now my friend pointed out an error on the Jang‘s news update page. Here is a snapshot,

Can you figure out , what is the source of error here .:D,

see closely , its not that much difficult.

C’mon, C’mon,

well, this is the photo of right corner of FAST karachi campus😀, and it has nothing to do with Removal of 10% Tax on Wheat Import

Sweeeeeet!!

This page was retrieved from the url :

http://www.jang.com.pk/jang/may2008-daily/27-05-2008/update.htm#65

regards

faraz