Love OOP Python

Python makes it easy to automate manual tasks. Over time I have accumulated some scripts each for a different task but not sharing any code between them but having some similar logic, basically a few of them were having duplicate logic. So this week as I was adding another script to download and add the latest plex media server to my local repo, I came over an article about OOP python on Stackoverflow.
After creating a class for all the common logic in my scripts I was able to reduce the size of most of them by over half, I make my living writing OOP code for java but OOP for python was new to me. I wish there was OOP for bash 🙂 I have a bunch of bash scripts that need culling.

Cloud heaven = Plex + Android + CloudSync + Linux server + Own Cloud

I recently started hosting my own cloud service and it has been an awesome experience. After having my smart phone for sometime i started running low on storage, while I had backed up some pictures to a local share this is not really convenient. We take pictures on our phones so that we can have them close by so having to be at home to view my photos and videos was not very interesting. With a few apps and a Linux server I was able to put together a cloud service for the whole family that we are all loving very much.

The setup
Own Cloud installed on the Linux server. I tried a couple own cloud plugins for multimedia and none worked out for me. Using own cloud’s android sync app I ran into issues as it would lock up my phone when syncing. To fix this two issues I decided to have Plex handle the multimedia stuff and CloudSync handle the syncing process. Since I already had Plex serving up my video content adding photos was a breeze, plex also displays all your photos as thumbnails on your phone which you can click to view while the own cloud app displays a file name list which you have to click on a file to view it. I installed cloudSync on all the phones that needed backing up, this is like the swiss knife of sync apps it supports several cloud services plus regular services such as sftp,ftp and webdav just to name a few. You can back up your data to different locations by setting up filters for each data type which is awesome as I don’t want pictures and videos in one folder.
With this setup am able to have pictures and videos synced instantly and rsynced between different storage clients for redundancy. Within minutes of any of any of the phones taking a picture or a video any of the other phones can view that content so no need to send each other whatever you just captured.

While regular cloud providers offer you a few gigs for free and you have to pay once you get over 20gigs by hosting your own cloud you have terabytes of data readily accessible under your own control. You can use this cloud providers for just backing up your sensitive documents that you need an offsite backup in case of fire etc but remember to encrypt it first.

So now with everything backed up I have cleared my phones storage barely using a quarter of it and I still have access to all the pictures and clips that have been taken by any phone in the house for the last few years.

Dual boot with Fedora 17+

After years of using Fedora on my desktop I wanted to try something else I decided to go with Mageia. Install went ok until I got to setting up Grub2 for dual boot. While in the past I have multi booted several OS’s with classic grub I have never done that with Grub2. This thread pointed me in the right direction while this site was a great resource on grub2 it’s more focused on Ubuntu’s version of grub2 and there are a few differences with the fedora version, I found that the command “update-grub” does not work in Fedora other than that I did not notice much difference. I also did not go through all the steps in the tutorial just what I needed to get my setup working.
So how is my setup? I have several partitions on my HD and one of this partitions has fedora which boots on startup. I installed Mageia on an unused partition and made sure that it installed it’s bootloader in it’s partition. This is very important if you are trying to multiboot properly as explained in the grub2 tutorial. Only one application can have it’s bootloader installed in the MBR check the grub2 tutorial if you want further explanation about this otherwise each new OS you install will keep taking over the boot process.
At this point even though Mageia has been installed on reboot it does not show up on Fedora’s grub menu. To my knowledge I had 2 options add a script as described in the grub2 tutorial or just add Mageia to Fedora’s grub menu. I had already prepared my script when i fiugred I would not need it since my distributions would have totally different names, this would not be the case if I was trying to boot similar OS’s like kubuntu and Ubuntu. To add Mageia to Fedora grub menu I run the command below, it scans your HD for any other OS’s and automatically adds them. That’s it no editing scripts or grub files.
grub2-mkconfig -o /boot/grub2/grub.cfg

FreeNX/NX No suitable cache file found.

I ran into this error after my connection got disconnected due to a power outage during a storm. Googling around I could not find a solution to fix my situation. On a hunch I connected a keyboard and monitor to the server logged on and off in the GUI then tried the NX connection and it worked, so in my situation it seems some Xorg files got corrupted causing NX to fail starting an X session.
If this ever happens again I would like to try fixing it from an ssh connection by clearing X related files and locks for the user, as some fixes online involved adding a new user to NX and using the new account. So it looks as if the problem might be caused by unreleased locks or session files.

Update enom dynamic IP address

I have been using LqConsulting for about five years now to register my domain, if you are a linux user and you have used Linuxquestions to get some issues resolved consider using this registrar as it it is owned by the same person.

Back to the point this registrar currently uses enom to register your domains, which offers DyDns services and you can get a list from both places on the clients you can use to update your Dynamic IP. The problem comes with configuration, I like most people who rum linux to host personal websites have never setup one of this Dydns clients before and the help I got from my registrar was not very helpful. So for sometime as you can see from this post I was using a script to notify me when my ip changed and i would log in to my registrar and update my IP manually, this is not a very ideal way of doing it. Am not trying to bash my registrar here they provide me with a great service, they are a small shop and the main part is they do a lot for linux users, this being a personal site I was not loosing any sleep or money due to my site going down as a result of my IP changing.

But life is about convenience so I finally crawled the net and was able to find configuration info for ddclient with enom services, straight away I setup ddclient in my Centos box, and life was great anytime my ip changed I would get an email notification and my registrar would be updated automatically. The problem with life is once you have gone forward it’s hard to go back so when I updated my Centos box to the next version it came with a new version of ddclient which would not take the patch to make it work with enom but it also did not work with enom even though it was supposed to support it. So I could go back to manually updating my IP or get another client that would work with enom, I ended up putting together this python script to update my IP changes and to also send me an email whenever my dynamic IP changed. This is my first ever python code, I have worked with other languages and it was a real pleasure to see how simple python makes some tasks that would take a lot more coding in other languages I have used. Most of the code is made up of different pieces i found around the net so I can’t claim to have done it all by myself. So in the spirit of others before me am putting it out there to help anyone else who might need it feel free to use as you please and change it to your liking. If it works for you or not let me know but it is not a requirement.

[Solution] ALSA lib conf.c:4514:(parse_args) Unknown parameter AES0

I would get this error while trying to watch certain movies over HDMI with XBMC on my tv and no audio would be available.

ALSA lib conf.c:4514:(parse_args) Unknown parameter AES0
ALSA lib conf.c:4647:(snd_config_expand) Parse arguments error: No such file or directory
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM plughw:0,0,AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2

My solution to this error is in audio settings section under passthrough output device choose custom and enter whatever output you use for your HDMI mine is “plughw:1,7”. To my understanding it’s an ALSA issue with ac3 where it passes the wrong output parameters, and the AES0 parameter is supposed to set the digital audio output connector in the right mode. Thats my understanding from what I have read about it so google it if you want to find out more on this. As for me am content that it all works and I can stream all my stuff with sound to my tv.

Gnome Shell

I upgraded to Fedora 15 yesterday and I like gnome shell, sure it’s different to the old gnome but that’s why we upgrade software. I also like the fact that you can alt tab all the way to other workspaces nice!!. Personally I don’t miss the status bar and according to the word online, some features are already being added to Gnome3.2 which are missing currently, so for the first release this is pretty awesome work congrats Gnome team.
Personally the only thing I would like is for it to be easier to customize, but I see their is already an app Gnome Tweak Tool to help you customize your setup. The fact that the UI has moved away from all that windows like look is a great plus, this is Linux after all and we pride ourselves in being different.

HTTPService get with parameters

I was trying to put together a simple HTTPService Get service and most of the tutorials online did not work for me, as most of them are get calls without parameters and I needed to pass 2 to 3 arguments with my get call. Below is sample code for my get call.

[cc lang=”actionscript3″]

private function getListings():void
var params:Object = new Object;
params[“Input”] = txtInput.text;
params[“Index”] = new String(cmbSample.selectedIndex);
How does this work
When the HTTPService executes it will convert the above call to


This way am not having to do a post call just to send two parameters.

The ResourceConfig instance does not contain any root resource classes

I have finished building a web service several times start up tomcat and get the above error even though my classes have @path annotations and my web.xml is properly setup for web services.

Here is a solution I found out, make sure to do a manual project build from Eclipse when you are done working on it. For some unknown reason even though the project is on auto build, the resource configurator did not pick up my new restful project until I did a manual build. The manual build is only required the first time you need to add the restful service to your resources, the servlet entry below is all you need to add to your web.xml to enable restful services to be configured by resource locator.

[cc lang=”xml”]