Sunday, March 06, 2011

Combining a Cocoa hobby with family and work

Since I bought myself an iPad I decided to get my hands dirty again with XCode. I felt immediately at home programming for iOS. The brilliance of the Cocoa framework shows here as well. It is also a great opportunity since it hasn't bloated yet and is simple to learn.

Before my hobby gets out of hand I want to validate whether it is worth spending time on. Balancing my career with spending time with my 1 1/2 month old daughter is not easy. Adding a hobby project as well is not evident. Thus these are my 3 requirements:
  1. it should be fun;
  2. it should not prevent me from being with Vienna and Evelien (daughter and wife);
  3. it should be in line with Collibra.
Number one is easy. Designing and programming are my work and hobby. Doing it on the mac with Cocoa makes it gold.

To fulfill number two, I have the rule to only work on my project at home. It's easy to get tempted to just work on it at the office after my hours. I noticed I was getting home at night when the family was already asleep. No need to say that's bad.

I find I can combine spending time with my daughter and program rather well. She sleeps for max 3 hours and then forces me to take a break. I can entertain her with what's on the screen, and get some exercise to play with her. Double win.

To fulfill point three I did some research. Anybody can sense that the mobile market is big and there's a lot of money to be made. I wanted to get some figures though.

Since their introduction Android and iPhone have become the main players on the mobile market. Apple reported to have sold $ 1 billion so far via their App Store (WWDC 2010 keynote) since the start in July 2008. At this time there are currently more than 400 000 apps available accounting for more than 10 billion downloads. The android market is currently good for about 200 000 apps. We haven't seen anything yet though. The mobile market is expected to triple by 2015 according to Juniper Research.

The way I see it, is that a mobile app would be a great way to increase visibility to the company. The app should be simple, and allow you to accomplish the most core tasks. In case of Collibra's Glossary that would be searching for terms and validating definitions.

Stay tuned as I will publish my adventures on getting on the App Store.

Sunday, June 07, 2009

A cartoon about semantics

With this cartoon I try to illustrate semantic with as little words as possible. The scenario is as follows.

A trading company has an electronic data format about deliveries of goods. A new partner joins the network with a different format.

For each of the symbols the data mapper needs to find out what they mean and how they translate between data formats.



In this example the data mapper is investigating what A means and how it translates. He thinks hard and remembers that A is the Date of sending the Delivery. By calling up his partner and explaining that he is looking for this Date he finds out that they call it B.

He takes the classic approach and creates a script that translates A to B.

One month later another partner joins with again a different data format. Again he thinks hard and finds out A and B are the Date of sending the Delivery.

Because he does not make the meaning clear the mapper has to rely on his memory and make many phone calls. This is clearly error prone and a tiring process.

In Collibra's approach the meaning of the symbols is made explicit. Instead of saying that A equals B, we say what A means and what B means. The translation between data formats can then be derived using this information.

Do not just keep the meaning in your head. Make it explicit and you will save time and many  headaches.

Disclaimer: I have very limited drawing skills, so I relied on what I could find online. The stick figures are by Thor, created in Omnigraffle.

Monday, May 11, 2009

Moved back to Flanders

After living in Brussels for about 3 years, I have moved back to Flanders. I must say I appreciate the relaxing feeling of leaving the city and going home. I grew up in a rural area and this feels like properly going home again.

Brussels is a great city, but not my favorite. Culinary however, I don't think anything will top it price/quality wise.

The first week I experienced a false sense of happiness about traffic. Driving to Collibra took me 25 mins, which is only 5 more mins than before. This morning the came the hard truth with a 1 hour drive. It's still acceptable though.

I live now in Kampenhout in a proper house with a garden. Even before mowing my lawn the first thing I will do is organise a barbecue. Before I didn't even have a terrace, so I have some serious catching up to do.

I am also experimenting with my hifi setup, but that will be a later post.

Thursday, February 12, 2009

Belgian Eclipse Community Meeting

The following is a copy from my post on the Collibra company blog.

Yesterday Hendrik from Sigasi and I organised the first regional Eclipse community meeting in Belgium. We had people from industry (Sigasi, Inventive Designers and Collibra) and academia (VUB students and a researcher from STARLab). Considering the very short notice on which we organised this and the "just-getting-to-know-each-other" intent of the meeting, this is quite reasonable.

We demonstrated our usage of Eclipse, and it is impressive to see how slick you can make your Eclipse product look. You get lots of stuff for free, but of course, we all had our complaints about lacking documentation and unresolved bug fixes. Nevertheless, in general the benefits far outweigh the negative experiences.

Dieter from Inventive Designers demonstrated Scriptura, an application for document flow control and reporting. They have been working with Eclipse since version 3.0 and have built up extensive experience after all those years. We really look forward to learning more from these guys, as they had to learn about some sharp edges in Eclipse the hard way.


Hendrik showed the Sigasi Hardware Development Tool that basically finally provides a real IDE for the VHDL language. Support for code completion, syntax highlighting, refactoring, etc. These are things we as software engineers take for granted, but are not so common for hardware developers. Eclipse really shines in reuse when you're extending the IDE.

We of course demonstrated our Collibra Studio that is still hard in development. We received many ideas from the discussions afterwards on how to improve our tools. This really makes this kind of community event very useful. Seeing how others solved problems can work very inspirational. It is tempting to lose focus with all these low hanging fruits :)

It is really hard to imagine that there was still no organisation of the eclipse community in Belgium. We now took the first steps in what will hopefully become a large community. Though I am confident that this will become a success. The enthusiasm of the participants and the support from the Eclipse foundation make that a sure bet.

I was actually quite surprised by how helpful the foundation is. Ralph Mueller from the foundation was very supportive and I'd be thrilled to invite him for one of our next events. We will make sure that there is enough time to announce this properly then.

If you would be interested to join the community, feel free to contact me. You could also take a look at the wiki set up on the Eclipse site.

Thursday, February 05, 2009

I'm back

I finally did it it! I started blogging again after 2 years and a half of silence. During this time an unimaginable amount of things happened. That of course has the advantage I have a lot of stuff to write about. But that's for a next post :)

Expect more posts about Collibra (our company), semantic technology, Eclipse, Macs, Wine and my travels.

Friday, July 28, 2006

Using Accessory Views in Print Panel

Intended Audience


Intended for people having difficulties with accessory views in the print panel. Especially on how to handle option changes in this accessory view.
Level: Intermediate

Problem


Lately for a project I was quite stuck on how to let the user set some options in the print panel. Especially the apple docs were not very helpful, so that's why I decided to write this quick how-to. I also searched the web if there was any information available from other sources, but did not find anything.

So here's the deal: I have an application that lets teachers create exams. Now the teacher can choose whether (s)he wants to print solutions along with the questions in such an exam (e.g. for teaching assistants whom correct the exams). The most intuitive place to put this option is in the print panel itself. There we add a checkbox "Print solutions". You can see this on the picture below, note that the name of the application is Questions.



So now we know what our goal is, next we take a look on how we reach this goal.

Solution


The checkbox with "print solutions; is contained into a custom view, which is augmented to the print panel. This is also known as an accessory view. I simply add the view to my MainMenu.nib and bind the value of the checkbox to a custom key, named PrintSolutions, in the Shared Defaults. Don't worry if no Shared Defaults instance is shown in MainMenu.nib yet, it will be automatically added when you bind a value to it.



Now we can query the state of PrintSolutions from anywhere in our applications by asking the shared defaults. We could do this like this:

[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:@"PrintSolutions"];


To be able to access our PrintAccessoryView (which contains our checkbox) from code we add an outlet in our AppDelegate (or whichever class that catches the print action).

 IBOutlet NSView *printAccessoryView;


The next step is to add our view to the print panel. This is where my approach differs from Apple's documentation. But first how the docs of Apple do it:

- (void)print:(id)sender;
{
// create a printable view for our exam and create a print operation with this view
...
NSView *examView = [examPrintView printableView];
NSPrintOperation *op = [NSPrintOperation printOperationWithView:examView];

[op setAccessoryView:printAccessoryView];
[op runOperation];
}

So first we create our view for the exam, not knowing whether the user wants the solutions or not, and create a printoperation that will print this view. Next, we add our accessory view to the panel, so that user can make his choice whether he wants the answers printed or not. Finally we fire the operation away by calling runOperation. When run operation is called the print panel shows up and then our user can click on the checkbox.

The problem is, that it is already too late now. The printable view for the exam has already been created and passed to the printoperation for printing. Whatever the user clicks in the printing panel will not have any effect. Thus, we need a solution where we first show the panel and afterwards create the view and fire up the printoperation.

Here is my solution:

- (void)print:(id)sender;
{
NSPrintPanel *printPanel = [NSPrintPanel printPanel];
[printPanel setAccessoryView:printAccessoryView];

[printPanel beginSheetWithPrintInfo:[NSPrintInfo sharedPrintInfo]
modalForWindow:[self window]
delegate:self
didEndSelector:@selector(printPanelDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}


In this approach we just create a print panel and fire away the panel with a callback to the
printPanelDidEnd:returnCode:contextInfo:
selector. And here's what this looks like:

- (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
BOOL printSolutions = [[defaults valueForKey:@"PrintSolutions"] boolValue];

// Create the printable view with or without the solutions
...
NSView *examView = printSolutions ? [examPrintView printableView] : [examPrintView printableViewWithSolutions];

// PrintOperation
NSPrintOperation *printOperation;
printOperation = [NSPrintOperation printOperationWithView:examView printInfo:printInfo];
[printOperation setShowsPrintPanel:NO];
[printOperation setShowsProgressPanel:YES];
[printOperation runOperation];

// Clean up the sheet
[NSApp endSheet:[[self window] attachedSheet]];
[[[self window] attachedSheet] close];
}
}

Now we have control over our view before we run the printoperation. So we first can check the value of our defaults and build up a different view accordingly. Pay attention that you also turn off showing of the print panel in the print operation with setShowsPrintPanel:NO. Otherwise you will show the print panel twice.

Conclusion


So now we've learned how to read the options set by the user in the accessory view of the print panel, before running a print operation. I guess the approach found in Apple's docs also works, but is a little trickier and less efficient. When the user makes a change in the accessory view, this could fire up an action that changes the printable view somehow. For example when the user clicks the checkbox, an action
togglePrintSolutions:
could be fired. This method could in its turn then rebuild the view that was passed to printoperation, etc...

This is an elegant solution and I am puzzled why Apple didn't put this in its Printing documentation. Or maybe I just missed it. Anyway, I hope this proves helpful to someone.

Acknowledgments


I did not come up with this solution entirely by myself. When I could not find any documentation on this, I started looking at open source projects, to see how they solved it. The first one I found which solved my problem was Smultron by Peter Borg. So I am very grateful to Peter for his code, and I owe the solution entirely to him. Incidentally, it even looks to be a nice text editor that is well coded. I advise everyone to check it out.

References


Tuesday, October 25, 2005

Graphical Editing Framework for Cocoa

For my apprenticeship I am working on a project in Java in the Eclipse framework. Because we're working on a visual editor we make use of GEF (Graphical Editing Framework). The documentation for this is rather poor, but that's not the point of my post.

Now I have been searching for a similar framework in Cocoa, but haven't found anything. So here comes my mad megalomanic idea. Let's start a project on sourceforge to make our own framework, based on GEF. Of course making use of the idiosyncrasies of Objective-C and Cocoa, instead of the Java stuff in GEF.

I really believe such a project could provide a boost in Cocoa application development. Some input from other developers would be nice.

Mind, that I currently don't have time to immediately start something like that. Just some thoughts and dreams for the moment.

References:
Eclipse: http://www.eclipse.org
Gef: http://www.eclipse.org/gef/