adsense szeles

Sunday, October 19, 2014

Android "Lollipop" for Nexus 4 confirmed

I'm very happy because I don't have to return to the hacky, smelly, dirty homebrew ROM stuff. While Nexus 4 is at least two years old, I still feel that it's hardware is quite decent (easily overtakes the recent "cheap but strong as hell" MediaTek SoC's), and because the newest major Android release is on the way to my device, I think I can postpone the phone buying project for at least 1 year.
We will see how Lollipop performs. As a fact, I did not factory reset or whatever my phone since the end of 2013, and it's still very fast and responsive. Hope Lollipop also does this job.
(I'm using the full factory software stack by google, not even CWM is installed).
This is a clear evidence that Android phones doesn't need factory resets from time to time - it's not Windows 98 or something. One just have to avoid crappy phones (and Android phone companies often create crappy builds. Still don't understand why they slow down AOSP).

Tuesday, July 22, 2014

Friday, July 4, 2014

Java reflection: get value of nested fields

Scenario: we have a bean with singular and associated fields. Associated fields have nested fields, too. We have two instances of the bean, some original and a modified version. We created two annotations, @Audited and @NestedAudit. The first is used for singular fields, the others for associated fields. We want to write some log information of the updated fields in both level. The code is as follows.

for(Field f : class.getDeclaredFields()) {
   if(f.isAnnotationPresent(Audited.class)){
    try {
     f.setAccessible(true);
     Object a = f.get(original);
     Object b = f.get(updated);
     if(!Objects.equal(a, b)) {
      // log change audit
     }
    } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
    }
   }

   if(f.isAnnotationPresent(NestedAudit.class)){
    for(Field g : f.getType().getDeclaredFields()) {
     if(g.isAnnotationPresent(Audited.class)){
      try {
       f.setAccessible(true);
       g.setAccessible(true);
       Object a = g.get(f.get(original));
       Object b = g.get(f.get(updated));

       if(!Objects.equal(a, b)) {
        // log nested change audit
       }
      } catch (IllegalAccessException e) {
       throw new RuntimeException(e);
      }
     }
    }
   }
  }

Monday, June 23, 2014

JPA/Hibernate single table inheritance

Here is a correct annotation configuration for the following scenario:
- abstract (mapped) super class (this means the super class is not an entity itself but inherited entites gets its fields)
- two or more subclasses

On the DB layer, we want a single table, so we use a discriminator column.

@Entity
@Inheritance
@DiscriminatorColumn(name="TYPE")
@Table(name="TABLE")
public abstract class AbstractEntity implements Serializable { ... }

@Entity
@DiscriminatorValue("TYPE1")
public class ConcreteEntity1 extends AbstractEntity { ... }

@Entity
@DiscriminatorValue("TYPE2")
public class ConcreteEntity2 extends AbstractEntity { ... }

Thursday, June 12, 2014

OpenJDK: Java SE reference implementation since Java SE 7

People.

The era of "nice but malfunctional/incomplete" OpenJDK and the "not so nice, but functional, usable and fast" Oracle JDK is end by the GA release of Java SE 7.
I know OpenJDK6 was not production ready (although I created production systems with that), but that's over.

If you need official verification, please read this announcement directly from Oracle: https://blogs.oracle.com/henrik/entry/moving_to_openjdk_as_the

OpenJDK 7 is the reference implementation. It actually is what you download from Oracle (plus some closed stuff like the installer itself, browser plugin and some other things not so important that I can't recall exactly, but please fix me in comments).
If you use Linux and need a JDK, just stick to the OpenJDK package. You don't need to add (wishfully) maintained PPAs, download binaries by hand and all the stuff. OpenJDK licensing conforms distribution with other software, so it is packaged (and security-maintained) just like all your other parts of the system.
I see a general confusion on this topic. Poor Oracle failed to spread this good news.

The same applies for Java SE 8 and all future releases.

Tuesday, June 10, 2014

LinkedIn

Everybody endorses me for PostgreSQL. Still, I don't know how they know.

Wednesday, June 4, 2014

Where is my Nexus 4 4.4.3 OTA file?

I know the full factory image is released, but I need the OTA file for sideload upgrade (or normal OTA, but even when Google launches OTA, the rollout doesn't include all devices at once, so most people have to wait a few days or even weeks).
The following devices are already got the OTA files or the OTA is in progress:

  • Nexus 5
  • One M7
  • One M8
  • Galaxy S4
  • Z Ultra
  • 2013 Wifi Nexus 7
This image of Khaleesi expresses my emotions now.