How to install new Xcode themes

If you are not that satisfied by the default syntax highlighting in Xcode and the pre installed themes aren’t that useful for you there is an easy way to install some new ones. At first, open Finder and navigate to:

~/Library/Developer/Xcode

(to do so press cmd+shift+g and type in the folder). now create a new folder called

FontAndColorThemes

You are now ready to color up Xcode with new themes. To find some a good starting point to search on github.com for “Xcode themes”. Typically you will find a file with the ending:

.dvtcolortheme

Copy this file to the newly created directory. If you restart Xcode now you will see your installed themes under Preferences-Fonts & Colors. If everything went fine it should look like this:

fonts_colors

Saving data with UIDocument in iOS

Reading and writing data in iOS is a crucial thing if your app depends on it. In my app Stepr (iTunes link). I’ve made the naive mistake to save all my data into a plist file with a (too) simple mechanism and made my users not very happy with this approach. Stepr is basically a pedometer which reads the data from the M7 coprocessor in the iPhone 5s, compares it to a goal set by the user and saves all steps of a day into a file (more on this in a separate post). The user can view all the recorded steps afterwards in a statistic and watch the overall progress.

So what was wrong with saving into a plist file? In general – nothing. If you when your data is loaded and ready to get saved you are (probably) fine. But for Stepr things are a bit more complicated. The app utilizes Background Fetch to update the data even when the app is not active. Stepr will be launched in the background and gets about 30 seconds to do its stuff till iOS will quit it and querying the CoreMotion framework is threaded too, so you don’t really know when updates are done. So in the worst case Stepr tried to load data, tried to update it and saved it at nearly the same time. Data got corrupted and the plist file was broken – not good!

The solution to this problem was to switch to UIDocument for file operations. But how to do it right? I asked this question myself and found a very very good tutorial from Kevin Hunter from Silver Bay Technologies on how to implement UIDocument for your file operations. And the best thing of all – the tutorial also covers unit tests and test driven development (TDD)! After working through it my document knows when loading data is done, when it has unsaved data and when the data is saved – the data management in Stepr is very robust now…awesome!

Because of this tutorial I was able to solve my problem for Stepr, learnt a lot about TDD and had also some knowledge on how to develop a mechanism to migrate from the old plist file to the new UIDocument powered file with unit tests and all the nice stuff.

I just can highly recommend to read this tutorial, it’s one of the best I’ve found so far! (Link)

Macintosh turns 30!

Today in 1984 the original Macintosh was released! This was one year before I was born. Incredible what happened since then.

Apple made a very nice web site according to the anniversary, have a look: http://www.apple.com/30-years/

Also you can download a font where the characters are all Macintosh desktops and notebooks made until today (via osxdaily)

font

iOS 7 Tech Talks – Game Developer Day in Berlin

11360134115_c16a5772ba_b

 

On December 13th 2013 I had the chance to attend the iOS 7 Tech Talks Game Developer Day from Apple at the Maritim Hotel in Berlin. In short: it was amazing!

I’ve met some interesting people to talk about iOS & game development and got a lot of information and tips. The presentations were hold by Apple Developers and had many useful hints and tips to improve Apps and software in general. One of my favorite presentations was the one about OpenGL ES 3.0. It’s truly awesome what mobile devices are able to do these days!

Next to the presentation room was a lab where you had the opportunity to talk to the developers from person to person. For me this was one of the highlights of the day because they gave me a lot of input for some of the projects I am working on.  Everyone was willing to help you on your problems and it’s great to discuss stuff of your apps directly with people with tons of experience.

To summarize, it was a very interesting day and I think it’s great that Apple cares so much about the developers! I hope that I will have the chance to join some of this kind of event (WWDC? ;-) ) again, even if it was a bit stressful after all (there was the christmas party of my job the same evening in Dresden…)!

If your are a in the iOS Developer Program you can watch the presentations here: https://developer.apple.com/tech-talks/videos/

 

Turning your Raspberry pi into an AirPlay receiver

Processed with VSCOcam with c2 preset

The Raspberry Pi is an awesome piece of hardware, you can do so much stuff with this little computer at very low costs and nearly unlimited possibilities. I’ve got one to expand my “musical network” at home. Besides a AirPlay enabled receiver in the living room and a Apple TV in the bedroom I wanted to get another AirPlay client for the bathroom or kitchen. After some research the Raspberry Pi turned up as the at least expensive and most flexible solution. Since there are a lot of tutorials on the Pi and Airplay it is fairly easy to set everything up.

get some more…

the hassle-free guide to wifi-up your raspberry pi!

you’ve got an raspberry pi and want to get wifi working? it’s pretty easy if you choose this usb dongle: EDIMAX EW-7811UN it is working out of the box with just some configuration. the setup is done in some minutes and you are ready to use wifi with your raspberry pi!

get some more…

making of 1 million particles

this time I will give you some insights on how to create a gpu driven particle system with opengl and glsl. for most of my opengl work I choose cinder and highly recommend to get in touch with it. already knowing cinder is not essential but gives a better understanding of the text. also since this is just a making of, not a step by step guide, some OpenGL and shader knowledge is required.

1mp_bw

before we dive into the code I think it’s good to get an overview on how the system works. the base of this particle system is a so called ping-pong framebuffer object. ping-pong means that you have two framebuffer objects (fbo) which are drawn alternately. when fbo A is drawn fbo B is used for calculations. on the next frame B will be drawn and A is used for calculations and so on. the particle movement is calculated by an glsl shader, all results (current position, velocity,…) are saved into textures. the drawing of the particles is also controlled by a shader who controls opacity and size. each particle has a time to live, if it’s old enough it will be respawned at a new position with it’s initial velocity. you see there is not that much going on, so now let’s look at the code a little bit deeper!

get some more…

1 million particles revisited

1million particles

here we go again, I reworked my gpgpu particle system which I did some time ago (link). the new version offers a better particle movement driven by perlin noise. also it is a bit more colorful since the original version was black & white only. aside from some minor code tweaks the big thing is that you can grab a copy on github now! i’ve got some requests to share the code but never felt that it is good enough to give it to others (the new version might not be that better… ;-) ). i hope it will help people to learn something about gpgpu programming and OpenGL in general :-) at the moment I am also writing a “making of” to explain some of the nifty stuff a bit more, so check the blog the next days!

github

new processing sketch — cubicle

we have updated our home with some new furniture. as a result we now have more space to hang some pictures and what is better than creating the pictures by yourself? yes right, code them by yourself!!! at least if you can’t draw.

the sketch I made today is called “cubicle” and does nothing more than drawing some quads and rotate every quad by some degrees. the result is vortex of quads :-)

cubicle

 

 

 

the code behind it is fairly simple, nothing special to explain. just some basic setup of size and settings and after that we’re ready to go. draw a lot of quads till they reach the border which is set in the condition of the while iteration. have a look:

size(1000,1000);
background(255);

smooth();
strokeWeight(0.5);
noFill();

float initialSize = 20.0f;
float rotation = 0.430f;

float strokeAlph = 30.0f; 

while(initialSize < height - 300)
{
  stroke(0,strokeAlph); 
  pushMatrix();
  translate(width/2, height/2);
  rotate(rotation);
  rect( 0 - initialSize / 2, 0 - initialSize / 2, initialSize, initialSize);
  popMatrix();

  initialSize += sqrt( 2 * pow(initialSize,2)) * .0033;
  strokeAlph += .1f;
  rotation += noise(PI / 3);
}

if you want you can grab the code (and other sketches too) on my github!