C++ Tiled Tmx Parser

I had a need for a lightweight quick and down to business tmx parser.

For those unfamiliar TMX is the file format used by Tiled.  Tiled is a map editor for tile maps.

The parser at the moment required C++11x but only for one small bit of code which could easily be removed.  The parser is mostly a C library in its usage.  It returns simply an error code and a struct you allocated the memory for containing the entirety of the tmx file.

GitHub Source: libtmx-parser

IOS Launch Image For Landscape Only App for iPhone’s

Nearing the end of an app development cycle it came time to add a splash screen or in IOS SDK terms the LaunchImage.  The app in question is to be locked in landscape mode as per request of the client.  There is no way to specify a launch image for phones in landscape mode.  If you are using Images.xcassets then you have probably already noticed this.

The following is a very quick and simple way to fix this.

  1. To start, you will need to design your launch image using portrait dimensions.  This is very simple, just rotate the image you want to use as a launch image by 90 degrees.
  2. There are several ways to specify your Launch Image and this is not the subject of this document.  For me I used Images.xcassets to setup the Launch Images.  Take your rotated landscape ready portrait dimensions image and place it into the Images.xcassets appropriately.
  3. Re-Enable portrait mode in your Application Settings.  You can do this via YOURAPP-Info.plist or in the project settings.  Make sure if you do it within YOURAPP-Info.plist that portrait mode is first.
  4. Add the following code snippet to AppDelegate.m (change that return value appropriately for your app):

    -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {

    return UIInterfaceOrientationMaskLandscapeRight;

    }

     

  5. Everything is working now however you will notice that the status bar appears in a funny position.  Add the following the YOURAPP-Info.plist:
           “Status bar is initially hidden” -> YES

There you have it.  Landscape mode locked application with a clean launch image.

Enjoy!

Halsafar

Installing VMware 9 On Ubuntu 13.04 With Kernel 3.8

If you are a VMware user and an Ubuntu user you might have encountered an issue installing vmware’s kernel modules.  Basically as linux kernel development has accelerated over the last year or two, VMware did not keep up.

Skip to end of article for a script to run.

This is done on Ubuntu 13.04 running kernel 3.8.0-26-generic at the time of writing this article.

When you run VMware Workstation for the first time on a new machine after installation you will be presented with a dialogue asking you find the kernel headers.  The following command fixes this issue.  Either Ubuntu or VMware is not following the norm on where to store version.h:

sudo apt-get install build-essential linux-headers-$(uname -r) open-vm-dkms
sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

The next command will install the modules.  You can just re-run VMware but doing this from the command line lets you examine any errors:

sudo vmware-modconfig --console --install-all

There is a good chance this will end with an error.  Previous versions of Vmware and the linux kernel this was about all you had to do.  A user on askubuntu posted a nice script that handles the patch required on vmci:

http://askubuntu.com/a/294691/167903

Simply run that script as root all should be well.  If you are nervous of running a random script give it a quick examine, it is pretty simple.

 

Halsafar

Eclipse – See All Shortcuts Available

A short post but a big tip.  It seems I have somehow used Eclipse for years without learning this very simple hotkey.

CTLR+SHIFT+L

This will bring up a window showing all available shortcuts given the current context.  There are hundreds of hotkeys available in Eclipse and the only way to make them habit is to find and use them.