Plans, reflections and dreams.

This is a complete self reflection, so move along if you don’t want to read anything personal ;)

As you may know by know, a few days ago, we announced partiql, a software company. And this is my story behind it, why it’s such a damn joyride :)

About 9 months ago, I sat in the sun, somewhere between San Jose and Palo Alto and had a nice sandwich, probably Subways. I remember that day pretty clearly, I almost got arrested at Google and Apple at the same day ;)

It was in situations like these when I dreamed of having my own company, getting up late in the morning, creative people around and work on things I like and only a few who I trust tell me what to do in certain situations. Why? I don’t know. Daydreaming perhaps. I just thought about making a living around the corner of LinkedIn, Radar Networks or Digg. It all felt so vibrant, so bold, so pumping. Back home, it was hard at first, realizing that the bank account probably wouldn’t allow an own startup right now.. Days went by, I started working at Memonic, got quite a good feeling of what it’s like to work with a startup. They always call(ed) it Roller Coaster, and that’s probably the right term for it. One day you are down, no users, no one cares about you. The other day you are featured on lifehacker.com. Yet when you have to explain the product to someone you suddenly realize that you haven’t done so much yet but yet you worked like crazy.. WTF? (That’s valid for everything I’ve ever done..) However, you get something back, that not everyone gets. You see something grow, something “getting born..”

I once had a nice chat with Marc Liyanage about how long he will remain a Software Developer, because I was unsure if I wanted to do this all my life.. He said something like “writing software is one of the only things you can create something on your own out of nothing” – and this sentence has been in my head ever since.

So, this feeling of something getting alive… I tell you, it’s quite addictive. You not only get sick and tired of doing the same stuff over and over again, you also feel the need to create something from scratch every now and then. Having tabula rasa once in a while is a nice feeling. And this is why we and specifically I founded partiql.com.. Every day I come across technology I so desperately want to try out, be it at ETH (rarely) or by reading (often), that I would let everything else fall for the moment. “Es grausams ADHS Chind” (EN: “a terrible ADD child”) – as my girlfriend once noted :) Also, I have that inner desire to strive for perfection. And this doesn’t mainly mean the perfection you see, but the perfection I know. I think every developer knows what I’m talking about, that line of code that shouldn’t be there, that one element that wasn’t meant to be in that class.. (But of course also things that you might and will see..). Since Stefan is one of the best partners you can imagine to start up a company, it’s pretty easy for me to do a lot of refactoring and prototyping. Currently, we have a setup of 4-8 hosts, completely dynamic, running with some pretty fancy software like MongoDB and other software that even I wouldn’t recommend if we had 20 employees to feed (no offense, former employers). It’s those risks that make it so exciting. Will the API hold? Will the setup scale for real? Is the App really ready? Will we get a lot of one star rating because we didn’t live up to the expectations?

Can you feel it? I really cannot tell you to try it out, because it’s like publicly announcing that you should try cocaine or something.

Even the marketing. Both Stefan and I never did something like this before. Raising expectations before something’s finished? Not really our style. But, it’s like adding a bit of concrete into the water you are about to jump into from about 100m (300ft).

There are still many dreams to come. Like providing that space of creativity, sanctuary where other people can experience the same thing, but maybe with some help and a fallback option. Or going completely different ways with other style of applications, other devices.. Whatever will come, I’m excited as hell to be on this trip now.

Wanna know what it’s like? You hardly get any sleep, you are always nervous (“chribelig”) and yet you have that superhero feeling inside of you. A burning desire to tell everyone what you are doing yet you cannot tell anyone. Having good friends around you that help you, that wish you well but who’s expectations you have yet to meet. It feels like Stockholm Syndrome, it might torment you, but you still would never let go.

Thank you all for the great support so far and I really hope we can live up to the expectations we have set.

Look! UIAlertView is dating UITableView!

As you may have guessed, this is about UIAlertView containing a UITableView. Since I started playing around with GameKit, I had the issue that I couldn’t use the PeerPicker with Client/Server stuff..
I can’t really get into the stuff we are doing and where we are using it – but I can offer you some trick and code to have a UIAlertView displayed with a fully controllable UITableView.

I started off with making it a decorator.. After 20′ I had to give up, because it was just too complicated to decorate objects where you don’t really know what’s going on. So I had to subclass it – unfortunately, but anyway..

Let’s take a look at what you would probably like to have..

Client

UIAlertTableView *alert = [[UIAlertTableView alloc] initWithTitle:@"Select Option"
    message:@"select option or create one"
    delegate:self
    cancelButtonTitle:@"Cancel"
    otherButtonTitles:@"Create", nil];
alert.tableDelegate = self;
alert.dataSource = self;
alert.tableHeight = 120;

And this should be the result:

Alright, so, we just add a UITableView to the UIAlertView as a Subview, right? Hold on, Tiger :)
First of all, if we set the message to nil, we want to have this:

And if we rotate, we want to have the nice effects! Like this:

Rotate Animation

If you only want to grab the code without BlahBlah: UIAlertTableView on Bitbucket.org (btw. I switched to bitbucket.org – but that’s another story)

So, let’s look at the code a bit:

UIAlertTableView.h


#import <UIKit/UIKit.h>

@class UIAlertView;

@interface UIAlertTableView : UIAlertView {
	// The Alert View to decorate
	UIAlertView *alertView;

	// The Table View to display
	UITableView *tableView;

	// Height of the table
	int tableHeight;

	// Space the Table requires (incl. padding)
	int tableExtHeight;

	id dataSource;
	id tableDelegate;
}

@property (nonatomic, assign) id dataSource;
@property (nonatomic, assign) id tableDelegate;

@property (nonatomic, readonly) UITableView *tableView;
@property (nonatomic, assign) int tableHeight;

- (void)prepare;

@end

You see: we subclass UIAlertView, we have a UITableView, we have a delegate which needs to implement the protocol as well as a dataSource. Straight forward, I’d say…

Now, as for the implementation, one would think: just overload the “show” method and insert the TableView as a subview etc. Well, that works – NOT. First of all: you have to resize your AlertView, then you have to move the buttons down and then you have to place the tableView somewhere (esoteric?).
OkOk, just overwrite the drawRect then? You are getting closer!
But, first, let’s have a look at the prepare method.

UIAlertTableView.m:prepare


- (void)prepare {
	if (tableHeight == 0) {
		tableHeight = 150.0f;
	}

	// Calculate the TableViewHeight with padding
	tableExtHeight = tableHeight + 2 * kTablePadding;

	tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
	tableView.delegate = tableDelegate;
	tableView.dataSource = dataSource;	

	// Insert it as the first subview
	[self insertSubview:tableView atIndex:0];
}

This code creates the TableView but does not set a real frame yet. It sets the given DataSource and Delegate. To be totally correct, there should be a custom setTableDelegate / setDataSource method which changes them in the tableView – but this is left as an exercise to the reader :)
After the creation, we insert the tableView as the very first subview of the alertView – so we know where to find it again and that nothing is hidden because of the tableView.

Now comes the tricky part: drawing.
For that, we use a private API call to the AlertView, called layoutAnimated:(BOOL)animated.
We overload it in our custom subclass because the initial drawing and the drawing on setNeedsLayout goes through that method.
After that method is called, all the elements that belong to the AlertView (title, message, buttons …) are arranged, so we can use those values for our next computations.

So, this is how it goes:

UIAlertTableView.m:layoutAnimated


- (void)layoutAnimated:(BOOL)fp8 {
	[super layoutAnimated:fp8];
	[self setFrame:CGRectMake(self.frame.origin.x, self.frame.origin.y - tableExtHeight/2, self.frame.size.width, self.frame.size.height + tableExtHeight)];

	// We get the lowest non-control view (i.e. Labels) so we can place the table view just below
	UIView *lowestView = [self.subviews objectAtIndex:0];
	int i = 0;
	while (![[self.subviews objectAtIndex:i] isKindOfClass:[UIControl class]]) {
		UIView *v = [self.subviews objectAtIndex:i];
		if (lowestView.frame.origin.y + lowestView.frame.size.height < v.frame.origin.y + v.frame.size.height) {
			lowestView = v;
		}

		i++;
	}

	// TODO: calculate this value
	CGFloat tableWidth = 262.0f;

	tableView.frame = CGRectMake(11.0f, lowestView.frame.origin.y + lowestView.frame.size.height + 2 * kTablePadding, tableWidth, tableHeight);

	for (UIView *sv in self.subviews) {
		// Move all Controls down
		if ([sv isKindOfClass:[UIControl class]]) {
			sv.frame = CGRectMake(sv.frame.origin.x, sv.frame.origin.y + tableExtHeight, sv.frame.size.width, sv.frame.size.height);
		}
	}
}

Step by step: first, we call the superclass - so everything gets arranged.
Then, we set a new frame for the AlertView, which is the same frame + tableHeight + padding. But we also need to rearrange the frame - which is half of that additional height.
After that, we compute the lowest "sitting" normal view - no control object - in the alert view. We loop through it, until we find the first control element - which are usually the buttons, because they are added at the end. You could loop through all views and get the lowest from any non-UIControl objects. But this works :)
This position is used to place the TableView at the correct position - whether you have a message, a title or whatever there.. but it needs to be above the buttons - UI standards.
To be above the buttons, we need to rearrange the buttons, and this is what happens: all UIControl object in the AlertView are moved down by the size we added to the AlertView frame - the complete TableHeight. And this is it.
We resize the AlertView, calculate the position where the TableView is supposed to be inserted at and then move the buttons. If we rotate, this gets calculated again and nicely rearranged.

Note: you can apply the very same method for any other UIView object you want to insert into an UIAlertView.. Be it TextField or ImageView or whatever. (For textField, you should use their private APIs though)

Again, code is here: Code on Bitbucket.org

BOSW, a big thank you and Open Source on the iPhone

Whew, those were a few interesting and pretty exhausting days.

Open Source on the iPhone @ OpenExpo

The first part of this article is about my morning of that fancy day. I had the really great opportunity to hold a talk at the OpenExpo in Berne. The talk was about Open Source Software on the iPhone and I think it went quite well. Had a few interesting Mails with questions and the crowds seemed to understand the issues and problems coming with Development and Deployment of Open Source Software.

The Slides are available here (english) while there is a video on youtube of the presentation here (english)

Best of Swiss Web

You may have heard about that event called “Best of Swiss Web” – if you don’t, look it up :) It’s an award for the “best” swiss Websites of the passed year.
Thanks to a wizard called Hannes, Liip decided to participate with GottaGo in this event (as well as with the RaiWeb project – which is however not part of this article), 2 categories – Technology Innovation, Public Affairs and was also nominated for the Master – which is the price of the prices.
The night then started not so bad – we won bronze, in “Public Affairs”. The night went on, nice food, a very nice white wine.. after that, “Technology Innovation” was on.. Bronze, Silver.. Silver for SBB and their app.. No word of GottaGo? The light turns up.. Gold! Short before the event I said: I don’t want to win the Master award, but the Technology Innovation award.
Later on, some glasses of wine later – an excellent red wine btw. – the Master was on. Number 1 again.. whooo!
Besides, Liip won 2x silver with the RaiWeb Project!
Now, enough of that. I just want to say “Thank you”, really really thank you for helping me, supporting me, criticising me, trying to buy me out of this project, pissing me off with lame comments, giving me a reason to work and last but not least – let me work. Thank you Liip for never telling me to get up early, never telling me to work afterhours but rather let me work afterhours and let me get up early or late or not getting up at all and of course, pay me enough money that I don’t have to work 100% :)
Thanks to all the Beta Testers who took time to help me improve this software. And then, there are two guys in particular, one, is my not-so-bossy-and-always-play-to-win-partial-boss Hannes Gassert who worked afterhours to kick out a bad ass presentation about GottaGo. The other is, who would have guessed, Stefan Sicher.. I know you don’t feel like you’ve done a lot, but you really made this project a success. A nice idea is nothing without the right presentation.
See here for some pictures, and here for some interviews from that evening. To that Microsoft guy who thought I would wear a suit next year: I wear T-Shirts with heart and soul. And this is why I’ll most probably never work for you :)

Stay tuned for some hot updates to come now..

Beer for Issue!

Hi there.. It’s been a while and I’m still pretty busy, but I feel like I have to write something this very sunny afternoon.
There are a lot of projects in the pipeline, a few will come out sooner or later :)
One project which is still making my head go up and down and left and right is Transport. I somehow managed to get on the shortlist of this years Best of Swiss Web. Besides that, I found a still secret partner for the work on Transport. There has been a lot of development, of which not all is on github yet – some parts are just not ready for open source deployment. (But they will be!)
Today, I want to talk about my beta testers – they are great. Most of them anyway :)

I’m facing two problems with them though. First, I don’t know all of them – which is unfortunate. There are some I just cannot meet because they live in the south of Uguhagdarbia (not quite..) but there are  others which live in the very same city – Zurich – and I still haven’t managed to meet them.

Second, some of them just want to have an application before everyone else does – (no offense guys..) – and what I want in return is feedback – and not always get it. However, there are some very serious beta testers and I really want to thank you :)

This night, I had an insanly great idea to solve both problems at once and actually solve a third problem: get more testers :)

So what is it about? There have been rumors, that Transport will be ready at the end of march, and so I will need testers in the next few weeks.
This is why I proudly announce the “Beer for Issue” program :) What is that? My idea is: If you sign up until the 20th of march on beta[AT]codesofa.com with your UDID, name and e-mail (see Apply for Beta) and you are among the first 70 to sign up, then you get into the “program”. After that, you will receive a copy of “Transport.app” Beta for the iPhone somewhen after the 20th.

`HOLY CRAP WHERE IS THAT BEER!` – yes, we are coming to it. After that, you will receive instructions of how to report bugs/issues/whatsoever to me :) Since I really appreciate your time and haven’t figured out a way to show that to you, I offer Beer. Free Beer actually. :) The exact rules have to be determined after the signup is completed, but I plan to give out a beer for every fibonacci number of issues you report, starting at 3.. As long as they are not a duplicate. With “improvement” requests, I’m not so sure yet. That will be a mater of personal oppinion, if they are great, I’ll buy you 2 beers, if they are ridiculous, you’ll have to buy me 4 to make me implement it ;)

Let’s make an example: You report 3 issues – get 1 beer, 4 issues – still only 1, 5 issues (2+3) – get 2 beers, 6 & 7 issues – 2 beers, 8 issues – 3 beers etc. Maybe there will be more beer – I don’t know yet :)

`IS HE INSANE?!` – No, not at all. This will force me to write good code, so I don’t have to buy a lot of beers and besides that, I get to know all of you :) It’s like a release party.. But more fun because everyone worked on it..

In short:

  • Write me an E-Mail with you iPhone/iPod UDID, your name and your e-mail address until march 20th, 2009 to beta[AT]codesofa.com
  • Report issues on “Transport” iPhone app.
  • Get paid in beer – and yes, for ladies there will be a special arrangement possible :)

Have fun.

btw.: There is some special ruling for the last testing-period testers, I will figure something out – but you’ll get more ;)

GottaGo takes a day off, or two..

As I promised yesterday on twitter and facebook, today is a fun day for GottaGo..
So why is that? GottaGo is retiring. But its younger brother, Transport is taking over the spot..

So this is the official announcement that GottaGo is renamed to Transport.

There is a new logo, a new name, but the App itself hasn’t changed much. We fixed a few issues and improved some minor things like the hitboxes for the Locate-Button and for the Date-Refresh-Button, as they are now a lot bigger.

But, this is again not the fun part :)
Ever since the NDA was in place, I tried to figure out how to get around it. I posted a tutorial about NSXMLParser, which was meant to help iPhone Developers because usually, you’d use DOMDoc and not SAX.

Through personal requests, I was also able to provide some bits and pieces of code because this was some kind of a request of a customer – where you’re allowed to talk about code :)
Now that the SDK has fallen, we have more or less a little greenhouse where we can play around in almost free nature.

A brief history of GottaGo/Transport: It started off as a free-time project and continued as such ever after. I started it to have an example of a real application to help other developers with their own problems. Usually, in books, they always write about your Car object, which has an ivar with wheels and such. Yeah, thanks, not really real-world :) So it’s always nice to look at real code which is used out there. 
To look at code, there really is no better way as to look at Free Open Source Software.

This is why I declare that GottaGo/Transport shall from now on be Open Source and distributed under a more or less GPL v.2 license. So everyone can create their own Transport App or learn from it or improve it. (The latter would be really nice!)

What does this mean? Not so much for the users, as they are only getting better software :) (Yes, I truly believe in FOSS)

For developers this means: Just drop me a line and help developing the best Transport Application for the iPhone there is. This also means that Android developers and iPhone developers in other countries can adapt Transport for their need and release an equally helpful App for their device and country.

For those who don’t really understand what I’m doing here: I give everyone the right to improve, copy and adapt my code.

The code is available on:
https://svn.liip.ch/repos/public/iphone/Transport

(more…)

done.

 So much for tonight. Thanks Stefan :)

© 2010 some rights reserved by codesofa
Design by Stefan Sicher
Powered by WordPress