Monday, 10 November 2008

Ubuntu and me - the story so far

I've been using Ubuntu in quite a big way for the last 2-4 months and I thought I'd just write down a few points, good and bad.

Good
  1. Speed - massive improvement over Windows for day to day use, especially wireless networking and boot up times. The only bad part is using Firefox to upload photos to flickr which seems to cripple firefox. I have now overcome this by using F-spot photo manager instead.
  2. Viruses - not come across any yet!
  3. VirtualBox - can be used when you really must have Windows
  4. Really cool for a lot of development, especially having the command line so handy.
Bad
  1. Suspend and Hibernate seem impossible to get working on either of my HP laptops and believe me, I've tried.
  2. Can't seem to get the microphone working either.
  3. I do miss Outlook
  4. No Livemeeting which can be a pain in a mostly Microsoft company. But Yuuguu is cool for simple sharing.
  5. Screen properties are a bit flakey.
  6. I'd like to share a printer with other Windows machines on my LAN, but I've still to crack getting CUPS to do this for me.

Tuesday, 30 September 2008

Good Interweb customer service

After quite a long break over the Summer, I recently started to use my Phoenix flight sim again. Checking their site I noticed I was quite a few releases behind, so decided to download the updates and upgrade my installation.

Although the installs all went OK, the results were very disappointing, with dodgy shadows and very clunky slow graphics. As the latest release was Beta, I decided to send off an email to the support address, not really expecting much from what is surely a pretty niche product. To my pleasant surprise, I got an almost instant response, and after a fairly lengthly, but rapid, exchange of emails, my issues were resolved with an upgrade to my Nvidia drivers and also Directx.

Thanks guys!

Friday, 4 July 2008

Cedric's coding challenge

So, the latest little problem buzzing around is Cedric's coding challenge. I took Raghav's solution as a base, and just simplified it somewhat I think:



package com.bt.test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CedricCodingChallenge {
public static void main(String[] args) {
CedricCodingChallenge codingChallenge = new CedricCodingChallenge();

int max = 10000;

long startTime = System.currentTimeMillis();
List<String> list = codingChallenge.populateList(1, max);
long endTime = System.currentTimeMillis();

System.out.println(Arrays.toString(list.toArray()));
System.out.println(String.format("Size of list: %d", list.size()));
System.out.println(String.format("Biggest jump: %d",
codingChallenge.getBiggestJump(list, max)));
System.out.println(String.format("Total time: %d", endTime - startTime));
}

private List<String> populateList(int start, int end) {
List<String> whiteList = new ArrayList<String>();
for (int i = start; i < end; i++)
whiteList.add(String.format("%d", i));

for (int i = 0; i <= 9; i++)
whiteList = removeDuplicatesFromWhiteList(whiteList, i);

return whiteList;
}

private List<String> removeDuplicatesFromWhiteList(List<String> whiteList, int i) {
List<String> result = new ArrayList<String>(whiteList.size());
for (String item: whiteList) {
String c = String.format("%d", i);
int f = item.indexOf(c);
if (f < 0) {
result.add(item);
continue;
}
int l = item.lastIndexOf(c);
if (f == l) {
result.add(item);
continue;
}
}
return result;
}

private int getBiggestJump(List<String> list, int max) {
int result = 0;
int last = 0;
for (String item: list){
int i = Integer.parseInt(item);
int jump = i - last;
if (jump > result)
result = jump;
last = i;
}
if ((max - last) > result)
result = max - last;
return result;
}
}

My solution took 722ms.

Saturday, 28 June 2008

Wimbledon

After 45 years on the planet, most of them living near enough to Wimbledon, I finally went to the tennis on Thursday after work. Certainly an experience I'm glad I made the effort for.

But what an effort it was! 90 minutes queuing for about 2 hours tennis on the outside courts.

Isn't Wimbledon just another "Ballet" or "Opera"? Seems like the Centre and No.1 courts are for the "haves" and the "have-nots" make do with the outside courts. The whole place if full of pompousness, loads of uniformed official telling you what you can and can't do and they even give you a "guide to queuing" to make it seems like it's all part of the experience.

Joan A

Just watching a bit of Glastonbury on the TV, I never realised that Joan Armatrading was such a cool guitar player. Also related, and in the news, it turns out that all those rumours about her and Valarie Singleton are just a pack of lies!

Thursday, 24 April 2008

Company car time!

Yes, I know that company cars do not make sense financially but......

I've hankered after one for over 20 years and, now that I've finally become eligible and, having loads of grief with my just out of warranty caravan tug and, with one of the family holidays coming up soon...

It seems like now might be the time to make the switch. Of course it wont arrive in time for the holiday, so hopefully I can get the problems sorted in time.

Thursday, 17 April 2008

Python homework

As part of a 'Python study group' at work, we were given the following challenge:


Exercise 1:

Write a program that processes a list of numbers from 1 to 100. For each number, if the number is a multiple of 3, print “FIZZ”; if the number is a multiple of 5, print “BANG”; otherwise, print the number.

You are *NOT* allowed to use any *IF/ELSE* statements in your code. You can use the list-accessing ternary operator hack, but whilst I’ll accept your homework if you do, you’ll miss out on the prize (alcoholic), which goes to the most concise code (not including whitespace).

Have fun!


Here's my final solution:


for i in range(1, 101):
f = (i % 3 == 0) and "FIZZ" or ""
b = (i % 5 == 0) and f + "BANG" or f + ""
n = (len(b) > 0) and b or i
print n