Friday, February 09, 2007

Microsoft/AOL giveaway

Not really. This is an old internet hoax, dating back in 2004, claiming that Microsoft and AOL are running a tracked email test paying people for participating, urging them to forward a silly . Now, why am I making such a fuss NOW, many years after this hoax first appeared? Because there are gullible people out there that keep circulating these phony messages believe or not, and they did send it to me!!!!
Well, sorry folks, but there aint no free lunch yet. Now get back to work.

Saturday, March 04, 2006

random pin generation

Automatical random PIN generation has been all the more common now, especially in mobile applications. There is a very good utility around by Stephen Ostermiller, that lets you generate random sequences of arbitrary length and arbitrary alphabets. You can download the latest Ostermiller Utils from http://ostermiller.org/utils/ostermillerutils_1_06_00.jar and then use it directly from command line (java -classpath utils.jar com.Ostermiller.util.RandPass), or more commonly through your Java application:

String pass = new RandPass(new char[]{'A','B','C'}).getPass(8)

Sunday, February 19, 2006

happy tree friends

Happy Tree FriendsThe Happy Tree Friends are cute little cartoon animals that get themselves into dire situations, always ending up in mayhem. Created by Kenn Navarro and Rhode Montijo, their short horrible stories can be watched on www.happytreefriends.com or on G4 videogame tv. Unbelievably insane and funny. Highly recommended to comic lovers.

Monday, January 23, 2006

despair inc.

Effort demotivator This is only one of the many demotivators, pictures with a funny, pessimistic and subversive tagline that can be found in Despair Inc.. There's loads of demotivators that you can also buy as calendars, posters and even mugs including: "IDIOCY: Never understimate the power of stupid people in large groups", "BLAME: The secret to success is knowing who to blame for your failures." or "DREAMS: Dreams are like rainbows. Only idiots chase them.". Even the site itself is full of witticisms, e.g. Where did you hear about us? (leave blank if answer is "the voices".). Dr E.L. Kresten the founder of Despair Inc., the man who registered the :-( emoticon, has released a highly acclaimed book The Art of Demotivation. Definitely worth reading.

Friday, January 06, 2006

web developer plugin

Web Developer plugin in Firefox Web Developer plugin by Chris Pederick for Firefox just got better. Released on December 31, 2005 version 1.0 is fully compatible with Firefox 1.5 and brings a host of new goodies. Here are some that I found very handy:

  • Positioning information by means of a ruler and line guides.
  • Ability to edit the source.
  • Outline of all images, including background.
  • View document size.
  • Added viewport options so that you always know what fits in 800x600, 1024x768 etc.
If you work with Firefox, Flock or Mozilla and you still haven't heard of it, go get it now!

Friday, December 30, 2005

bug in Tomcat 5.0.16

I discovered that the reason my sessionDestroyed() handler is called twice is, for a change, not due to my rauceus programming but because of the Tomcat version (5.0.16) I was using. The standard sessions manager expires timed out sessions twice, once when checking whether they have expired and again when, well, is on the job. Of course I'm sure you're not using that old a Tomcat version but just in case. See bugzilla issues 25234 and 27273 for more info. There's actually at least a couple more duplicate issues there.

Friday, April 01, 2005

What happened to the Opencola?


I wasn't aware that the Opencola softdrink formula was just a marketing promotion to support the OpenCola company's open source product. Apparently the Toronto based company fell victim to its own promotion: no one really remembers or even knows that OpenCola actually wrote software. The GNU licensed open cola formula was removed from public availability as of October 31, 2002. Back then though, open cola was even consumed at student parties and sold over the internet. Now the only thing you can buy from the opencola.com domain seems to be cheap bedding...

Sunday, February 13, 2005

javascript compactor in java

To my astonishment I found out that there are very few free javascript compressors out there, and most of them don't actually work. I came across Mike Hall's Javascript Crunchinator, a javascript compressor which, being written in Javascript, is very slow and didn't work for my sample complex script. The other worth mentioning compressor was a Perl snippet written by Mihai Bazon. I decided I wanted one written in Java instead, so I sat down and cranked out the following just so that you have yet one more option...

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * The compactor can be used to compact java scripts by removing comments, 
 * leading and trailing whitespaces, newlines, and condense any spaces between
 * operators, parentheses, brackets etc. It only works if all statements 
 * (including classes and simple functions) are properly
 * terminated by semicolons. If you read the script from a file using 
 * readLine() method make sure you put the new line character back at the end 
 * of the line, as readLine() consumes it.
 */
public class JavascriptCompactor {
    public static String compactJSCode(String sCode) {
        // Protect single and double quoted strings.
        Pattern strings = Pattern.compile("\"(\\\\.|[^\"\\\\])*\"
                                          |'(\\\\.|[^'\\\\])*'");

        Matcher m = strings.matcher(sCode);
        StringBuffer sb = new StringBuffer();
        HashMap theStrings = new HashMap();
        while (m.find()) {
            String sReplacement = "__STR_" + theStrings.size();
            theStrings.put(sReplacement, m.group());
            m.appendReplacement(sb, sReplacement);
        }
        m.appendTail(sb);
        sCode = sb.toString();

        // remove C style comments
        Pattern pattern = Pattern.compile("/\\*.*?\\*/", Pattern.DOTALL);
        sCode = pattern.matcher(sCode).replaceAll("");

        // remove C++ style comments.
        sCode = sCode.replaceAll("//.*?\\n", "");

        // remove leading/trailing whitespaces.
        sCode = sCode.replaceAll("(?:(?:^|\\n)\\s+|\\s+(?:$|\n))", "");

        // remove newlines.
        sCode = sCode.replaceAll("\\r?\\n", "");

        // remove spaces around operators etc.
        sCode = sCode.replaceAll("\\s+", " ");
        sCode = sCode.replaceAll("\\s([\\x21\\x25\\x26\\x28\\x29 \                
             \\x2a\\x2b\\x2c\\x2d\\x2f\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f
              \\x5b\\x5d\\x5c\\x7b\\x7c\\x7d\\x7e])", "$1");
        sCode = sCode.replaceAll("([\\x21\\x25\\x26\\x28\\x29
              \\x2a\\x2b\\x2c\\x2d\\x2f\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f
              \\x5b\\x5d\\x5c\\x7b\\x7c\\x7d\\x7e])\\s", "$1");

        // Put back strings.
        m = Pattern.compile("__STR_\\d+").matcher(sCode);
        StringBuffer result = new StringBuffer();
        int iLastEnd = 0;
        while (m.find()) {
            result.append(sCode.substring(iLastEnd, m.start()));
            result.append((String) theStrings.get(m.group()));

            iLastEnd = m.end();
        }
        result.append(sCode.substring(iLastEnd));

        return result.toString();
    }
}

Friday, January 28, 2005

gmail and K700i bug

I was invited by a friend to try out the new beta version of Google's email service. Invitations get distributed randomly on a limited basis, as a means of throwing in a bit of exclusivity to it. Meaning, if you're not invited by someone, you can't get an account. So I got mine - zmeeagain@gmail.com, what else? - and started playing around with it. The good stuff:
  • 1G of space at 10MB per message
  • seamless contacts importing from Outlook
  • a reasonably 9 months allowance for dormant accounts before you get thrown out
  • atom 0.3 support
  • free POP access
  • keyboard shortcuts
So far so good. Unfortunately, I've had no luck accessing the account from my newly bought SonyEricsson K700i due to a hideous ssl bug. Basically, the last m in the outgoing ssl domain smtp.gmail.com disappears during connection and the phone hungs up while "Receiving messages"! How dissapointing. For those of you that happen to have a Vodafone GR connection, here's the steps for setting up the data connection (pop settings can be found in gmail's help center).
Go to Connectivity, Data Comm., Data Accounts and select New Account. Pick the Gprs data type and enter a name for the connection. Use internet.vodafone.gr as APN, Username user and Password pass. Save and you're done.

If you manage to get it working for gmail, let me know, will ya?

Wednesday, January 26, 2005

extensionless files in windows

Another geeky post I'm afraid. There's loads of extensionless files out there like LICENSE, Readme, Makefile etc that cannot be associated with an application directly from Windows' UI; alas, the Always use the selected program to open this kind of file checkbox is simply denying us the obvious. Log in as admin and run this little reg file to associate all such files with UltraEdit. You can use any application you want of course, that's just my favourite editor there.

REGEDIT4

[HKEY_CLASSES_ROOT\.]
@="noext"

[HKEY_CLASSES_ROOT\noext]
@="no extension"

[HKEY_CLASSES_ROOT\noext\shell]

[HKEY_CLASSES_ROOT\noext\shell\open]

[HKEY_CLASSES_ROOT\noext\shell\open\command]
@="\"C:\\Program Files\\UltraEdit\\uedit32.exe\" %1"

[HKEY_CLASSES_ROOT\noext\shell\print]

[HKEY_CLASSES_ROOT\noext\shell\print\command]
@="\"C:\\Program Files\\UltraEdit\\uedit32.exe\" /p \"%1\""