Saturday, 24 December 2011

I think I might build my own tablet

So the raspberry pi looks like its gonna ship in January. Can't wait have so many great ideas of what to do with them. My favorite Idea is to make my own tablet.

I already have usb bluetooth and wifi dongles lying around so thats the connectivity taken care of. I'll need a Screen that there are linux drivers for. Although I'd like to find something cheaper than the one I linked too so if anyone has any ideas let me know. Maybe something that actually uses the RCA or HDI connectors on the raspberry pi. Then I'll get one of the kits for the old triple e's to turn them into a touch screen. The EEE's all shipped with Xandros at the start so I presume there are linux drivers for the kits out there somewhere. The last thing I'll need is some batteries I figure some of those solar powered lithium ion batteries used for back up charging phones and tablets would do. Probably try to use two, one sending power to the raspberry pi and the other to the monitor. For the case I'm think balsa wood and mechano but we will see how serious I get about this when I actually get a raspberry pi.

Software wise I'm going to be going with some linux distro obviously. Really which ever one has the best support for the raspberry pi is probably going to be my first choice. Then I'm going to either use kde's new plasma active interface as a desktop environment or hildon, which is the awesome interface used in maemo on the nokia n series Internet tablets. As for any other operating systems I might put on it, unless there is a really convincing argument for it android can suck it although I might try webOS after they open source it.

The most important thing about this entire design(if you could even call it that) is that I wont have to solder much because I can do many things but give me a soldering iron and I'm only going to get the job done after 3rd degree burns. Still can't wait till the raspberry pi comes out and I get a new toy to play with.

Friday, 16 December 2011

Humble Bundle Linux Hacks

The Humble Indie Bundle 4 was just released the other day and its awesome but one of the major differences between this bundle and some of the others is that every game has just been ported to Linux. Which is great more games on Linux is always a good thing much better than those royal bundle folks who sometimes don't even give us a single Linux game. The issue is that all of these are 1.0's so we have to be patient and wait for the developers to fix the couple of bugs which are going to come up. Unfortunately this mean we have to wait to play our games which sucks so here are a few hacks and general advice to get them up and running.


Note some of these are broad and will help the less well informed about Linux but some will help everyone.

Check for Updates
It may be obvious but the devs have new builds out very quickly the only game to not have a new build since the launch it bit trip runner. People are submitting bugs to the bugzillas and they are getting fixed so if there is a new build out give it a try.


  • Gratuitous Space Battles - I got a segfault when I tried to run it when it came out with the latest build its fixed :)
  • NightSky - Didn't run when I first tried it. Got the latest build today and it works perfectly

Bit.trip.runner
Didn't work out of the box. Firstly their was issues with their .deb package which according to the software center was of bad quality(and since it didn't run I agree with them). Anyway a nice redditor, hakdragron, found a neat little solution around the error I was getting:
GLIBCXX_3.4.15' not found (required by ./bit.trip.runner)
Its quite clever how he found out about this hack. He basically got the same error when running the jamestown game not from their script which basically tells the game to use the libraries that come with the game rather than the ones from your distro. So he wrote a little bash script to make the bit.trip.runner game use the libraries that came with jamestown.

So in my case its a script like this:

LD_LIBRARY_PATH=/home/shane/jamestown/x86:$LD_LIBRARY_PATH exec /home/shane/bit.trip.runner-1.0/bit.trip.runner/bit.trip.runner "$@"

The paths will be different for you but its just wherever jamestown is on your system and wherever bit.trip.runner is on you box. To be honest dependency issues like this aren't that big of a deal and I'm sure they will fix it soon.

Gratuitous Space Battles
So Gratuitous Space Battles worked after the update. Well thats not exactly true I was left with a black screen during the gameplay but thats much better than a Segmentation fault that stop you playing it entirely. This obviously would have made the game unplayable but all I had to do to fix this was turn off Gratuitous Shaders in the options menu. Then I was able to play the full game in all its glory.


Up to Date Distros
I know from development projects I've done in the past that there are only so many systems the developers will test on and rightly so god knows if they tested on every linux distro they would never get anytime to do anything but test. My best guess is they probably tested these four in this order and didn't bother with the rest.
  • Ubuntu 11.10
  • Fedora 16
  • OpenSuse 12.1
  • Arch
If you really want a game to run these are your best bet. I've heard a lot of good things especially from fedora and arch users about games working out of the box that simply don't on other systems. So if you have a spare usb key why not put a live persistant image of fedora on it and give the game you want a go. They will probably fix it to work with your current distro soon.

Use Proprietary Drivers
Sorry to those of you that are so against the idea of closed source applications that they are willing to take the performance hit but the games are likely to perform better on better drivers. Obviously if your on a nvidia chip set you don't have any choice the nouveau driver just isn't good enough for most of these games however AMD's open source drivers a very decent so while the games are more likely to run on the closed source drivers. They will probably work well enough in the open source ones.

Wine
I know you won't be running the linux version but wine is not an emulator its an api translator. The games will run at the same speed or very close to that and many of the games have excellent ratings on wine's appdb.


All tests done on a Ubuntu 11.04 Machine Running Gnome 2
Games that work out of the box(or download technically) as of 16 December
  • Jamestown
  • Gratuitous Space Battles
  • CaveStory+
  • NightSky
Games to go
  • Bit.trip.runner(Obviously not that big of an issue. Just dependencies I'm sure they will fix it soon)
  • Shank
    • Segmentation fault
    • Also read the bash script for launching shank some of the comments are brilliant
    • Gold rating on appdb so give it a go under wine
    • EDIT: Now works brilliantly 
  • Super Meat Boy
Hope this helped those of you who are struggling to get your games running. In all likelihood they will have fixed all of the games in time for the end of the bundle and if you haven't got a bundle yet go get one they are only a cent if your cheap but seriously pay a decent price for them and support indie developers and Linux as a platform for gaming.




Sunday, 20 November 2011

More texting on your N810

In a previous post I explained how I made a web texting app for my nokia n810 using cabbage on my server and Illumination and a few custom blocks to write a little python script on for my device. Unfortunately this post's app was only really relevant to people in Ireland and I have found another way to text on my n810, using a bluetooth connection to my phone. Its a cool command line app called gnokii. When I originally installed gnokii it  had a feature in the control panel to configure and a gui called phone link neither of which actually worked for me. So I uninstalled all the phone link stuff and was just left with the command line app gnokii. I did a bit of googling and found out you have to write a config file for gnokii to work properly with you phone. So I wrote one and placed it in gnokii's default place for its config on the n810 ./home/user/.gnokiirc, this is a different place from its config on desktop linux to which I can only say "Why?". My config will work with most phones. The port is your phone's mac address. I've blanked mine out in case some mean people ever read this. Model refers to how the commands that gnokii will use to communicate with the phone. AT stands for AT commands which were developed in the 80's for old telephone systems and I think you can guess connection.

I decided re-use my Illumination file from my web text project so I just added a button to the GUI, moved a few blocks around and wrote a quick little custom block to read text messages using gnokii. I made sure the app could do this because the entire idea of this project is that I never have to take my phone out of my bag. Anyway here's the code I use for the custom block.


f=os.popen(ISCVariable1)
 filearray = f.readlines()
 lastline = filearray[-3]+filearray[-2]+filearray[-1]
 ISCVariable2 = lastline
 
 #Output1


This block runs a gnokii command gnokii --getsms 1 end and grab the last message the phone received from the output. Now I never have to look at my phone again if I don't want to. It can stay in my bag while I play emulator on my n810 and if I receive a text I can read and respond to it all from my n810. By the way if anyone thinks its cool how easy it is to develop for this device why don't you grab one on ebay I got mine for 60 euro. Also you may want to get illumination especially if your lazy like me. I think they have sale on and its only 20 dollars until December 1st.

Here is the Illumination file and source code:
Source
Illumination file

Did I mention the python script, I have written for n810, will also work on any linux desktop with python and gtk support(ie. pretty much all of them) for this particular one you just need to sudo apt-get install gnokii. Although if you really want something like this for Desktop Linux use Wammu its an amazing application for using your phone with Linux.

Last but certainly not least a little bit of news on the jupiter broadcasting app. I've added the feature to see the live video. Although I would like to point out this is entirely due to scale engine and Allan being awesome.
/*
 Commented this bit out because turns out I put it in the market ;)

 I've given Chris and unsigned apk to sign himself and put it in the market so you should see it in the market soon.
*/

Tuesday, 1 November 2011

Easy Ruby Media Player

I'm currently in the process of learning ruby due to a college module but one of the crap things about learning a new language is that most of the examples and short programs you write are so pointless. They don't really do anything or at least anything useful. So I decided to write something in ruby that I could actually use.

One of the local radio stations radio nova a rather awesome rock station just had a top 500 guitar songs of all time and published them on their website. Its a pretty good list of songs so I thought why not make a script to play a random song the list using ruby and youtube . Turns out its not that hard :


This just picks a random line in an inputed file searchs for it on youtube and opens the first link. I thought that was easy why not make something slight more useful lets give it the ability to to play multiple songs and skip songs. Another regex to get the length of the video and tell the thread to sleep for that length between songs. Then a second thread to take input from the command line and we are done :

There we have it my new media player at least until I get bored of the novelty of it and go back to a real one. Obviously this isn't the most advance ruby script ever but still it was nice to make my first multi-threaded ruby script and have it doing something relatively useful rather than turning on and off the light in an imaginary lighthouse. Hope this was helpful to others just starting off with ruby.






Friday, 28 October 2011

Web Texting Apps

So if your an Irish KDE user or n810 owner the little projects that I'm about to write about are going to be useful to you. If not it may be an interesting read or it may not(Your decision really). There is a web texting app for android,web, j2me and windows called cabbage . The developer seems like quite a nice guy I emailed him before starting initially to get the php setting for the web scripts for the app because my initial Idea was to run my n810 as a web server (using ligHTTPd) to host the scripts and build a much simpler web based gui on top of them but unfortunately the php packages for the n810 doesn't support curl which meant that Idea was dead in the water.

I then decided to implement my app in python and to not need a web server using his scripts as a model to rick the networks websites with httplib but to be honest that was going to be a lot of work and I already have a server online so there was no really need. So as you can see I was being quite lazy about this project therfore I decided to be even lazier and use a developer tool called Illumination Software Creator.  Which allows you to program with blocks and build guis really easily. It didn't have all the functionality I needed but the developers allow you to make and use custom blocks. This meant that all the code I had to write was

 data = urllib.urlencode({"u":"YourNumber",
"p":"YourPassowrd","s":"v","d":ISCVariable2,"m":ISCVariable1})
 f = urllib.urlopen("YourServer", data)
 s = f.read()
 ISCVariable1  = s #so I can alert the number of messages later with illumination

 #Output1



A very lazy(efficient if I'm ever asked in an interview) way to code :). As you can see this quite a simple but effective little program and to be quite honest for not all that much effort. Here is the full source and Illumination files:
Python Source Code
Ilumination Project

The server I'm using is given to me by my university judging on the blog stats there shuldn't be to much of an issue because there isn't that many of you reading this and the proportion from Ireland is only like 10% tops but if there is to much traffic is sent to the server I'll take down the scripts.

I not that many of you may know I have recently converted back from gnome to kde because once I change the keyboard shortcuts kde was much more like gnome 2 than gnome 3 or unity. One of the really cool features that I got from my switch from gnome to kde was desktop plasma widgets ( and probably the prettiest desktop in the world) which as it turns out are super easy to develop. Hats off to the kde developer for making such cool ways to make these widgets and great documentation . You can develop widgets in python, javascript, ruby, c++ and web technologies. So I just made a simple little web page a .desktop file and I had my awesome little web texter kde applet.

Here is the source :
Applet(Open Zip to see source)



To add this to  your desktop just right click add widget -> click get new widgets -> install from file -> and choose the zip file above and you will have your awesome texting widget. I'll be adding phone book support to this later and I'll chuck a note on another post when I do so you know that you can upgrade :).

Wednesday, 19 October 2011

Java Script Mobile Kings App

So a few weeks ago I was in Eindhoven with a few friends consuming copious amounts of alcohol. Before going out we were engaging in the great student tradition of pre-drinking by playing drinking games. Mainly "Kings" or "King's Cup" according to Wikipedia however there was a few issues with this game, we had to spent quite a bit of time to find the cards when we wanted to play and when the cards were lined around the cup they became quite wet.

I thought it would be great to have an app to play kings so that I wouldn't have to find a deck of cards only to spill drinks on them . It turns out that both the android market and apple app store have "Kings" apps available but I don't just want an app for my android I want one for all of my devices especially my nokia n810 maemo device.
So I decided to write the app in javascript and html because lets face it. Its hard to think of a devices that doesn't support either. I kept it very simple so that it would be fast on all mobile devices therefore I chose to not use jquery or any other library.

I started by getting some free card images off http://www.jfitz.com/cards/ . It doesn't really matter about the quality of these images for the moment. I may see if I can get really pretty images like the cards from the cards games in kde desktop later.
I started a simple web page with an image and a button :

<img src="./css/b1fv.png" id="card" onclick="nextCard();" width="200px" >
<button class="boldbuttons"id="RuleButton" onclick="rule();" type="button" style="width: 200px;">Rule</button>

I then created three functions in java script. The changeSize() function which I run when the page loads and does something like this for both the button and the card :


                var cardImg = document.getElementById('card');
                cardImg.style.width =(screen.availWidth-70)+'px';

The nextCard() function  generates a random number associated with the card image and changes the src value of the image to that number and throws that number into an array so it isn't used again and finally the rule() function which is just a lot of if statements in order to throw a java-script alert of the rule based on the current card. So as you can see this was rather easy to write and is ultra portable and anyone  can make it look as pretty as they like later with different images and css.

Here is the code:
http://ubuntuone.com/6x7B9W6EK7vDQiTrwmSWcK

In order to make it an app I can host in on a server, package it with webviews in android or just leave the files on the device. So for the n810 I just left the files on the device but on my droid I packaged it up with a webview and initializing it with the web age in the assets folder . One of the great things about doing this is that the user generally can't even tell that the app is just a web page. On top of that if you wished to include ads rather than use ad-mob you could just use regular Google ads embedded in the web page.

Here is the code and apk:
source code
apk

I hope this helps some alcoholics and people who want make apps but don't want to use java alike :) .

PS. Next time I put money into my account I'll pay the 25 dollars and upload the jupiter broadcasting app and the kings app to the android market place and here is the qr code for the jupiter broadcasting app thank to rob




Thursday, 13 October 2011

Jupiter Broadcasting App

Ok so this is going to be my first post. I never really blogged before but I wanted a outlet for some of the cool and not so cool little projects that I do (mainly to do with software). Anyway, last Thursday I was watching Linux Action Show and TechSnap. Which are awesome by the way. I heard someone in the chatroom say that there was an iphone app but not an android app. I really think that is because you don't really need an android app with all the apps in the market place to stream content and to get rss feeds but I made this anyway because its annoying to keep hearing people say things like that and it will be a good educational piece of code for people starting off with android.

Lets get started, so first thing I did was decide to play the audio stream. So I created a media player object and set the data source to mp3 stream from jblive.am. Then I created a quick GUI, just a button using drag and drop with eclipse. Then I linked the button to a listener like this


play.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
if(!mp.isPlaying()){
         mp.setDataSource("http://64.150.176.9:8232");
mp.prepare();
         mp.start();
         play.setText("Pause");
}else{
mp.stop();
         play.setText("Play");
}

}
     
        });
    }

where play is the button Object. So I gave the chat room a link and was told they liked it but was asked if could I add ongoing app notifications. I went rummaging through the android docs to find out how to do this, turns out its not that hard. So I set the notifications on the on Pause listener like this


@Override protected void onPause() {
   super.onPause();
   {
  String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
  if(mp.isPlaying()){
Notification notification = new Notification(R.drawable.icon, "Jupiter Broadcasting",System.currentTimeMillis());

Intent notificationIntent = new Intent(this, Home.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent intent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(getApplicationContext(),"Jupiter Broadcasting", "Playing Live Stream", intent);

notification.flags = Notification.FLAG_ONGOING_EVENT ;
mNotificationManager.notify(34,notification);
  }else{
      mNotificationManager.cancel(34);
      }
   }
    }


The "mNotificationManager.cancel(34);" is very important to stop the notification appearing unintentionally. By this stage we have a relatively functional radio app and I started thinking about new features that could be useful and I remembered I had some code for an RSS reader that I grabbed from someones blog and modified slightly so I added the feed for all shows so that people can download the latest episodes.

I'm just about finished but I'll probably update and add stuff to this over time but its pretty much done. I'd also like to point out that while most of the code is mine(The RSS reader part isn't I've been trying to find the blog I took it from however I have modified it to click into links) and feel free to use it whatever way you want. The images I don't know what sort of copy right there is about the images and if Chris or anyone else from jupiter broadcasting wants me to take this down or remove or modify it. I will without issue. Hope you enjoyed my first blog(Although it was probably boring as sin sorry :))



Here is the code and the apk
Source Code (Eclipse Project)
APK

Update its in the android market now : https://play.google.com/store/apps/details?id=jupiter.broadcasting.live.tv