My Story Of Persistence with persistence on OpenHAB. AND a tutorial on Rule and Timers

Introduction

The raspberry pi does not have the conventional x86 architecture for a processor. Instead it has an ARM processor running at 400MHz. Now this means that even though you are running Linux and even though you can compile the same program using GCC on ARM as on a PC, the output of the compiler will be totally different due to the underlying instruction set. This ultimately means that programs such as MySQL may be different on a PC than the RPi in terms of their execution as well. A lot of times the code is also optimized for the platform such as RPi and all this means that MySQL on the PC might not be the same as on the RPi. Java is an exception because it run on top of the JVM BUT resources on the JVM are not same across platform. Like com ports on windows are like com1, com2 etc but in Linux, everything is a file like /dev/usb0 /dev/AMA0 etc. Continue reading “My Story Of Persistence with persistence on OpenHAB. AND a tutorial on Rule and Timers”

Working with unsigned drivers in windows 8.1

I have a couple of open source tools such as “Bus Pirate” and “Open Logic Sniffer” from Dangerous prototypes and I recently upgraded my workbench with a Lenovo Flex 14 which is a Windows 8.1 Touch Laptop with loads of goodies. Now for the most part I am liking the new window 8.1 mostly because I do most of my stuff in Arch which run in the Virtual Box on-top 😛 But in order to use the Open Sniffer, I need to install unsigned drivers which are actually for the USB enabled PIC micro. I have had no problems with FTDI chips till date so this was a first. Here is a small how-to install unsigned drivers since Windows 8.1 simply blocks unsigned drivers altogether.

Unsigned Drivers
Unsigned Drivers

IMPORTANT!

To protect the average user, Windows 8 requires all hardware drivers have a digital signature before you can install them, making it more difficult to install malicious drivers. These are not necessarily hardware drivers but drivers like those of virtual network adapters and ports etc. If a driver isn’t properly signed — or it was signed with a signature that’s been revoked because it was used for malicious purposes — Windows 8 won’t allow users to install it. You should only do this if you know what you’re doing.

Press the Win + C keyboard combination to bring up the Charms Bar, then click on the Settings Charm.

Charms Bar
Charms Bar

Open the control panel by clicking “Change PC Settings”

To the Control Panel
To the Control Panel

Boot into EFI- Click on the last option on the left column. This will open up a set of options to update or recover your system.

Update and Recovery
Update and Recovery

Click Recovery to be presented with further options to enter the EFI mode.

EFI Mode Settings
EFI Mode Settings

Click on “Restart now” under Advanced startup which will take you immediately into the EFI menu.

Startup Settings
Startup Settings

Once your Computer has rebooted you will need to choose the Troubleshoot option.

Toubleshoot
Toubleshoot

Then Choose Advanced options among the troubleshoot options.

Advanced Options
Advanced Options

Next we want to visit the “Startup Settings” option from the set of Advanced options.

Startup Settings
Startup Settings

For us to Modify the boot time configuration settings, we will need to restart your Computer one last time.

Startup Settings
Startup Settings- Reboot

Finally, we will be given a list of startup settings that you can change. You’ll be offered a few familiar options like Safe Mode and Debug mode. The one we are looking for is “Disable driver signature enforcement”. To choose the setting, you will need to press the F7 key.

Press F7 Here
Press F7 Here

That’s it! Now windows 8.1 will behave like it did in windows 7 and will ask you if you want to install unsigned drivers. That reminds me… I have work to do!

Python 3 and 2 Meet Twitter


There has been a lot of confusion with regards to accessing twitter with python. For people like me who had used python 2.4 etc with twitter are wondering why their scripts are not working anymore. I dug mine out from an old backup only to find that it not only has problems with twitter but also with python 3 – The shiny new thing.

Continue reading “Python 3 and 2 Meet Twitter”

Download web pages in BASH: From binkley’s BLOG

BASH is quite amazing. From Bhaskar V. Karambelkar comes Bash shell tricks and this gem (with some small corrections):

function headers()
{
    server=$1
    port=${2:-80}
    exec 5<>/dev/tcp/$server/$port
    echo -ne "HEAD / HTTP/1.0\r\nHost: $server:$port\r\n\r\n" >&5
    cat <&5
    exec 5<&-;
}

I work behind a corporate firewall, so I need web proxy settings. No problem, BASH is still amazing:

function webget()
{
    declare -a parts
    parts=($(echo $1 | tr / ' '))
    protocol=${parts[0]}
    server=${parts[1]}
    path=$(echo $1 | sed "s,$protocol//$server,,")

    exec 5<>/dev/tcp/$http_proxy_server/$http_proxy_port
    echo -ne "GET $path HTTP/1.0\r\nHost: $server\r\n\r\n" >&5
    cat <&5
    exec 5<&-;
}

Usage is obvious:

$ webget http://www.ccil.org/jargon/
# Out pops the top page for Jargon File Resources

UPDATE: Also useful for talking to SMTP (email) servers:

$ exec 5<>/dev/tcp/localhost/smtp
$ read -u 5 line
$ echo $line
220 my.full.host.name ESMTP ...
$ echo QUIT >&5
$ read -u 5 line
$ echo $line
221 2.0.0 my.full.host.name closing connection

This also shows that BASH knows to map the SMTP service to port 25

I love Scripting – In the words of Shelon Cooper,"I love you Ubuntu"

I have always been a fan of Linux – RedHat Enterprise Linux in particular. I have used RHEL Client for my PC since I could do so much more than I could in my Bhindoze. 🙂

However there was always something missing- I could never pin-point it. I always thought the flexibility was so great but there was always some software tool that did not work in Linux- Plus it was always a monotonous to work in linux. The scrolling text boot screen soon lost its charm. Then KDE and moodin cosmetic lost their charm and I let go of linux more or less. If it was a server then definitely RHEL but I never got it back to my desktop again. (Fedora in the initial stages was a confusion and a disappointment when I found libraries and things simply missing.) I gave into my desire of windows software as I heard a voice call me to “Embrace The Dark Side Of the Force”

Then came ubuntu. A long time back I took my first glance at the OS and it looked too – simple. I did not feel it was serious enough to be useful to me. I recently started a new project for a Home Theater System. On scouring the web, I discovered a lot of people looking to Linux for help. There are a lot of distributions out there specially compiled for Home Theater and Entertainment aka HTPC or Home Theater Personal Computer. Basically its a PC with a custom Linux Distribution with multimedia Apps and Codecs. So deeper into the rabbit hole I go.

Lets get one thing clear- I am not writing a guide on building a HTPC anytime soon until I get to do the whole thing personally and with all the projects I currently have going, its a long queue. I suggest looking at Mythdora with XBMC. Or you could try what I am trying.

Now here is where I start talking about Ubuntu 10.04 aka Lucid Lynx. 🙂 Even the mention of that brings a smile to my face. I downloaded the distro from the torrent and its perfectly legal. After looking around the web a bit I found quite a lot of useful utils. The problem is that if I want to enable my Linux box to play MP3s or MP4 coded movie Trailors, then I need codecs. Unfortunately these are not free everywhere. So there is a project out there called medibuntu. This is a repository of multimedia packages and stuff that you can use. You can also opt for Mythdora that has a lot of these things embedded already. I prefer to configure my own. If I am using Linux I will do it my way. So there are a lot of things I can get using the standard ‘sudo apt-get install XXX’ OR there is another way – SCRIPTING.

I decided since I have always written bash scripts in the past, why not here. Seems like there are others who have the same idea and beat me to it. Introducing Ubuntu Start Project.

These guys have a set of startup scripts that use zenity to ask you what to install and then install it while you get some coffee. I used the script and seems like these things get out-dated very quickly.

I am in the process of developing my own script but more on that later. I found the project to be very useful and will prolly take it as the base for my work. I think my apt just finished so I’m going tinkering… more on this later.