söndag 11 september 2011

Quizer video!

Recorded a short video where I demonstrate Quizer:


Quizer Video 1 from Olof Dahlbom on Vimeo.

One week of PHP-Pain

This past week i've been struggling with PHP. I knew even before going into the week that this would mean pain. My PHP skills are extremely limited and I honestly think the language is a pain to work with. The biggest problem for me is the lack of debugging methods in PHP. I love breakpoints and console outputs for debugging, none of the above is possible when you send code from the iPhone to a PHP-script.

What I wanted to do is to send my JSON-Quiz from "Quizer" (The app I'm working on) to the server. And then parse it into the database. After a weeks struggle that is now working. You can create a Quiz from the phone and load a quiz from the server to the phone. What's left now in this process is to debug the app so it won't crash when the request takes longer time then usual (3G networks can be so slow at HTTP-requests.)

The week ended on a double-happy-note when I arrived home this friday and meet my new best friend, MacBook Air:



MacBook Air "13


The computer is wonderful to work with, and it's so thin and light it's amazing.. I only hope the 4gb RAM will be enough for my use.

This is the PHP script for Quizer if anyone wonders how it turned out (I know it's an easy one.. when you know PHP):

//Code on!

måndag 5 september 2011

MacBook Air

Today there is not much programming going on. But I just had to tell you that I've now ordered a REAL mac! For some time now I've been using an old HP NC6400 with Mac OS X Lion installed on it. Yesterday I took the step and ordered a MacBook Air 13"!

This is my current computer:

MacBook Fail 13"




Yesterday I posted a pic on Ludvig.. this made my other friends extremely jealous so here's a pic of them as well!

Agent Eel & Android!
//Code on!

söndag 4 september 2011

Update on threading

In a previous post ("Safe threading") I talked about threading, and using the method performselectoronmainthread. This method is great for "fast-jumping" from your own thread to the applications main-thread. After using the method for a while I however realized that the method is very constricted. This resulted in a thread on StackOverflow where I asked if there is any smarter ways to jump in and out of threads. I got a great response to the question that really made my threading easier:




Well, you're already using dispatch_async. Then you should just use
     dispatch_async(dispatch_get_main_queue(),^ { ... } );
from inside your background thread to perform things on the main thread. For example,
     if ([self testServerMethod])
        {
            dispatch_async(dispatch_get_main_queue(),^ {
               [self showMessageBoxWithString: @"Server is working!"];
               [self threadedUIActivityRemover:nil];
            } );
        }else ...


This way of calling 
dispatch_get_main_queue()



And then performing UIKit-related stuff is really smooth and much more versatile then performselectoronmainthread. 

So, that's an update to the hole Threading-colundrum. Now on to new things. 
I'm still writing on Quizer as much as I can. And it's slowly starting to take form. Next week I hope to have time to tackle the main logics of the game itself. And thats really something I'm looking forward to. 
To be able to run the app 24/7 I've invested in a small NAS that run Apache and MySql. It will be fun to see how it will handle high traffic-load etc. I'll come back to you regarding that when I'm testing the app in a few weeks!
Today I'm in school programming with my friend Ludvig. He's not the most inspired programmer today.. but after all it's sunday.. 
Ludvig at work!
//Code on!