[en] Internet Explorer, Chrome, Safari transform: skew aliasing aka jagged edges

Let’s say you have an HTML code as this one:

<section>
    <img src="gfx/slider1.jpg" alt=""/>
    <article class="container">
        Lorem ipsum dolor sit amet...
    </article>
</section>

and you skew it using CSS transforms (I’m using LESS):

section {
    position: relative;
    overflow: hidden;
    height: 740px;
    transform: skewY(-2.917deg);

    > img, > article {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
    }

    > article {
        transform: skewY(2.917deg);
    }
}

It works nicely in all modern browsers, but of course Internet Explorer must give you a headache by presenting jagged, aliased edge:

To force it to antialias the edge, just apply this little fix:

section > img {
    top: -1px;
}

and suddenly it looks like this:

Why? It seems IE antialiases only the transformed element’s edges, but does nothing for its contents. When image is moved beyond parent, skewed element — its antialiasing takes care of stuff.

If it has jagged edges in Chrome, Safari and other Webkit-based browsers, apply another fix:

section {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

[en] Get NamedQuery as string in Eclipselink

It’s nice to have all the queries in one place and @NamedQuery give you just that. But what if you need to have parametrized ORDER BY or stuff like that — NamedQueries are static and cannot be modified and ORDER can’t use a parameter.

There is no simple way to customize the NamedQuery, too. You can use setMaxResults but not „setOrder”.

My solution is to read @NamedQuery annotation’s „query” parameter and construct the query myself, adding necessary ORDER BY clause.

The code is (Eclipselink-specific):

import javax.persistence.NamedQuery;
import javax.persistence.Query;
import org.eclipse.persistence.internal.jpa.EJBQueryImpl;
import org.eclipse.persistence.queries.DatabaseQuery;
// (...)
public String getNamedQueryString(String namedQuery) {
    Query tmpQuery = entityManager.createNamedQuery(namedQuery);
    DatabaseQuery databaseQuery = ((EJBQueryImpl) tmpQuery).getDatabaseQuery();
    Class resultClass = databaseQuery.getReferenceClass();

    NamedQuery annotation = (NamedQuery) resultClass.getAnnotation(NamedQuery.class);

    // it's possible there's NamedQueries instead of single NamedQuery annotation
    if (annotation == null) {
        NamedQueries annotations = (NamedQueries) resultClass.getAnnotation(NamedQueries.class);
        for (NamedQuery nq : annotations.value()) {
            if (namedQuery.equals(nq.name())) {
                annotation = nq;
                break;
            }
        }
    }

    return annotation.query();
}
// (...)

[en] Install unsigned driver in Windows 8

They just love complicating simple things. Following is stolen from http://forum.xda-developers.com/showthread.php?t=2303046

The steps to install a unsigned driver on windows 8 is as follows.

  1. From windows 8 control panel choose General –> Under “Advanced Startup” –> Restart now.

Now the system will restart and might take some minutes to show up the boot menu. Wait for It patiently.

After some time you will be prompted with a menu with following options.

  1. Continue

  2. Troubleshoot

  3. Turn off

Choose Troubleshoot

Then the following menu appears.

Refresh your PC Reset your PC Advanced Options Choose Advanced Options

Then the following menu appears

System Restore System Image Recovery Automatic Repair Command Prompt Windows Startup settings Choose Windows Startup Settings, then Click Restart.

Now the computer will restart and the boot menu appears. Choose “Disable Driver signature Enforcement” from the menu. Now windows will start and you can do the installation of the driver that is not signed.