Tuesday, 12 October 2010

Using the "Key Magic" with One For All remote

I recently purchased a One for All remote (URC-7940 in this case) to use with my DVD player. All was going well until I wanted to program individual keys to some functions that weren’t working.

The user manual that came with the remote boasted that it had a “Key Magic” function that allowed me to do just this, however it neglected to tell me how. After more searching than should have been required I finally found a post on a forum that mentioned how to program a button.

To program a button you must first get a 5 digit function for the device you’re trying to program the remote for. These functions are called EFCs and you can usually find them using a search engine. For instance I found my device's EFCs here.

Anyway the procedure is as follows:

  1. Hold the ‘M’ button (Key Magic) until the red light on the control blinks twice
  2. On the remote press the buttons “994″. The red light should blink twice. 
  3. Press ‘M’ again. The red light will blink once more. You are now in Key Magic mode
  4. Enter your 5 digit code for the function.
  5. Finally press the key you want to assign the function to. The red light will blink twice more to confirm you’re back in normal mode

You should now be able to use the programmed key

Friday, 11 June 2010

Unlocking your Facebook account when it "forgets" your e-mail address

My girlfriend lost access to her Facebook account this week and Facebook kept reporting that her e-mail address wasn't registered. Her profile was still active and looking on the Internet showed unfortunately this has happened to a number of people and any requests of help were ignored by Facebook.

The exact message that Facebook was giving was:
Incorrect email address
The email address you entered does not belong to any account. You may try clearing your browser’s cache and cookies by following these instructions.
You can log in using any email address, username or mobile phone number associated with your account. Make sure that it is typed correctly.
A few people had reported finding a solution in using their username instead of their e-mail address when logging in. You have to set your username up manually and not everyone has done this, including my girlfriend, so this wasn't any help to us. The same goes for phone numbers.

To solve this problem I decided to try to test all of her other e-mail addresses to see if one of those had been made her login e-mail address somehow. Lucky it had and we were back into her account.

I don’t know if this is a bug in Facebook or somehow she changed it without knowing but she now has the account back. One thing that may be the cause was that she no longer had access to the e-mail address in question so it’s possible Facebook discovered this and in their wisdom deleted it from her account without saying so.

If you do get back into your account then I suggest changing your password just on the off chance that a hacker got into the account to cause the original e-mail address to be lost.

Wednesday, 12 May 2010

Installing KDevelop in Kubuntu/Ubuntu 10.04

After upgrading to Kubuntu 10.04 I was disappointed to find that KDevelop wasn't listed in the default repositories as apparently it wasn’t ready in time for the release. From what I've read there’s not much chance of it being added to the repository any time soon either so I decided to find another way to install it.

Luckily installing it isn't too difficult (no need to install from source) as it is available from the Kubuntu Backports PPA.

To add the PPA to your repository simply use the command:
sudo add-apt-repository ppa:kubuntu-ppa/backports
You can now update your repository and install KDevelop as normal:
sudo apt-get update
sudo apt-get install kdevelop

Wednesday, 20 January 2010

Resizing a QGraphicsPixmapItem

I've just finished some code where I wanted to resize some QGraphicsPixmapItems. I was able to scale them but this didn't allow me to resize to specific pixels. After a short while I noticed that if I create a pixmap object first I can resize that, then create a QGraphicsPixmapItem using the pixmap object:

//first create a pixmap object
QPixmap pixmapObject(":Images/myimage.png");

//now create a QGraphicsPixmapItem
QGraphicsPixmapItem * myImagePixmapItem
= new QGraphicsPixmapItem();

//add the resized QGraphicsPixmapItem to the pixmap

The scaledToHeight function in the last line could be either scaled, scaledToWidth or scaledToHeight. scaled allows you to set both the width and height of the object where as the other 2 will scale the other side automatically so that the aspect ratio of the pixmap is preserved.

Monday, 18 January 2010

Remove trailing newline character from asctime output

When converting a tm structure to a string using the asctime function in c++ you are left with a cstring ending with a newline character (\n). This is often a pain if you want to insert the date into another string to use later.

By looking at the contents of the cstring you can see that the last two characters are \n and \0. Therefore we just need to change the second to last character in the string from \n to \0:

struct tm * timeinfo;
char * time = asctime(timeinfo);
time(strlen(time)-1) = '\0';
cout << "The time is: " << time;
If you’re not sure what’s going on here the end of a cstring is terminated when the character \0 (A null terminator) is reached. If we look at what the cstring looks like before we use the above code it would look like this:
Sat May 20 15:21:51 2000\n\0
After the code is run it will look like this:
Sat May 20 15:21:51 2000\0\0