Wednesday, December 14, 2011

Match multiple patterns with a single regex expression

I wanted to add multiple patterns to single regex expression. Such as password check. For example:

Friday, October 21, 2011

solved maven error "NoClassDefFoundError" ComponentLifecycleException


niskia:/xxyyzz# mvn jar:jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/component/repository/exception/ComponentLifecycleException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
at org.codehaus.classworlds.Launcher.getEnhancedMainMethod(Launcher.java:195)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:294)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.component.repository.exception.ComponentLifecycleException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 9 more

The solution was reinstalling maven. For debian is done by:

apt-get remove maven2
apt-get install maven2

Monday, September 12, 2011

OOO - Out Of Office email

Здравейте колеги,
На дати ХХХХХХХХХХХХХ ще бъда в отпуска.
Ако ви стане мъчно за мен, може да ме потърсите на някой от следните телефони:
0xxx-xxx-xxx
0xxx-xxx-xxx

За съжаление няма да имам достъп до компютър и до интернет.

Поздрави

Thursday, September 1, 2011

Installing bugzilla on Debian

Download latest Bugzilla and unpack the archive in apache document root (or configure a virtualhost).

Pre-check in shell with command:

./checksetup.pl --check-modules


I get some missing modules:

Monday, August 15, 2011

Modify primary key syntax

MySQL:

ALTER TABLE your_table DROP PRIMARY KEY, ADD PRIMARY KEY ( some_field, other_field );


There is no problem some_field to be AUTO_INCREMENT.

Friday, August 12, 2011

Easier Command prompts recognition

If you use more that one Command Prompts in Windows, you probably mess them up. An easy way to distinguish them is with color command. Write in each of them color command with different arguments. Letter color changes, yeah!

Command Prompt window #1:
color A

Command Prompt window #2:
color B

MS DOS batch tips

So, by way of tribute to the dying art of the DOS Batch file, I present my top ten batch file tricks:

1 Use PUSHD / POPD to change directories
Read Scott Hanselman's writeup on PUSHD. The basic idea is that it keeps a stack, so at the simplest level you can do something like this:

PUSHD "C:\Working Directory\" ::DO SOME WORK POPD

That allows you to call the batch file from any directory and return to the original directory when you're done. The cool thing is that PUSHD can be nested, so you can move all over the place within your scripts and just POPD your way out when you're done.