Monday, May 20, 2013

How to get icons for your projects

Snippet from the Perqui iconset
If you're a hardcore software developer like me, you'll probably know this problem: you suck at designing stuff – especially icons. I'm getting better in creating simple vector graphics but it's still a long and cumbersome procedure. If you don't have the time or even patience to create your own icons, then there are some pretty great websites out there, where you can get free icons that you can use for your projects.

My favorite is Icon Finder, which offers a great search with icon previews and designers can upload multiple icon resolutions. Most of the icons are released under some Creative Commons license, which is great for both the designer and people like us. Linking back is a great way of promoting a designer and seeing some great icon could even lead to developers contacting designer to start working together :D
In addition, Icon Finder recently started a Marketplace which even allows designers to directly sell their works instead of implementing their own web shop.

Another great resource is Icon Archive, which is pretty similar to Icon Finder, but the website is not as pretty and usable. The icons hosted there are also not as good as on Icon Finder.

One of the disadvantages of Icon Finder and Archive is, that the icons are usually available as PNGs and ICOs (rarely as SVG). Even though they often available in multiple resolutions, you sometimes need them in an even different resolution because you want to combine them.

This is where the third great resource, OpenClipArt Library, can help you. It's a great place to get vector graphics (SVG), which you can freely reuse for your own good. And the best about OpenClipArt is the license: Public Domain! That's why I started working with Inkscape to design my own icons using parts of really great graphics available on OpenClipArt.

Do you have some other locations you get your icon inspiration from? Would love how other not so experienced programmer-designers do it – except for actually having a designer as a partner ;)

Thursday, May 2, 2013

The observer pattern in different programming languages

It's time for a more technical post. I have to admit, it seems like I lost focus on what I wanted this blog to be and from now on I will post more technical stuff here – as well as continuing with reviews, but focusing on more interesting review topics ;)

Some time ago I realized that when working with events and using the observer pattern (see GoF - Observer pattern), there is a huge difference between programming languages. I never really thought about it, but when you work on multiple platforms using different programming languages, you realize, how different this simple pattern can be.
The programming languages which I want to compare are ActionScript, Java and C#. Let's start with the descriptions of the implementations and after that I will talk about advantages and disadvantages.

ActionScript
Basically it's very easy to use and implement events using ActionScript. In order to dispatch events you have to inherit from the class EventDispatcher (or one of its subclasses) to get access to the method dispatchEvent(e:Event). This method takes an Event object and then dispatches events to observers. There are already some subclasses of Event you can use if the event includes data that the observers should receive, for example DataEvent which includes a string data field. If you want developers to be aware of events an object dispatches and provide them with better code completion (at least in Adobe Flash Builder), you can add the following metadata to the class:
[Event(name="dispatchedEventName", type="flash.events.Event")]
The name of the event is the same as the Event object's type name and the type is the actual ActionScript datatype of the dispatched event.

Observing events is quite easy too: just create a new object and add or remove an event handler method for a specific event using the methods provided by the subject's base class EventDispatcher:
addEventListener(type:String, listener:Function) and removeEventListener(type:String, listener:Function)
Again, the type of the event is the Event object's type name.

Java
In Java it is possible to use a similar approach as with ActionScript: there is a class java.util.Observable that a class can extend which provides methods for registering, unregistering and notifying observers (addObserverdeleteObserver and notifyObservers). In this case observers are classes that implements the interface java.util.Observer to receive notifications about events when the method update is invoked. You can of course also implement your own custom observer base class and observable interface.

But wait! When you work with JavaBeans it's not the same. A JavaBean requires the developer to follow naming conventions: for (un)registering an observer you have to implement a method add/remove<Event>Listener(<Event>Listener a). Now you can just use an Observable object to delegate the functionality. Instead of Observer objects you have to create a new interface that extends Observer but name it according to the naming conventions.

C#
Last but not least the observer pattern in C# is quite simple too. Again there are two possible solutions: you can use the IObserver and IObservable interfaces and implement them (very similar to Java) or you could use "real" C# events.

At first you have to declare a delegate that describes the interface of the observer's callback method (1). Then you can use this delegate as the datatype of an event property/field (2). To fire the event you just have to check if the field isn't null and call it like a method (3).
Registering and unregistering is very easy. Just add or remove observers (4).
public EventDemo {
(1)  public delegate void AHappenedDelegate(A a);
(2)  public event AHappenedDelegate AHappened;
  protected void DoAHappened() {
    if (AHappened != null)
(3)      AHappened(new A());
  }
}
public void SomeAHappenedDelegate(A a) {...}
(4) AHappened -= SomeAHappenedDelegate;
AHappened += SomeAHappenedDelegate;

Comparison
Basically, most approaches are quite similar. The approach I like the most is the C# events, because you have a dedicated event type for registration and dispatching. It's really easy to use and you have the necessary syntactic sugar ;)
Everything else is nice, but could be better. Especially when working with Java, it's kind of annoying to only have naming conventions and no real guarantees on implementing it correctly – except maybe via IDEs.

I hope you liked this quick comparison and next time you work with events, think about it and maybe you know some completely different approach you would like to share :)

Wednesday, April 24, 2013

Update: Simple Battery Widget for Android

Some days ago I finally got my Android developer account was finally upgraded to include the possibility to reply to Play Store reviews. Because I had just received a reply from another developer, I saw that I was also able to do that and immediately started going through comments.
This was when I stumbled across a really helpful review, asking me to remove the loading indicator icon or percent text on my Simple Battery Widget for Android. I had already read the review over a month ago, but didn't have time to implement it yet.
So this is what I did: work on the Simple Battery Widget.

The update to version 1.6 is already live in the Google Play store and as previously you can download my widget for free. The biggest changes are, the new configuration user interface, which now looks more like a real Android 4 app using the awesome ActionBarSherlock library – also on devices running Android 2.x (the widget still supports Android 2.2 ;)).
Of course one of the new features is the loading indicator. You can now display either both the percent text and the loading icon (as before), display only the icon or only the text, during charging. Hope this makes the interface better!

Another feature request that I have received in the past is customizable percent boundaries. They are also included in this update and I hope the interface is intuitive enough. A small update for Android 4+ users: there is now only one widget available in the widget chooser, because the centerable 2x1 widget can be achieved by resizing the widget. For earlier Android version the two widget sized stay the same.
Enjoy!

Friday, April 19, 2013

Review: Mini Solar Power Toy Car by ChinaBuye.com

There's another small gadget I got on ChinaBuye: a miniature solar powered toy car.
Solar powered car still in packaging
The miniature car does not come with batteries. Why? Because it does not need them. It only needs the sun and is powered by a solar panel that is about 2.5 x 2 cm. It's really nice that this works–sure it's no rocket science and basically quite simple, but nevertheless nice to actually see how powerful our sun is :).
And this is also the main reason this miniature toy car exists: educational purposes. Even though it does not ship with an instruction manual on how to create such a solar panel, it still shows how the whole stuff works: put it in the bright sun and it will produce enough energy to power the motor.
You can get the gadget here for about 2 USD, but as usual, the price is subject to change–shipping will be free of course.

Here's a short video I made to show that it actually works:


Thursday, April 18, 2013

Review: Sports Bracelet Watch by ChinaBuye.com

As you'll probably remember, I bought some stuff on ChinaBuye, because I wanted to check out the gadgets they offer. After almost a month waiting for the items (it was my own fault, because I used the free but slower shipping method ;)), I finally received them.

Current time showing on the display
The first item I want to review is the silicone Sports Bracelet Watch which you can find here. As already mentioned, it is made out of silicone which is, according to the description and I have already worn it a couple of times, not harmful to your skin ;)
Thanks to the material it's really comfortable and should fit almost every regular sized wrist. They did not include a size, but it has a diameter of about 6.5 cm.
Even if the size is a bit too big for your wrist, it should not end up faced down on the "back side" of your wrist, because it's not a perfect circle but more or less egg-shaped. This will prevent it from changing position. In addition, the flat parts on the sides are ribbed (see picture right), which should also help.

The nice thing about the watch is, that as soon as you get it, you can use it. At first I was a little bit afraid that it would not come with batteries, but it did. Also, the friendly people from ChinaBuye's customer service already confirmed it before I ordered it. So, just rip open the packaging and you're ready to go.
Wait, there was one thing you have to do: set the time, which is again, really easy. There are two tiny buttons on the back side of the casing which are labeled A and M and with the help of a small, pointed object you will be able to set the date and time. And yes, it does not only show the time of the day, it even includes a date. As soon as you are finished setting the time, it will start cycling through the two and instead of two points blinking as a seconds indicator, the word Hello will blink, which is a pretty nice touch ;).

According to the item details, it's supposed to be 1ATM water resistant (which is about 10m) and I can verify that holding it under the running faucet didn't kill it. So don't worry if you actually use it for sports, get sweat all over it and wash it off again–or even wear it when taking a shower.

So there is only one thing left to mention: it's not only available in red, but you can choose from red, black, green, purple, white, blue, yellow and cyan. The price will probably vary (it even does for different colors), but you can get it for as little as around $1 with shipping already included!

Saturday, April 13, 2013

Project Analyze, something amazing by Microsoft Research

Since I started blogging for the AmbassadorBase, I come in contact with a lot more Microsoft related content am I have to admit, that I'm really glad about that: Microsoft Research has a lot of really great projects :)
I recently found a video leak of a still unannounced project called Analyze, which will certainly revolutionize how you enter queries in Microsoft Excel:

With this project, Excel can be controlled using natural language input. In the video they use an Excel sheet with wages (base pay and overtime pay) and instead of writing some unnatural and rather complicated formula like =F1+G1, =F2+G2, …, you just enter "add the base pay and overtime pay" and it will automatically sum up the columns base pay and overtime pay.
This is a really simple example, but something like "add up the pay for the capital hill baristas", would actually sum up only pays for baristas – something which currently involves quite complex forumlae. It's even possible to just highlight cells, rows or columns that match certain conditions as well as generate charts.
I'm really impressed by this because I know how complex natural language recognition is and hope this will actually mature into a real product. Wouldn't you also love to control Excel using natural language instead of those weird formulae? ;)

Wednesday, March 20, 2013

Review: Sony SmartWatch MN2

Everyone is currently talking about smartwatches. Some companies, like Samsung, announced new products, for other, like Google and Apple, people are speculating about them releasing a smartwatch. I already wear one everyday since December because I got one for christmas: the Sony SmartWatch MN2.

Let's start at the beginning: what is a smartwatch?

Simply put, it's just what the name says: a wristwatch, which can display more than just the time, but also more sophisticated information. Usually smartwatches include a (for a watch) big display, different sensors, like vibration or sound and they are connected with your smartphone to connect with the internet. Some recently announced smartwatches also come with a mobile radio, but usually you connect them with your smartphone.

Why would I even need a smartwatch?

The simplest use case for a smartwatch is displaying information from your smartphone – usually notifications about incoming phone calls, text messages, emails or the latest weather report. Basically, a smartwatch is an external display for your smartphone. It's especially useful if you receive a lot of notifications and don't want to check your phone all the time – just look at your watch and you know if the notification is important enough to get our your phone ;)

Specifications and the Sony SmartWatch MN2

Let's start with the specifications of Sony's SmartWatch MN2, which is the direct successor of the 2010 Sony Ericsson Live View. The SmartWatch has a 1.3" OLED color display with a resolution of 128x128 pixels – not retina but enough. The display supports multitouch gestures with up to two fingers. In order to use the SmartWatch, you have to connect it with your Android 2.1+ device via bluetooth. It would be nice to also use it with other platforms like Windows Phone, iOS or BlackBerry 10, but I don't think Sony will (and even can) release apps that support those devices too.
The case is made from aluminum and plastic and only measures 36x36x8mm, which is not much bigger than traditional wristwatches. According to Sony, the battery lasts about 3 to 4 days, or 14 days when in standby. To inform you about notifications, it includes a vibration module. You can get the Sony SmartWatch MN2 via Amazon.at at around 80€, which is quite cheap – especially compared to other smartwatches.
Some days ago the SmartWatch received an update, which included more types of watch faces and a better user interface of the Android management app. In order to run apps, you have to install them on your Android device and connect via bluetooth. Otherwise you will only be able to see the time. Apps will run on your phone and only send display and vibration updates to the watch. You can also interact with the apps via touchscreen inputs.

Me and the Sony SmartWatch MN2

After more than two months wearing the Sony SmartWatch, I can only say that I'm really satisfied and I love using it. At first I was really skeptical if an external display even makes sense, but by now I have postponed reading and replying to unwanted mails often enough but just looking at the watch's notification that it definitely makes sense to own one ;)
Another concern was battery life – not only of the watch, but also of my phone. I was worried over nothing, because when disconnecting the bluetooth connection over night (I'm not wearing it when I'm sleeping ;)), the battery lasts almost a whole week! And my smartphone? No difference to before, even though it's not even using bluetooth 4. You can even schedule disconnecting your watch using Sony's Smart Connect app.
I'm also very satisfied with the apps available for the watch. They can be installed directly via the Google Play Store and Sony already released a lot themselves. In addition, there was a coding contest last summer, which resulted in a lot more 3rd party apps. There're apps for reading email, text messages, a minimalistic phonebook, weather and calendar apps and much more.

Similar products

There are of course other products than Sony's SmartWatch. There's Pebble, a kickstarter funded e-ink smartwatch, i'm watch, from an italian manufacturer, Meta Watch, a very open and developer-friendly product. Casio also announced a G-shock smartwatch, which looks just like their regular digital G-shock wristwatches.

Résumé

It's definitely not for everyone but thanks to many different manufacturers, smartwatches are slowly getting the attention they deserve. Even though they are nothing more but an external display for smartphones, they are great for deciding on getting our your smartphone or not. It's really nice when people notice my watch, ask me about it and even comment, how cool it is to own the "Knight Rider watch" ;)