Change the title of cancel button in UISearchBar

If you are writing a iOS app that contains of UITableView along with a UISearchBar, you might want to change the title of the cancel button, i.e. if you’re localizing your app.

But the cancel button isn’t that trivial to get a hold of.
Here is some code that allows you to change the title:
Implement the searchDisplayControllerWillBeginSearch method and have it contain the following:

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
   self.searchDisplayController.searchBar.showsCancelButton = YES;
   UIButton *cancelButton = nil;
   for (UIView *subView in self.searchDisplayController.searchBar.subviews) {
      if ([subView isKindOfClass:NSClassFromString(@"UIButton")]) {
         cancelButton = (UIButton*)subView;
      }
   }
   [cancelButton setTitle:@"Annuller" forState:UIControlStateNormal];
}

The above code assumes that your class is a UISearchDisplayDelegate

Posted in Programming | Leave a comment

Alternative to eee-control in Ubuntu 10.10

I’ve earlier did some writing on how to get eee-control to work in Ubuntu 10.04 and 10.10. I have had problems getting the eee-control-daemon to run in 10.10, and in my search for a solution I found jupiter! Jupiter does exactly what eee-control does.

You can download jupiter from sourceforge

Posted in Linux | Leave a comment

Switch from iPhone to Android

If you, as myself, owns an iPhone, but also looking in the direction of Android, Lifehacker posted an article on the subject. It gives a good overview of what the two OS’s, does comparing to eachother. I really like my iPhone for it’s super user interface. And one of my main concerns about shifting to Android is if the user interface is as responsive as the iPhone. Let’s face it… the user experience means everything in the daily use of a smartphone.

So… interesting article to read, and lots of useful user responses as well. In the mean time, I’m still thinking about the switching to Android.

Posted in Gadgets | 1 Comment

UPDATE: How to get eee-control to work in Ubuntu 10.10

Yet another update:
I’ve switched to jupiter instead of eee-control and it works flawlessly.
You can get it from sourceforge

UPDATE: This should also work for Maverick Meerkat – Ubuntu 10.10
If you are among the people who are trying out the new Lucid Lynx beta of Ubuntu, and are using an eee-pc, you might be having problems with getting the eee-control applet to work. eee-control is a application that allows you to clock the processor, disable the eee-pc specific devices etc.

The problem with Lucid is apparently the provided kernel can’t load the eeepc_laptop module, and therefor eee-control-daemon can’t be started. The solution is somewhat simple. You’ll have to add a boot option to the kernel, by adding a entry to grub.
With you favorite editor, open up the file:

/etc/default/grub

In the start of the files there is a list of boot options, and you’ll wanna add a entry looking like this:

GRUB_CMDLINE_LINUX="acpi_osi=Linux"

When you’re done editing the file, update grub with the following command:

sudo update-grub

and then reboot. Now the eepc_laptop module should load fine, and eee-control-daemon will hopefully start automatically.

Posted in Linux | Tagged | 2 Comments

Terminator (Terminal app)

Here’s a quick guide on how to install the absolute awesome terminal app ‘Terminator’ in Ubuntu. With Terminator you can arrange terminal windows in grids and many other cool things. You can read about it here at the official website.

The installation of Terminator can be done i 3 simple steps:

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

And then you can start exploring the many cool features of Terminator!

Posted in Linux | Leave a comment

A guide to system recover with the help of Ubuntu

Lifehacker posted a super guide to saving a Windows System with the help of a thumb drive and Ubuntu.

This could come in handy, if you like me, sometimes have to help Windows Users solve various problems… the guide can help with the following things:

  • Clean a virus with a Linux-based anti-virus app.
  • Recover files and save them onto that same thumb drive, to a web storage spot like Dropbox, or to another USB drive.
  • Change your login password if you’ve forgotten it, or someone’s changed it on you.
  • Analyze your hard drive to figure out what’s filled it, and resize partitions if you’re dual booting and need to free up more space.
Posted in Generelt | Leave a comment

Simple twitter client written in Python

So… I finally got started looking at Python as a programming language. In my job I work with Java, and I never really done any other programming in another language. But I decided to throw myself at Python to see what the hype was all about. The problem with learning a new language, at least in my head, is that I need something to program. I need at specific problem to address. And now that I’m starting to use Twitter more and more, I decided to see what I could do with Python and the Twitter API. Doing some Google searching a found a very simple example of accessing Twitter through the API with Python. I found a guide here: Python/Twitter example I might need to say, that I did this on Ubuntu 9.10. So the first step was installing a python-twitter library:

sudo apt-get install python-twitter

Then I created a

termtwit.py

with Vim, (I prefer Vim for basic text editing), and I basically just copy/pasted the code from the site I linked to above. So the file ended up looking like this:

import twitter

username = "your_username"
password = "your_password"
api = twitter.Api(username=username, password=password)
statuses = api.GetFriendsTimeline(username)
for s in statuses :
print s.user.name.encode("utf-8"), "(", s.user.screen_name, ") :"
print s.text.encode("utf-8")
print

Run the file like this:

python termtwit.py

and It’ll show you the latest updates. So there you have it. Google the twitter API to learn more about the functions…

Posted in Programming | Tagged , , , , | Leave a comment

Metallica i Forum

Jeps! Så er der lagt ovnen til en ond heavy uge! Metallica spiller hele 4 koncerter i Forum, København, d. 20, 22, 23 og 27 juli.

Den 4 koncert er lige blevet annonceret i dag, som en X-tra koncert fordi efterspørgslen er pænt stor. Jeg må også indrømme at jeg har flottet mig og gravet dybt i lommerne, og købt billetter til de første 3 koncerter. Det bliver ondt!

Posted in Generelt | Leave a comment

Arriva WI-FI

Lørdag morgen skulle jeg fra Århus til Silkeborg med Arrivas regional tog (efter en tur til Berlin for at se Metallica :-) ) Selvom jeg var pænt træt og smadret lagde jeg mærke til et sticker over døren i den ene vogn hvor der stod noget i retningen af Arriva Online. Jeg fiskede hurtigt min iPod Touch op af tasken for at afprøve. Og vupti! Efter en lille registrering med e-mail adresse var jeg online, i toget på vej til Herning fra Århus. Nemt og smertefrit og umiddelbart var hastigheden helt god! Way to go Arriva!! Nu har toget prioritet over bussen næste gang jeg skal til Århus.

Posted in Generelt | 2 Comments

Nyerhvervet iPod Touch

Da jeg i sidste uge var på konferencen JSFOne i Washington D.C., anskaffede jeg mig en iPod Touch. Jeg ved godt at der lige er blevet annonceret nye modeller, men vi fik et Apple Store gavekort, og det benyttede jeg mig af. Det er nu en ret snedig lille sag. Jeg har blandt andet installeret et WordPress program, og det er fra det at jeg skriver dette lille indlæg. Ret cool.

Posted in Generelt | Tagged , , | Leave a comment