October 22, 2011 0

354 problems but easy ain’t one… Hit me!

Recently I came across an interesting place on the interwebs (via Twitter). Project Euler is a collection of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. The goal is to feed mathematical interested people’s hunger to learn and/or keep those people’s problem solving skills on the edge. And by doing so, you also get better insights in modern programming languages. Awesome… no?

Find the largest prime factor of the number 600851475143

I registered an account and solved 10 problems so far. And I must say… It’s more fun I’d have thought! You even get awards for solving specific problem sequences. I chose to tackle the problems using ActionScript 3, just because it’s a quick and nice language to mess around with. If you’re interested, I shared my solutions on Github. And here’s the ActionScript solution to the 3th Euler problem straight away ;-) .

package {
import flash.display.Sprite;

public class EulerProblem003 extends Sprite {
   public function EulerProblem003() {
      super();

      /* 
       The prime factors of 13195 are 5, 7, 13 and 29.
       What is the largest prime factor of the
       number 00851475143?
       */ 

      // Start the algoritm by dividing with the
      // smallest prime (=2).
      divide(600851475143, 2);
   }

   private function divide(num:Number, prime:Number):void {
      while (num % prime == 0) {
         num = num / prime;
         if (num == 1) {
            trace("Result: " + prime);
            return;
         }
      }

      do {
         prime++;
      } while (!isPrime(prime));

      divide(num, prime);
   }

   public function isPrime(num:Number):Boolean {
      for (var i:Number = 3; i <= Math.sqrt(num); i += 2) {
         if (num % i == 0) {
            return false;
         }
      }
      return (( num % 2 != 0 && num > 2) || num == 2);
   }
}
}

Are you exited to try and solve a couple of problems too? Get yourself an account then! Off course you can also take a look at the problems first if you’d like ;-) .

July 16, 2011 0

An iOS yes / no popup, but gentle

For a little personal iOS project, I needed a yes / no popup. And I didn’t wanted to use the default UIAlertView because it feels a bit disconnected from the UI of the app. So I created my very own MKActionPanel, based on the MKInfoPanel class written by Mugunth Kumar (@mugunthkumar).
Kudos bro!

A little overview of all the functionality:
(note: only the last button brings up my MKActionPanel)

Cool, no? And it’s dead easy to use. You just make a single call and the panel shows and hides itself:

[MKInfoPanel showPanelInView:self.view
                        type:MKInfoPanelTypeInfo
                       title:@"Tweet Posted!"
                    subtitle:@"Arigatou!"
                   hideAfter:2];
[MKActionPanel showPanelInView:self.view
                     withTitle:@"Any questions?"
               leftButtonTitle:@"YES"
              rightButtonTitle:@"NO"
                      delegate:self
            leftButtonSelector:@selector(leftButtonTapped)
           rightButtonSelector:@selector(rightButtonTapped)];

The source code is available for free on Github. However, a little mention somewhere in the social cloud woudn’t cost you either ;-) .

To use this awesomeness in your own apps: Open the project in XCode, drag the MKInfoPanel / MKActionPanel group into your project and link your project against the QuartzCore.Framework. And that’s it!

July 4, 2011 0

Google+ first impressions

I had my first experience with Google+ (#googleplus) with some colleagues at work. And I have to say… I am somewhat impressed :-) .

Note that we all own a gmail account, so login and add people to the network were very simple. Immediately I tried the brand new “circle” system to categorize friends. A pleasant experience because it seems to work very simple and innovative. With a gentle drag&drop functionality you can organize everything. Actually, these “circles” are a fancy alternative to Facebook’s “groups”. But they stand out more and are much easier to use. Another nice feature is the ability to “follow” people (Twitter- like). Their public shares are added to your stream in this case. So both friending and following are integrated into a one social network. Privacy settings can be set for each “circle” individually, just like Facebook groups.

Google’s drag&drop is like a tiny godfinger… sorting people

Of course the comparison with Facebook is indispensable; So we started to share opinions, post photos, tag and comment them… Everything went very smoothly and easily. You can even share things directly from f.i. your search results or news reader. This can be done via a +1 button (the equivalent of “like”), and/or through the new black “topbar” on any Google page. Simple no? That’s what Google+ is all about. You get a better overview than with its largest competitor. The pages and especially the friendstream “breathe” more and look very clean. But that’s a personal perception.

Last but not least there’s the somewhat dubious feature called “hangout”. You can join a video (group)chat with friends in your browser. However, to enable this you need a special plugin from Google. At first sight it is a slick feature, but I don’t know whether it will be used widely. A nice addition though is the ability to share youtube videos during a “hangout”. And so therefore you can watch “Keyboardcat” and “Starwars kid” together with your friends :-D . +1 for that!

 

I can say that I have discovered a worthy competitor for Facebook (and even Twitter). But we’ll have to wait whether Google+ can match the latter. It will depend on how much people start using the network. And for that matter, Google’s competitors have a significant advantage. But I would say, try it yourself. And you will see the search giant has built this network with great expectations ;-) .

June 11, 2011 1

An awesome Bumper Pool game

Ladies and gentleman, I present you: the first post on my brand new blog! And because I didn’t wanted it to be about the purpose of my writings, it’s about a Bumper Pool game :-D . That’s right, and it’s called Finger Billiards.

We released this iPad game recently and I can say I’m fairly proud of it. So how does it work? The game comes in a (digital) wooden box you’ll have to slide open. Oh wait… since it’s a 2 player game you might want to find an opponent first. Then, the start player (red or white) is chosen by the box. Let’s play! Use 3 fingers and a rubber band (probably the first digital one you’ve ever used) to take your shot. But be careful, if you stretch the rubber band too far it will snap! Further explanation is not needed I guess. The rules are the same as with it’s bigger brother.

Check the screenshots below for some first impressions:

The game was developed by Nascom. It is build with cocos2d for iOS and box2d. And that’s all there really is to say… If you have not already, go to the App Store and download this game. It might take a little practice, but it’s great fun! And off course you can always contact me for some feedback ;-) .