Funky Monkey Software | Development, Applications and Chimps

CAT | Fun and Play

My friend FlabbyRabbit (over at HackThis) recommended that I start blogging about my software projects so that I can help other people with their projects and have something to look back on when everything is finished. For this reason, I've decided to start writing about ADM (my Android Download Manager) as I develop it, documenting my trials and tribulations as I go along.

So What's going on in the world of Android and downloading at the moment? Well, ADM still doesn't really do much in all honesty. Currently, you can add URLs to the database and ADM will check them for you to see if they are online (provided the relevant downloader plugin is installed).

I've had quite a lot of trouble getting the threaded parts of the application to talk to each other in a meaningful way. The need for threads in an application that does a lot of networking is fairly obvious. The user doesn't want to be sat there waiting for something to happen for hours with no progress dialog. Users want results. Therefore, I've put in a system that goes off, downloads the data and then returns it to the GUI thread while the GUI sits with a progress bar, waiting patiently for some useful input.

Unfortunately, my first attempts at this were met with a rather nasty looking exception "CalledFromWrongThreadException". This basically states that a secondary thread is not allowed to alter a view that was created by a primary thread. That is, if Thread A creates a layout and Thread B goes off and does some work, Thread B is not allowed to update the layout directly.

"So how can we get around this?" You might ask. Well Google have kindly provided a nice answer for you: Handlers. Handlers can be used as a 'proxy' between the two threads, passing information from B back to A. Therefore I can simply implement a handler within my first thread with the following code:

    // Define the Handler that receives
    // messages from the thread and
    // update the progress
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
//progress has been made, update the thread GUI
            updateGUI();

}
};

Then, the second thread (thread B) can just call:

Message msg = mHandler.obtainMessage();
msg.arg1 = total;
threadA.handler.sendMessage(msg);

So there you have it. I'll be posting some screenshots of ADM soonish :)

· · · · ·

Feb/11

14

Android and ADM

The last few weeks have been incredibly busy with a huge number of activities going on, including revision for exams and Work Week. Now that I finally have some free time, I decided to have a quick look into the development of Android applications using my Scroll. I noticed that there is currently a lack of JDownloader-esque apps for Android and when I'm up on the uni campus with only my Android, I'd like to be able to download stuff on masse using the University's stupidly fast connection. For these reasons, ADM was  born

ADM (pronounced 'Adam') or Android Download Manager, is going to be a fully fledged download core system complete with link parser/checker functionality and a file hosting crawler that searches places like Rapidshare and Hotfile for relevant downloads that may interest the user. I may also build in un-rar functionality too. I've started working on it and have some early designs and stuff, but nothing too exciting.

I'll post more info when I have something exciting to show you. Unfortunately, my WordPress Script seems to hate me and is not letting me upload images or anything at the moment!

· · · · · · · ·

One of the most interesting modules that I've  been studying this semester has been Artificial Intelligence.

I've been shown how to do lots of very complex, intelligent things with computers including the use of Search Trees to find a solution to a complicated problem, how to use Genetic Algorithms and Genetic Programming to 'evolve' complex solutions and how to cluster data into groups and classify labelled data.

As a revision exercise (but also just to see if I could) I decided to try and cluster my music collection into genres using K-Means and Agglomerative Hierachical clustering. I originally planned to use the actual shape of the music (through wave form analysis) as my metric to find the distance between tracks. However, I simply don't have the mathematical expertise for this job. Therefore, I've been implementing the system using Last.FM metadata and comparing tags assigned to songs.

The biggest problem I've had so far is establishing some rules and some form of distance measure using the tagging system. However, after some lengthy googling, I came across this little gem of information. Essentially, it suggests assigning each possible tag a weight based on the frequency of its use. If a tag is used 5 times and the overall number of taggings (that is assignments of a word to a track, not the number of words themselves) is 100, then the tag's weight is 1/20.

With this system in place, its really easy to start building a picture of a song's 'weight' and matching tracks. The next part was the clustering of the tracks using a Hierarchical Agglomerative approach. This basically means, taking the Euclidean value of each cluster and merging it with its closest neighbor until there is only one big cluster left. Unfortunately, my python code really doesn't want to play ball, so I've written off to the python mailing list to see if any of them can solve it. But if you are interested in seeing the program I came up with, take a look at this python code.

I'm hoping to figure out why this isn't working myself, but any input would be very valuable to me.

"Dude!, She just called you useless!" "OH HELL NO!! Hold my Bachelor of Arts!"

· · · · · ·

Dec/10

26

Season’s greetings

So, as quickly as ever, it seems that Christmas has snook up on us yet again! The Christmas holiday period marks a highly anticipated break from student life for me and many of my student colleagues. It's also a great opportunity for me to start getting creative and using a lot of the knowledge I picked up during the uni semester to develop some new software packages.

Christmas also brought me a lovely new android tablet to play with, providing me with the perfect opportunity to have a go at writing some android apps. I'be harassment wonderful day today and a wonderful year in general (although I'll save all the reminiscing stuff for my new year's post).

All the best and lots of Yuletide cheer

James

· · · · ·

Nov/10

23

Gregynog

Its been more than a week since I attended the fabled "Gregynog Careers Weekend" and I've still not written about it. Essentially, it was a very useful and important experience to me and I really had fun. Gregynog is a large stately home, situated in the welsh countryside, a few miles outside Newtown. It is owned by the University of Wales (a group, Aberystwyth University was formerly part of) and is used for a variety of residential courses and University related gatherings.

We left on Friday evening in the dark and the Welsh Drizzle, arriving at Gregynog and dining at around 6pm. The food was really good and we all wolfed it down like no tomorrow. We then had an introductory talk from the Industrialists and were sent off to the bar.

At 9am the next day the fun began! We were sent around the house, doing various tasks including Panel Interviews, group building activities and even making posters on Belbin personality traits! The most important of these activities (to me at least) was the interview. We were grilled, in turn, on our aspirations, our reasons for applying for the fake job, and our interests. The interviews were set up to be deliberately scary and difficult to attempt to prepare us for any potential interview that we may encounter in our search for industrial placements. I learnt a lot about myself, about how to cope under pressure and about how to set up my CV. The most important lesson I learned was not to undersell yourself. It is a very British trait to underplay huge achievements, and apparently, I have a lot more to offer than my CV would lead you to believe.

The industrialists were fairly impressed with our performance, you can find some of their blog posts (thanks to Peter 'Welp' Weller) here.

· · · · · · · ·

Jun/10

24

Predtr, The Lakes and Alton Towers

So, I've been mighty busy with my latest software project, PREDTR as of late. I'm afraid I'm keeping PREDTR quite hush hush at the moment, but all will be when it is released (for the most part under the GNU license and eventually available from predtr.funkymonkeysoftware.com. I'm hoping the project will be useful to someone, its certainly been interesting developing it and its keeping me on my feet in terms of Java too.

Today, me and my Dad's side of the family are heading up to the Lake District for a long weekend. My Dad and Grandparents are from Hoole and they've always been drawn to the North. We're off to see Kendal where my Grandad used to be the caretaker for the museum, and for a walk along Scout Scar. We'll be up there for a few days returning on Sunday. I will then be getting an early night in preparation for my trip the next day.

On Monday, myself and a few of the Ludlow gang (as well as Luke and Nat from uni) are going up to Alton towers for the day. We managed to find some half price coupons (its £35 per person, who'd pay full price?) and will be checking out all the rollercoasters that can be squeezed into a single day.

I leave you on this note: "How many Bears could Bear Grylls Grill, if Bear Grylls could Grill Bears?"

· · · · · · · ·

Jun/10

17

What to do with an empty day

I've been at home for nigh on 3 weeks, and most of my friends are either at work, at Uni or living somewhere remote. This morning I've been musing at this statement, since it means that I've been home for nearly 3 weeks and got by with a minimum of social interaction by cutting my losses and finding as many things to do in and around the house as possible. So, here are my top 10 favourite things to do when home alone:

10) Gardening - This is at the bottom of the list since its the activity that makes you feel old, withered and boring. However, once you get past this initial mindset and the fact that you feel about 70, you start to - enjoy is a strong word - get some fulfilment from doing it. At the moment, I'm hacking a flower bed full of weeds apart, plant by plan.

9) Cooking - Again this is fairly near the bottom of the list, I do love cooking but it requires much effort and a great deal of care to get right. I'm living with 3 of my friends from Aberystwyth computer science next year, and I think I'm going to be cooking for them quite a lot. So, I've been practicing. You can get a load of free recipes on the internet and if you have twitter, its worth following @CookeryBook24 for some neat tips.

8 ) Watching TV - A nice simple one, TV is awesome, I'm currently following Lie to Me, Eureka, Two and Half Men, Grey's Anatomy and Burn Notice. I've also just finished watching House, Hugh Laurie is a Demi-God.

7) Meditation and Reflection - Boring - to start with, but meditation is really really relaxing. The idea is to focus on one aspect of your current being: your breathing (in and out, in and out) or you can chant ('aum'). Your mind wonders off and the idea is to reign it in and carry on focusing. Eventually, you end up with an empty mind, no thought, no worries, nothing.

6) Gaming - Maybe a cliche for a computer scientist, but when boredom strikes, strike back in 3D at the ZOMBIES! Currently playing the L4D2 campaigns all the way through. Fantastic fun and quite challenging in the right mode. I'm in a really zombie-fascinated mood at the moment and I might revisit the Resident Evil games next. Gaming is fun and pretty rewarding too!

5) Programming - This is one of the most enjoyable times of year to be a programmer. I have no assignments due in, I have no crushing projects that I'm being forced to write for. I'm able to write my own code, as and when I feel like it for my onw personal projects. I'm writing some pretty cool AI programs at the moment and I'll be posting about them on here soon.

My guess is that the average person wouldn't be interested in programming in their spare time, but if you have an open mind, try writing a website and use Javascript or PHP to do it.

4) Listening to Music - So, I rarely do this purely on its own, but listening to music is one of my favourite activities. My Collection is piling up and I have a Spotify account, so I can listen to pretty much anything I want to (if I can put up with the awful adverts in between songs). As you may have guessed, Music is one of my key interests and its always interesting to discover new bands and songs. You can get a Spotify Account for free here.

3)Writing Music - I'm a bit of a composer and I like to write covers and parodies of existing songs, as well as creating my own. I'm currently working on some arrangements of popular songs for Solo saxophone with backing track/accompaniment. I'll post it when I'm done. You don't have to be a genius to write music, you could even just settle for writing lyrics if you wanted something to do.

2) Reading - There aren't many things better than just sitting and reading. I have to say, that I adore sitting in the Garden with a paperback and my MP3 player. The best thing is, reading is free! Get to your local library and check out their collection of awesome fiction books!

1) Playing a Musical Instrument - My favourite activity for filling an empty day: Practicing my Sax. I have a Blue Roy Benson Alto Sax and I'm in love with it. I am currently learning some of Dexter Gordon's work and have a book by Raphael Ravenscroft - the guy who did the Baker Street Sax Solo and also a relative somewhere down the line.

If you are interested in taking up an instrument, you can pick up an old guitar for a negligable sum these days, My friend sold his old guitar -in full working order - for £10 the other day. There are plenty of guitar tabs and tutorials on the net.

So there you have it. Next time you're home and bored, why not try one of these things? I'm having great fun. I still can't wait for my friends to return! I'll be posting any antics between now and then on here!

· · · · · · · · · · ·

Its been a while since I last had a go at using Haskell. We had to learn it as part of our first year course at University and it was a very eye-opening experience (as programming experiences go that is). Unfortunately, there's not much call for the use of Haskell in the real world, it appears to be one of those 'academia-only' oddities that the computing industry doesn't really care about. I think Haskell is a fantastic language that really makes the writer think about what needs to be done much more carefully than most mainstream procedural languages. The code is also much more efficient (more semantics per line) than many procedural languages too.

To start with, I was trying to figure out how to build a templating library that converts strings into code. For this, I needed a split function that takes a string and a deliminator and returns a list of strings. There are already lots of examples of how to write such a function for a single character deliminator available out there. For example, check out this four year old post from Julio Merino. This provided me with somewhere to start, but the problem of having to parse many characters to determine the location of a deliminator was not helped here. After a little bit of messing around, I figured this out for myself, and came out with the following.

--The split function takes a long string and a deliminater and breaks up the long string every time the deliminater is found
split :: String -> String -> [String]

--trying to split an empty string returns an empty string --what else did you expect fool?
split [] _ = [""]

split (c : cs) delim
	| shouldSplit cs delim = "" : (drop (length delim) (head rest) ) : tail rest
	| otherwise = (c : head rest) : tail rest
	where
	   rest = split cs delim
	   shouldSplit _ [] = True
	   shouldSplit [] _ = False
	   shouldSplit (c : cs) ( d : ds)
	     | c == d = shouldSplit cs ds
		 | otherwise = False

Feel free to use this anywhere you like. I don't mind whether you attribute it to me or not, as long as its useful to someone. Also, if any hardcore Haskellers want to leave improved code, feel free! I do love a bit of constructive criticism.

EDIT: Also, please note the lovely Haskell syntax highlighter plugin for SyntaxHighlighter: Evolved written by Alessandro Vermeulen

· · · · · ·

So yesterday marked the end of my first year as a University student with my final exam in Java Software Development. I felt the exam went pretty well and I'm pretty confident it's a first!

To celebrate this, and to celebrate both Luke's and Saul's birthdays, we decided to go out on the town last night and did a bit of a pub crawl around aber. We Started in Spoons and Finished up in the Pier, a good night was had by all! There are lots of pictures to check out too! We finally got home at 3am after going back to the club to get Emily's phone (she accidentally left it, luckily Merlyn picked it up and sorted out getting it back to Emz).

My  next task is to decide what to do with myself over the summer. I've figured out that I can't afford to stay in Aber unless I get a full time job here, which is unfortunately not going to happen. So, I'll be heading back to the Shire and working as much as I can in the local pubs. I'll also be reading up on next year's course content (since already knowing most of the stuff played a key part in passing this year). I've also got a lot of catching up to do with my friends from home.

On a side note: I've got a ticket to see Joe Satriani in Birmingham Symphony hall in October. Joe's my guitar hero and I've already seen him twice, as part of Chickenfoot and playing solo with support from Paul Gilbert.

· · · · · ·

So I have precisely 3 days until my first exam and I thought it would be a much better idea to update my blog instead of revising. So, this weekend I went home to see the parentals. Its been roughly 6 weeks since I was last at my Dad's place, he was in Hong Kong last time I went home so I only saw my Mum. It also happens that I haven't seen any of my parents since my birthday so I was greeted with cake and presents at both locations!

The birthday cake

Mario and Luigi wish you a happy birthday!

My Mum presented me with a mini synthesizer, the Korg nanoKey. Its not a synth on its own, its simply a really tiny and compact USB MIDI controller that fits nicely into my laptop bag. I've been messing around with some recording software and managed to find some VST plugins that make it sound exactly like Eddie Van Halen's Oberheim OB-Xa in Jump. I also found some Nintendo inspired plugins that gave me some nice sounding 8-bit chip noise. I was quite happy to spend most of my Saturday playing with the nanoKey before setting off to my Dad's. She also gave me a pretty cool Nintendo birthday cake (see below).

The Morgan

Out for a spin!

Saturday evening, I met my Dad and was presented with a really cool watch and a couple of little gifts from his holiday, I also got a cool coffee

cake (no pictures unfortunately, we ate it all :p ). We then went out in the Morgan and had a quiet drink at a local pub.

Sunday I went to HMV to spend a token I had been given for my birthday. Just as I was giving up hope on ever finding something I would be interested in, I accidentally stumbled across Charlie Brooker's Screen Burn. Brooker happens to be one of my favourite 'commentators' of the last few years. I previously read one of his other titles Dawn of the Dumb (yes, I know I read them in the wrong order) and really enjoyed it. His satirical... 'bitching' is a really entertaining read and a sure fire way to cheer yourself up.

As I made my way back to Aberystwyth this morning, I spent most of the 4 hour journey sniggering to myself and attracting quite a lot of unwanted attention from onlookers. So in conclusion. Weekend status: AWESOME. Current occupation: REVISION. Boredom: 105%

· · · · · · · · · · ·

Older posts >>

Theme Design by devolux.nh2.me