NumberPickerPreference

Today i was working with the PreferenceActivity where you can create you preference screen automatically with xml. Nice solution to not store and load your settings each time manually.

I missed a number picker widget. There are only a few you can use, as for example EditTextPreference or CheckBoxPreference. So i had no choice and made my own NumberPickerPreference widget, which i would like to share.

Here my GitHub Repository with further infos: https://github.com/leonardarnold/NumberPickerPreference

Feel free to fork me, star me or whatever.

 

NumberPickerPreference screenshot number picker preference preferences Leonard Arnold NumberPickerPreference screenshot number picker preference preferences Leonard Arnold

raspberry pi + xbmc + amazon prime instant

The amazon instant video streaming launched their services in germany about one month ago. I don’t have a playstation or a xbox to stream it directly to my tv so i wanted to stream it via my raspberry pi using xbmc. I could not find a plugin so I decided to make one by myself. I started to get the streaming services to work on my arch linux. As all(?!) streaming services, amazon uses the silverlight plugin from microsoft. Because of the DRM encryption is inevitable to install silverlight. In linux you can use piplight which emulates the real silverlight plugin to get it work. Now i thought to simply code an addon to browse nicely in xbmc through the movies then launch url via a browser which have piplight installed and uses a faked user agent and then control the stream via my keyboard, or map the controls via the HDMI-CEC settings. I didn’t have my raspberry pi here so i started with the addon on my computer which basically shows the movies with text and images. To start the browser i wanted to use the ChromeLauncher addon which is outthere.. All was possible until i got my raspberry pi today and i realised that it’s not possible to get pipelight work on it.

As Michael Müller from the pipelight team said:

sorry, but it is not possible to install Pipelight on ARM devices, since we use the original windows version of Silverlight/Flash/… which are only available for x86 processors. The only possibility to run these plugins on ARM devices is to emulate a x86 processor, but this is terrible slow and not suitable for video rendering.

So here you can browse or use my uncompleted plugin code for future projects. I think that the life of silverlight won’t be so long anymore, so maybe i can finish my project later.

 

[UPDATE]

Amazon allows you now to stream with flash instead of silverlight. So checkout this plugin and have fun: http://www.kodinerds.net/index.php/Thread/43912-RELEASE-Amazon-Prime-Instant-Video-US-UK-DE

broken links when fetching url with urllib2 python ISO-8859-15 to utf-8

I had a little annoying issue which was a simple encoding error. I’m not a python expert and i tried to read a webpage via urllib2 in python. Let’s see what i did:

import urllib2
req = urllib2.Request(url)
response = urllib2.urlopen(req)
content = response.read()
response.close()

When i tried to work with my webpage i got in “content” i had a really weird problem. The webpage i got was different from the webpage in the browser.

print response.headers.getheader('Content-Type')
text/html; charset=ISO-8859-15

The charset of the response was “ISO-8859-15″. My browser used “UTF-8″, so we add now a useragent to ‘convert’ our charset from ISO-8859-15 to utf-8:

import urllib2
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/22.0')
response = urllib2.urlopen(req)
content = response.read()
response.close()
 
print response.headers.getheader('Content-Type')
text/html;charset=UTF-8

This is what I got. Then I replaced the ‘&’ and all german special characters like this:

content = content.replace('&', '&')
#for german special characters
content = content.replace('ü', 'ü')
content = content.replace('ä', 'ä')
content = content.replace('ö', 'ö')
content = content.replace('ß', 'ß')

Maybe there is another more beautiful way for this, but this worked for my and i can go on with my actually work.

Ubuntu eduroam wifi does not connect

My Ubuntu 13.04 didn’t connect to the “eduroam”(“wwu”) wifi. It tried to auto-configurate the connection as android, ios, firefoxos, windows and mac do pretty well, but ubuntu failed.
First you have to download a certificate which should provide your university. I had to choose between three different certificates, i downloaded them all and tried them one after another. Problem here: My Firefox showed up that all these certificates were already installed by clicking on them, so i had to use the link below which showed me the certificate as a text in the browser. I opened a text editor, copy and paste, and I saved it as “filename.pem”. Unfortunaly my ubuntu is in german but anyhow you can see my configuration easily in the screenshot below.eduroam wifi wlan wwu configuration certificate zertifikat problem ubuntu linux

Age of empires II graphic bug windows 7

This bug is really annoying. If you see it, you’ll agree with me.
Just put the following code into notepad, save it, as “start.bat”, place it next to the .EXE file. Just start our new .bat file.

For Aoe II

@echo off
taskkill /f /IM explorer.exe
empires2.exe
start explorer.exe 

For Aoe II the conquerors

@echo off
taskkill /f /IM explorer.exe
age2_x1.exe
start explorer.exe 

You can find everywhere this solution on the internet, don’t know why aoe has problems with the Windows 7 explorer.exe.

Hamachi Error 1053 on Windows 8

These days I found my old Age of empires II Cd’s and i called my friends to play together as we did some years ago. I installed the latest version of Hamachi on Windows 8 (i use linux, but W8 was already installed and i kept it to play). I always got a message “Failed to connect to the engine” (german: “Die Verbindung mit der Engine konnte nicht hergestellt werden”). To solve the problem you can search for an old hamachi archive or do the following steps:

  • Press WINDOWS + R, type in “services.msc”, search for “LogMeIn Hamachi […]”, right click, press start or restart.
  • open notepad, copy paste the following code, save as “hamachifix.reg”, open it.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LogMeIn Hamachi]
"EngineConfigDir"=""

hope it helps