# Monday, July 14, 2008

73 meters from the ground

This is 73 meters from the ground. It is scary and physically intensive. I did this route twice, the first time without the special gloves. My fingers still hurt.



On the top the second time (on the verge of not making it).


It's over, let's have something to eat.


More pictures when I get them.

MySQL, I hate you so much [Installing mysql as a service]

The first idea was to have the DB (MySQL) start as part of the script that launched the tests. Google couldn't find anything good. MySQL is one of the most unintuitive things I have ever seen, so the decision was to not try to figure it out on my own.

The next thing was to install MySQL as a service. That turned out to be difficult.

I tried to install MySQL as a service:

/>mysqld --install

As easy as that. The problem is IT DID NOT WORK. The service did not want to start.

After some reading it came out that the RIGHT way was to do it like that:

__correct dir__/><<path>>\mysqld.exe --install MySQL --defaults-file="<<path>>\my.ini"

Why do I have to supply the mysql directory explicitly?
Why do I have to supply the my.ini directory explicitly?

Why doesn't mysqld give me an error message when I install it without the needed parameters?
Why doesn't mysqld give me an error message when I install it without the needed explicit paths?

...is beyond my inderstanding.

MySQL, you are a disgrace.
MySQL, not only are you not a real RDBMS but you can't even start without making your users' life misserable.


Google mail servers fail?! All of them?

Connection timed out on all their servers?!

Technical details of temporary failure:
TEMP_FAILURE: The recipient server did not accept our requests to connect.
[ASPMX.L.GOOGLE.com. (1): Connection timed out]
[ALT1.ASPMX.L.GOOGLE.com. (5): Connection timed out]
[ALT2.ASPMX.L.GOOGLE.com. (5): Connection timed out]
[ASPMX3.GOOGLEMAIL.com. (10): Connection timed out]
[ASPMX5.GOOGLEMAIL.com. (10): Connection timed out]
[ASPMX2.GOOGLEMAIL.com. (10): Connection timed out]
[ASPMX4.GOOGLEMAIL.com. (10): Connection timed out]

# Friday, July 11, 2008

The sources for hibernate-entitymanager.jar, version 3.2.1GA

Yea, it was difficult. So difficult that I had to extract the sources from a zipped project file, put them into archive and rename to jar file. And hope that the versions I'm using are mathing....

The JBoss jar says it's implemented by JBoss.
JBoss/hibernate-entitymanager.jar/META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Product: Hibernate EntityManager
Specification-Title: JBoss
Created-By: 1.5.0_09-b03 (Sun Microsystems Inc.)
Specification-Version: 4.2.2.GA
Implementation-Vendor-Id: http://www.jboss.org/   WTF?
Version: 3.2.1.GA
Implementation-URL: http://www.jboss.org/
Ant-Version: Apache Ant 1.6.5
Implementation-Title: JBoss [Trinity]
Specification-Vendor: JBoss (http://www.jboss.org/)
Implementation-Version: 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=20
 0710221139)
Implementation-Vendor: JBoss Inc.

However, the JBoss source does not have the sources.
http://repository.jboss.org/hibernate-entitymanager/3.2.1.GA/
WTF number 2?


In the hibernate downloads the source is missing as a separate download
http://sourceforge.net/project/showfiles.php?group_id=40712&package_id=156160
WTF number 3?

Finally, found it in the zip file in the last link. I was desparate, thinking of using the repositories here:
http://anonsvn.jboss.org/repos/hibernate/entitymanager/tags/
Had to extract it, re-zip it and hope the versions match. So far so good.

Why does it have to be so difficult?!

# Thursday, July 10, 2008

Overriding a method with a raw type, want to use generics in the override

I want to override that api.org.hibernate.Interceptor#postFlush(java.util.Iterator)
I want to do it like that:
@Override
public void postFlush( Iterator<?> entities ) throws CallbackException {...}
Does not work - the method is not with the same signature ?!

Then:
@Override
public void postFlush( Iterator<Object> entities ) throws CallbackException {...}
Does not work - the method is not with the same signature ?! WTF?

The only thing that does work (without a silly warning) is that:
@Override
public void postFlush( @SuppressWarnings( "unchecked" ) Iterator entities ) throws CallbackException {


Why?!!

Iterating over iterator contents with a for loop

How an iterator works:

Iterator i = collection.iterator();
while( i.hasNext() ) {
 Object o = i.next();
 //do stuff
}

Well, I want to move the red line in the loop init, so it would not mingle with the loop body where only business logic would reside.

Unfortunately that cannot happen. A for loop first inits the data, then checks the condition. With an iterator one has to first check if there are elements, then to get them.

And why would someone give you an iterator instead of a collection, my mind cannot understand. (org.hibernate.Interceptor#postFlush(java.util.Iterator))
# Tuesday, July 08, 2008

JUnit, exceptions in @Before and @After methods

JUnit spec (not very easy to find) states, that if there's an exception in the @Before method, the test is not called. True. BUT

JUnit spec does not state that in this case the @After method is called.

JUnit spec also does not state that if there's an exception in both the @Before and @After methods, the second exception (guess which one) overrides the first one. In my case the first one causes the second one (the first one is ConnectionClosed or similar, the second one is a NullPointerException because the resource is not initialized).

So the real reason for the problem is lost. One will say - avoid exceptions in the @After method - that's what I just did (and the real exception was printed), but finding the reason for that was not easy and straightforward.

I'm using junit 4.4, the default runner is JUnit4ClassRunner, JUnit4ClassRunner is calling ClassRoadie.runProtected():

public void runProtected() {
    try {
        runBefores();
        runUnprotected();
    } catch (FailedBefore e) {
    } finally {
        runAfters();
    }
}

This is the reason for the mentioned override. I hate when finally does that.

There's no such thing as a natural

There's no such thing as a natural. A natural is someone who practices so much it looks like they don't need to.
# Monday, June 30, 2008

blogging from an iphone

It's not very easy, this is the first phone that is sophisticated enough to support the editing page and easy enough to be usable for that purpose. Uploading does not work. Rich editing does not work. But typing is fast enough and easy enough.

# Tuesday, June 24, 2008

Hibernate, AuditLogging, cannot configure listeners in persistence.xml

First, what's my goal
I want to do an audit log. I read the http://www.hibernate.org/318.html and there two different approaches were mentioned.
The first is using a Listener.
The second is using the new eventing model in Hibernate3.
The author said that he couldn't make the eventing approach work for an unknown reason.

I'm using Hibernate via JPA. I'm using it in an EJB. So the problem with the first approach is that it is difficult (if possilbe) to supply the same transaction to the interceptor so that it can write an entry in the audit log. There is a solution with a static field holding a session or an EM, but that seems ugly.

So I chose the second approach. I created a class, inherited few eventhandlers (PreInsertEventListener, PostUpdateEventListener ) and tried to add the class as a listener.

Using the API, it worked (the callback methods in the listeners were called):

AnnotationConfiguration configuration = new AnnotationConfiguration();

configuration.setListener( "post-update", new Test1() );


configuration.addProperties( hibernateProperties );
EntityManagerFactory factory = new EntityManagerFactoryImpl( configuration.buildSessionFactory(),
   PersistenceUnitTransactionType.RESOURCE_LOCAL, true );
EntityManager result = factory.createEntityManager();


Using properties (as if using persistence.xml) failed(the callback methods in the listeners were NOT called):

Properties hibernateProperties = new Properties();
...

hibernateProperties.put( "hibernate.ejb.event.pre-update", "package.Test1" );
hibernateProperties.put( "hibernate.ejb.event.pre-insert", "package.Test1" );
 
AnnotationConfiguration configuration = new AnnotationConfiguration();
configuration.addProperties( hibernateProperties );
EntityManagerFactory factory = new EntityManagerFactoryImpl( configuration.buildSessionFactory(),
   PersistenceUnitTransactionType.RESOURCE_LOCAL, true );
EntityManager result = factory.createEntityManager();


Ideas why?
# Saturday, June 21, 2008

A new challenge - a dog

I have to keep it alive for 24 hours. It's gonna be hard




Update: It's done - I successfully returned the dog alive, unharmed and in good condition.
# Friday, June 20, 2008

Category A in my driving license

Today I passed the exam for category A (motorcycles above 50cc). Very happy.

'Sucks' category

There's a trend - there are a lot of articles here in which I bitch about something. So there should be a category called 'Sucks'.

Update: reviewing the articles I found a lot of candidates for the category, it comes out that all I'm doing is bitching about stuff - I should change the subtitle of the blog :)

@Override in eclipse

When one implements an interface, the template in Eclipse puts an @Override and it does not complain about it. Ant javac task also compiles without warnings.

Sometimes other Eclipse instances start to complain exactly for that @Override stating that there's no method that's overridden. Well, Eclipse, please do make up your mind.

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html
"Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message."

Well, that's not very clear. As far as I remember an Interface is a pure abstract class, right? So, which one's correct.

P.S. Sometime ago I was having a similar problem with Eclipse and generics - Eclipse only gave a warning about something (can't remember what exactly), but the javac said that it was an error - Google said something like "eclipse uses jikes, you use javac". So what, aren't there specs?!


Update: apparently JDK5 (or 1.5, suit yourself) does not allow that. So in order to get all the wrong @Overrides - set the Compliance level to 5.0 (Eclipse -> Window -> Preferences -> Java -> Compiler -> Compiler compliance level ) - and..... correct them. I have 29 left.

Referrers from live.com

All the referrers to this blog from live.com come like that:
http://search.live.com/results.aspx?q=class&form=QBHP or
http://search.live.com/results.aspx?q=interface&form=QBHP

The search word seems to be only 'class'. I can't believe that I come out in a search for only the word 'class'. I guess all the other words from the search are stripped which, if on purpose, is stupid, and, if not, ignorant.

# Thursday, June 19, 2008

Разговор за софтуера и бизнеса в него, дори за бизнеса като цяло

Той: em toq html nema izmestvane 100 godini veche

Той: mn tapo

Той:  It can make direct calls to JavaAPIs that are on the platform.

Той: e to pochva da prilicha na aplet ;)

Аз: всичките технологии са аплет-like

Аз: виж кой им е предшественика

Той: da samo ne znam kak opredelqt thin / fat client

Той: to sa razmiva leko

Той: ajax-a e thin i toi uj ;)

Аз: има група хора (аз също съм от тях), които са свикнали да пишат на силно типизирани езици и име е адски трудно да разберат как технологии като perl, php, rss, html, javascript и разни други 'боклуци' придобиват такава голяма популярност - отговорът е в леснотата на употреба и бързината на разработка. А че се жертват разни неща като добър стил и loose coupling - на кой му пука

 Той: awe za html i www kvo mu e lesnotata chovek

 Той: kat v ie raboti po edin nachin u firefox ne

 Той: i staash na lud

 Той: tva e nai-golemiq tashak :)

 Той: prosto ne moa da povervam che sa go dopusnali

 Той: ako imashe pone malko tipizirane :)

 Аз: There is a certain group of people (counting me too) that are used to working with strongly typed languages. It's really hard for that group of people to understand how technologies like php, html, javascript (..., rss, perl, ...) become so popular.

 

The answer is (in my humble opinion) the ease of use and rapidness. Everybody can learn to use them. Sacrificing the good style and the heavy approach (that comes from the heavy books) comes out be (in most cases) an acceptable loss.

Аз: последното изречение го прочети няколко пъти

Аз: :)

Той: :)

Той: awe tva jnlo mn bavno zarejda obache

Той: https://openjfx.dev.java.net/learning.html

Той: skivai tova

Той: http://download.java.net/general/openjfx/demos/tesla.jnlp

Той: ima torque/power curve

Той: a to html i js uj prosto ama vari pravi ajax

Аз: ?

Аз: винаги съм се дразнил на джава приложенията, че нямат райт клик

Той: mi ne e prosto da praish dobar interface (ajax) za www

Той: ich daje

Той: kav right click :)

Аз: explain:

Аз: a to html i js uj prosto ama vari pravi ajax

Аз: mi ne e prosto da praish dobar interface (ajax) za www

 Аз: apletite i сега javaFX нямат right-click

 Той: nali vikash che sa razprostranilo shot bilo prosto

 Аз: zabranen e

 Той: :)

 Аз: da, taka e

 Той: em prosto da praish prosti neshta :)

 Аз: taka :)

 Аз: гмаил, гугъл мапс

 Той: zashto tezi koito iskat da praat ne prosti neshta tria da lejat varhu prosti tech

 Аз: прости ли са?

 Той: shot prostite tech sa sa nalojili

 Аз: защото те са популярни и се поддържат от публиката

 Той: ili shot te samite sa prosti che ne sa nalojili drugo vmesto da praat shitove running varhu prostite tech

 Аз: бизнесът търси размах, дори и да имаш супер технология, ако тя не се ползва, няма смисъл от нея

 Той: mrazq bisnes :)

 Той: i mrazq da mrazq :)

 Аз: трудно е един бизнес да 'налага' технологии (виж на Майкрософт колко им е трудно един стандарт да наложат)

 Той: mi to ako e qko moje da se samonaloji sigurno

 Аз: целият софтуер, който се пише е подчинен на основни бизнес зависимости: (микроикономика 101) търсене и предлагане

 Аз: има доста адекватни технологии, които не са се наложили

 Аз: причини много ()

 Аз: една технология, за да се наложи и трябва много повече от техническа адекватност

 Аз: там отново се намесва мразения от теб бизнес

 Аз: :)

 Той: biznesa razvalq sichko

 Той: vnasq mn izkrivqvane

 Той: ne sa prai shot e qko a shot tekat pari

 Той: i vsichko e shit

 Аз: приятелю мой, забавно е да те слуша човек

 Аз: причината е в развитието

 Аз: смята се, че пазарната икономика води до най-високо развитие. Тя се гради точно тоя принцип с парите, търсенето и предлагането и конкуренцията

 Той: pazarnata ikonomika e shit :)

 Той: vij posokata na razvitieto obache

 Той: tva e edna dosta shibana posoka

 Аз: посоката?

 Той: izkrivena ot bisnesa

 Аз: бъди по-точен

 Той: shit ot sekade :)

 Той: posokata da se pechalat pari

 Аз: разбира се

 Той: razvitie saobrazno taq posoka

 Той: tva e shit

 Той: pitai malkite deca ako ne mi vqrvash :)

 Аз: това е най-важния (ако не единствен) показател колко добре се справяш - универсалният показател

 Аз: хаха

 Аз: кефиш

 Той: toq pokazatel vaji samo taq matrica :)

 Той: v

 Той: v taq

 Аз: така е

 Той: :)

 Аз: другите опитани модели са плановата икономика (комунизмът), която практиката показва, че е не толкова успешна

 Аз: Пазарната икономика е естествен механизъм, който те принуждава да оптимизираш ресурсите, с които разполагаш

 Аз: парите са просто универсално разменно средство, нищо повече

 Аз: :)

 Той: mn poveche ot tova sa :)

 Той: vsashnost

 Той: za neshtastie :)

 Той: ne che i na men ne mi triat ama ..

 Аз: какво друго са?

 Той: te promenqt horata we

 Той: ne samo nekvi hartiiki

 Аз: хаха

 Аз: не перите ги променят, жаждата за материалното ги променя

 Той: e to e sashtoto :)

 Аз: а то, материалното, се измерва с пари просто

 Аз: но не забравяй, че тази жажда (или алчност ако щеш) кара същите тези хора да се стремят към тях и да работят

 Аз: двигателят на прогреса

 Аз: точно тук е гениалността на пазарната икономика естественото желание да купиш най-много с най-малко

 Той: na metrialniq progres

 Аз: ?

 Той: materialniq progres

 Аз: ами духовното е индивидуално, много трудно се измерва с пари и е трудно да се вкара в тая 'матрица'

 Той: to ne moish da go izmervash s pari

 Той: am kvo stana s html i js

 Той: shte gi mahame li ot upotreba :)

 Аз: едва ли скоро

 Аз: :)

 Аз: бтв, мога ли да пусна разговора в блога си?

Strongly-typed vs. weakly-typed

There is a certain group of people (counting me too) that are used to working with strongly typed languages. It's really hard for that group of people to understand how technologies like php, html, javascript (..., rss, perl, ...) become so popular.

The answer is (in my humble opinion) the ease of use and rapidness. Everybody can learn to use them. Sacrificing the good style and the heavy approach (that comes from the heavy books) comes out be (in most cases) an acceptable loss.

# Wednesday, June 18, 2008

Chill the coffee out

Patents pending - don't steal my intellectual (he he) property.

The biggest screen resolution I have ever seen - found in my living room

Have you ever seen a screen that supports that big a resolution? This is (...calculating...) ~4.29 GigaPixels. Quite a lot, huh?

Check out how many options it gave for color depth.



P.S. This happened on a friend's machine after two years of no support and windows update.

A custom res: