A little food for thought

Thursday, June 04, 2009

Regular Expressions Syntax summary

Items to match a single character

Meta characters

Matches

.

Dot

Matches any one character

[….]

Character class

Matches any one character listed

[^….]

Negated character class

Matches any one character not listed

\char

Escaped character

Matches literal character

Items appended to provide “Counting” : The Quantifiers

?

question

One allowed but it is optional

*

star

Any number allowed but all are optional

+

Plus

At least one is required; additional are optional

{min, max}

Specified range

Min required , Max allowed

Items that match a position

^

Caret

Matches the position at the start of the line

$

Dollar

Matches the position at the end of the line

\<

Word boundary

Matches the position at the start of the word

\>

Word boundary

Matches the position at the end of the word

|

Alternation

Matches either expression it separates

( )

Parentheses

Limits the scope of alternation, provides the grouping for quantifier and captures for back references

\1 \2

Back references

Matches the text previously match within first , second etc.

\t

Tab character

 

\n

Newline character

 

\r

Carriage return

 

\s

 

Matches any whitespace

\S

 

Any thing not \s

\w

 

Matches any word

\W

 

Matches non word [^a-zA-Z0-9_]

\d

 

Matches any numeric digit [0-9]

\D

 

Any thing not \d

(?<=…)

Look behind

Successful if can match to the left

(?<!...)

Negative look behind

Successful if can not match to the left

(?=…..)

Look ahead

Success full if can match to the right

(?!....)

Negative look ahead

Successful if can not match to the right

Thursday, May 28, 2009

Getting syntax highlighting work in Blogger

As my previous post suggest I was trying different methods suggested by different blogs. But none of them working. Part of the problem was that blogger doesn not support CSS and JS files upload. So you need to depend on external sites to refer to these files. The other problem was instructions on these different blogs. Most of them said the to put first set of files before </head> But the problem is there are many </head> tags in Blogger template. Finally I could get it working. This is what I did

1> I added following lines after <$BlogMetaData$> tag.
<link type="text/css" rel="stylesheet" href="http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css"></link>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js"></script>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js"></script>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js"></script>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js"></script>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js"></script>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js"></script>
2> Add following lines before </body> tag. This should be just after <!-- End wraps --> tag.
<script language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = "http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/clipboard.swf";
dp.SyntaxHighlighter.HighlightAll("code");
</script> 
This worked for me. Most probably will work for you as well. Enjoy.

Trying Syntax highlighting

Yesterday I wastrying syntax highlighting for my previous post. Not decided to create this post just to try it.
class myClass
{
/* Add code here */


}



Wednesday, May 27, 2009

Notepad++ and PLSQL

In addition to my previous post. You also need to add PL/SQL for syntax highlighting. To get that working you need to follow these steps. 1> Goto %APPDATA%\Notepad++ (Start->Run>%APPDATA%\Notepad++) 2> Check for the file userDefineLang.xml 3> If file exists then add following code into it just before tag


        
            
            
            
        
        
            000000
            begin
            end
            ! " % & ( ) * , / : ; ? @ [ \ ] ^ ` | ~ + < = >
            1 2 0#
            ALL ALTER AND ANY ARRAY AS ASC AT AUTHID AVG BETWEEN BINARY_INTEGER BODY BOOLEAN BULK BY CASE CHAR CHAR_BASE CHECK CLOSE CLUSTER COALESCE COLLECT COMMENT COMMIT COMPRESS CONNECT CONSTANT CREATE CURRENT CURRVAL CURSOR DATE DAY DECLARE DECIMAL DEFAULT DELETE DESC DISTINCT DO DROP ELSE ELSIF EXCEPTION EXCLUSIVE EXECUTE EXISTS EXIT EXTENDS EXTRACT FALSE FETCH FLOAT FOR FORALL FROM FUNCTION GOTO GROUP HAVING HEAP HOUR IF IMMEDIATE IN INDEX INDICATOR INSERT INTEGER INTERFACE INTERSECT INTERVAL INTO IS ISOLATION JAVALEVEL LIKE LIMITED LOCK LONG LOOPMAX MIN MINUS MINUTE MLSLABEL MOD MODE MONTH NATURAL NATURALN NEW NEXTVAL NOCOPY NOT NOWAIT NULL NULLIF NUMBER NUMBER_BASE OCIROWID OF ON OPAQUE OPEN OPERATOR OPTION OR ORDER ORGANIZATION OTHERS OUT PACKAGE PARTITION PCTFREE PLS_INTEGER POSITIVE POSITIVEN PRAGMA PRIOR PRIVATE PROCEDURE PUBLIC RAISE RANGE RAW REAL RECORD REF RELEASE RETURN REVERSE ROLLBACK ROW ROWID ROWNUM ROWTYPE SAVEPOINT SECOND SELECT SEPARATE SET SHARE SMALLINT SPACE SQL SQLCODE SQLERRM START STDDEV SUBTYPE SUCCESSFUL SUM SYNONYM SYSDATE ABLE THEN TIME TIMESTAMP TIMEZONE_REGION TIMEZONE_ABBR TIMEZONE_MINUTE TIMEZONE_HOUR TO TRIGGER TRUE TYPE UID UNION UNIQUE UPDATE USE USER VALIDATE VALUES VARCHAR VARCHAR2 VARIANCE VIEW WHEN WHENEVER WHERE WHILE WITH WORK WRITE YEAR ZONE
            ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl foreach % ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp spps spsv sv tee where ? write cat cd clear cp h history kill lp ls mount mv popd ps pushd pwd r rm rmdir echo cls chdir copy del dir erase move rd ren set type
            
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        
    

4> If file does not exists then create the file and add following code


    
        
            
            
            
        
        
            000000
            begin
            end
            ! " % & ( ) * , / : ; ? @ [ \ ] ^ ` | ~ + < = >
            1 2 0#
            ALL ALTER AND ANY ARRAY AS ASC AT AUTHID AVG BETWEEN BINARY_INTEGER BODY BOOLEAN BULK BY CASE CHAR CHAR_BASE CHECK CLOSE CLUSTER COALESCE COLLECT COMMENT COMMIT COMPRESS CONNECT CONSTANT CREATE CURRENT CURRVAL CURSOR DATE DAY DECLARE DECIMAL DEFAULT DELETE DESC DISTINCT DO DROP ELSE ELSIF EXCEPTION EXCLUSIVE EXECUTE EXISTS EXIT EXTENDS EXTRACT FALSE FETCH FLOAT FOR FORALL FROM FUNCTION GOTO GROUP HAVING HEAP HOUR IF IMMEDIATE IN INDEX INDICATOR INSERT INTEGER INTERFACE INTERSECT INTERVAL INTO IS ISOLATION JAVALEVEL LIKE LIMITED LOCK LONG LOOPMAX MIN MINUS MINUTE MLSLABEL MOD MODE MONTH NATURAL NATURALN NEW NEXTVAL NOCOPY NOT NOWAIT NULL NULLIF NUMBER NUMBER_BASE OCIROWID OF ON OPAQUE OPEN OPERATOR OPTION OR ORDER ORGANIZATION OTHERS OUT PACKAGE PARTITION PCTFREE PLS_INTEGER POSITIVE POSITIVEN PRAGMA PRIOR PRIVATE PROCEDURE PUBLIC RAISE RANGE RAW REAL RECORD REF RELEASE RETURN REVERSE ROLLBACK ROW ROWID ROWNUM ROWTYPE SAVEPOINT SECOND SELECT SEPARATE SET SHARE SMALLINT SPACE SQL SQLCODE SQLERRM START STDDEV SUBTYPE SUCCESSFUL SUM SYNONYM SYSDATE ABLE THEN TIME TIMESTAMP TIMEZONE_REGION TIMEZONE_ABBR TIMEZONE_MINUTE TIMEZONE_HOUR TO TRIGGER TRUE TYPE UID UNION UNIQUE UPDATE USE USER VALIDATE VALUES VARCHAR VARCHAR2 VARIANCE VIEW WHEN WHENEVER WHERE WHILE WITH WORK WRITE YEAR ZONE
            ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl foreach % ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp spps spsv sv tee where ? write cat cd clear cp h history kill lp ls mount mv popd ps pushd pwd r rm rmdir echo cls chdir copy del dir erase move rd ren set type
            
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        
    


Enjoy

Notepad ++ and PLSQL

Recently I installed notepad ++ on my machine. As I am doing lot od javscript programming lately. And I found Notepad++ is one of the best editor for Javascript. Other being Visual Studio. But since I also do PLSQL programming I was looking for a way to get PLSQL Syntax checking and autocompletion. With some minor tweaking I could get both working. If you have similar requirement please follow these steps. 1>Create a file called plsql.xml in 'C:\Program Files\Notepad++\plugins\APIs' directory. 2> Copy and paste following code into this file.
 
 
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    

3. Close and restart the notepad++. Enjoy

Monday, May 25, 2009

Back to blogging

I am back to blogging. After a very long time. However I will try to blog more frequently this time. Let us see how long that lasts.

Wednesday, October 19, 2005

One more test

I am again testing it.  Its very convinient to create a blog entry through email.
 
by the way I gave up on blogging through word.  I guess it has a bug. It was hanging my word whenever I tried to copy and paste some huge content.
 
 
Lets see how this thing goes. 

Tuesday, October 18, 2005

Test blog

I am currently testing email -to  blog functionality.
 
 
 
 

Tuesday, August 23, 2005

Blogger Tool for Word

This is the test for Word for Blooger. May be I will use this for future Posts

Monday, May 30, 2005

Netbean J2ME

Currently working on my List project in Netbean 4.1. This is awsome. I could finish about 70% of use cases without writing a single line of code. This so VB like experience. You just drag and drop some screens and add commands to those screens. Link those screens together. And a add some behaviour to those commands. No code required. The problem is the code generated is not much of OO in nature. Its like procedural code. May be I need to relooked at the code once I finish the program.

Tuesday, May 17, 2005

New Project

I am thinking about this new idea for a project. I am not sure I should use J2ME or Python for this. But currently python looks better and faster option for this. The idea is this, we have these smart phones. These smart phones have more computing power than early PCs and these small PCs are just running into loop and doing nothing. Imagine whatwe can achieve if we can get these processors to do something useful. I am thinking of developing a cron utility in python which will look into crontab file and do the things at specific time. Once I get this utility working then I can come up with many small command line utilities to be executed by this cron server to do usefull things. Following things come to mind for these utilities
  • Send a reminder sms to some one (need a small command sms tool which will read the file and send a sms to that person.
  • Upload all the photos from a directory to the server (Flicker)
  • Download some of the podcast
  • sync the contacts

Later I can come up with GUI utility to create the crontab file.

Thursday, May 05, 2005

Apche Mysql and PSP

After getting working the PHP and MySQL working, I worked on to get mod_python to work just to see the difference. After reading through the documentation. It was pretty simple installation And I could get the PSP working in about 30 minutes. The code for both was about the same size.

Saturday, April 30, 2005

Apache, PHP and MySQL

Last 2 days I spent on installing Apache, PHP and MySQL. I wanted to see the server side of development. I used my windows laptop I got it from work. Windows has its own advantages (easy installers) and disadvantage (not enough help). So I started with installing Apache. I downloaded the Apache server. It comes as a installer file . And installed in laptop. Installation went fine just the way installation goes in windows. But when I tried to start the server. It could not start the server. It seems some of the software on my machine already using port 80. I could not figure it out which one. So I just changed the port of Apache to 8080 and wholla.....it started the server and I could see the Aapche test page. The nest step was to install PHP. There is no installer for PHP. What we need to do is download the file and unzipped it at any directory....so simple. After unzipping the next step is rename a file to php.ini. And create some lines in httpd.conf file. But after following the steps....I still could not get the php running....So went back to google (long live google....i just don't know how was the life before google). I found that we need to copy the dlls from sapi directory to main php directory. After doing that it started working. So the last piece of puzzle is Mysql. It is again direct installation. After installation it failed to create service. It seems that my pc already has a mysql service. But I could not find the software installed anywhere. So I guess the person using this laptop might have installed this and uninstalled it later. But uninstallation must have removed the software keeping services there. How do we delete the service. The services window does not allow you to delete the service. Back to google. It seems you need to use a command line tool 'sc -delete service' to delete the service. A command line tool on windows XP in 2005 !!!! After deleting the service I could create a new service and could start the server. I could also connect to server and create some tables and insert rows. Now connect the PHP to Mysql....No setups nothing..Supposed to work out of box. Nope.....when i run test page it gives me error 'Client does not support sever authentication upgrade the server' What the hell... It seems Mysql 4.1 used 16 bit password but PHP mysql client uses 8 bit....so solution? change the password with old_password('oldpwd') function. After doing all these I could see php page spitting mysql data on apache server.... Hope fully when I do the same excersise on my home PC, it should not have so many issue, Also may be I will just use easy php...

Thursday, April 28, 2005

w.blogger

Just came across this tool. I am writing this blog from this tool. So this is sort of testing. Let me see how it looks....

Tuesday, April 26, 2005

Change the blog name and purpose

I just change my blog title and also decided to change the purpose. Initially I started this blog to capture my jurney to learn Java (J2ME) and Python. This blog was supposed to keep track of my work on these projects. Even though I will continue to do this I had lots of thoughts which I want to put down which has nothing to with me learning experience. I also decided to post my thoughts during the lunch time hence the name. Hope fully I will be more productive this time.

Monday, April 04, 2005

Netbean 4.1 Book

Some Sun employees are writing a book about Netbean 4.1 version. Its is schedule to release by June 05. "Netbean IDE Field Guide" should some what satisfy the need for a book in Netbean space. I have seen lots of books covering Eclips but till now saw only one Netbean Definative Guide in netbean space. I will post my comments about this book next week(I am planning to read this 300+ page book in this weekend.

Friday, March 11, 2005

New Project

Netbean 4.1 has made me going again on my journey which was not moving bacause of lots of other things. As my shopping list project has finished I am trying a new project which will also be in List. It will be list management system. It will help users to mange different lists. This can be used as a shopping list like my earlier project but this will be more general. With this users can create and maintain lists. I am planning to create this in two phases Phase I - In this version users can create new lists, delete lists, update lists and also mark/unmark list items and delete list items and delete all. Phase II - This will help users to copy the items from another lists. So that users can make one master lists and then create smaller lists for occasion.

Thursday, March 10, 2005

Netbean 4.1 Beta

Just downloaded the Netbean 4.1 beta. Its has lots of improvements. I was using Sun mobility Studio which was based on Netbean 3.6. Which was good but this one has lots of improvements specially if you are doing development in J2EE or J2ME area.

Monday, December 27, 2004

Python for series 60 Released

Python for series 60 released last week. I downloaded the files and installed on 7610. Installation went fine. I also tried couple of programs that came with installations. I have toyed with the idea of porting my J2ME shopping list to Python but realised that Python listbox does not support the multi selection. So I need to wait for that. My J2ME shopping list is working fine. I will be doing some enhancements for these during these couple of days.

Friday, December 10, 2004

Shopping list project completed

My shopping list project is completed in J2ME. Its working fine in my Nokia 6610. But its failing in my wife's 7610. I thouht since 7610 is newer and supports MIDP 2.0. it should work fine. But I guess I am wrong. I need to fix it fast as she is the one who is user of this MIDlet.