[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 trans­forms (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 brow­sers, but of course Inter­net Explo­rer must give you a heada­che by pre­sen­ting jag­ged, alia­sed edge:

To force it to antia­lias the edge, just apply this lit­tle fix:

section > img {
    top: -1px;
}

and sud­denly it looks like this:

Why? It seems IE antia­lia­ses only the trans­for­med element’s edges, but does nothing for its con­tents. When image is moved bey­ond parent, ske­wed ele­ment — its antia­lia­sing takes care of stuff.

If it has jag­ged edges in Chrome, Safari and other Webkit-based brow­sers, apply ano­ther 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 para­me­tri­zed ORDER BY or stuff like that — Name­dQu­eries are sta­tic and can­not be modi­fied and ORDER can’t use a parameter.

There is no sim­ple way to custo­mize the Name­dQu­ery, too. You can use set­Ma­xRe­sults but not „setOrder”.

My solu­tion is to read @NamedQuery annotation’s „query” para­me­ter and con­struct the query myself, adding neces­sary 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 com­pli­ca­ting sim­ple things. Fol­lo­wing is sto­len from http://​forum​.xda​-deve​lo​pers​.com/​s​h​o​w​t​h​r​e​a​d​.​p​h​p​?​t​=​2​3​0​3​046

The steps to install a unsi­gned dri­ver on win­dows 8 is as follows.

  1. From win­dows 8 con­trol panel cho­ose Gene­ral –> Under “Advan­ced Star­tup” –> Restart now.

Now the sys­tem will restart and might take some minu­tes to show up the boot menu. Wait for It patiently.

After some time you will be promp­ted with a menu with fol­lo­wing options.

  1. Con­ti­nue

  2. Tro­uble­shoot

  3. Turn off

Cho­ose Troubleshoot

Then the fol­lo­wing menu appears.

Refresh your PC Reset your PC Advan­ced Options Cho­ose Advan­ced Options

Then the fol­lo­wing menu appears

Sys­tem Restore Sys­tem Image Reco­very Auto­ma­tic Repair Com­mand Prompt Win­dows Star­tup set­tings Cho­ose Win­dows Star­tup Set­tings, then Click Restart.

Now the com­pu­ter will restart and the boot menu appe­ars. Cho­ose “Disa­ble Dri­ver signa­ture Enfor­ce­ment” from the menu. Now win­dows will start and you can do the instal­la­tion of the dri­ver that is not signed.