Mobile - Design for reusability

I have faced the problem of writing the very same feature/screen for many apps. It seems quite obvious. Designing the interface, using some inheritance can easily make the day.

However there are some small and ridiculous issues:
- watch out for helper or utility methods, constants! - try to use a unified set of helper classes for some task, so you can easily share or in worse case copy them.
- check hidden requirements! if the "same" feature in two areas looks 90% similar- it will give you a hard time to implement for both cases.

- C-based lets you build a common code folder to include or even a library
- Java based projects will give you a hard imeas package identifiers will contain app specific parts. Consider library based approach.

Cocoa with love

Cocoa & objective-C - though somewhat strange to us, earthlings grown up on Visual Studio with C# and Eclipse with Java - has some quite interesting and useful and interesting features to be used.

As I just exploring this whole new galaxy, it shall not be a shame to present some of these "stone samples" just found...

[customers valueForKeyPath:@"@avg.emailAddress.length"];

... more on Cocoa key paths here.

NSPredicate *bPredicate =
[NSPredicate predicateWithFormat:@"SELF beginswith[c] 'b'"];
NSArray *beginWithB =
[array filteredArrayUsingPredicate:bPredicate];

...more on predicates here.

Folk dancing bubble sort

I am always fond of any visualization of algorithms and making (not so) complex things easy to understand for everyone.

NSInvocation in Objective C via delegate

I had some hard time finding the solution for a smooth usage of NSInvocation.
Furthermore I was to call a method within a delegate.

All's well that ends well and I am happy now.

Here is my code snippet.
My very last error was that I forgot to call the setSelector method :)

if (self.delegate)
SEL sel = @selector(fetchComplete:withParam1:withParam3:);
if (self.delegate!=nil && [self.delegate respondsToSelector:sel])
NSMethodSignature *sig = [[self.delegate class] instanceMethodSignatureForSelector:sel];
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];

[inv setSelector:sel];
[inv setTarget:self.delegate];
[inv setArgument:&Param1 atIndex:2];
[inv setArgument:&Param2 atIndex:3];
[inv setArgument:&Param3 atIndex:4];

[inv invoke];

// [self.delegate performSelector:@selector(fetchComplete:withParam1:withParam2:)
// withObject:elementtype
// withObject:Param2
// withObject:Param3
// ];

Facebook development made easy

Recently a colleague of mine talked about some quite cool facebook app, he developed.

About the motivation: I am always quite enthusiastic about any web application, especially when integrated.

It was quite astonishing to see that facebook has a very easy to use integration library.
  1. download the Facebook Development Toolkit from Microsoft
  2. install it
  3. add the necessary tabs to the toolbox (default path for the dlls are C:\Program Files\Coding4Fun\Facebook\Binaries\)
  4. Create an IIS website for the application
  5. (my default site was tergeted for v2.0 .NET framework, and yielded errors. Thus I needed to change to v4.0 framework)
  6. you might host your app in your own server, however for simplicity why not register your application at localhost? :)
  7. off you go...

Should you need some hint or sample code, just visit this blog post from Steve.

You Win, RIM (link)

A colleague of mine has drawn mine attention to this nice and funny blog post about a superhero developer just tring to develop on BlackBerry RIM platform.
As I have experienced the very same attitude I can just congratulate the guy for his willing.

Sociometry, Social Network Analisys

A couple years ago I have created a simple tool to visualize a sociometry.
A sociometry is a simple quantitative method to visualize social relations.

Given a class the teacher asks some questions about likes and dislikes within the predefined group of persons (class).

Given a connection matrix between the individuals the main task is to visualize and cluster groups within the class and understand important factors like central and peripheral positions.

Here is a visualization of a sample dataset (without names).

The tool takes the individuals and the connections into account and attracts and distracts/repels the nodes (persons) thus minimizing the total aggregated force within the system (attraction is +, repel is -).

I am keen to rewrite the whole tool in C# in the near future.

My current formulas for the sliders are:
  • repel: sqrt(exp(1/dist)*trProximity.Position)*cos(angleA)
  • attrack: sgn(ddist)*sqrt(exp(abs(ddist)/trConnection2.Position)*trConnection.Position)*cos(angleA)
  • mutual connections can receive bonus attraction

Performance counters runnning wild -- Perfmon, Data Collection Sets

In our project we were lucky enough to reach the point for performance profiling and optimization.
My colleagues were constantly fighting with time: the profiled instance being requested from the cloud and they were monitoring and then saving the screenshot and the data from performance monitor. They were not able to leave the office until the measurement typically taking 1 hour were done. We needed data from the perfmon.

I just happened to meet the adequate solution on windows.
One can define Data Collection Sets and afterwards getting data out via reports with the perfmon tool.
A sample for ReadyBoost technology profiling can be found here.

Do you happen to know the demotivational poster about premature optimization & the devil? And Mr Knuth of course.)

Long long time ago, there was a .NET/CLR

Recently I had a quite interesting opportunity to talk about .Net fundamentals.
Though using C# for various reasons and framework I am aware that I lack the real bits and bolts of the language & the framework.

An interesting (and quite basic topic) - FYI.

What will b1 and b2 be (and why)?

            object s1 = "apple";
            object s2 = "apple";
            bool b1 = s1 == s2;

            object i1 = 1;
            object i2 = 1;
            bool b2 = i1 == i2;

I remembered that I need the fundamentals of boxing and unboxing, etc; therefore my answer was ok, however the reasoning was not ok. Some background here.
The solution is (true, false). My understanding about the reasons: b1: Reference, however string is immutable thus CLR maps to same address; b2: boxed value type becomes reference type, thus different pointers.

Taking screenshots on an Android phone

The team has just finished our brand new Android client application.
I was naive enough to make an attempt to capture some screenshots on the device.

This task was very straightforward on iPhone, Windows Mobile and even with some utility on BlackBerry. However on Android every forum tried to go for turning on the USB debugging option and then taking the screenshots on the PC.
I do not like this approach (and also it wouldn't work on my PC due to some missing Samsung drivers).

A smartphone should be self-contained: installing apps, taking screenshots, everything.

After some googling I managed to find this nice utility: screenshot.apk.

Try it, it seems to perform well.

A very motivating discussion

Today I took part in a very motivating discussion with Ed, the tech lead for a huge and working software, envisioning a change to unify many applications on a single platform starting from business use cases to real architecture.

A bold, yet realistic plan.
How many teams are brave enough to dream about such a transition?
And how many companies over 100 are brave enough?

VMWare Player on Windows 7

Off topic.
I have tried to install VMWare Player 3 on my Windows 7 system.
The installer produced a quite weird error: setup window pops up then... shazam.... shazam..... uh well. Nothing happens.
An ugly grey and empty window grins on the unhappy user, as found in many complains all around google.

Log says: "20110123224814:ERROR** CHtmlDialog::CallJScript: Failed to obtain required required jscript ID; COM Error: -2147352570".
Many posts claim that booting safe mode will help.
No, it wont :(

The solution was quite simple, yet annoying - this is the reason for my post.

I have booted up an old XP machine, started the installer there. Afterwards looked for the temp folder with a vmware_<some numbers> folder. The folder contains the "vmware player.msi" installer, that can be copied back to my Windows Seven system :-)

Happy End.

ASP.NET,avoiding unnecessary async AJAX postbacks

I have faced an issue trying to avoid unnecessary async postbacks.

First of all, improve the website performance - e.g. avoid using updates by design (e.g. markup or default UpdateMode="always" behaviour),instead use UpdateMode="Conditional" and even consider ChildrenAsTriggers="false".

In this manner one will be able to minimize the need for updating specific update panels and thus posting back dummy markup and causing flicker applying them.

So far, so good, I am able to tell if e.g. updUpdatepanel1 is to be updated by my code and the very same for updUpdatepanel2. I could even check if an UpdatePanel is being updated or not with some little tricks.

But I could not find any means to:
  • check if no update is pending (on server side) and cancel the postback
    currently I am experimenting with Response.End.
  • cancel only one updatepanel at a later point and cause only a small part of the page to be partially rendered....

Thoughts about Scrum ("re-blog")

I have found many interesting thoughts in this post about what is scrum about and what it is not about.
Tips, tricks, hints and failures...

Scrum will not save your project instantly. If started without careful preparation and knowledge there will be little success or fun...

The original post in Hungarian and a very rough translation.

Under-promise & over-deliver versus (?) Scrum

One of my colleagues, happens to be in a fortunate situation to control English almost as a mother tounge. It is always a pleasure to get fresh new ideas from him.

Lately he pops up again and again the under-deliver-over-promise saying.

In Eastern Europe this is one thing most people do not seem to value enough.

Though at some level there can be a trap in this I think that applied carefully and right this can serve as a key element of scrum.
Yeah, I know -- Scrum is about honesty, but currently I seem so many bad examples of over-promising and under-delivering that as a direction is seems to be very tempting.

Keeping the team honest should be the most essential part of any working methodology & project...

Recommended eBook: Agile Development Made Easy!

Some months ago I ran into some slides of Kelly Waters.
I see he has a promising eBook, now on sale for ten bucks.

I have checked his "agile principles" in the past and I have found his style quite enjoyable. He has a brief, well structured mindset, yet doesn't fall into the common mistake of writing some introduction in a agile-for-dummies minimalistic style. I really got useful ideas.

(please note, I am just convinced: I do not get any percentage :-)