Posts

Showing posts from March, 2012

Parsing the Logical expression

Sometimes you need to parse the logical expression. I have made for my own purposes the regular expression which would distringuish all important tokens from the logical expression: ([\(!\s]*)[\s]*([^<=\s]+)[\s]*(<>|!=|==|<=|>=|<|>)[\s]*([^\s&|\)]*)[\s]*([\)]*)(&&|\|\|)? or as java string: "([\\(!\\s]*)[\\s]*([^<=\\s]+)[\\s]*(<>|!=|==|<=|>=|<|>)[\\s]*([^\\s&|\\)]*)[\\s]*([\\)]*)(&&|\\|\\|)?" this would give for  !(! (one== 56) && two>45) || !three!=funny the following solution Regular Expression ([\(!\s]*)[\s]*([^<=\s]+)[\s]*(<>|!=|==|<=|>=|<|>)[\s]*([^\s&|\)]*)[\s]*([\)]*)(&&|\|\|)? as a Java string "([\\(!\\s]*)[\\s]*([^<=\\s]+)[\\s]*(<>|!=|==|<=|>=|<|>)[\\s]*([^\\s&|\\)]*)[\\s]*([\\)]*)(&&|\\|\\|)?" Replacement $1fieldValue(\"$2\")$3$4$5$6 groupCount() 6

A useless, but nice Excel trick

To show just the fields in the worksheet which are useful, and hide all the rest of the fiels, To Hide Rows Select row whereyour data finishes Press Ctrl + Shift + Down Arrow Key Move mouse pointer over the row numbers, Right Click, Hide To Hide Columns Select Column 21 Press Ctrl + Shift + Right Arrow Keys Move mouse pointer over the column numbers/letters, Right Click, Hide

jQuery print example

This is just a small update of BenNadel 's great post on printing the part of the page using jQuery/Javascript. The code is placed here

Encoding troubles UTF-8 in Eclipse/Rational Application Developer...

Uh, I never understood at all what is the reason for all these encoding types! I had to do some modifications on a custom made JavaEE project which uses velocity template engine. I ended up having a lots of encoding problems. Now I want to write sort of a step by step instruction how fix it. Ok, so let's start. Sooo, you have troubles with your spring/javaEE eclipse project. Several steps to take a look: 1) Check here: Window -> Preferences -> General -> Workspace -> Text file encoding - set to UTF-8 This setting will let even your new files to be encoded in UTF-8. It is usual cause of troubleshttp://www.blogger.com/img/blank.gif 2) under Window -> Preferences search for encoding keyword and set everything you see to UTF-8 (this does not help too much, but sometimes is useful) 3) If your files are created outside eclipse project, check whether they are written/saved in UTF-8 coding. Notepad++ has a nice feature that is able to show you encoding of y

Samsung Galaxy S2 tip

It seems that Samsung is using by default the fast dormancy, a new technology which tries to save your battery life by turning your phone completely connection less if no activity is detected. This is cool, right? Not really, since in order for this to work, network provider has to support it as well, which makes the completely opposite effect, by draining the phone battery and still make phone disconnected when idle (e.g. no SMSes received). To disable this (my strong suggestion), do the following: *#*#9900#*#* and then choose disable fast dormancy and then Exit . I have tested this already for 1 month, and it works pretty fine, and battery life is extended definitely by some 20%-30%. Summary: - it prolongs/extends the battery life - it solves the issue of phone being completely disconnected at times Sources:http://www.blogger.com/img/blank.gif Source More about fast dormancy: Here Some other codes are also interesting, which I haven't tested yet (but will t