Sunday, August 31, 2014

Personal Weather Station V2 - Revamping an old project

After more than 4 years working reliably, I decided to retire my weather station... No, I did not, I decided it was time for an upgrade!!!

Inside the weather station controller enclosure - 4 years after. You have served me well!

The weather station project was one of the most interesting projects I ever did and I miss all the excitement that went along with it at the time. Even now it's one of the most visited projects on my site (right after the wifi speakers project).

I have recently come across a good use for the data that the weather station collects: I now live near the sea and being the outdoors man that I am, I like to be out as much as I can and the current is very important to know before going out. Yeah, I can just look out the window but what's the fun in that? Actually there's another think the weather data is important for and that is all my friends that do not live near but that still come over frequently to enjoy the beauties of the sea. It would be great to provide an updated current weather view along with a camera feed on the current sea or beach conditions.

As such, the main project goals of the this project are:

1. Use as much of the existing weather station hardware as possible (might be a challenge as a lot of the equipment is already 4 years old and it shows!)
The weather station sensors as they stand after 4 years of reliable data gathering (note the wind speed sensor with a broken segment...). A little more rust then when I got it but everything still works well.
2. Eliminate the need for a dedicated network (I currently have a separate network for the weather station. I would like to install a wireless bridge to connect the weather station to a single network.
A refurbished and quite old Buffalo wifi router will be our wireless bridge.

3. Move data storage to my own cloud server instead of on my computer or thinkspeak.
4. Provide a connection page to all users with the current weather data, historical weather data and a camera feed.
5. Collect, store and display the following data:
  • Temperature
  • Relative humidity
  • Wind direction (will not be perfect because of installation restrictions)
  • Wind speed (will not be perfect because of installation restrictions)
  • Luminosity
  • Dust/ Particles sensor
  • Provide camera feed of current conditions
6. Technically, I will use the following equipment, software and tools:
The Sharp GP2Y10 particle sensor.
  • [hardware] Old buffalo router as network bridge, model WZR2-G300N, where I intend to replace the stock firmware by 
  • [software] DD-WRT to allow for more advanced features. Apparently this router is not supported by the open-source firmware, but there's some files that were made available that have seen users report successful firmware changes. I will make the files available soon as I had to so some digging around to get them. The instructions for what needs to be done are here - look for the post dated Fri Jul 30, 2010 11:14 by REPASSAC.
I will use this blog as data collection tool for me and for other users that may require the information that I collect as I go (like software I will use and all code that I develop or equipment datasheets).

I will usually work on this on Sundays, so don't expect posts more frequent 

Wednesday, March 5, 2014

Hack into 'Jurassic Park' like you're Samuel L. Jackson

via theverge.com

For a movie full of giant dinosaurs, it's strange that one of Jurassic Park's most memorable scenes involves portly programmer Dennis Nedry — played by Seinfeld regular Wayne Knight — wagging his finger and repeating the words "Ah-ah-ah! You didn't say the magic word!" Now you can try to wrest control of the dinosaur-packed park back from the nefarious Nedry, using the recreation of the movie's UNIX network found at JurassicSystems.com.

Monday, January 13, 2014

change unity launcher buttons size

run the following script as root

to run from the command line: sudo script_name.py XX, where XX is the icon size (popular size is 32)

logout and login again and you should see smaller icons in the laucher.

---copy and paste from this line to the end to a file called "script.py"
#!/usr/bin/python

import shutil
import sys
import os

def getparent (content, line_nr):
    for i in range (line_nr - 1, -1, -1):
        if "{" in content[i].lstrip():
            return content[i].lstrip().split(" ")[0]

def change_line (content, key, value, parent):
    line_nr = 0
    for line in content:
        if line.lstrip().startswith(key + ":"):
            lparent = getparent(content, line_nr)
            if parent == lparent:
                content[line_nr] = key + ": " + value + "\n"
                return content
        line_nr = line_nr + 1       

def load_file (filename):
    file = open (filename, "r")
    content = file.readlines()
    file.close()
    return content
   
def write_file (filename, content):
    shutil.copyfile (filename, filename + ".bak")
    file = open (filename, "w")
    for line in content:
        file.write (line)
    file.close()
    return
           
shell_qml = "/usr/share/unity-2d/shell/Shell.qml"
icontile_qml = "/usr/share/unity-2d/shell/common/IconTile.qml"
launcherlist_qml = "/usr/share/unity-2d/shell/launcher/LauncherList.qml"
launcheritem_qml = "/usr/share/unity-2d/shell/launcher/LauncherItem.qml"

if (len(sys.argv) > 1):
    icon_size = int(sys.argv[1])
else:
    sys.exit("Please enter your desired icon size as the first argument.")
   
if not os.geteuid() == 0:
    sys.exit("Script must be run as root.")

content = load_file (shell_qml)
content = change_line (content, "width", str (icon_size + 16), "LauncherLoader")
write_file (shell_qml, content)
content = load_file (icontile_qml)
content = change_line (content, "sourceSize.width", str (icon_size), "Image")
content = change_line (content, "sourceSize.height", str (icon_size), "Image")
write_file (icontile_qml, content)
content = load_file (launcherlist_qml)
content = change_line (content, "property int tileSize", str (icon_size + 6), "AutoScrollingListView")
content = change_line (content, "property int selectionOutlineSize", str (icon_size + 16), "AutoScrollingListView")
write_file (launcherlist_qml, content)

Tuesday, May 14, 2013

Resettting your mySQL root password

When you need to reset your root password for your mySQL server, proceed this way:

# sudo /etc/init.d/mysql stop
# sudo mysqld_safe --skip-grant-tables &
# sudo mysql -u root

on the mySQL console:

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit


# sudo /etc/init.d/mysql stop
# sudo /etc/init.d/mysql start






To confirm you indeed have access to mySQL with the new password:


# mysql -u root -p

Thursday, May 2, 2013

Clementine - Finally a great Linux music player


I'm currently exploring clementine v1.0.1, a Linux music player. The first impressions are really good. It picked up most of my music collection (although it took a while, but it is a LONG collection...) but I got better organization than all other players I have tried.

A lot of the reviews I read said a lot of great things about last.fm and similar services integration but I'm not a customer of those platforms, so I can't really comment on that. I can tell you, however, that the "internet services" tab is quite comprehensive: Jamendo, last.fm, grooveshark, magnatune, sky.fm and somafm - a lot of them I really never heard about.


Internet services tab

The album art for most of my collection was downloaded without problems, and the ones that were not downloaded were afterwards when you go tot he album covert option and select download missing cover art. There's quite a few that are not correct, but nothing that a little time to kill won't fix. Very happy with this point too.

cover manager window

Another thing that seems to be above average is file meta data management. By that I mean the sometimes tedious task of making sure that the album artist is the same on all your files because media organizers tend to think Korn is a completely different artist to KoRn. Bulk metadata change is a breeze with clementine and in no time you will have your albums/ artists organized in a very OCD-pleasing way - just the way I like it!

Bulk metadata edit made easy!

Integration with my HTC sensation mobile phone is a breeze. It sees it as a removable disk, which is nothing special, but the interaction with the phone and your music library is pretty good in my opinion.

Media player integration

Then there's the song information tab, that shows you - you guessed it - song information: how many people listened to that song on last.fm and how many times was played (note that that information shows up even if you are playing files from your personal collection). It shows you lyrics and artist info. All this is obviously pulled from online resources such as wikipedia and wikilyrics. Some of the more obscure bands and artists in my collection were not found, but I think only me and another 3 people have ever heard of them, so that's understandable.

the lyrics tab - all obviously pulled off the web on demand. So far accuracy has been great!

Another cool thing is the fade-in fade-out feature that you can hear when you skip songs or when you stop the player. For sure this is a feature other players also have but it's yet another point for clementine. On the topic of cool features, I also like the equalizer visualization at the bottom of the window - it's very responsive and you can change the visualization that mostly suits you. Again, for sure you can find this in other programs, but I particularly like it in clementine.

Like I wrote in the beginning of this review, I really like it and I will keep using it. If you are looking for a robust music player, try clementine.

Monday, April 29, 2013

get contents of network share on ubuntu

Took some time to get this one and in the end it's really really easy...

The problem: nautilus finds network share easily, lists it under the network section on the left had side bar. It also allows you to browse it with no problems.

However, regular programs (say a music library program) cannot open folders on the share because the network shares do not show up on the "open folder" dialog.

What do you do?

go to ~/.gvfs and you will find your share contents there.

Why did I not know this?