Thursday, December 20, 2012

UICollectionView prior to iOS6

Recently we had the need of presenting our entries in a kind of gallery in one of our apps. This is not supposed to be a big problem, as in iOS6 the new UICollectionView was introduced, however we were not allowed yet to drop the support for iOS5 so we were basically screwed.

By looking at a solution to this problem i found the PSTCollectionView that was developed by Peter Steinberger for one of his projects, but fortunately he put it open source onto GitHub.

From the functionalities and the look&feel its almost a 1:1 copy of the native UICollectionView but it works all the way down to iOS 4.3, which is great, as we just need it to work on iOS5. The best feature in my opinion is the full interoperability with the native UICollectionView classes and helper classes.

This means, that you're able to use native classes if they are present (so if its running on >iOS6.0) otherwise there is a build in fallback to the custom PSTCollectionView classes. All you need to do in your code (beside providing the library files) is to change the definitions from e.g. UICollectionView to   PSUICollectionView, UICollectionViewDelegate to   PSUICollectionViewDelegate, and so on. The rest is performed in the background.

Installing it into your project is simple as well, mainly if you use CocoaPods, which I'll discuss in a future article.

Thursday, December 13, 2012

Change the SSID on your Telecom Italia WiFi modem/router

If you live in Italy (like me) and your ADSL is provided by Telecom Italia, then you probably got this wireless router as a welcome gift. 
Initially I though that it is, like any other router provided by the phone companies, a castrated version of a badly working modem. Therefore I just put it into its box and away.

However lately my usual router stopped working and as I needed an immediate substitute, that gift came in my mind. When I started configuring it through its loveless GUI I felt confirmed in my aversion against it, however when you're willing to invest a bit more time into it you'll find more and more options present in Netgear or Fritz!Box routers, just badly presented in that awful GUI.

You can have DynDNS, Port-Forwarding, 256-WLAN-encryption, Print server via USB, ... so basically everything you need...

...Except one thing. By default your WLAN is called something like "Telecom-123456" which could be kind of distracting  so that your computers will find 10 or more WLAN with almost the same name.

So, basically I had to change the name of it. Simple you guess? Me too, however there is no option to change the name of the WLAN in that GUI which was really surprising me, but there is a solution to that problem too.

Basically just create a backup of your routers settings using the GUI, which will be saved as something like "AGConfig20121212.kry". That one is an encrypted version of the settings which we are going to decrypt using the following command

openssl aes-128-cbc -K 65316532656263323039373831383630 -nosalt -iv 0 -d -in AGConfig20121212.kry -out AGConfig20121212.xml

In the XML then you can just search for the name of your WLAN and change it to a name you like it to be. After that we need to encrypt the changed file using the following command (note that "-e"(encrypt) now changed to "-d"(decrypt) and the filenames are in reversed order)

openssl aes-128-cbc -K 65316532656263323039373831383630 -nosalt -iv 0 -e -in AGConfig20121212.xml -out AGConfig20121212.kry

Now you can just restore your router with this newly created file (pay attention on your power supply during that action) and provided that you did not change any other values in the file, your router starts up in the same configuration as before just with a new SSID.

Golang setup PATH

Quite recently we startet in the company to use and write some Go programs. I love Go. It's easy to learn, read and modify. One of the m...