SonyEricsson K750i. SonyEricsson people, THANK YOU

Sony Ericsson K750i was my phone for quite a while. This is a thank-you note to the creators of that amazing machine.
Yesterday the latest accident finished it. This time for sure. It doesn’t want to switch on. It’s not showing any sign of life.

This phone made amazing pictures,
most of my public images are made with it. It was the best of its time.
There are still phone that can’t match that. The iPhone’s camera, for
example, sucks. With a really steady hand one could make night shots
too. I had a 2GB flash card of the awful sony format – memory stick.

The opera mini made it a decent browser. I could read mobi.capital.bg and mobi.dnevnik.bg in the restroom. BTW mobi.dnevnik.bg is boring as opposed to mobi.capital.bg.
Opera mini, BTW, is an example of a perfect minimalistic software. It’s amazing. Great job.

I could use the phone with a bluetooth GPS
until I lost the GPS in Amsterdam. The software choice wasn’t that
great, because I only had Java and no operating system. Here’s the
place to mention Nav4All
– an amazing map software with routing (navigation) maps for Bulgaria.
Once I ended up in a construction site in Sofia, but I hear these
things happen to every map software. Nav4All used internet for
downloading maps, and that made it quite a drag.

ReaderManiac made the phone an electronic book reader. Again
an amazing software – I was planning to write an article about it, but
maybe some other time. I read like 10 books on it. See the read books section
(phone pages state that I read this on the phone). Navigation was
amazing. Different font and sizes, great software. It even told you
when to rest your eyes. I could supply Cyrillic fonts.

Lacking an OS made the phone very stable and pretty fast. It crashed only once a few months. I hate the so called organizers – Windows Mobile sucks big time.

The 2GB flash made the phone an excellent mp3 player.
While snowboarding at -20 degrees Celsius it was working flawlessly.
The earpieces weren’t that well attached but the quality was quite
satisfying.

A business phone: when it said that the battery was depleted it could work for at least a day at heavy use.

Negative sides:
the jacks got pretty dirty and the earpieces and the usb connection got
interferences. The screen wasn’t as bright as the new phones. The
inside of the protective glass (plastic) in front of the screen got
full with sand and dirt and it was quite hard to clean it up. Thanks,
Steen. Ugly flash card jack (memory stick duo), ugly earphones jack
(something SonyEricsson). Nokia beats it here..

Update: I’d like to thank the mobile-review site for the outstanding reviews they make. Here’s the one for K750i. Surely, I’ll consult them for my next phone too. Also, their news page looks quite deserted, I really hope, they would continue to write good reviews.

So chronologically:

First
while free-riding (snowboarding outside the track in fresh snow) I
dropped it. After 80 minutes of heavy ringing I found it pretty wet
under 20cm of snow still working and most importantly ringing so I
could find it.

Second, I swam with it in a pool for at least
half a minute. After a complete drying it continued to work but with a
few minor quirks. Battery swelled up few days later and nearly blew up
the whole phone. The new battery didn’t charge correctly. The quality
of the talks went significantly lower.

Third, yesterday I was
with the phone in the sea for around 10 minutes. This was the end of
it. It didn’t show any signs of life after that. I did everything I can.

It’s over.

Thank you, SonyEricsson people. This is was an amazing example of equipment.

Unfortunately
SonyEricsson does not have a decent model with GPS. And that’s what I’m
looking for. I’m planning to have an iPhone (my roommate has one, it’s
a decent thing, but not for a primary phone) and maybe a Nokia with a
GPS. My friends say E71, although ugly, is a pretty good one for
business purposes. Both suck at pictures.
Maybe N82 too. We’ll see.
Update2: BTW, mobile-review guys give a pretty bad review of the iPhone. They’re right, I also strongly dislike Apple and its “closed” approach, but the article seems a little prejudiced. It seems personal. A red (bad) point for them.

Any other suggestions?
I’m looking for a GPS, decent mapping software with maps and
routing/navigation, wireless, a decent camera, fast interaction, no
Windows Mobile, a lot of space, decent mp3 player, sturdy….

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.

@CollectionOfElements, JPA, the documentation and the problems it raises

In a project that I mention a lot there’s an persistent model using JPA as an interface to Hibernate.

There was case where I wanted to put extra columns in a @ManyToMany relationship. JPA cannot do that.

So I had to use the Hibernate’s @CollectionOfElements.
It works like that: if there are the objects Class and Student, the extra columns go to the wrapper class EnhancedStudent. The EnhancedStudent has a property of type Student.

Now I have a few bugs related to it:

  1. Causes the @Version of the containing object (Class) to increment on EntityManager.html#find(java.lang.Class, java.lang.Object)
  2. The creation of an ExtraStudent cannot propagate (cascade) the inner Student – no matter what.

The funniest thing is that the documentation of the @CollectionOfElements is a single line:


Annotation used to mark a collection as a collection of elements or a collection of embedded objects

http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/annotations/CollectionOfElements.html

🙁

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.

Mocking an EJB Container

There are a lot of tests for some EJBs.

Starting an J2EE server is slow. I wanted to test the business logic faster.

Most of the beans reference only each other and a persistence context.

So what should the mock worry about – transaction demarcation and dependency injection. And… exception wrapping and unwrapping.

  1. First just add some setters or change the access level modifiers (from private to protected for example).
  2. Know your transaction authority.
  3. Count started transactions. If 0, begin. If 0, commit. Rollback when necessary.
  4. Listen for all the exceptions and wrap and unwrap them.
  5. Reuse as much as possible of the code.

If I have some spare time left, I’ll write some code.

Serialization, cyclic references (via hashmaps) and overriding hashCode()

I’ll try to simplify it.
There’s an object model. In it there are cyclic references (one object references a second one, the second one – a third one, the third one – the first one).
Some of the cyclic references are through aggregations – one object has a map of other objects.
Some of the objects have a meaningful hashCode() and equals() overridden. These two depend on some properties in the object itself.

Some of the objects get serizalized/deserialized (travel through a stream).

Now here comes the problem – the deserialization first sees the cyclic reference, makes instances of all the objects, initializes all the primitive fileds, does not initialize the other fields, then links the objects.

Here comes the problem, linking two objects (one of which has a map of the other) requires hashCode(). This requires some specific properties in that object that are not initialized – this causes NullPointerException (or in my case an AssertionError).

If the hashCode returns a default value if the properties are not there – another serious problem si caused – there are objects in the map in the wrong buckets – they entered the map with the default hash, but when they got completely initialized – they now have a different hash. I think that is really bad – the map has to be rehashed.

Here’s a bug detail:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4957674

Here’s what some of the guys say on the subject:

The problem is that HashMap’s readObject() implementation , in order to re-hash the map, invokes the hashCode() method of some of its keys, regardless of whether those keys have been fully deserialized.

And:

The fix for this is actually quite easy: Modify the readObject() and writeObject() of HashMap so that it also saves the original hash code. (I am currently using this fix in production code for a large web site.) That way, when the map is reconstructed, you don’t have to recompute the hashcode—-the problem is caused by recomputing the hashcode at a moment when it is not computable.

What you *give up* with this fix is that HashMaps containing Objects that don’t override hashCode() and equals() will not be deserialized properly.

So basically, you have a choice: either it will be robust for classes that implement hashCode(), or it will work for bare Objects(). One or the other. I prefer the former, because people are supposed to implement hashCode().

But, not all my object have a rewritten equals (of course I can check with reflection which ones do and which ones don’t, but…). This would also mean that I’m using a customized collection.

There’s another proposition – to hash the hashcode.

The fix for this is actually quite easy:  Modify the readObject() and writeObject() of HashMap so that it also saves the original hash code.  (I am currently using this fix in production code for a large web site.)

The hashcode is a primitive type, so it would get initialized first and the problem would be solved. This would mean to have an hashCode() and equals() which check which one is available – the cached hash or the properties – isn’t that UGLY.

I’ll investigate more.

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

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))

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.

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?

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

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


Той: 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.

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:


In a few days

In a few days this adventure (having a blog) is going to have its first birthday. I remember the birthday because it is embedded in the admin password (yea, try me ;).

Today I was reading a few articles about having a blog (here and here) and the impression I got left with was that starting a blog is not always a good idea and to do that you have to have something to share and to follow some rules and most importantly have a goal.

F**k that. (Update: I don’t know why I put asterisks, maybe I’m afraid of the moderators ?!)

I don’t know if I have something to share. I don’t know if I have a goal set for my blog. I didn’t know about the rules until today. But I don’t care.

What made me start the blog was an article from Joel (I can’t find it right now) that simply said that a blog can help you express yourself better, can help you perfect the language you present your blog in, can help you understand yourself better. And one other thing – get more feedback for yourself – and that one is particularly precious for me.

So, do I follow the rules – no. Do I care – I guess not. (yea, sometimes I check the logs to see how ‘famous’ am I and the good results and some comments boost my ego, but that’s pretty much it). Overall, I find it a good experience and the time spent on the blog wasn’t completely waisted.

What am I going to do from now on – I guess pretty much the same thing.

P.S. Thank you my one reader for the continuing support and the few comments you left from different IPs (appreciate the effort). I would gladly buy you a beer.

E-banking – finally, there may be a winner

Seeing these posts first may help get the context of the talk:
What not to do when you’re a bank
What to do when most e-banking interfaces suck?
First Investment Bank, the sequel
SG Expressbank

Being stuck with SG Expressbank made electronic transfers impossible, because they didn’t work with epay.bg (prohibited) nor did they work with the e-banking software (every recepient has to be registered offline on-site (bank office), and for the ones that are registered the software does not work 🙂 ).

Almost by accident I tested a card I had in epay.bg for the balance (most banks have stopped this service, because of too many requests). And… I got it. It was working. Strange.

I remebered that I had registered the e-banking for that bank and had left the user/pass somewhere.

After a few days of searching I found it.  Keep in mind that getting the user/pass from the bank was quite an adventure and took more than 20 days and quite a few trips to the local office.

The login screen is right on the main page of the bank. I was amazed to see how easy the generation of the certificate was. While doing it I saw that they support smart cars (e-signatures). Well done.

The interface is really user friendly. Supports almost everything or at least it seems so. I haven’t tried it yet, because the bankaccount is nearly emtpy.

From the interface notifications can be defined: SMS notifications, email notifications. Now I’m waiting to see whether it works.

A minor drawback was that I can’t tranfer money to another bank account via epay.bg – I guess only FIB cards can (FIB is connected to epay).

And because I’m lazy to do it the old-fashion way – now I’m using the only possible way to transfer money electronically from SG Expressbank card to the new card I have – the epay’s microbill (микросметка) – another thing I have to learn how to use. It was quite straight forward to start up and use, but it takes a few days (in my case 2 full days) to tranfer the money and the commissions are not going to be small.

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.

@Lob in JPA, what if the class is not Serializable

If you have

@Entity
public class Student {
    @Lob
    private static MyPictureClass picture;

and suppose you forgot to put Serializable to MyPictureClass, then guess what: there’s no exception. You have to check the data in the DB.

Surprise no2:
Suppose MyPictureClassis a base abstract class and it is not Serializable. Suppose every inheriting class is Serializable. Then what happens? Well one thing’s for sure: there wouldn’t be an exception, but there wouldn’t be any data in the DB (you’ll get null). The runtime checks (in Hibernate) check the signature of the defining class I suppose, not the supplied class at runtime – and I would assume the opposite, because serialization works the opposite way. Maybe it’s because Hibernate does some runtime bytecode modifications.

Primitive types as fields in an JPA Entity

The JPA spec supports primitive types as @Columns. What they don’t say (assuming Hibernate is the implementation (maybe TopLink does that too)) is that this column becomes nullable = false and the default value is the default for the primitive type. And that is so, even though the @Column(nullable by default is true.

So

@Entity
public class Person {
    private int age;
    private boolean male;

actually means

@Entity
public class Person {
    @Column( nullable = false )
    private int age = 0;
    @Column( nullable = false )
    private boolean male = false;


So watch out.

The new firefox 3.0 RC1 (update: RC2)

The new firefox 3.0 (not final yet – rc1 for now) is awesome. Most plug-ins don’t work yet, but that changes very rapidly.
The engine itself is unbelievably fast and looks pretty stable – for a few days it crashed only once – trying to start the updater.

Try it, definitely try it. Link.

Update: the RC2 is out. The link points to it.

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?

hudson ant javac unit-tests fork=true, cannot start javac.exe compiler

Hudson is a continuous integration tool similar to CruiseControl. It has a very good web GUI for defining tasks unlike CruiseControl.
Inside it I have configured a call to an ant task.

Strangely enough in on of the projects that had to be build I got:

build.xml:200: Error running _path_to_jdk_/javac.exe compiler

Strange.

I double checked the script in eclipse. It worked.
Manual call to ant on the eclipse machine also worked.

Then I went to the Hudson machine (a test environment). I ran the script manually. The same freaking error.
I copied the whole dir to another place on the test environment: no problem.

Maybe it’s the credentials: added read/write to all. Still the same error.

Then I ran the script with: ant -verbose and see what I got:

_path_\build.xml:75: _path_\javac.exe compiler
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:509)
        at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:997)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.io.IOException: Cannot run program “_path_\javac.exe”: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at java.lang.Runtime.exec(Runtime.java:593)
        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 org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:828)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:506)
        … 20 more
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
        at java.lang.ProcessImpl.start(ProcessImpl.java:30)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        … 29 more
— Nested Exception —
java.io.IOException: Cannot run program “_path_\javac.exe”: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at java.lang.Runtime.exec(Runtime.java:593)
        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 org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:828)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:506)
        at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:997)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
        at java.lang.ProcessImpl.start(ProcessImpl.java:30)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        … 29 more

Cannot create a process?!
That’s weird.

So tired enough I did something desperate:

From

<javac fork=”true”

I went to


<javac fork=”false”

and it worked ….. 🙁

Keep in mind that in the same build project I was calling a few other build.xml doing <javac fork=”true”
several times before this one.
But this one was the only one having a reference to junit.jar (somewhere on the net I saw an article saying something about junit but don’t remember what).

So I left it like this.