Freitag, 2. September 2016

Passport in-person checklist for the U.S. Consulate in Frankfurt


Official Checklist: for comparison.


Summary and take-away follows.


Do bring:

  • Appointment (alternative link) printed out.
  • Printed, filled out but unsigned Form DS-11 (A4 paper is ok)
  • Social Security Number
  • Pre-paid, filled out courier envelope:  DHL Express Easy Brief
  • Evidence of U.S. Citizenship (e.g. expired passport)
  • Present Identification (e.g. German Personalausweis)
  • Photocopy of Identification (I was not asked for this)
  • Photo (2 x 2 inches - 51 x 51 mm)
  • Around $135 dollars in cash or a credit card

Do NOT bring any electronic devices. They are 100 % strict about this.
There is a little shop ~500 meters next to consulate which takes the mobile phone in safe keeping for €2 in case you forget. You get a numbered plastic card to get the phone back later.


Notes:
The appointment is "only" for the front gate. You will get a number from the front gate and later inside they will call your number. Waiting time inside is up to and around 45 minutes.

Present Identification: This one is interesting. The official checklist states that an expired passport would be sufficient. But in my case they wanted another ID so I used my German Personalausweis.

Montag, 29. August 2016

Top 10 missing features from the Audible Android App

I love audio books and I love Audible.

The choice and prices are great, the Audible productions use great narrators and are high quality and
the support is top notch and always helpful!

With everything else being so great it is surprising that there is a product which is not up to par.
That product is the Audible App for Android which is severely lacking in organizational features for users with large libraries.

This post is intended to reach out  to the Audible mobile app developers and give them some feedback and ideas for the future.

Without further ado here are the top 10 missing features from the Audible Android App
  1. Let us organize our books by tags, Don't just show them all in a single long list.
  2. At least show folders for books of a series and make it easy to buy the missing ones.
  3. Let us tag books and filter by tags. The current filters are practically useless.
  4. Allow users to sort their library by user rating, bestselling and a percentage count showing how many users have finished the book.
  5. Show the user rating and top comment in the book description popup.
  6. I want my cloud book list to filter the finished titles out and the device book list to show the finished books so I can easily delete them. So basically remember that filter setting per list!
  7. Let users add a custom sleep mode time, 30 is too long and 15 too short!
  8. Allow us to shake the phone to reset the sleep timer
  9. Synchronize play time position between devices not only on the first play.
  10. Consider open sourcing parts of the App so the community can help adding these features!

Explanation


At the heart of this list is the desire for more organizational and discovery features.

User with large libraries are overwhelmed by the single large book list with few useful filter options.

Collapse

Let us organize and collapse books by a common feature like a folder or tags.

Folders are great but maybe to limiting for audio books, so tags are a more powerful concept and allow for greater organizational flexibility. For example The Crossing from Michael Connelly is both a part of the Harry Bosch as well as the Mickey Haller series. So let's tag it with both.

Filter

Let us filter by tags so the lists becomes manageable again.

Sort

User with large libraries usually have not heard all their books, so we would like to discover our "next best listen" from our existing library. To do that we need better sorting options.
For example by best selling, by rating and by a percentage of how many other users have completed the book.

Use a combination of all three values to calculate a new popularity rating and allow sorting by that.

Summary

In essence treat our library as you treat your shop!

Thanks for reading :)



Dienstag, 29. Januar 2013

On JavaScript inheritance

I have struggled for quite some time to find the right inheritance strategy for me considering all the available blog posts about this topic and the many many different approaches.

After many searches I finally found this stackoverflow post:
http://stackoverflow.com/questions/7486825/javascript-inheritance

And in particular:
http://stackoverflow.com/questions/7486825/javascript-inheritance/10245829

This looked like a very nice approach.

The new thing for me was the D.call(this) idea.
( This solved the problem with the shared matrix attribute from my Spatial class in Spatial child classes.)

This led me to:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call

With this information I realized that there was a slight draw back with the new approach:
The class constructors were being called twice.
Once: D.call(this); and again: new D();

This led me to Object.create:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create

To learn about the difference between new and Object.create I read this:
http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript
and this:

understanding-the-difference-between-object-create-and-new-somefunction-in-javascript


But the answer in the second link was not accurate as one commenter pointed out. He had a link to the EcmaScript 5 specification: http://es5.github.com/#x15.2.3.5

This made it finally clear and I started to understand these lines in some inheritance examples:
Child.prototype = Object.create(Parent.prototype);

This basically avoids the unneeded call to the constructor.
Here is a complete example:
http://jsfiddle.net/9Dxkb/1/
or:
http://stackoverflow.com/questions/7486825/javascript-inheritance/12816953

Donnerstag, 27. Dezember 2012

On writing my own WebGL engine


So I did try out Threejs and CubicVR JS and while they are really powerful, I got stuck on using a 6 picture based Skybox with both of them. Threejs does it in a weird - two pass way I didn't like and CubicVR only supports an all-in-one picture approach I didn't like either.

So I tried to add a new Skybox object to CubicVR based on the "Cube with Multiple Materials" example.
But I failed horribly. Both because I didn't understand the inner workings of CubicVR enough and because I didn't understand WebGL.

It has been my personal experience, that to truly use a framework to its maximum potential you should understand the underlying concepts it is trying to abstract anyways.

So after I have stayed away from OpenGL for my entire life, I decided to finally learn it. ( OpenGL ES 2.0 to be specific ) and I am happy to report that it has payed of big time - I am in love !

While the old OpenGL (1.0 and maybe 2.0 )  without shaders was truly ugly, the new shader based OpenGL is easy to learn, understand and like. While I still believe this is an API that would benefit incredibly if converted to an object oriented API it is easy enough to build one yourself now and not cry in pain over all the ugly fixed functions because there are only so few left :-)


WebGL rocks

So I started playing around with WebGL. And it became clear to me that this is the future.
Screw Flash and Unity Webplayer and all the other plugins, this is it !

Here is why WebGL rocks:

  • Everyone can play the game right away in a secure environment.
  • No installation.
  • You can combine it with HTML5 Video and Audio and WebSockets.
  • You can make your WebGL application fullscreen with the new Fullscreen API.
  • You can lock the mouse if you develop a first person game.
  • Texturing is so easy, all the formats the browser understands you can use as textures.
  • Dynamic texturing is easy, just use a HTML 5 2D canvas, paint on it and use it as input for your texture.
  • Scripting ? Haha, it's built in !
  • Based on the amazing Open GL ES 2.0 standard. They removed all of the cruft and left only the essential tools in. ( i.e. everything revolves around using Shaders ! )
  • Amazing WebGL engines for free: Threejs.org and CubicVR JS among many others !
  • Dart support !
AND HERE COMES THE KICKER:
  • FREE USER INTERFACE CONTROLS
    Yes, you read that correctly: you can mix and match WebGL with normal HTML.
    Just position a DIV with HTML inputs over the WebGL canvas !
    Anyone familiar with the pain on how to get a good OpenGL UI will appreciate this !

"But Shaders look so scary!"
Yeah, I thought so too, but these are the basic 2 shaders you need to get started:

1. Vertex shader:
void main(void) {
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
}

2. Fragment shader:
void main(void) {
gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
}

They will carry you a long way !
( I removed the variables for clarity, you can get the full versions at learningwebgl.com )

Everything is there now in the Browser !
  • High performance 2D and 3D Graphics
  • Sound
  • Background music
  • Networking
  • Mouse lock
  • Fullscreen
The guys at Mozilla and Google did it !
Great job guys !


If I made you curious here are some great places to learn WebGL:

Start with:
http://learningwebgl.com/blog

Then head over to:
http://blog.tojicode.com/p/demos.html

For more resources check out:
http://www.khronos.org/webgl/wiki/Main_Page
and
webgl.com

Have Fun and Start Coding !





Mittwoch, 10. Oktober 2012

Why Tom Hanks is the best actor of all time


The reason is, no one else has such a list of exceptional movie performances.

Here is the list:

1986 6.0 The Money Pit - movie carrying, signatur comedy performace
1988 7.2 Big - movie carrying, signatur childrens movie performace
1993 6.7 Sleepless in Seattle - movie carrying, signatur romantic comedy performace
1993 7.6 Philadelphia - movie carrying, signature, oscar winning drama performace ( best male actor )
1994 8.7 Forrest Gump - movie carrying, oscar winning romantic comedy performace ( best male actor )
1995 7.5 Apollo 13 - movie carrying, flawless drama performance
1995 8.3 Toy Story - movie carrying, signature voice acting performance
1998 8.9 From the Earth to the Moon - movie carrying, signature narration performance
1998 8.6 Saving Private Ryan - movie carrying, oscar nominated drama performace ( best male actor )
1999 8.5 The Green Mile - movie carrying, flawless drama performance
2000 7.6 Cast Away - movie carrying, oscar nominated drama performace ( best male actor )
2002 7.8 Road to Perdition - movie carrying, flawless drama performance
2004 7.2 Terminal - movie carrying, flawless romantic comedy performance

PS: the second column is the IMDB rating as of this posting.

Donnerstag, 26. Mai 2011

A simple XSL Transformation (XSLT) for docbook xml files

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="http://docbook.org/ns/docbook">

<xsl:template match="/">
<html><head><title><xsl:value-of select="d:book/d:info/d:title" /></title></head><body style="font-family:Verdana">
<xsl:apply-templates select="d:book/d:preface"/>
<xsl:apply-templates select="d:book/d:chapter"/>
</body></html>
</xsl:template>

<xsl:template match="d:info/d:author">
<b><xsl:value-of select="." /></b>
</xsl:template>

<xsl:template match="d:preface">
<h1><xsl:value-of select="d:title"/></h1>
<xsl:apply-templates select="d:para"/>
<xsl:apply-templates select="d:itemizedlist"/>
<xsl:apply-templates select="d:orderedlist"/>
</xsl:template>

<xsl:template match="d:chapter">
<h1><xsl:value-of select="d:title"/></h1>
<xsl:apply-templates select="d:para"/>
<xsl:apply-templates select="d:itemizedlist"/>
<xsl:apply-templates select="d:orderedlist"/>
<xsl:apply-templates select="d:section"/>
</xsl:template>

<xsl:template match="d:para">
<p><xsl:value-of select="."/></p>
</xsl:template>

<xsl:template match="d:itemizedlist">
<ul><xsl:apply-templates select="d:listitem"/></ul>
</xsl:template>

<xsl:template match="d:orderedlist">
<ol><xsl:apply-templates select="d:listitem"/></ol>
</xsl:template>

<xsl:template match="d:listitem">
<li><xsl:value-of select="."/></li>
</xsl:template>

<xsl:template match="d:section">
<h2><xsl:value-of select="d:title"/></h2>
<xsl:apply-templates select="d:para"/>
<xsl:apply-templates select="d:itemizedlist"/>
<xsl:apply-templates select="d:orderedlist"/>
</xsl:template>

</xsl:stylesheet>

Dienstag, 26. Oktober 2010

TakeOwnership Explorer menu entry for german Windows 7

Create a file like: TakeOwnershipGer.reg.
Fill it with this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d j && icacls \"%1\" /grant administratoren:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d j && icacls \"%1\" /grant administratoren:F /t"


---

Found this for english windows here:
http://www.blogsdna.com/2173/add-take-ownership-option-in-right-click-context-menu-of-windows-7.htm

Also this is untested but seems to support more options:
http://beatmasters-winlite-blog.de/?p=1609

Freitag, 18. Juni 2010

JBoss Tools and JBoss AS 5

Well, for some reason the JBoss Tools Team refuses to add easy Seam support for JBoss 5.

If you create a new Seam war project with JBoss 5, you get many weird errors.

Some suggest to add all entities to persistence.xml....

http://seamframework.org/Documentation/RunningSeamExamplesWithJBossApplicationServer5
and
https://jira.jboss.org/browse/JBSEAM-3821

But the real soultion is this:

add the following line to persistence.xml:
<property name="jboss.entity.manager.factory.jndi.name" value="java:/myEntityManagerFactory">

remove the following lines in components.xml:

<persistence:entity-manager-factory name="entityManagerFactory"
persistence-unit-name="MYPU"/>

<persistence:managed-persistence-context name="entityManager" auto-create="true"
entity-manager-factory="#{entityManagerFactory}"/>

add the following line:

<persistence:managed-persistence-context name="entityManager" auto-create="true"
entity-manager-factory="#{entityManagerFactory}"
persistence-unit-jndi-name="java:/myEntityManagerFactory"/>

Also hot depoly doesn't work anymore with JBoss 5 AS if you start it normally.
Try to start JBoss AS 5 in debug mode, then hot deploy should work again.
Don't know why though...

Happy Coding all !
Ray.

Freitag, 28. Mai 2010

OpenVPN client error: Sorry, 'Auth' password cannot be read from a file.

If you don't like to be patronized by OpenVPN client here is a version
with the compile flag ENABLE_PASSWORD_SAVE set:

http://rapidshare.com/files/388904833/openvpn-2.1.1-passwordsave-install.exe

Found in:

forum.perfect-privacy.com

Confirmed to work.
Great job who ever compiled it, thanks !

Samstag, 9. Januar 2010

Add custom entries to NetBeans palette including events

Inspired by:
http://www.ryerson.ca/~dgrimsha/courses/cps841/JB_events.html

I could finally make my dream EventPanel.
Extending JPanel it allows Listeners to register for the paint event.

So you don't need to subclass JPanel anymore.
Just add EventPanel to NetBeans and add an event handler
for the now selectable paint event.

The Graphics2D object is placed into the the event Source object.

Get the source here:
http://kenai.com/projects/rayssharedcode/sources

Freitag, 27. November 2009

Turn JBoss AS into a HSQLDB server

Developing with Seam its nice to have easy access to a test DB.
Hypersonic SQL fits the need nicely.
Best of all - its distributed with JBoss AS already.

Before now, I used the supplied hsqldb-ds.xml and modified it to my needs,
inlcuding enabling the hsqldb over tcp mbean.

But it was painful to create a new dummy Seam project with the JBoss Tools
just to switch the datasource file later.

Then it occured to me:

Why not just copy the mbean part into a new service.xml file ?

Then I can use a persisting hsqldb server in tcp mode and create new
Seam projects with the real datasource from the start.

So without further ado here is the contents of my new hsqldb-service.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=HypersonicDB">
<attribute name="Port">9001</attribute>
<attribute name="BindAddress">${jboss.bind.address} </attribute>
<attribute name="Silent">true</attribute>
<attribute name="Database">default</attribute>
<attribute name="Trace">false</attribute>
<attribute name="No_system_exit">true</attribute>
</mbean>
</server>



Update:
Use 127.0.0.1 instead of ${jboss.bind.address}.
Makes it easier to create ds.xml files for and makes it more secure.


<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=HypersonicDB">
<attribute name="Port">9001</attribute>
<attribute name="BindAddress">127.0.0.1</attribute>
<attribute name="Silent">true</attribute>
<attribute name="Database">default</attribute>
<attribute name="Trace">false</attribute>
<attribute name="No_system_exit">true</attribute>
</mbean>
</server>

Donnerstag, 19. November 2009

Good source code is the best documentation

There, I said it... but before you hunt me out of the village, let me elaborate.

The way picture editing software sharpens images, is by generating a blurred
or smoothed version of the picture and then calculating all the differences
to the original picture pixels. It then multiplies the differences by a constant
factor based on your settings. The product is then added to the blurred picture
pixels, resulting in a sharper image than the original.

Now, if you take a normal piece of source code and run it through an obfuscator
you kinda get a blurred version of the source code.

My thesis is, that if you look at the differences of the original and the obfuscated code
and enhance the differences, you get self explanatory code.

What does an obfuscator do with f.book(p) ?
=> a.b(c)

So the sharper version of the code would be:
flight.book(passenger);

My rules of thumb are:

1. Make short functions ( one task per function )
2. give function and parameter names explanatory names
3. don't be afraid to refactor if you find a limitation in your code
4. Read Java Concurrency in Practice

Sonntag, 8. November 2009

Hack Java 6 to let SOAP headers for web services be set

Java 6 (and NetBeans) make it extremely hard to let people set SOAP headers.

( UPDATE AT END )

How to normally do it is outlined in the metro guide:
https://metro.dev.java.net/guide/SOAP_headers.html

and looks like this:
WSBindingProvider bp = (WSBindingProvider)port;
bp.setOutboundHeader( Headers.create(new QName("simpleHeader"),"stringValue") );

( Hm, in Java 6 there is only bp.setOutboundHeaders with an "s" at the end... )
Problem is the WSBindingProvider is in an internal package in Java 6.
So javac or NetBeans won't let you compile the code.
( Eclipse lets you btw. if you allow internal class usage in the preferences. )

So what can we do ?

1. Maybe this: http://devplace.wordpress.com/2007/09/24/adding-soap-header-in-java/
in combination with:

BindingProvider bp = (BindingProvider) port;
bp.getBinding():
...

2. Fight the authority and use reflection once again:

public static void setHeader(MyPortType port, String session) throws Exception {
Method[] methods = port.getClass().getMethods();
for (Method method : methods) {
if (method.getName().equals("setOutboundHeaders")) {
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> class1 : parameterTypes) {
if (class1.getName().endsWith(".List")) {
Object h = getHeader(session);
List l = new ArrayList();
l.add(h);
method.invoke(port, l);
return;
}
}
}
}
}


public static Object getHeader(String session) throws Exception {
Class<?> header = Class.forName("com.sun.xml.internal.ws.api.message.Headers");
Method[] methods = header.getDeclaredMethods();
for (Method method : methods) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length == 2 && parameterTypes[0].getName().endsWith("QName")) {
return method.invoke(null, new QName("http://schemas.domain.com/2005/01/Product/types", "session"),
session);
}
}
return null;
}
The method getHeader acquires an instance of forbidden Headers class and invokes
the static method "create" to return a new Header object.
(In my code it is only called from the other method "setHeader".)

The method setHeader searches for a method called "setOutboundHeaders"
in the port object which accepts a List object as its parameter.
Then it acquires a new Header object, stuffes it in an ArrayList
and invokes the setOutboundHeaders method.
Voilà.

( Yeah I know I could make better use of the parameter method search, but hey... )

UPDATE:
Here are the refined, clean, loopless methods:


public static Object getHeader(String session) throws Exception {
Class header = Class.forName("com.sun.xml.internal.ws.api.message.Headers");
Method method = header.getDeclaredMethod( "create", QName.class, String.class);
return method.invoke(null, new QName("http://schemas.domain.com/2005/01/product/types", "session"), session);
}

public static void setHeader(MyPortType port, String session) throws Exception {
port.getClass().getMethod("setOutboundHeaders", List.class).invoke(port, Arrays.asList(getHeader(session)));
}


public static void setURL(MyPortType port, String url) {
BindingProvider bp = (BindingProvider) port;
Map rc = bp.getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
}

Samstag, 10. Oktober 2009

Set Apache Element Construction Set to pretty print

Unfortunately there is no easy way to overwrite the default settings
for the Element Construction Set to make it print pretty HTML.

After playing around with the only official way which is to set a comandline option:
For example, java -Decs.properties="my.ecs.properties"
and trying
System.setProperty("ecs.properties", "ecs.properties");

I fell back to using reflection.

This little piece of code does the trick:


try {
Field fld = ECSDefaults.class.getDeclaredField("defaults");
fld.setAccessible(true);
ECSDefaults ed = (ECSDefaults) fld.get(null);
Field pp = ECSDefaults.class.getDeclaredField("pretty_print");
pp.setAccessible(true);
pp.setBoolean(ed, Boolean.TRUE);

} catch (Exception ex) {
Logger.getLogger(Report.class.getName()).log(Level.SEVERE, null, ex);
}

IMPORTANT: Add this BEFORE you construct your document,
i.e.: Html h = new Html();
otherwise it doesn't work.

Sonntag, 24. Mai 2009

Jboss Tools & Seam

I wanted to work with JSF ever since I had used Sun's Java Studio Creator back when it was in early access.

WOW, I thought to myself, finally a WYSIWYG IDE for web applications.
I was blown away...

But soon, working on a test project, the IDE bugs haunted me, not even going away with the final and updated version of the creator...

When it was merged into NetBeans I tried it again, but something didn't feel right... Sun's enhanced JSF library ( Woodstock ) was very propriatory and the future seemed to be JSF and JPA.
But the JSF/JPA project from NetBeans was without visual help...

Also, pure JSF/JPA has a very tricky way to get paging working with very large datasets which was not drag&dropable in NetBeans. ( JSF DataModel )

Hmm, I was unhappy, what was left of Sun's Java Studio Creator's promise ?

Searching the web for JSF libraries I found ICEFaces.
They didn't solve the paging problem, but had very powerful AJAX features on top of JSF.
Later I even found a promising paging demo in the then unreleased 1.8 examples... I was getting hopeful again.

I played around with ICEFaces using the Eclipse plugins for two days just to understand the basics... quite a steap learning curve.
( Keep in mind I never wrote JSF by hand before, as Creator did all of that for me... )

Hmm that wasn't perfect either, why do I need managed beans if I have an entity bean with all the same values ?

That was when I found Seam and its way of getting rid of much config XML and those stupid managed beans. I had heard about it before so I decided to give it a try.

Cool, there are even eclipse plugins for it, the JBoss Tools !

But WOW, they are overwhelming... so many new options, so many new resources.

I needed to take a step back, so I looked for a Seam book and found the so far, very good to read Seam in Action from Manning ( http://mojavelinux.com/seaminaction )

But the book used the seam-gen command line tools... not what I wanted.
But hey, I gave it a try and it worked, but still, I wanted to work in a IDE and have tool support. ( Yes, I know I can import a seam-gen project... )

So I went back to the IDE and startd to play around. At least now I had a better understanding of the terminology. So the book helped me alot to get myself comfortable with the tools. ( BTW: http://www.jboss.org/tools )

The online documentation for the tools don't help at all with what to do after a project is generated... How to turn in it into your project.

So more playing around was necesary, and boy was it painful.
Let me give you some of the most important things I learnd so far:


1. Use old stuff !

Use the last version of: Jboss application server ( 4.2.3 not 5.X), Seam ( 2.0.X maybe 2.1 ), Java (1.5 not 1.6)

If not you will be in for a lot of pain!
So much stuff goes wrong if you want to make a WAR project if you switch out one of these things with a current version.
( EAR works better, but overwhelmes again. )

You can use the current Jboss Tools, that's ok.


2. Don't use a DB in embedded mode.

DON'T use a java DB like HyperSonic SQL in embedded mode !
The tools and JBoss App Server NEED concurrent access and you will get so much frustrating trouble if you do...

I used HSQLDB embedded first because it was easy... don't !
Read the docs how to run it in stand alone server mode and do it.


3. Customizing the reverse engineering process

You will never guess how to customize the Java classes and attribute names if you generate your entities from an existing DB with JBoss Tools:

In the Seam perspective there is a little new run button with a hibernate symbol. There is a sub option called: "Hibernate Code Generation Configurations..."
There you will find a configuration for your project if you executed "Seam Generate Entities" in the "New" Wizard.
Its this magic place where you can browse to a reveng.xml file which you create easily prior with the hibernate tools ( part of JBoss Tools ).
And then rerun and voilà new entities and xhtml files

( Now you just need to get rid of the old ones :-(
Also, this did not work with MySQL for some reason, but with HSQLDB )

Please JBoss guys, add a page in the Seam wizards for a reveng.xml file !!!


4. Schema Validation

If you generate a project from existing tables, the tools will set the hibernate.hbm2ddl.auto property to validate... boy will you get errors!
You will scramble, you will search, you will change java code and table column types. The easy fix ? Remove the word validate leaving emtpy "" quotes...


5. Restrictions ( This is the best ! )

Great now you have a nice little web application, much like phpMyAdmin.
Everyone can see everything... logged in users additionally can change everything.
But thats not what you want, many times you want users to see their own stuff only !

How can you do that with classes extending EntityQuery which provide the tabular data ?
Should you do something to that getEjbql() function maybe ?
No, add restrictions !

In the generated class you will see a RESTRICTIONS constant.
The trick is to know that you can add any restriction to that array and Seam will use and add that restriction if and only if the expression language (EL) variable in the string has data.
So in my authenticate method I simply set a variable in a new session scoped component which I use in my restriction.

WOW, I found this 3 days trying to find a solution for this.
( Yeah, I bet the book explains it later too... but I'm only in chap 3 )

I may write a little tutorial on how to make a Seam WEB project your own.
Stay tuned.

Montag, 4. August 2008

major issues with the latest Ganymede update and SVN

Be aware that there are major issues with the latest Eclipse update ( Mylyn related )
and if you have used subversive from the Ganymede update site. ( Like I recomended ).

You will have many error windows when u open a SVN project.

The solution is to update subversive by using the "official"
update site;

http://download.eclipse.org/technology/subversive/0.7/update-site/

You can add it, or if its already there use "manage sites..."
to show it.

There select the newer "SVN Team provider".

Then maybe the connectors again from

http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/


( I don't know as I reinstalled... due to the issues )

Mittwoch, 16. Juli 2008

Search for Java casts

Here is a little regular expression which
allows you to search for Java casts.

Its not perfect, but a good starting point.

\([a-zA-Z]+\)

Montag, 7. Juli 2008

Eclipse 3.4 Ganymede and subversion repositories

I tried out the new Eclipse version 3.4.

I really has some nice new features.
But it also was very hard to get it to behave
properly with subversion repositories.

Here are my findings:

1. Don't use subclipse anymore.
The current version does not work properly with Eclipse 3.4

2. It seems that subversive has won the "battle" for default eclipse svn plugin.
( http://www.eclipse.org/subversive )

3. It is now even "included" with 3.4. But you have to select it for installation.

3.5. download and install Eclipse Ganymede
( Eclipse IDE for Java EE Developers (163 MB) )

4. install subversive BEFORE you import any project.
Or you get in trouble.

"Help" -> "Software Updates..." -> "Available Software" -> "Ganymede" ->
"Collaboration Tools" -> "SVN *"

( Please note, that I have installed 3.4 in a new directory with a new workspace,
I do not recommend any other way of installation, due to my SVN plugin switch. )

5. In the Software Updater add a new Site;
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/

Install the JAVA HL 1.5 svn connector from that site.

5.5. Restart eclipse.

6. Choose "File" -> "Import..." -> Existing projects into workspace.

If everything is correct, you should see your projects and
also in [brackets] the path to the svn server.

7. If you have troubles check the classes directory,
There may NOT be any .svn directories there.
Subversive WILL NOT work correctly if so.

If you have these, close all projects and
manually delete all files in the classes directory.
Then open your projects again.

3 cool Eclipse 3.4 tricks

1. If you have a piece of code in the clipboard,
select a package on the left inside the package explorer.
Then press ctrl+v to automatically create a new Snippet.java
with a class and a main method. Inside ? Your code from the
clipboard, ready to test.

2. If you have a line with a function call like System.getProperties();
Press Ctrl+2, release and then press L.
This create a new variable of the proper type and even
a reasonable name. Its one of the greates time savers !

3. Ever wondered why sometimes the function parameter help
in Eclipse shows the parameters you are currently supposed to enter
and sometimes not ? Well after you type in an object name, type "."
to get the list of functions, then select one and press enter.
Now you get the parameter hints. If you moved the cursor around
and lost the hint, just go behind the inserted function name and
press ctrl+space and then select the function and then press enter.
Basically pressing enter after the selection is the trick.