Android device as a security camera

I have a really old android phone sitting in my drawer. Its high time my Galaxy Spica got a new job and so can your old device.

Start with the easy part. Install SSH Server on your device, its totally free. This app will help you remotely reboot your device, so you do not have to touch the device, after you set it up. Make sure you enable auto start of the app on boot. When creating a new server for SSH make sure you enable auto boot as well and memorize the connection port. On users tab, add a user with the password. Try to connect to the device with putty if on Windows. Type in the IP of the device (set a static IP), port and user name. Now you should be able to issue commands such as restart for restarting or restart -p for powering off. In order to do this, you have to be superuser, so type in su security camera

 The important app for streaming video is IP Webcam, free again. Just like SSH server, make sure you enable the setting that runs this app on boot. You can play around with other settings to fit your needs (such as lowering FPS, which helps with your device not overheating). Otherwise this app is ready to go from the start. Check out the stream by visiting 192.168.X.XXX:8080 (IP of the device along with :8080). Click on Flash tabs so you can see the video and audio stream. Really nice! Now you need to read this stream and get email notifications when a change is detected.

Last part is a bit longer, because you need to find the right settings for your camera, so you do not get too many false notifications. Install a nice application named Motion with apt-get install motion. You need to modify a few things in the configuration file with nano /etc/motion/motion.conf. Change daemon off to daemon on, which will start motion on startup. Now search for netcam_url and add  http://192.168.X.XXX:8080/video. This setting tells motion where the video source is.  The last of the mandatory settings is on_picture_save, which sets the action that occurs after motion is detected.  Change it to something like on_picture_save echo ‘Webcam alert’ | mail -a %f -s “Webcam Alert” [email protected]  Save the file, move your hand in front of the phone and hope for the best. You should get an email that has a picture attached. These pictures are saved locally, you can change the path by altering the setting target_dir.

This should be all there is to it. You can now fine tune the settings – which parts of the screen can trigger the motion detection, how many changed pixels trigger motion detection, video recording and much much more. Have fun!

Galaxy Ace S5830 flashing

There are loads and loads of tutorials for flashing custom ROMs to S5830 Galaxy Ace smartphone. I know, because I’ve read several of them. But there are a few main reasons for this post that has content, which already exists on lots of pages. I’m always a little bit afraid of flashing zip files from unknown sources. I never know if the ROM will be any good. I’m always afraid of botching up the flashing project. Lots of files needed for flashing are no present on hosting sites. These three reasons convinced me to write a tutorial that will contain 100% working files, the 100% correct flashing process and a really good custom ROM. All the files will remain on my Dropbox as long as I have one. This whole process has been tested myself and I can guarantee that you will not brick your phone if you follow this tutorial step by step.

If you never connected your Ace to the PC, you need to install Samsung Kies. It’s needed because it has various drivers bundled in its package. I had to install Visual C++ fix because I was getting an error concerning an dll error. Download ClockWorkMod 5, latest official firmware and Odin. Optionally you can also download root updater and Myth ROM. You will read about those two later on. Place all of these files, except the Odin package, on your SD card but do not insert it just yet.

It’s useful if your phone is charged over 50% just in case before beginning. If you press power button, volume down and home you will enter downloading mode. Fire up Odin,select OPS and find your ops file. Tick the One package option and connect your phone. Take a look at the screenshot to see how it looks when the process is finished. Double check everything and press start. Your phone will be rebooted several times, but do not worry.tutorial

Congrats, you have the most recent official firmware for this phone. If you want reliability and stability, stop here. But if you want some extra space and other cool features, then install a custom ROM. I recommend Myth ROM mod. The rest of the steps are not hard to follow so do not be afraid to keep reading. Power off phone, press power and hold it with home button. When the screen appears, stop holding the power button but keep pressing home button. Welcome to stock recovery mode. First you will install ClockWork Mod 5 that will replace the current recovery that you see. Select apply update from sdcard. Select upd_1 which will give you root access. Repeat the process but this time choose  Clockworkmod package. Reboot and return to the new and improved recovery mode. Navigate to Advanced, Partition, select at least 1024 (if your SD card has such space) and 32 for swap space. Now you can install the ROM. Run it the same way you ran upd_1. You will be presented with a really nice installation process. Select such options as you see fit. Select reboot and wait for the system to boot. It will take a several minutes for first boot but it is worth the wait! That is all, enjoy your your Galaxy Ace on steroids.

Raspberry PI with lighttpd

Yep, yet another Raspberry Pi post! After a little time off, I have just resumed my work on It’s running WordPress on my hard working Raspberry Pi. After adding several tweaks to it, such as caching, I still felt that it’s a little slow sometimes. That is why I decided to step away from the classic LAMP (Linux, Apache, MySQL, PHP) and try out something new. This new option is lighttpd, also nicknamed lighty. It is much easier to set up, compared with nginx and the Quick Cache plugin works flawlessly with it. The increase of speed is noticeable, you should try it yourself.

Start with the well known command – sudo apt-get install lighttpd. With it, your Pi will install lighttpd along with any required dependencies. After installation the server will start and notify you. Same as with Apache, you show the website contents in /var/www map. Take ownership of this map with sudo chown www-data:www-data /var/www. Also allow the group to write to this directory by typing sudo chmod 775 /var/www. To test if the first part was completed successfully, create a simple html file inside /var/www. Hopefully the contents of the html file will be shown.

Now you need to work on the rewrite rules, so your WordPress site will be able to use pretty links. Modify the configuration file – nano /etc/lighttpd/lighttpd.conf. Here is the important part of config for my site along with some comments. You can easily copy and paste it to your config.

#replace raspberryweather with your domain/ip

$HTTP["host"] == "" {
  server.document-root = "/var/www/"

  server.error-handler-404 = "/index.php"

  url.rewrite-final = (
    # exclude directories from rewriting
    "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",

    # exclude .php files at root from rewriting
    "^/(.*.php)" => "$0",
    # exclude robots.txt from rewriting
    "/robots.txt" => "$0",
    # exclude xml files also
    "^/(.*.xml)" => "$0",

    # handle permalinks and feeds
    "^/(.*)$" => "/index.php/$1"

To test it our, restart the service with  /etc/init.d/lighttpd restart. In your WordPress admin panel, navigate to Settings, Permalinks. Make sure that Custom Structure with /%postname%/ is chosen. Hopefully you will not get any 404 errors while browsing your site.

If you want to give some extra speed, then enable gzip. Again, modify the conf by adding the following code

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ("text/xml","application/x-javascript", "application/javascript", "text/javascript", "text/x-js", "text/css", "text/html", "text/plain", "image/png", "image/gif", "image/jpg", "image/svg+xml", "application/xml")

In my case I had to comment out the existing two lines. If you forget that, you will get an error when restarting lighttpd service. Make sure that var/cache/lighttpd/compress does indeed exist! You need to take ownership of this particular folder as well issue the command chown www-data:www-data /var/cache/lighttpd/compress/. Restart the service and test if all is working as planned. Go to and type in your IP or domain name.

Easy Facebook hash generating

According to Google Analytics one of my previous posts regarding Facebook key hash generating is quite popular. I have recently stumbled upon an even easier method of generating this key. No extra code is needed at all, but it is limited to Windows users only. You need to download the application here. Afterwards find the keystore for your application, make sure you’re selecting the right one. Run the downloaded application, drag and drop the keystore to the application. Type in the keystore password and wait for magic to happen. I have checked the file with NOD32 and it’s clean, so no worries on that part. Easy as pie!

This great little application was not created by me, I’m just promoting it.


Simple Twitter integration for Android

I have decided to try out integrating Twitter into an Android application. It appears that this takes a little bit of more effort than for Facebook. There is no official SDK for this, so you are pretty much on your own. There are lots of unofficial plugins like Twitter4J but I could not find one that would be simple to implement and would look nice. In the end, after hours of Googling and testing different solutions I decided for the simplest solution there is. It’s not the best one, mind you, but it’s simple and efficient. You do not need to get your own api key and its only a few lines of code. The solution is launching the web browser with some parameters, one of them is the string that will be tweeted.

public void twitterAction()
		String yourTweet="This is your tweet!";
		String url = ""+yourTweet+" %2simple";
	    Intent i = new Intent(Intent.ACTION_VIEW);
	    Uri u = Uri.parse(url);
	    catch(ActivityNotFoundException ex)
	    	Toast.makeText(getActivity(), "No browser installed", Toast.LENGTH_SHORT).show();

After calling this method, your browser will be opened and you will have to login. Afterwards your message will be tweeted along with a hashtag. If there is no browser present an exception is caught and displayed with a toast message. Simple and nice :).

Vacation in Valencia

Another travel related blog post. This year truly is full of different travels. We have never been to Spain and decided to wait for the season to end and visit Valencia, which is the third biggest city in Spain. Let me tell you, waiting was worth it! The prices were much lower and there were almost no tourists. Luckily the weather was more than fine. We had to change our clothes the first thing after landing. It was around 25-30 degrees for the whole week. It rained only once and it quickly stopped.

We stayed in the 50 Flats hotel, where we had a whole apartment to ourselves. The hotel was really nice and the staff exceptionally kind and helpful. City center is pretty close so we made most of our trips on foot. Valencia is filled with lovely alleyways that are decorated with ceramics and graffiti. These street paintings are not the kind we are used to seeing back home, but are much more artistic. Some are painted on the shop entrances and usually represent the store. Making long walks is really easy, because there is always something to see. One of the funnier things are wires on buildings, they usually hang down and do not look too safe. It’s probably because these buildings are really old and that makes it difficult to do the wiring.

The city of arts and science is something totally different, you cannot get more modern and futuristic buildings that this. There we purchased a combined ticket for 3 museums – science, imax cinema an Oceanographic. It was well worth the money, especially because of Oceanographic. The animals there are really something one needs to see. The most popular part of Oceanographic is the underwater tunnel. There are two of them and they are truly a must see. Its really nice to see all those fishes swim around you and above your head.


All in all, Valencia is a really nice place to visit. Most of the attractions are available on foot. The seaside is a few kilometers away from the city center, but the bus is not that expensive – 1,5€ in one way. The beach has really clean sand which was also a pleasant surprise. The Albufera lake was a bit of a letdown. Sadly the road next to it obscures most of the view to the lake. There is only one spot (at least one that I saw) that offers a nice view. But the city next to it is the starting place of paella dish. In the end it was worth the trip. Definitively a memorable vacation!


Outlook custom domain

You might have heard, that Google Apps is no longer free. Every since the beginning of this year, you cannot register new Google Apps for free. If you did so before this time, you’re safe. Others should look for a good alternative. One of the best options is, the new and improved The process is fairly simple and you should be done pretty fast. My domain is using the service for DNS hosting, and will be used to show you what to change. The process itself is similar on other sites or your hosting control panel.

Start by going to, click the get started button and type in your domain. Leave the “set for my domain” checked and proceed. Create a new account with your domain. Create a new account or sign in if you have previously registered on I have registered a new domain and verified my account. Afterwards I visited again and clicked on get started. There you have to type in your domain again, leave the radiobox as it is and continue. After typing in the CAPTCHA, leave everything unchanged.

Now you need to prove that you really own this domain. You will be presented with some long strings that need to be added to certain records in your domain. These strings will be different for each user, do not paste my strings that are displayed here just for reference. Log in you domain management. As said before, in my case this is First, change the MX record. I had to click on add new record next to MX tab. Then I pasted in something like in the points to textbox. Same process but different text for TXT record. In my case the text was something like v=msv1 t=635850d78bd7722a7720408d652w9x. Create yet another MX record, mine looks like 6w5850x78b329d7731040425632d92.msv1.invalid but make sure the MX priority is 11. Last but not least, another TXT record for spf, looks similar to v=spf1 ~all.

I myself do not care for messenger, so I skipped that part and pressed the refresh button. It took a few seconds to check all the new records and it worked like a charm. Now you can add the accounts you want to be using for your new domain. That way you can use instead of the obsolete webmail. You will have to set your security question the first time you log. it might cause some problems if you plan on using a client that checks for your email, so sign in with your browser for the first time.

Install nginx on Raspberry Pi

Here is how to install nginx on your Raspberry Pi. I have decided to use it instead of apache, because of its great reviews and speed. First off, you need to update the dependencies by typing in apt-get update. Wait a bit for it to finish.

Next, start installing the required packages. Type in apt-get install nginx php5-fpm php5-cgi php5-cli php5-common php5-mysql . This will install nginx along with needed php5 packages. This will take some time, so relax and wait for it to finish. Start the service up by typing service nginx start. Get your IP address by typing in ifconfig. When you have the IP, paste it into the browser. You should get a nice html page, that tells you that nginx is running. So far so good, right?

Now you have to modify the configuration a bit. Type in cd /etc/nginx/sites-available, there is a single file default, which you need to modify with nano. First off, find the line below root /usr/share/nginx/www; . You will need to add support for php files, so type in index.php next to index.html. Leave the remaining line untouched.

Search for a line that starts with pass the PHP scripts to and move down two lines to location ~ \.php$ { . You will be needing this part, so uncomment it by removing the # symbol. Do the same for next line (starts with fastcgi_split_path_info) and the ones below that start with fastcgi_pass unix, fastcgi_index and include fastgi_params. Make sure you do not forget to uncomment the closing curly brace! You need to uncomment the part that denies access to .htaccess files. These lines start with location ~ /\, deny all; and the closing curly brace. For reference, take a look at the sample picture.

install nginx

Save the file by ctr+x and confirm rewriting the file. Restart the service so that the new changes start working. Issue the command service nginx restart. Lets test if .php files are now working. The contents that are displayed on the web are located in /usr/share/nginx/www. Get there and create a sample file with nano test.php.
Type in <?php phpinfo(); ?> and save by ctr+x. Open your browser, put in your ip and new file for example Recheck if a html page appears with only the IP. That is all for now, you have successfully installed nginx!

How to solder Adafruit Pi Cobbler Kit

I have recently received my Adafruit Pi Cobbler kit, which I will be using for an upcoming project of mine. The pieces themselves might look intimidating to some people, but the whole process is pretty simple and beginner friendly. That is why I decided to write a “How to solder Adafruit Pi Cobbler Kit”.Unpack all of the items from the bags, start by removing the one black long “stick” – these are the header pins. Break it in two 13 pin pieces. There were a few extra pins left in my case, but do not worry about them. Place them somewhere on the protoboard, anywhere will do.

2013-07-01 18.08.43


Next off, prepare the PCB and the ribbon case socket. There is only one way of putting it together correctly. Make sure that the indentation is next to the number 21. In my case it was next to 21/27. Yup, just like in the red circle in the image below. Meanwhile, turn your solder iron on, so it gets nice an hot.

2013-07-01 18.09.20

Now the fun part. Turn the whole piece around, so you see the pins that need to be soldered. Go on, start soldering. I recommend using a less thick solder iron that I was using, because it’s much easier to solder.

2013-07-01 18.09.42

After that, take the protoboard from the first step. Place the newly soldered item on the pins. It does not matter which way you put them on. In the final step, solder these pins together and you are nearly done.

2013-07-01 18.29.06

For the final step, connect the Pi Cobbler with the ribbon cable and you are done! It was not that hard, right?



How to export an Android application

By following this guide, you will learn how easy it is to export any installed app on your Android device. Why is this useful, you ask? Well, I can think of two good reasons right now. For example, if you would need to decompile an apk, you would need to export it first. After that, you can do anything you want with it. The other one is even more interesting. When you buy a app, you have 15 minutes, to try out the app and then refund it. Many things can happen in these 15 minutes :).

First off, you will root access to your phone. If you do not have it and want to take care of that yourself, I recommend guys at XDA developers. They know their stuff and you will most definitively find a good tutorial on rooting your phone over their forums. The second one, you need to install the Root Explorer application. The free version is not good enough for this tutorial. After this its smooth sailing from now on.

export an android application

Download your desired application from Google Play and wait for it to be installed. Afterwards start up the Root Explorer. You will be prompted for root access, which you must grant. Tap the data folder, then app and you will get a list of all installed applications. Long press on the recently installed application and choose copy. Go two folders up, scroll down to sdcard and tap on paste. This will copy the apk file on your sd card. If you do not have one, then copy it somewhere else it does not matter where exactly. That is all there is to it, exporting an android application is really simple.

Page 2 of 3 123