Category Archives: Tips & Tricks

How to move unmovable apps to the SD card on Android?

Hey there!

It’s been a pretty long time since I haven’t posted anything here, certainly because I actually didn’t have anything important to write. But anyway, today I’d like to share with you a trick I discovered that fixed low internal storage space issues on my Samsung Galaxy S2. Because a few weeks ago I started to experience my first “insufficient storage available” as I didn’t install any new apps or anything, perhaps the apps that were already installed continued to grow by themselves certainly due to cached data or something, using always more storage space over days.

My Galaxy S2 during the process

My Galaxy S2 during the process

My first thought was to move all my apps to the SD card but I realized once I opened up Android’s apps manager that only a bunch of them could be moved, and those were the lightest ones installed on my phone, max. 10Mb whereas Facebook for example (which is an unmovable app) uses something like 50Mb (and I still don’t understand why). Once I moved all the apps I could, there still wasn’t enough free space anyway so I had to find out a way to move those annoying “unmovable” apps.

The trick is pretty simple, it is actually just a command to run in a terminal emulator on the device itself with root permissions:

$ su

# pm setinstallLocation 2 (for Android <4.0)

# pm set-install-location 2 (for Android 4.0+)

Choose which command suits your phone, depending on the Android version it runs.

If you don’t have root permissions on your device, use ADB (included in the Android SDK) in a shell on your computer, the commands may differ on Windows:

$ cd path/to/adb/

$ ./adb devices

$ ./adb shell pm setinstallLocation 2 (for Android <4.0)

$ ./adb shell pm set-install-location 2 (for Android 4.0+)

Please note that you can display the current configuration by entering the following command (thanks Amandilh!):

# pm get-install-location (directly on the phone)
./adb shell pm get-install-location (using ADB)

Voila! Your phone will now install every new app on the SD card and you’re now able to move ANY app to the SD card, enjoy! :)

AirPlay server on the Raspberry Pi

As said in my post’s title, I received my Raspberry Pi at home something like a month ago, but I was unable to play around it because of high school etc… Now that I’m officially in holidays for three whole weeks, I will have some free time to spend on hacking with my new toy!

A wild raspberry as an AirPlay receiver

A wild raspberry as an AirPlay receiver

As you may already know if you follow me on Twitter, the main reason I ordered this Raspberry Pi for was to use it as an AirPlay server, so I can stream some sound over the air, directly through my speakers from iTunes or an iOS device, like an iPad. So, as soon as I bough an SD card (4gb – Class 4, enough storage space and relatively fast, basically what is recommended to install Raspbian) for my Pi, I installed Raspbian (which is a custom Debian version for the Raspberry Pi) and I began setting up Shairport, the open-source Airplay server that I used for this process.

So let’s get into it, most of the commands I’m gonna be using here requires root access, so log you as a superuser for all the tutorial, it’ll be much easier. Just be careful, don’t screw up and follow my steps when you’ll be root on your device.

First of all, you will need to install a few packets which will enable you to compile Shairport’s sources, what we’re gonna be doing in the next step.

root@Hera:/home/drav# apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils

Next, we will fetch Shairport’s source code to compile it with all the tools that we have downloaded.

root@Hera:/home/drav# git clone https://github.com/albertz/shairport.git shairport
root@Hera:/home/drav# cd shairport
root@Hera:/home/drav/shairport# make

So, at this point you may get a few compilation errors. If everything went as expected, you can skip this step and go to the next one. Anyway, on my device I got these errors, for a pretty simple reason… If you see that sort of ugly things instead of a glorious “done” message at the end of the process:

cc -O2 -Wall -c alac.c -o alac.o
make: cc: Command not found
make: *** [alac.o] Error 127

… this is simply because the development package is not installed on your machine. To fix this problem, the solution is pretty simple:

root@hera:~/shairport# apt-get install build-essential

And that’s it. Relauch your make command and normally everything went back to normal! Let’s get into the next step, we’re going to select an audio output and start our Shairport server to see if everything is all right.

Talking about the audio output, if you wanna use your Pi’s one, then you will have to use that command:

root@Hera:/home/drav/shairport# amixer cset numid=3 1

Congratulations, in theory your sound should come out of your Raspberry’s jack plug, let’s check if everything works well by launching the server.

root@Hera:/home/drav/shairport# ./shairport.pl -a HeraSound

So, just a little explanation on how this command works… ./shairport.pl is obvioulsy to start the server using the executable file that we just compiled, no need to be genius to understand this (well, in fact I’m actually writing some useless stuff to raise the word counter on my WordPress admin interface ^-^). Anyway, something maybe more helpful, -a HeraSound is to specify the name you wanna give to your AirPlay server. You can set it to “LivingRoom”, “bedroom”, whatever you want. Personally, mine is called HeraSound simply because my server is called Hera Linux. It’s up to you, use your cat’s name if you really don’t know which name to use.

Okay, let’s go back to the tutorial. In principle, and I say “in principle” only, your Shairport server should work fine. But it’s possible that you experience sound issues, for example, my Raspberry Pi’s sound didn’t come out of its jack output. So, once again, there is a completely rational explanation for this problem (which, from what I read and what I heard is quite common), that is that Alsa (I mean something which related to Alsa) isn’t installed. So yeah, that’s normal, it won’t work if you’re in the same case as me. :D
To resume, If you get that kind of error messages:

root@Hera:/home/drav/shairport# ./shairport.pl -a HeraSound
Established under name ’24803C3438E3@HeraSound 1004 on Hera’
ALSA lib confmisc.c:768:(parse_card) cannot find card ’0′
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM default
FATAL: Could not open ao device

… then the audio driver isn’t correctly loaded on your device! To solve that issue, nothing easier… We just have to install the alsa-utils package and to run the right modprobe, and the job’s done!

root@Hera:/home/drav/shairport# apt-get install alsa-utils
root@Hera:/home/drav/shairport# modprobe snd_bcm2835
root@Hera:/home/drav/shairport# ./shairport.pl -a HeraSound

Voila! So, yeah, I don’t really know if that normal but on my machine, I’m obligated to run my modprobe after every reboot so my sound works properly. Because that command requires root access, that a little bit complicated and we cannot manage to run it on every boot with the init.d directory, we’ll see this at the end of this article. Anyway, if even after rebooting your device your sound works well, you won’t need to follow this extra step. That’s just a part for luckless guys like me.

So, normally your AirPlay server works pretty well (if it doesn’t, then I can no longer help you, Google is your friend). The only (big) issue is that we need to start the server manualy. So basically what we’re going to do next is moving Shairport’s script to our init.d directory, so that it starts automatically when your Raspberry Pi boots up.

root@hera:/home/drav/shairport# make install
root@hera:/home/drav/shairport# cp shairport.init.sample /etc/init.d/shairport
root@hera:/home/drav/shairport# cd /etc/init.d
root@hera:/etc/init.d# chmod a+x shairport
root@hera:/etc/init.d# update-rc.d shairport defaults

… but it’s not sufficient! At this point your Shairport daemon starts on startup, but without any name specified. So what we’re gonna do is editing the perl script with nano shairport and finding the DAEMON_ARGS line to make it look like this:

DAEMON_ARGS=”-w $PIDFILE -a HeraSound”

After, same as before, put anything you want instead of HeraSound. Personally, I don’t care.

Okay so this is the part for luckless guys like me. If you’re not concerned and if your sound is working on your raspberry without having to do any modprobe after the boot, that’s great and you can skip this section.
To get the sound working on your Pi, you have to do a modprobe snd_bcm2835, am I right ? But this command can be ran only as a superuser, because of this we can’t run it on every boot using the init.d way.
In fact, it’s not really difficult to fix this problem. You just have to do a nano /etc/rc.local and to type modprobe snd_bcm2835 just before exit 0. Voila! The job’s done and the modprobe is gonna be launched on every boot to load the audio driver!

Congratulations, you just installed a 100% working AirPlay server on your Raspberry Pi! Use it as you want, plug it behind a stereo or build a speaker with it! :)

And, as a bonus, a little home-made video showing you a little bit the result of the process (french).

Using a fingerprint reader on Linux Mint

Hi there!

I hope that you really enjoyed this season to do your last snowboard or ski sessions, in my case I was in Vars (French Alps) and it was awesome ! But anyway, that is not today’s topic. So, in this post, I’m going to show you step-by-step how to use a fingerprint reader on Linux. For those who are wondering how useful it is: first of all that’s very handy to log in when your laptop starts up, and finally, it allows you to refrain from your password mostly everywhere you used to type it (like in the console when you have to use sudo commands for example). You no longer need to enter your 20 characters password every time you wanna do something that requires root access, in the console as well as in the graphical interface. And this is quite awesome, because the support for fingerprint readers becomes far more advanced on Linux than on Windows! What a shame as they has first been designed to run on Microsoft’s operating system!

Okay so let’s get into it. As you may have already guess, this manipulation won’t work with all the fingerprint readers. AuthenTec’s ones (like the one I’ve got on my DV9000) are well-known to work without any trouble with the tools we’ll be using. If you are not sure whether your reader is compatible or not, follow the “tutorial” anyway and you will see if it works. 😉

So, first of all we’ll need to install all of these packages:

$ su
$ apt-get install fprintd libpam-fprintd

Once you’ve done it, you no longer need to do anything else except enrolling your fingers and linking them to your user account.

The “true rootz” way

As said in the sub-title, we’re gonna have a look at the easiest and the quickest way to enroll your fingers in the software, because this manipulation can be done by just running a command into the terminal.
So, to start the fingerprint-enrolling process, execute the fprintd-enroll command and swipe your finger as the softwares asks it.

$ fprintd-enroll
Enrolling right index finger.
Enroll result: enroll-stage-passed
Enroll result: enroll-stage-passed
Enroll result: enroll-stage-passed
Enroll result: enroll-stage-passed
Enroll result: enroll-stage-passed
Enroll result: enroll-completed

Simple, and efficient. :)

The “Windows users” way

Open the “User Accounts” application from the main menu and unlock it by clicking the button in the top right corner. Then, enable the fingerprint reader, choose the finger you want to enroll and the job’s done!

No matter which way you used to get your fingerprint reader working, you get exactly the same result, and if you reader works well with fprintd, you should now be able to use your finger almost everywhere, when your system asks for an authentication (terminal commands, GUI softwares etc…)!

Clone your hard drives with XXClone!

Hello everyone!

During this weekend, I suddenly wanted to replace my HP DV9000′s old 150Gb HDD by a brand new Scorpio Blue 640Gb hard drive from Western Digital. But here is the problem: how could I move all the content from my actual hard drive to the new on, including of course the operating system without having to reinstall Windows/Linux? I just had to clone it!

Hard drive cloning with XXClone

Hard drive cloning with XXClone

To get this job done, I used a little piece of software called XXClone, as written in the post’s title, it allows you to do a complete carbon copy of a hard drive to a second one. It means of course that all the content of the drive is cloned, including document, softwares and of course, the operating system. It can even transfer the “bootable” characteristic from one disk to another… And, the last but not least, this is a freeware!

Software’s graphical interface is pretty easy to handle and asks on the home screen for your source hard drive and your “target” hard drive, if you search a little bit in the “Cool Tools” tab, you’ll find the option which can transfer the bootable characteristic from the source drive to the target one. In my case, cloning my hard drive took me approximately 3 hours (for something like 140Gb of data) and I’ve been obliged to restore the MBR on my target HDD, I think I’ve done something wrong, certainly ticking a case that I wasn’t supposed to tick.

Anyway, this software does its job, and it does it pretty well, maybe it is not as powerful as Norton Ghost but it works for simple taks and, over all, for free. Please notice that beyond simple cloning, the software can be used to do some incremental backup. I think that this software and a storage server working together could do the same job as cron & rsync on Linux. :)

XXClone is available for free here but a paid “pro” version also exists, to enable servers support, HyperSync (to get a super-fast cloning), auto-shutdown and lots of other cool options.

 

Online-mode boolean sets itself back to true on every Bukkit startup? Here’s a solution.

Hi there,

During this week-end, I had the idea of going again into setting up a multiplayer Minecraft server with Bukkit.
So, I download the latest CraftBukkit build, everything is all right, I write my run.bat script to launch my .jar file and I input Java’s executable path in my PATH environment variable. As usual.
But, because there’s a but, I’ve got a pretty big issue with my server. On every startup, the “online-mode” boolean in the server.properties file came back to “true”! Of course, I haven’t bought the game yet (shame on me, I know), but this parameter allows me to enable or not the user account checking on Minecraft.net, in other words, it allows cracked versions to log in on the server.
I’ve got a solution to this problem, you just have to edit your Batch script which should look like this:

@echo off
java -Xms1024M -Xmx1024M -jar craftbukkit.jar -o true
PAUSE

… and to change “- o true” into “-o false”, which should give you this final result:

@echo off
java -Xms1024M -Xmx1024M -jar craftbukkit.jar -o false
PAUSE

And that’s all! Restart your Bukkit server and normally the offline mode warning message is displayed, your server is now allowing cracked Minecraft versions! :)

Online-mode warning message on Bukkit

Online-mode warning message on Bukkit

Use your Galaxy S2 with woolen gloves

Winter is there since a little bit of time now and you may certainly have put on your old woolen gloves for this occasion, but here’s the point, Santa didn’t bring you the brand new Lumia 920 (which allows you to use the touchscreen through your glove or anything else) and you’re keeping your “old” S2? You would say that’s impossible to use the touchscreen without removing your hyper-thick gloves? Anyway, I have a 100% software solution for you, so you will save money on buying touchscreen-compatible gloves. :)
So, to do this, you’ll need a CyanogenMod-powered Galaxy S2… And that’s all.
You’Il just have to go to “Galaxy S2 settings” from the launcher, slide to the “Screen” tab and then set the “Touch Sensitivity” to 20.

Galaxy S2 Sensitivity

That’s all, and your smartphone should now work fine with your woolen gloves! Be careful, I’m actually talking about woolen gloves, not synthetic ultra-thick gloves that you use to wear when you ski… The functionning of this manipulation is pretty simple to understand, what you’ve just done is increasing the sensitivity of the digitizer.
This works pretty well, the proof is that I’m currently writing this post on my Galaxy S2 without any trouble!
Please notice that if you increase the sensitivity to 10, you will no longer need to touch the screen to use your phone. 😀

Have fun, your hands are going to be thankful ^_^.