Geek Garage

Find inspiration in awesome ideas.

Category: Tutorial (Page 1 of 3)

Setup Django on OS X

Installing Django on OS X is just as easy as any other Python library or framework. It is just a one line command as it is described in the Django documentation. But if you have an all-new OS X system, you don’t have all the tools installed. Pip is not part of the standard system, but installing also straightforward and you just have to follow the documentation. This post is a reminder for all the steps.

To download the pip-installer, the preferred way on OS X is by using curl:

curl -O

You can install pip using this installer. Be aware that you’ll need the administrator privileges.

sudo python

Now you can install Django as it is described in the documentation which was version 1.7.1 at the time of writing this post.

sudo pip install Django==1.7.1

You can finally check if the installation is successful in a Python console

>>> import django
>>> print(django.get_version())

As you see, no tricks here. All the documentations are correct so everything should be ready in less than 5 minutes. Hope that if you find this post, it will have saved you the extra minute to search trough the different docs.

Upgrading to Yosemite and Android Studio

I just upgraded to Os X Yosemite and ran into some issues to have Android Studio running properly. Some things must be checked right after the upgrade. But you will have the same issues on a new Mac while installing your development tools. So, check this out.

You must remember that Java is no more part of Os X. So every time you upgrade Os X, you have to install it again. If not, launching any JetBrains software will pop up this message.

Java not found dialog

Actually, this message is a little misleading. If you google the problem, the solution is straightforward: you’ll have to change the value of the required jdk version in a configuration file. You just have to find the file Info.plist which is located into:


Edit that file, look for the following lines:


And make the following change


So now you are supposed to launch properly Android Studio. Unfortunately, you may see the same message again… Sounds weird until you check your Java version.

java -version

And this is how I remembered that Java was removed by the system… Told you the message could be misleading. Just install a JDK and your IDE should launch properly.

This setting is not restricted to Android Studio. Actually, you should edit the Info.plist file for every one of your JetBrains software. They should be in your Applications folder. I had to update the configuration file for PyCharm, located into


Unfortunately, you’ll have to get used to this. Every time I updated Android Studio, the process asked for an update of this configuration file which will roll back your modifications.

Back to Android Studio. Once I launched it, the project loaded properly, but unfortunately stopped with the following message.

Gradle can't find javaHome dialog

The trick is that the JavaVirtualMachines is no longer into this path but into /Library/Java. So you may have to correct that value either.

Now, you are good to go.

Using the Dropbox SDK with Android Studio and Gradle

Dropbox DeveloperDropbox provides a set of interesting online services. Last year, they released a nice feature, the Datastore API. The documentation is good, but meant for using with Eclipse. If like me, you are using Android Studio, you will have to look for some more steps to make this working.

I gathered all of them into this single post.

Read More

Be efficient in your shell command trough outputs

I just read a tutorial about configuring Apache where you had to create a conf file based on your username. The tutorial reminded that you can get your username trough the whoami command. So this is the two commands you should issue.

touch username.conf

Two commands and a copy & past. Not cool as there is a far easier way. Remember that you can get the result of a command while using Bash. Historically, it was trough the backticks, but today, $(…) is preferred. So, rather than two lines and a copy & past, prefer this single line

touch $(whoami).conf

This way, you don’t have to worry about the username. Even better, ou can use this in a shell script.

Android, how to programmatically get a ressource

BIG T3 view

On BIG T3, the flags are resources loaded dynamically.

This was my problem: in the application Brothers In Games T3, I needed to display some images depending on a parameter. Those images are country flags and are the one of the country where the event is located. Those flags images are resources stored in the app. Their name is standardized with the country ISO code.

Now, how to load a resource when you have to compose its name ? I mean something more elegant than a brute if country then load resource elsif other country…

Fortunately, Android offers an elegant and easy way to do so, but maybe not that obvious, so lets see how it works.

Read More

Easily delete jpg files when shooting RAW+jpg

As a photographer, I always shoot in RAW files. But unfortunately, my Canon G11 cannot be set for only RAW files. If I want a RAW file, it will be a RAW+jpg. So, I always have to get ride of the jpgs once unloaded on my computer. In the easiest scenario, I could just delete all the jpgs files once exported.

But the G11 is the family camera. My wife sometimes shoot in the green square mode. When set to the green square, there is no RAW file, only jpg. So if I unload the pictures, I cannot just delete the jpgs as I will delete those pictures which exists only as jpgs.

I could check every file and delete it by hand, but we use computers, they should do the job. Actually, the job can be done by a 10 lines shell script.

Read More

Referencing a local aar file in Android Studio

If you have created a library in Android Studio, you certainly want to use it in another project. The easiest way should be to create the aar file and then reference it from your new project. Prior to Android Studio 0.4.4, referencing local aar files was not supported as you can see from Xavier Ducrohet or in this issue report.

But there is an easy workaround for this. Lets see what we have to do, lets say, after you’ve created a stand alone library.

Read More

Date manipulation curse from Java in Android

Java does certainly have the reputation of the worst date manipulation features. This all comes with the bad designed Calendar API. Hopefully, there are better third-party APIs and if you have to manipulate dates, moment, times… You certainly prefer JodaTime. From my point of view, it’s a no brainer.

I was working on a date picker for an Android project and found that the SDK provided a set of convenient methods and interfaces. But this lead to a little bug in the interface, a little shift in the displayed date. Of course, this comes from the old Java Calendar API curse and from a lack of precision in the documentation.

Read More

Parsing RSS feed from an Android device

When it comes to RSS feed parsing, any Java developer will use the org.xml.sax library. But Android provides a nice wrapper that simplifies the code without sacrificing the performances. This wrapper is present since API level 1 and is the easiest way to write a simple parser for any XML.

In this tutorial, I’ll show you how to parse a RSS feed using the android.sax package. I’ll use Geek Garage’s feed. As any XML parsing, using the android.sax package, you can ignore the elements you don’t need, so, I’ll only collect some of the items.

Read More

Create a standalone library with Android Studio

As a software developer, you know that reusable ressources should be in libraries. Android is a Java-based technology, so, your library can be a jar file. But if you want to store some Android specific resources, you need to create a Android Library Project.

Google released Android Studio as the main development platform for Android. Android Studio is a packages IntelliJ Idea environment and relies on Gradle for the build management. At the time being, it is a little unclear how to manage a library so this is a first tutorial.

Read More

Page 1 of 3

Powered by WordPress & Theme by Anders Norén