June 2011

You are currently browsing the monthly archive for June 2011.

Some days ago I felt that my blog was really slow and sluggish, so I looked into that problem. I deleted plugins that I didn’t use and I installed the cache plugin W3 Total Cache. So it should run much better now, which I think it has done during these few days of testing since the installation.

When I did the performance tweaking, I also realised that the theme monochrome that I used was kinda ugly and boring. So I went to WordPress.org and found a really nice and free theme called Tarski. As always I had to do some tweaking to the code to feel satisfied; in this case was the largest change the randomizing banner. I hope you like the theme and find it pretty. :)

Tags: , , ,

There is a pretty cool command-line based application that can execute keystrokes, mouse movement and mouse clicks, called Xautomation. It’s kinda useless if you are sitting at the computer with the terminal in the foreground. But it’s really awesome if you are coding an application that runs in the background and responds to signals from a remote control or similar. I have coded a little command-line based Python 3 program that does just that. It reads USB signals from my Arduino board which is connected to a IR receiver, and executes hotkeys that fits in Totem Media Player.

As an Arch Linux user it was a piece of cake to get Xautomation by downloading it from the AUR:

To use it, open a terminal and print:

xte --help

Then you will get a list of stuff that you can do with this piece of software, like:

xte "key a"
xte "str aAa"
xte "keydown Shift_L" "key a" "keyup Shift_L"
xte "mousermove 100 100"

To execute these commands from a Python 3 application, use this code:

import subprocess
subprocess.call(["xte", "key a"])

Tags: , , , , , , ,

Effektivare LinuxOn my local library I stumbled over a really nice book called Effektivare Linux – Kom Igång Med Kommandoraden (its Swedish title), which essentially is a printed and translated version of GNU/Linux Command-Line Tools Summary. I don’t know if it’s available as a book in English, but it’s at least readable on their website since it’s licensed under GNU GPL.

I think it’s an excellent book for everybody who wants to learn how to use the command-line/terminal. Because it goes through 250 (170 in my revision from 2008) useful and common commands that will bring joy to your life. I have only read half the book so far, but I have already learn a lot of commands that may be useful in the future. I don’t think that I will remember every command mentioned in the book, but I think it’s good to at least know what is available, so can I look it up (on Internet) when I need it.

Links:

Tags: , , , , , , ,

I suppose many already know this, but at least I didn’t until I browsed around the Arch Linux forums. Anyway, it’s possible in Linux to freely customize your bash prompt (PS1). :) Doesn’t that sound awesome?

In the Arch Linux Wiki they have a great page about this:

And in this forum thread you can find loads of nice looking prompts:

This is how my PS1 looks like:

ArchTerminalBashPromptAnd the code behind this prompt is:

PS1="\[\e[2;37m\][\A] \[\e[0;33m\]\u\[\e[0m\]@\[\e[34m\]\h \[\e[32m\]\w\[\e[35m\] \[\e[31m\]\$\[\e[0m\] "

I’m pretty sure that customizing the terminal prompt should work on every Linux-distro.

Tags: , , , , , ,

For long I didn’t know that there even existed an encrypted version of Wikipedia, since you can’t reach it by simply adding an s after http. The regular address that you are used to looks like this:

And the secure address looks like this:

So it’s a bit lot longer and troublesome to access. However, that mustn’t be a problem. If you are using DuckDuckGo as your search engine and has set it to search through SSL, it will automatically change the outgoing Wikipedia links to the encrypted version. If you would like to have the encrypted Wikipedia as an option in the search bar in Firefox, you can add an entry for it with this add-on.

If you are curios about DuckDuckGo, read my short blog post about it:

Tags: , , , ,

A search engine that I have heard some talk about lately is DuckDuckGo, which I also recently have set as my default search engine in Firefox.

The advantage over Google is that they value the user’s privacy much higher. DDG doesn’t track you, you can set DDG to always search through their encrypted version (https), and you can also set DDG to prevent the sites you visit from knowing what keywords you used to get to them. On the following page you can find the privacy settings, along with many, many more options (far more than those Google offers for their search engine):

What I like as a Swede is that they also have an option to choose region, which will increase the search results from that country. So I have in my Firefox search box added one entry for the regular DuckDuckGo, and one for it with the region set to Sweden.

If you wonder why you should be careful when you search stuff on the Internet, you can visit www.donttrack.us. It’s a homepage by DuckDuckGo that describes how the tracking of you works when you are using Google.
I’m not a person who searches for herpes, illegal stuff or something similar. But I can’t say that I really like to share all my keywords and data that I put into the search box with (advertisement) corporations and people around the whole world.

If you look around on DuckDuckGo you will find many smart features, like !Bang. So it’s a really competent search engine, that not only doesn’t track you and values your privacy, but offers good search results, loads of options and many features.

Tags: , , , ,

In the Arduino kit that I bought not long ago were an IR remote control and an IR receiver included. And I have found a really good library for Arduino that makes decoding the IR signals from the remote control really easy. So I have used this library and coded a short program to my Arduino card that reads the IR signals and then sends more logical signals to the computer through the USB cable.

Here is a link to the page where I found the library: http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html

Here is code that I have written for my Arduino board:

#include <IRremote.h>

int RECV_PIN = 11;
String in;
String cur = "";
String cur2 = "";

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {

    in = String(int(results.value), HEX);
    irrecv.resume(); // Receive the next value
    cur2 = "";

    if (in != "ffff") {
      if (in == "a25d") {      // ON/OFF
        cur = "11";
      }
      else if (in == "629d") { // Mode
        cur = "12";
      }
      else if (in == "e21d") { // Sound ON/OFF
        cur = "13";
      }
      else if (in == "22dd") { // Play/Pause
        cur = "21";
      }
      else if (in == "2fd") {  // Back
        cur = "22";
      }
      else if (in == "c23d") { // Forward
        cur = "23";
      }
      else if (in == "e01f") { // EQ
        cur = "31";
      }
      else if (in == "a857") { // VOL-
        cur = "32";
      }
      else if (in == "906f") { // VOL+
        cur = "33";
      }
      else if (in == "6897") { // 0
        cur = "41";
      }
      else if (in == "9867") { // RPT
        cur = "42";
      }
      else if (in == "b04f") { // U/SD
        cur = "43";
      }
      else if (in == "30cf") { // 1
        cur = "51";
      }
      else if (in == "18e7") { // 2
        cur = "52";
      }
      else if (in == "7a85") { // 3
        cur = "53";
      }
      else if (in == "10ef") { // 4
        cur = "61";
      }
      else if (in == "38c7") { // 5
        cur = "62";
      }
      else if (in == "5aa5") { // 6
        cur = "63";
      }
      else if (in == "42bd") { // 7
        cur = "71";
      }
      else if (in == "4ab5") { // 8
        cur = "72";
      }
      else if (in == "52ad") { // 9
        cur = "73";
      }
    }

    if (in == "ffff") { // Presses down a button
      Serial.println(cur + "d");
    } else if (cur.length() == 2) {
      Serial.println(cur + "0");
    }

  }

  delay(100);
}

I’m not sure if this program is so easy to understand, but I hope that it’s at least little help if you are setting up your own program for reading IR signals (and later controlling your computer).

Basically will the loop decode a signal, convert it to HEX and then check what button was pressed down. If I press a button on my remote control it will send a normal, unique signal (which in hex is something like a25d or 629d). But if I keep it pressed down it will keep on sending ffff signals, regardless of what button is kept pressed down. Therefore I have to save what button that was initially pressed down, which I do in cur.

The normal signals will result in numbers like 11, 12, 33 and 72 are saved as cur, and behind that is a really simple system. The first digit is the button row of the remote control, and the second digit is the the column. So as you may understand, I have 3 x 7 buttons on my remote control.

Before sending the number 22, 33, or something similar, to the computer, is 0 added to the end if the button was just pressed down or d if it already was pressed down in the previous loop.

So if press the button on my remote control that says 8 (row 7, column 2) the program will in the first run through send the message 720 to the computer. If I keep it pressed down will the program keep on sending 72d to the computer. If I bring up the Serial Monitor in the Arduino software will the output be:

720
72d
72d
72d
72d
72d
72d
72d

I apologize for my crappy English. ^.^

Tags: , , ,

I have heard some talk about Identi.ca on podcasts like Linux Outlaws and FLOSS Weekly, and today I took some time and checked it out. Identi.ca is a microblogging platform that works almost exactly as Twitter, but it’s based on the StatusNet software that is freely available for download and install.

What I find pretty funny is the kind of people that is hanging out on Identi.ca – open source geeks. This is obvious if you look at the page that lists the most popular groups, where you can see that the following groups got the most members: Linux, Ubuntu, GNU, Debian, Python and KDE.

I have also registered an account on Identi.ca, but I don’t know how active I will be. I never really got into Twitter, so I’m a bit dubious. However, here is a link to my profile: http://identi.ca/matachi/

Links:

Tags: , ,

Arduino Mega (ATmega1280)One week ago I ordered an Arduino kit from Ebay with an Arduino Mega (ATmega1280) board and some other stuff included, like a breadboard, some LED lights and a LCD display. It costed me only 62 $, so it was a really great price compared to what it would cost here in a Swedish store.

I installed the Arduino software from the AUR (Arch User Repository), but the version of avr-gcc that was included was 4.6.0. If I have understood it correctly, is avr-gcc a compiler that is designed for AVR microcontrollers. However, apparently there is a bug in the versions 4.4 – 4.6.0 of the compiler, which makes programs on the Arduino Mega board unable to send and receive signals through the USB cable. So the Serial Monitor in the Arduino software won’t work.

On Arduino’s website they recommend that you use version 4.3.x of avr-gcc instead, therefore I thought it would be a good idea to install it. And that have I been messing with since Friday. But I finally got it to work just a moment ago, thanks to madworm on the Arduino forums. I’m not here going to describe every step that I took, but if you are having the same problem that I described above, check out the thread and see if you can get it sorted out:

Tags: , , , , , ,

I had totally forgot that I promised to upload some photos of Ergo Proxy – The Complete Collection Box Set half a year ago. However, yesterday I got a comment from a guy wondering what happened with the pictures, so here they are (better late than never :) ):

Ergo Proxy – The Complete Collection Box Set - Photo 1

Ergo Proxy – The Complete Collection Box Set - Photo 2

Ergo Proxy – The Complete Collection Box Set - Photo 3

Ergo Proxy – The Complete Collection Box Set - Photo 4

As you can see, the case isn’t of the highest quality. I wonder if it even is possible to produce a box more cheaply than this. Everything is made of plastic, no individual boxes, and they didn’t include any type of extra content beyond the discs.

For comparison; here is a photo of the Ghost In The Shell: Stand Alone Complex – Complete 1st GIG box that I also own, which is made of remarkable higher quality:

Ghost in the Shell - Stand Alone Complex box

A couple of links:

Tags: , , , , ,

« Older entries