Geek Garage

Find inspiration in awesome ideas.

Upgrade and change on GeekGarage

Wow… My last post on this blog was nearly one year ago. No I am not dead, I just didn’t got on this as I should have. Today I do because of the last WordPress upgrades.

So, with those upgrade, I did some changes on the blog behavior. One of it is the comment feature. Until now, i used a plugin which posted the comments on the social medias and usually, people commenting here are using their Google/Google+ account.

Starting today, I am pushing the included comment feature. Soon, I will certainly disable the old plugin. The reason is because comments are meant to open discussions. Unfortunately, when you post on the social feed, nobody gets a notification. So I will give it a try with the included comment feature.

Si aside of this, I really have to post some stuff here, I have a lot to say regarding Android, Python and Swift.

Check back soon…

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 https://bootstrap.pypa.io/get-pip.py

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

sudo python get-pip.py

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())
1.7.1

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:

/Applications/Android\ Studio.app/Contents/

Edit that file, look for the following lines:

      <key>JVMVersion</key>
      <string>1.6*</string>

And make the following change

      <key>JVMVersion</key>
      <string>1.6+</string>

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

/Applications/PyCharm CE.app/Contents

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.

whoami
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.

March minibuild at the LEGO Store

March sounds like the return of spring, and that is exactly what awaited the kids at the LEGO Store. This month’s minibuild is a spring tree.

Spring tree

March 2014 minibuild, the Spring Tree

Well, spring tree… Lets say a fun spring tree straight from the Magic Kingdom of UniKitty…

Read More

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

February Mini Build at the LEGO Store

This month, you are certainly waiting for the return of the Walking Dead. But for LEGO, February is the month of the LEGO Movie. So, the Mini Build had to be about the movie.

LEGO 40095 Micro Manager

The Micro Manager at the LEGO Store

This black box robot is called a Micro Manager. There are already plenty of those in the boxes related to the movie, and this is certainly the simplest model.

Read More

Page 1 of 9

Powered by WordPress & Theme by Anders Norén