Importing a class from the 'default package' (no package) - impossible

Did you know that classes in the 'default package' (classes that don't have a package) cannot be imported from classes that do have a package?

I did not know that.

Try it:

This is what javac says:

>javac Class1.java

>javac package2\Clazz2.java -cp .

package2\Clazz2.java:3: '.' expected
import Class1;
             ^
package2\Clazz2.java:3: ';' expected
import Class1;
              ^
2 errors

How stupid is this?
Is this why omitting package is deprecated?

JAX-WS: Always clean-up generated stuff before regenerating.

I'm using JAX-WS.
When I'm generating stuff for a web service I generate the jaxws package in a 'gen' source folder.
I don't need the compiled stuff so I generate it to a temp folder that I don't care about.

It comes out that I do have to care about that folder because yesterday I got an obscure error:

com.sun.xml.ws.model.RuntimeModelerException: The serviceName cannot be retrieved from an interface.

This error has only 1 (one) hit on Google. Don't trust me?
Try this one out:

http://www.google.com/search?q=%22com.sun.xml.ws.model.RuntimeModelerException%3A+The+serviceName+cannot+be+retrieved+from+an+interface.%22

The use case in the forum has nothing to do with my environment so I cleaned up and everything worked like a charm.

I've always been unhappy with how production unready wsgen is (here).

Пощенска банка - поредната олигофренска банка

Бях си казал, че повече с глупости няма да се занимавам.

Но, бях отново опроверган мислейки си, че вече най-големите тъпотии от банки съм ги видял. Особено след тъпотиите на Първа инвестиционна банка.

Сега основната ми банка е Пощенска банка: прилично е-банкиране.

Малко предистория:
Реших в сметката си вързана с дебитна карта да не държа прекалено много пари. Направих си втора (някакъв тъп влог) и я вързах с е-банкирането си.

Поредната олигофрения:
Оказва се, че тоя олигофренски влог не може да се управлява от е-банкирането. А като го правех изрично казах, че искам да ползвам от е-банкирането си.
Другите видове можели, но точно моя не може. И се оказва, че имам сметката, но точно като се опитам да превеждам - не може.

Естествено грешката се вижда от някакво забито меню, на самия трансфер не я пише.

Няколко часа се опитвах да се свържа на официалния им телефон - или заето или никой не вдига. Звънях и на други телефони - или не се вдигат или все ми се казва - не мога да помогна.

Писах им два имейла - чак на втория след 2 часа ми отговориха и даже ми се обадиха.
Като ми обясниха каква е хавата, естествено ги питам как да го реша сега проблема си? Те - ами отивате до някой клон. И сега аз ще трябва да се вдигна в работно време и да ходя до олигофренския им клон. Те естествено не са виновни и нищо не могат да направят.

Естествено мога да отида и да се навикам на пиклата, която не ми е обяснила тази подробност. Но какво ще ми донесе това?

Update:
Бях в един клон на банката. Първата мацка естествено ми каза: "Ама то би трябвало да може". Явно не е наясно горката, но аз бях кратък и ясен: "Искам да говоря с някого, който знае как работи всичко" и тая има благоразумието да ме насочи към правилния човек.
Говорих си с "администраторката" (явно нещо като шефка във фронт офиса им). Първо и тя: "ама то би трябвало да работи". После "ама ние нямаме други видове влогове". Докато накрая стигнахме до "ааааааааааааааааааааа". Явно разбраха какъв е проблема.
Направиха ми нова сметка прехвърлиха ми каквото трябва. Обещаха ми до днес (04.11) на обяд всичко да е в онлайн банкирането ми и да работи.
Естествено не работеше. Към 15 часа сметката се появи, но без наличност. От предната сметка знам, че след известно време всичко сработва, но досега (почти 19) това не се е случило.
Естествено не успях да се свържа с "администтраторката", за да я питам защо лъже.
В онлайн банкирането дори се опитват да бъдат забавни:
"Сметката не е на клиент на eBank (може и да е ама още не се грижим за
нея)"
Дори пунктуационни грешки имат. И това банка. И кои сте вие, дето се "грижите" за нея? Обгрижихте я добре.

Въпроси към Пощенска:
Защо лъжете? Това е непрофесионално.
Толкова ли е трудно да си намерите качествени хора? Аз ви опознах системата за 24 часа и последния път като бях във ваш офис, я познавах по-добре от служителите ви.
Защо не си вдигате проклетите телефони?! Това е непрофесионално.
Защо олигофренския ви влог (с гръмкото име "мега") не може да се управлява онлайн?
Ако беше кредит и трябваше да го погасявам сигурно един ден закъснение щяхте през носа да ми го изкарате?

Оправданието:
Естествено пиклата ще каже: "Ама да сте питали". Common sense, скъпа, common sense е да ми кажеш за тая подробност.

Изводът:
Още една олигофренска банка, която не струва. Услугата ѝ е скапана.
Трябва ли да имам 5 дебитни карти с 10 сметки вътре?!
Трябва ли да си намеря някой пенсионер, който да ходи всеки ден и да ми е един вид "електронното банкиране"?
Трябва ли просто да се науча да си държа парите кеш, защото няма ни една банка, която просто да работи?
Update (към извода):
Стоят ми парите в банка - банката ги използва.
В разплащателна сметка по-скоро аз плащам (лихва няма, таксите са меко казано високи). Вие ми вземате парите, аз плащам?
Във влога уж получавам някаква келява лихва, но нищо не работи и тия олигофрени ми хабят време (което е в пъти по-ценно от смешната им лихва).
Често се случва тия приключения да завършат по кофти начин - аз тоя уикенд до тия пари достъп нямах.
Мисля си, че да си държиш парите в банка е тъпо, адски тъпо. Аз обиколих няколко банки, все нещо не им е наред. И обслужването - нямам думи, един долнопробен ресторант по морето има по-адекватно обслужване (поне служителите си познават ресторанта).

Въпросът:
Някой знае ли поне една професионална банка, която предлага само едно: да ми достави безупречно електронно банкиране? Не искам нито да я виждам на живо, нито да комуникирам с безумно противните лелки/какички, които знаят само едно "не сме ние виновни". Искам просто да ми се предоставят ограничен набор от услуги и те да работят 24/7.

П.П. Определено тонът ми е груб, но тия са поредните олигофрени, които ми губят времето и ми лазят по нервите.

П.П.2 И не, определено няма да пиша "молби" или "оплаквания". Отговорът ще е в стил Мтел: "ми откраднахме ти 100 лева за половин мегабайт интернет, ама да не си блял, целият ни бизнес план се гради на измами, ти кво искаш - да спрем да работим ли?"

Apache Tomcat 6 - enlarge VM's heap space

By default enlarging Java VM's heap space happens via "-Xms128m -Xmx512m".

How do we tell Tomcat 6 about it? They say via the CATALINA_OPTS variable (which is shared by all Tomcat instances on that machine). Or even via JAVA_OPTS (all java programs would use these settings).

But what if I want to set these options only to a specific Tomcat instance?
Google couldn't answer that.

I could mess with the startup scripts, which is not a good idea.

The best solution I found is to set the variable (CATALINA_OPTS) only on the console instance that is to start the Tomcat. This variable is not visible to other instances.
This works on windows - because of the temporary variables.

Vista...again...for the last time

I had a 2GB MemoryStick Duo Pro left from the last phone and I didn't know what do with it.
ReadyBoost was a nice feature to try out (Vista uses the flash card to boot faster).
The card was small in size so it wasn't a problem to keep it always in. I rarely if never use the card reader.

Now Vista starts even slower. The last boot it stood at least a minute on the login screen and hdd went crazy.
After my desktop appeared the it took a few more minutes for the hdd to calm down.

I'm waisting so much time complaining about it. I won't write for Vista anymore.

XP and Vista restart when they've installed a new update

So I choose to do something on my laptop (Vista) and just when I start doing it there's this annoying window - you have to restart - and it's bugging you once and a while. If you choose to ignore it long enough, it'll restart the machine right in the middle of a movie. How frustrating is that?!

There's an XP machine I have that has a service running. The service MUST be up all the time. The choice of operating system was not mine. So the XP updates and then restarts without restarting the service. How frustrating is that?!

I know that Vista and XP are end-user OSs, but how can Vista restart while I'm using it?!

'Vista's User Account Control

After a year with it, I switched it off.

It's slow and it proved useless.

Let me explain:
It's slow because switching to this darkened look while in Aero is taking a while. Caching keypresses is off, but I guess this is part of the idea.

It's useless:
Most software now requires privilege elevation, because ...well, I don't know. To spy better I guess. Why would Skype or Picasa require elevation otherwise?
It's useless because after you confirm the elevation, this software can do practically anything.

I prefer the old-school way of doing things right - never ever enter the machine with an administrator.
Very, very rarely elevate some CHECKED software with an admin user.
This is the best way to keep windows clean.
There's no need for an antivirus, only very rarely to assert one's self that everything is all right.

Does anyone know a good antivirus with the following characteristics:
1. Uses a maximum of one or two processes
2. It's easy to switch the real-time part of it off. To be able to switch it off completely without having to user regedit.
3. Small memory footprint.
4. To do a pretty good job.
5. Simple minimalistic interface where the "scan memory, registry and harddrives" button is on the front panel and there are no other buttons but the Update one.

Hibernate, @EmbeddedId and renaming columns

Making a composite natural key looks like that: (example from Manning book for JPA/Hibernate):

public class UserId implements Serializable {
    private String username;
    private String departmentNr;
    ...
}

And using it:

class SomeClass {
    ...
    @EmbeddedId
    private UserId userId;
    ...
}

The column names in SomeClass are id_username and id_departmentNr.
So one can't do the following

@SuppressWarnings( "unchecked" )
List<SomeClass> old = (List<SomeClass>) em.createQuery(
    "from someClass sc where sc.userId.username = :username and
sc.userId.entityType = :departmentNr")
          .setParameter(...).getResultList();

Because Hibernate wouldn't recognize the column names - it would say something like "someclass0._username - cannot find it".
So one has to do column names rewriting:

class SomeClass {
    ...
    @EmbeddedId
    @AttributeOverrides( {
        @AttributeOverride( name = "
username", column = @Column( name = "username" ) ),
        @AttributeOverride( name = "
departmentNr", column = @Column( name = "departmentNr" ) ) } )
    private UserId userId;
    ...
}

Which sucks 🙁

KFC sucks

On Saturday while shopping we decided to have a lunch at KFC (not because I like them, but because there were no duners around).

We had stomach issues for two days.

On top of that KFC is as expensive as grabbing a pizza in a decent restaurant.

KFC is full with idiots waiting to buy crappy food. I had to wait on a queue.

At KFC the chicken thing was full with water - I guess it was frozen and then directly fried.

KFC is unsanitary - I had to eat on a table used by some teenagers who left a ...(how to delicately put it).. a mess.

For me everybody eating at KFC is a complete moron.

I think McDonalds is the same shit, but at least I never had stomach issues after eating there.

Again for Vista and SP1

After SP1 was installed 7 months after it was released my Vista started downloading updates on an hourly basis. It was like SP1 was too big and my Vista was constipated. After it was installed it installed a couple of other updates, restart, then it started downloading new updates immediately, and this repeated twice. Installed so far:

Off topic: SP1 required an amazing 4.5 GB?! Dudes at microsoft, my HDD is 80 GB, do you plan to fill it all up with this shitty operating system?!

My windows folder is 14 (fourteen !!!!) GIGABYTES. And I have to clean it up, because windows is unable to do that for me.

Vista's "lock user" feature

Sometimes I lock my machine using WinBtn+L.
Sometimes while locked, windows thinks Alt is pressed. So I can't write my password because certain characters invoke some commands.
It's really annoying. I have to press the control (gray ) buttons several times, sometimes this does not help I have to use "swich user" which is (as every single part of Vista) SLOW.

I should make a separate "Vista SUCKS" section.

Windows Server did something so Microsoftish

It's 2 o'clock in the morning. I'm tired, I'm frustrated and I hate all that is Microsoft more than ever.

What happened.
Few hours ago there was a power surge. After the power was all back, my server started, I could ping it, but that was pretty much it. Nothing else worked.

I had to get a monitor at one past midnight to diagnose.
Long story short (it's 2 o'clock remember?) it came out that RRAS (Routing and remote access services) somehow started itself up to such an extent as to f*ck up my firewall, so my server went dead (network wise) - the ipnat.sys issue - very common it would seem.

After an hour of trial and error I fixed it using Safe Mode (Stopping the Firewall, starting RRAS, stopping RRAS, starting the Firewall, and the ICS afterwards). Fortunately neither the ICS, nor the Firewall lost their settings.

And..... I have to get up after three hour to drive to Greece.

I hate you microsoft software..

S60 Sucks, The phone rulez

S60 is a software platform for mobile phones, running on Symbian OS.
I have to work with it since I got my new Nokia E71.
Well I don't know if it's Symbian or S60, but I don't like it.

First, I can't save my laptop as a trusted bluetooth device. So it asks me on every single operation if my laptop is trusted. WTF? My previous phone could do that.
Second, I can't see my IP while in a wireless connection. No such option. This is important to me.
Third, I can't find the control panel which is for the keyboard layouts installed. WTF? I can't find the control panel for bluetooth. I can't find the control panel for anything.
Fourth, the Cyrillic language layout is really weird. Yea, ok, it's actually Russian, but still, it's weird.
   MTEL, YOU BASTARDOS, MAKE A BULGARIAN PHONE, YOU LAZY FUCKERS, FOR ONCE DO SOMETHING ON YOUR OWN AND DO IT RIGHT.
Fifth, I can't get the flash card and plug it in, the phone has to be restarted. WTF? My previous phone could do that.
Sixth, The phone crashes too often. At least it reboots fast and goes right in the menu where it crashed. This is nice.
Seventh, I can't use the Cyrillic capital characters of М, Н, О, П in my address book, since the Address book crashes. It cannot list them, but the quick search works. WTF? My previous phone worked perfectly with Cyrrilic.
   Now my whole Address Book is in Latin. I don't like that. I want to use Cyrrilic. I'm really dissapointed.
Eighth, The software for editing the address book sucks. It's slow. Opening a contact list - 3-4 seconds. Saving it - 4-5 seconds. WTF?

These are the bad things, and they are driving me crazy. I'm waiting for an update. This is an example how Nokia can skrew such a nice phone with such a stupid OS.Do
Don't get me wrong I don't regret bying this phone and I'll find a way around all those things.

JAX-WS wsgen tool

Now, fix this one:

...>wsgen SomeInterface -wsdl -cp .;more.jar
Problem encountered during annotation processing;
see stacktrace below for more information.
java.lang.NullPointerException

        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.isSubtype(WebServiceAP.java:418)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.isRemote(WebServiceAP.java:413)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:8
13)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java
:644)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.ja
va:624)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisi
tor.java:542)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVi
sitor.java:352)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisi
tor.java:145)
        at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:347)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:232)
        at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
        at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
        at com.sun.tools.apt.main.Main.compile(Main.java:1102)
        at com.sun.tools.apt.main.Main.compile(Main.java:964)
        at com.sun.tools.apt.Main.processing(Main.java:95)
        at com.sun.tools.apt.Main.process(Main.java:85)
        at com.sun.tools.apt.Main.process(Main.java:67)
        at com.sun.tools.internal.ws.wscompile.CompileTool.buildModel(CompileTool.java:605)
        at com.sun.tools.internal.ws.wscompile.CompileTool.run(CompileTool.java:538)
        at com.sun.tools.internal.ws.util.ToolBase.run(ToolBase.java:56)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.internal.ws.Invoker.main(Invoker.java:63)
        at com.sun.tools.internal.ws.WsGen.main(WsGen.java:30)
error: compilation failed, errors should have been reported

A NullPointerException from a tool bundled in the JDK, how serious is this? Too bad for the 150 000+ test the guys at Sun did.

"errors should have been reported"?, yea they have been, but SO WHAT?

About killing

Few days ago I accidentally hit a sparrow with my car. The poor creature did not survive. There's a really heavy feeling that grabs you right after that moment. Anger, frustration, trying to exonerate one's self. Sadness.

And if that's not enough, yesterday I hit a fox on the highway. I did not even stop to see what happened for which I kinda feel guilty. Again the sadness and thinking about life, the universe and everything else.

Damn bad luck. I have never hit anything before. And from the feeling of it - I'm no good for taking lives - I just can't bare the thought of it.

Blogs that supply part of the content in the RSS/Atom feeds

There are blogs that only supply a resume or part of the content in the RSS. And the reason, I guess, is that they want you to leave the comfort of your own RSS reader and visit their site and maybe see some ads or who-cares-else what.

Well, FUCK THEM. The best I know are not doing it. Actually the best I know have no ads and have minimalistic web sites (I understand it as only content and unobtrusive navigation buttons/links).... and..... provide outstanding content.

Blogs that do that:
http://www.karieri.bg/blog/
http://www.nova-rabota.com/

I decided to stop reading them.

Other things that turn me down - copyright footer, a lot of links like "vote for me in ...." and guys that start taking themselves too seriously. For the latter I'm ready to make an exception, because some of them have an amazing style.

Vital equipment dying

I think I'm having a bad dream.
Most of the most important technical equipment around me is failing:

First the phone: SonyEricsson K750i. An amazing machine. Very sturdy, survived a swimming pool, being lost in the snow while snowboarding, numerous hits, is now dead.

The laptop's battery completely fucked up, it's constantly overheating. The laptop itself is scaring me up - not to die one day - it's a DELL, so....

My car is on the end of its usable life. Although I'm so thankful to it for saving my life after all the stupid things I did when I was younger, I have to change it.

I'm planning to buy a motorcycle.

It's partly my fault - most of the equipment was showing dreadful signs for a long time, but I constantly postpone to take measures.

So now to be able to buy all that I'm thinking of finding a second job or sell a kidney.

I hate CDs/DVDs

I really do. Windows doesn't seem to understand them - the whole system stops and waits for a single DVD. The laptop is shaking.

Read/write times are really slow. Burning them with the windows's ATAPI service is hell.

When used to working with 3-5 MB/sec without worm-up times and spin times and whatever else times, it's really annoying.

But DVDs are the only reasonable way to give someone 15 GB even though you'll have to spend 2 hours to burn them.

P.S. I want to remove my laptop's DVD combo whatever bullshit, but I can't 🙁 It's such a waste of weight and space.

Vista/XP can't burn a single CD/DVD without infuriating you

This is part of the series 'Vista sucks'. Although XP sucks as much as Vista
in this case.

 

There was a feature first introduced in XP for burning CDs. In Xp the service
was called something like ATAPI burning or whatever. Couldn't burn DVDs. In
Vista the same software could burn DVDs. I couldn't find the service name. I may
have missed it somehow.

So this software was a nice feature - simple, fairly stable.

But it's so darn slow and requires twice as much space as the burned data.
Here's why:

First you copy the files on the CD/DVD with Windows Explorer. This copies the
files in a cache of some kind. Trying to burn 4.5 GB requires 4-5 minutes of
copying - and the machine is unusable  - copying utilizes the HDD. If you do
something else it could take up to 20 min.

Then to burn them, the wizard should be started - this again copies the files
to another cache I guess. Again 5 to 20 minutes.

This means 9 GB of space needed + the actual 4.5 GB. And a lot of time.

Vista/XP you messed up a good idea again. Vista/XP you suck.

As far as I can remember Nero was a lot faster, no cache needed, or at least
no that much. Is Nero still good? Is there a light version of it?

 

Adding columns to join tables (in the context of JPA/Hibernate)

At some point in a @ManyToMany relationship I had to add some extra columns in the join table (the middle table).

Here's what Gavin King says in Java Persistence with Hibernate (a notable book on the subject):

Adding columns to join tables
You can use two common strategies to map such a structure to Java
classes. The first strategy requires an intermediate entity class for
the join table and is mapped with one-to-many associations. The second
strategy utilizes a collection of components, with a value-type class
for the join table.

Later in that chapter for the first approach (the extra entity for the middle table):

The primary advantage of this strategy is the possibility for
bidirectional navigation: You can get all items in a category {...} and
the also navigate from the opposite direction {...}. A disadvantage is
the more complex code needed to manage {...} entity instances to create
and remove associations—they have to be saved and deleted
independently, and you need some infrastructure, such as the composite
identifier. However, you can enable transitive persistence with
cascading options on the
collections {...}, as explained {...}, “Transitive persistence.”

Later in that chapter for the second approach (the collection of components approach):

That’s it: You’ve mapped a ternary association with annotations. What looked
incredibly complex at the beginning has been reduced to a few lines of annota-
tion metadata, most of it optional.

Naively enough I chose the second approach. Who cares that there's a
hibernate dependency in my JPA data access layer. I already have a few
(a hibernate interceptor).

In this approach I had to use the @CollectionOfElements annotation. @CollectionOfElements
works like that: it maps a collection (set, map, list) of something to
a table. This table has no entity attached to it. It can work with
value types, Strings and @Embeddables. In my case it had to be the @Embeddable.

Let me give you an example - it will clear things up: there are classes
and there are students - two entities. There can be two classes with
many students some of which are the same - so the relationship is @ManyToMany. The extra column in the join table would the grade of the student in that class.

So the approach with the @CollectionOfElements works like that: one of the entities holds the relationship - let it be the class entity - so it has something like that:


@Entity


public class
Class {
    @Version
    private int version;
    ...
    @org.hibernate.annotations.CollectionOfElements
    private Set<GradedStudent> students;
    ...
}

Student is a simple entity, no code needed. Let's call the student with the grade an GradedStudent:


@Embeddable


public class
GradedStudent {
    ...
    @OneToOne(..., cascade = {MERGE, PERSIST, REFRESH})
    private Student student;
    ...
    @Column( nullable = false, ... )
    private int grade;
    ...
}

That's pretty much it. Seems simple, you would think and straightforward.

BUT IT DOESN'T WORK.

Here's what gets wrong:

  1. Everytime a class entity gets queried, it's version gets incremented. This makes updating a disconnected entity far more difficult and makes the @Version kind of obsolete.
    Solution: none, I couldn't find anything remotely connected to this problem on the net.
  2. The primary key in the join table (with a name like 'class_gradedstudent') is not the [class_id, student_id] but is [class_id,
    student_id, grade]. If you put extra columns in the join table and they
    are nullable = false, they would become part of the primary key.
  3. Cascading fails. You have to create and persist a Student first in order it to become a part of a certain class entity. Even though a GradedStudent is said to cascade a Student.
    Solution: none, I tried everything I could think of - no luck. I
    couldn't find anything remotely connected to this problem on the net.

Regarding 2: a quotation from the same book:

There is only
one change to the database tables: The {...} table now has a primary
key that is a composite of all columns, not only the ids of the two object, as in
the previous section. Hence, all properties should never be nullable—otherwise
you can’t identify a row in the join table.

Well, what if I don't want that? It doesn't say.

So, actually the second approach is not an option.

Gotcha MTEL, YOU CHEATING BASTARDS

From some time I noticed that Mtel (my mobile service operation) is using VoIP when I'm calling an Mtel number while roaming.
When I'm calling another operator's number while still roaming, there's no VoIP.

CHEAP BASTARDS. For these prices you can at least provide a decent service - a VoIP call is with bad quality and the callee cannot see who's calling, he sees some service number.

BUT THATS NOT ALL.

The top of the cherry is that when Mtel is using VoIP they clearly cannot see whether the other side answers or not, so no matter whether you make a successful call or not - while you're ringing you get billed. That's not right, is it?!

I found out all that today while checking my bill. Two months ago while in Brno I made a call and was quite sure that I would get billed for that call even though nobody answered.

GOTCHA, YOU CHEAP BASTARDOs

Update: other case of proved cheating:
Mtel made me pay 200 bucks for half a megabyte of internet while roaming. Before that I explicitly asked for the price. It came out that the price is 10 times more and they charge every GPRS session for a full megabyte (with 10 times the prices) without saying it.

Few months ago I caught them billing me for an international call to a friend I haven't spoken with for at least a couple of years.

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]

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?!

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?!!

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.

'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.

ant junitreport task cannot set vm arguments

ant junitreport task creates a html report from junit xml report files.
If the xml files are numerous enough and/or large enough (mine were 102MB total ), the task crashes with OutOfMemoryError.

Solution? set the GLOBAL variable ANT_OPTS. This changes defautl ant conf for the whole machine this setting is on.

Not very nice 🙂

CVS: dying gasps from server

Why can't there be software that just works?!

There's a CVS server (version 1.11.22) [one can get the version with cvs version -d cvs_root] on a Linux machine.

There's a Hudson on the Linux machine that queries the cvs just fine.

I have Hudson on a Windows machine that gives me:

cvs checkout: dying gasps from server unexpected

The explanation? Here's the best I could find:
dying gasps from server unexpected

There is a known bug in the server for CVS 1.9.18 and older which
can cause this. For me, this was reproducible if I used the -t global
option. It was fixed by Andy Piper's 14 Nov 1997 change to
src/filesubr.c, if anyone is curious. If you see the message, you
probably can just retry the operation which failed.

Sources:
http://magic.astro.uni-wuerzburg.de:81/mars/cvserror.html
http://cvsman.com/cvs-1.12.12/cvs_210.php
http://developer.apple.com/opensource/cvs/cederquist/cvs_174.html

Now check the version of the server I have (in the beginning). So what do we do now?!

Why can't there be software that just works?!

Eclipse, interface implemented by classes, but the implementation is in a base class

Suppose there's an interface

interface PrimaryObject {
    int getVersion();
}

and

public class Base /* not inheriting PrimaryObject */ {
    int getVersion(){}
}

now suppose there are a lot of classes like

public class Class1 extends Base implements PrimaryObject {
}

So why did I mention Eclipse in the title:
When you go to the interface and press Ctrl + T on the interface itself you get a list of all the classes like Class1:

But you you press Ctrl + T on the method you get NOTHING:

Eclipse fails to show all the classes that implement this interface and this method.

SG Expressbank

Another bank that I'm unhappy with - SG Expressbank. Reasons

  1. They charge me with 0.69 on ATM withdrawal.
  2. They charge me with 1.39 (monthly fee)
  3. Interest rate: 0.00
  4. E banking application - outrageously bad (screws up every file format I request, cannot send money to an account without going to the bank (some security shit), ugly, not intuitive)
  5. The service is far from good.

I'm looking for a decent bank. Any ideas?

EJB Sucks: one more reason why

I'm trying to like the specification, but I just can't.
Here's one more reason why:

I have SSB (Stateless Session Beans). The persistence is via JPA (implementation is Hibernate).

All my business method look something like:


...
public Object1 doSomething( Object2 ) throws ApplicationException1;
...

I use CMT (Container Managed Transactions) which means that the container calls begin() before the method call and commit() after the method call is over.

The problem: what happens if the transaction is rolled back?

A RollbackException is thrown. It looks common sense to try to rewrite it as ApplicationException1. Well.... YOU CAN'T.

No F way (at least not an easy one).

Solution1:
Make the Beans stateful and use SessionSynchronization. UGLY - I don't want to be stateful.

Solution2:
Implement TransactionSynchronizationRegistry - just look at it.

Solution3:
Make a facade EJB that calls my own EJBs which should use requiresNew. One more level of abstraction? I have to change the contract? I don't have just one Bean, so a wrapper for every single one of them?

Solution4:
Switch back to BMT (Bean Managed Transactions) and call begin() and commit() myself. Well then the container becomes useless. But my business methods are rarely longer than a few lines, so I'm choosing this one.

CMT without any simple way to plug after commit() and this is an enterprise level spec? Really?

I'd be really happy if someone corrects me and shows me a simple way to do what I need.

MySQL sucks: one more reason

MySQL is a RDBMS. Or at least that's what it's creators claim it to be.

There's no other self respecting database who's only engine that implements transactions (innoDB) is not created by MySQL guys. Only until recently their own engine claims to support them. Even small in-process databases like Hypersonic and Derby fully support transactions from version one. Flawlessly.

Today I found one more reason for which I think MySQL should not be put under the category RDBMS:

Caused by: java.sql.SQLException: Too many tables; MySQL can only use 61 tables in a join
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:3026)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1137)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1231)
        at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
        at org.hibernate.loader.Loader.doQuery(Loader.java:674)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)

Until recently the maximum was only 31 table. A major WTF?!

I would gladly bet that Hypersonic and Derby do not have a constraint like that (haven't investigated it though).

The stack trace is intently complete to show that this comes from Hibernate. This can be reproduced by having a rich object model with EAGER fetching.

Maybe I'll write a little more on the EAGER fetching and the issues I have: here.

ICQ in GoogleTalk web client (gmail) - revised

What I wrote so far:

Open browser, go to the messenger part, log in, as simple as that.

First impressions:

  • no ICQ groups - that sucks - I used to use it a lot
  • aliases
    of people are retained ('MG Zas' for example) - which is a backup for
    groups ('group MG -> user Zas' becomes 'MG Zas').
  • Cyrillic characters work fine (if it was working with my other client - Pidgin/Gaim)

Concerning
the standalone client - Google Talk - I have no idea if it works there
- Google have a pretty wierd update policy - they update silently and
only some clients - it sucks.

After all  - it's usable

After a week of using it this is what I noticed:

  1. Cyrillic doesn't always work with everybody, sometimes UTF-8 comes as cp-1251, even though the browser is in UTF-8.
    1. However, when I write, everybody sees it correctly.
  2. No way to give authorization to people, no way to ask for one.
  3. No way to see user info. No way, really.
  4. Some of my peers receive everything in html. It's hard to chat with them.
    1. I guess people without the official client.

After all - it's still usable, but I'm not going to recommend it to any more.