Cogitas Blog:
Google Android,
Common Lisp,
programming
and web design.

Fibonacci sequence in Common Lisp – the power of Lisp recursion

Filed under: programming — Tags: , — April 15, 2011

As I’m currently studying for a BSc in Mathematics with the Open University and I am trying to teach myself Common Lisp, I decided to try and create a function that outputs the Fibonacci nth element. Here it is, I think is a nice example to illustrate how recursion works in Lisp.
(defun fibonacci (n)
    (cond
        ((> n 1) (+ (fibonacci (- n 1)) (fibonacci (- n 2))))
        ((= n 1) 1)
        ((= n 0) 0)
        (T (print "invalid number"))))

Parsing XML in Android

Filed under: google android — Tags: , — March 17, 2011

With web services used everywhere, being able to parse XML is a necessary skill when developing Android apps. Here’s an example for you to modify for your own purposes.
(more…)

Power saving tips for Android and other smartphones

Filed under: google android — Tags: , , — March 16, 2011

Charging your smartphone every day is pretty much expect whether you have an iPhone or an Android phone, but how do you make sure your phone stays put for the whole day, particularly if it’s a long busy day away from home/the office?

Disable Wi-Fi: unless you know you want to use Wi-Fi, disable it. In Android, go to Settings –> Wireless & networks  –> Wi-Fi checkbox.

Airplane Mode: if you are travelling on a familiar journey and know you are going through zones of bad reception, or if you are in the basement of a building with no reception, or travelling on the underground for example, switch to airplane mode. For Android, press your power button for a few buttons until a menu pops up and choose Airplane Mode option.

Use Airplane Mode instead of Silent Mode: if you are in a meeting and don’t want to be disturbed but would still like your smartphone on to check the time or simply because the noise it makes when you switch it on and off is too awkward in front of the boss, switch to Airplane mode instead of silent mode.

Got any other easy power saving tips? Share in the comments :-)

Use a colors.xml file to create consistent Android layouts

Filed under: google android — Tags: , , — March 7, 2011

When defining a layout in Android using an xml file, the temptation is often to directly type in the colour, such as #000 for black. However, when developing a complex app, there is high risk of inconsistent colours throughout your app so the best way is to define a colour xml file, called colors.xml and saved in the values folder, and to refer to these colours, and these colours only, in your layout xml files. You may also define drawables that are colours in this file, for when you need a Drawable object of a certain colour, and not a Color object.
(more…)

Let down by technology… (humorous real conversation heard in shop)

Filed under: random — Tags: , , — March 5, 2011

Conversation heard yesterday between two men in their 50s. This took place in the office store Staples, in front of a couple of Android tablets (Samsung Galaxy and a cheap Archos one if I remember correctly).

Man1 “What are they?”

Man2 “They are like the iPad I think.”

Man1 “Oh yeah, that thing.”

Man2 “Yeah.”

Man1 “But what is it really?”

Man2 “Like a laptop without a keyboard.”

Man1 “How do you type emails without a keyboard?”

Man2 “I’m not sure…”

At this point, I thought I’d help them out.

Me “Yes, you are right, these are devices similar to the iPad. The screen is a touch screen so you can interact with it by touching the screen.”

Man1 “That’s nonsense, who would want that?”

Man2 “My niece has an iPad.”

Man1 “You’d think by now, they’d do something that can read your thoughts or something. A touch screen? What next? A laptop you can shake? That’s crap technology!”

How to develop an Android app using the accelerometer

Filed under: google android — Tags: , , — March 4, 2011

Think it’s fun to develop an app using the phone/tablet built in accelerometer? Me too! I’ll share here an example app, using the same technique for the accelerometer as used in my Android game Ants.
(more…)

Celebrating one download a minute of Ants – can we double that?

Filed under: google android — Tags: , ,

So last night (UK time), I published a casual game testing your strategy and spatial skills called Ants. This morning, I checked the download stats on Google Android Developers Console and it was almost 700, in about 12 hours, making it roughly one download a minute! No review so far but got one vote – a five star! I wonder if we can get to 2 downloads a minute?
(more…)

Ants – a new casual game for Android

Filed under: google android — Tags: , — March 3, 2011

I’ve just published Ants, a casual game for Android using the accelerometer – Giant Ants have invaded your space, will you manage to survive? The game is free so why not check it out? Currently, there are 20 levels and it will take you a while to get through them – trust me, I’ve been playing (I mean, testing…) the game a lot this past week and it ain’t easy (don’t let Level 1 fool you ;-) ) so you’ll get quite a lot of fun out of this.

Nokia demoting MeeGo from platform to project

Filed under: linux — Tags: , , , — February 11, 2011

Nokia has announced its plans and they are switching to Windows Mobile, and not Android as previously rumoured. They are keeping MeeGo as a “project” as opposed to the de-facto platform for their smartphones, indicating there will be only one MeeGo product in their range in 2011.

It is worth noting that Stephen Elop, the new CEO of Nokia since September 2010, worked for Microsoft between January 2008 and September 2010…

Read the open letter from Stephen Elop, CEO.

Find Tweets – a new Twitter app for Android with a difference

Filed under: google android — Tags: , — February 3, 2011

All Twitter apps I know of out there show tweets as a list… so I asked myself “is there another way to present tweets so users can see what’s what quickly?” The answer is “tag cloud”. So I’ve released a Twitter app for Android with this in mind. It does the usual stuff you would expect – yes, it does show tweets as a list if you want to – and it also shows a tag cloud so users can instantly see what their friends are tweeting about, or indeed what any specific user is tweeting about.
(more…)

Older Posts »