Sunday, June 1, 2014

Eclipse RCP application based on e4

Finally I got the build process clean and running to produce a headless eclipse based RCP application, including e4 support. Maven and Tycho is the key to a successful build and packaging process. A clear setup of plugins, features, product and a master pom within a build project makes the whole process clean and simple.

Beside the standard approach to sync and add all dependencies, make sure you have the org.eclipse.equinox.simpleconfigurator dependency added to your product definition file!

The maven tycho generates a full standalone product for all platform (win, linux, osx).

Check out the example provided by yafra.org on github.com https://github.com/yafraorg/yafra/tree/master/org.yafra.rcpbuild
The pom.xml file on rcpbuild shows all other related components used for this example.

Sunday, February 2, 2014

Photo orientation handling in google appengine with python

After realising that not all photos uploaded are correctly handled in regard to orientation the search started. After some hours I got the solution. First of all this happens only on PNG pictures uploaded by phonegap camera plugin on iOS. A work around would be parsing the meta data of an image uploaded to google appengine. If you use phonegap camera plugin with encoding JPEG there is no issue (and even much faster).

It occurred with my iPhone with PNG as phonegap camera encoding type and Apple uses the Orientation meta data tag, it seems the following values give guidance on how to rotate your uploaded image before you save.

This applies only to images saved in the datastore db.Blob, NOT the blobstore ! In blobstore you have no influence during the upload and the blobstore handles the orientation correctly.

The following post supported my solution:
http://lkubaski.wordpress.com/2013/01/18/rotating-photos-from-mobile-devices-uploaded-to-google-app-engine/

This posts lists the iOS orientation values used:

1: image is Normal-> that’s the orientation value you get when the iphone home button is on the right
2: image is flipped horizontally
3: image is rotated 180° -> that’s the orientation value you get when the iphone home button is on the left
4: image is flipped vertically
5: image is rotated 90° CCW and flipped vertically
6: image is rotated 90° CW 
7: image is rotated 90° CW and flipped vertically
8: image is rotated 90° CCW 

How to rotate the image
orientation = 1 -> don’t rotate
orientation = 3 -> rotate 180° clockwise
orientation = 6 -> rotate 90° clockwise
orientation = 8 -> rotate -90° clockwise (or 90° counter clockwise if you prefer)

The sample code (python google appengine):

obj = YourDBObj()
img = images.Image(raw_file)
img.resize(140)
save = img.execute_transforms(output_encoding=images.PNG, parse_source_metadata=True)
meta_data = img.get_original_metadata()
  if meta_data != None:
      logging.info('debug: meta data nach image %s', meta_data)
      if meta_data.get("Orientation"):
          logging.info('debug: meta data Orientation found %s', meta_data["Orientation"])
          if meta_data.get("Orientation") == 6:
              logging.info('debug: rotate image by 90')
              img.rotate(90)
              save = img.execute_transforms(output_encoding=images.PNG, parse_source_metadata=True)
      else:
          logging.info('debug: no orientation')
obj.pict = db.Blob(save)
obj.put()
For blogstore objects using the image get_serving_url() you could do rotation by adding -r90 as of an undocumented feature: https://code.google.com/p/googleappengine/issues/detail?id=4200

Thursday, January 2, 2014

iPhone / Android App

My first app. What a painful experience. Intention was to write an app which will run on all major mobile devices.

Starting with Accelerator showed quickly some drawbacks and the learning experience was not pleasant.

Next was PhoneGap based on Apache Cordova. Much better and getting an app running was quite simple. I chose the ionicframework and AnuglarJS as key frameworks to work with. ionic is similar to bootstrap and AngularJS is a MVC based javascript framework. I made an app talking to a google appengine service through RESTful API. And really write once run on all major platforms!

Google Appengine

Very mature application web server engine. I made some examples using python with functionalities like excel export, pdf creation, openid authentication, RESTful service, database design (big table based). Overall an excellent approach to develop web services very fast and being prepared for mass usage if you like.

Unfortunately the authentication seams to be still very beta. It supports only OpenID but OpenID Connect would be much better as this supports oauth1/2 and OpenID.

The google cloud console is still very early but shows the direction it will go to.

Chromebook and Chromecast

My Chromebook (HP Chromebook 14) / Chromecast experience quickly summarized. For what do I need it? I needed a laptop with HDMI, USB and SD Card interfaces, plus Wlan and Bluetooth. I'm always online, I have a google account and I mainly want to surf the internet. And guess what, the google chromebook just fits this needs 100%! With chromecast you can mirror tabs onto your HDMI TV. The chromebook can manage and r/w all kind of USB disc devices (can read all filesystem formats FAT, NTFS, ext3, ...). You can attach a printer to USB and enable it with the Google Cloud Print (not all are supported but the most commons are). If you have a printer with WLAN it's even easier. You have access to all Chrome Apps and Extensions. This includes remote desktop server functions, office and many other gadgets. Some Apps or Extensions are even offline capable, meaning that you can work without any WLAN connection and sync as soon as you are online.

As with iPad's you have some shortcuts with file formats like the RealPlayer RA format. However there are workarounds on the net, just google.

Overall a very nice laptop, basic functions but easy to handle and use and focused on what you do very often, surfing on the internet. Low price makes it an interesting alternative for tablets or full blown laptops, but always with the intention of surfing on the internet in mind.