Jan 20 2009

Minimizing Thunderbird to the system tray in Ubuntu

Some time ago I was writing about how you can minimize any application to the system tray in Ubuntu.

My main concern was minimizing the Thunderbird window to the system tray so I can have the mail reader running in the background.

Now I have just found a nice extension that do what I need.

FireTray is an extension for Firefox and Thunderbird that let you minimize both applications to the system tray, and still have them running in the background.

I have it running now in Ubuntu and it seems to work very fine!!


Jan 15 2009

Puzzle Star for the iPhone and iPod Touch

I enjoyed the classic “Same” game in the past, that little game where you have to collect pieces of the same color in order to clear the board.

It’s a really addictive game and I thought it could be a good game for trying out the iPhone SDK so… I created Puzzle Star!!!

I have changed some things from the original game. The difficulty increases as you progress in the game and so does your score. When you finish you can send your score to a worldwide scoreboard to compete with players around the world!!

I have already sent it to the Apple Store and it’s now waiting for review.

This waiting is killing me!! :-D

[Gallery not found]

Dec 3 2008

iPhone C++ programming

I am a hardcore C++ fan and I really dislike Objective C.

I decided to take a look to the iPhone SDK and see if I can make some OpenGL programming using pure C++.

I found that it’s really easy to mix both languages in the same project. You can even mix Objective C and C++ code in the same file just by adding the “.mm” extension to your files, instead of “.cpp”.

Using the OpenGL ES example bundled in the SDK I made a wrapper in C++ that receives the iPhone events I need, like input and drawing.

I modified the example so it calls to my wrapper in every drawing and input event and then, the wrapper calls to my pure C++ objects.

I can now concentrate my efforts in writing the logic and drawing methods in pure C++ and see the changes in my iPhone :mrgreen:


Dec 1 2008

Ubuntu tip: backing up installed packages

I have just installed a fresh copy of the new Ubuntu 8.10.

In order to mantain all the packages installed in my old system I generated a list of the currently installed packages, so I could restore them later.

dpkg --get-selections > packages

This generates a file with all the installed packages in your system. Just copy it to a safe place, usbstick or CD.

After you have installed the fresh copy of Ubuntu you can recover what was installed in your previous system with the file you generated and the following commands:

dpkg --set-selections < packages
apt-get dselect-upgrade

Aug 29 2008

Buttons and controls for our arcade cabinet

And there let be buttons… :mrgreen:

Like I already said in my previous post, I ordered all the buttons, joysticks and electronics at Ultimarc.

The buttons and joysticks are controlled by an IPAC interface, that we can connect to a PS/2 or USB port of our motherboard:

I am going to use some spare parts I have from my old desktop PC to build the CPU.

This is the motherboard (MSI K8N Diamond Plus), with RAM (2GB Crucial Ballistix) and processor (AMD X2 4200) already mounted:

The hard disk drive. Segate Barracuda, 320 GB for loads of ROMs!! :D

The video card. I think this NVIDIA Geforce 7900GT is enough for my purposes:

Some wires and connectors to setup the IPAC and the buttons:

The joysticks. I have chosen the E-Stick model because it’s easier to mount:

This little thing is the switch itself. It is mounted in the base of every button. We use the connectors shown below to plug it to the IPAC:

I am pretty sure you know what are this buttons for… ;)

Well, now begins the hard part: designing and building the cabinet itself from wood panels…


Aug 28 2008

Netbeans file templates

You may have seen that when you create a new class, interface or something with Netbeans, the IDE automatically generates some code for you.

It is possible to customize this code using the Netbeans File Templates.

Under the “Tools” menu there is an option called “Templates”. This dialog let you create and edit every template used in the IDE. Just click on the “Open on Editor” button to edit the desired template inside Netbeans.

Let’s see how the Java/Class template looks like:

<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">

<#if package?? && package != "">
package ${package};

</#if>
/**
*
* @author ${user}
*/
public class ${name} {

}

If you edit this file and save it, the IDE will be using your new template for every new Java class you create.

Since Netbeans 6.0 you can use the FreeMarker template language in your file templates. This way you can add logic to the templates via directives such as if/elseif/else and loop constructs.

You can also use some predefined variables:

  • ${date} — Inserts the current date, in this format: Feb 16, 2008
  • ${encoding} — Inserts the default encoding, such as: UTF-8
  • ${name} — Inserts the name of the file.
  • ${nameAndExt} — Inserts the name of the file, together with its extension.
  • ${package} — Inserts the name of the package where the file is created.
  • ${time} — Inserts the current time, in this format: 7:37:58 PM
  • ${user} — Inserts the user name.

This is an example of a modified file template for Java classes:

////////////////////////////////////////////////
/// File: ${nameAndExt}
/// Created: ${date}  ${time}
/// Encoding: ${encoding}
////////////////////////////////////////////////

<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">

<#if package?? && != "">
package ${package};

</#if>
/**
*
* @author ${user}
*/
public class ${name} {

}

Aug 26 2008

Java & Netbeans: Overriding paint to customize GUI components

I found that it’s somewhat tricky to override GUI components methods with Netbeans, because the IDE automatically generates the code needed for the component, and that code cannot be edited (it’s grayed out).

But there is a property, in the “Code” tab of the component properties called “Custom Creation Code”, that let us insert the creation code we need for that component.

For example. Create a new desktop application project and, using the design view, drop a new JPanel inside the main panel. If you inspect the source code that Netbeans has generated, you can see the declaration:

private javax.swing.JPanel jPanel1;

And the initialization for that JPanel:

jPanel1 = new javax.swing.JPanel();

Note that the code after the “=” is called “Creation Code”.

Now, open the properties menu of the JPanel you have just dropped before and click on the “code” tab. Click on the “Custom Creation Code” property.

This property allow us to insert whatever code we need for the creation of the component.

Today we just want to override paint() so we insert this code:

new javax.swing.JPanel()
{
    public void paint(Graphics g)
    {
        super.paint(g);
        ourCustomPaintingMethod(g);
    }
};

If you check the generated code again you can see that Netbeans has changed the creation code:

jPanel1 = new javax.swing.JPanel()
{
    public void paint(Graphics g)
    {
        super.paint(g);
        ourCustomPaintingMethod(g);
    }
};

This way we can override any GUI component method we want ;)


Jul 26 2008

Minimize any application to the system tray in Ubuntu

Today I was googling to figure out how I could minimize any application to the Ubuntu system tray.

I am very used to Outlook and I have recently migrated to Thunderbird, so I was looking for a method to minimize Thunderbird to the system tray.

I found two solutions.

The first one was New Mail Icon, which is an extension for Thunderbird. It works like a charm, putting the Thunderbird icon in the system tray. This icon changes when a new mail is received.

I also found the AllTray application. With this software you can minimaze any application you want to the Ubuntu system tray. Pretty cute!

To install it, open a terminal and type:

sudo apt-get install alltray



Jul 23 2008

Creating an XNA project for both Windows and XBOX platforms

This week I’ve started a new XNA project and I had some troubles trying to configure the solution with Visual Studio, until I figured out how easy it was.

The point was creating a single solution with both Windows and XBOX projects on it. I also want a single shared folder for the sources.

I started creating a blank solution.




Then I added both XBOX and Windows projects to the solution.




To create a shared folder for sources I had to create a folder in the solution.

Then I added the sources contained in that solution folder in both projects as a link.




If you need to add additional files to the sources folder you must add them in the solution folder, and then add them to both projects always as a link.




And that’s all. :mrgreen:


Jul 18 2008

Building an arcade cabinet from scratch

One of my current projects consists in building and old arcade cabinet entirely from scratch.

This would be a long process. I am planning to buy wood panels and cut them off to form the cabinet based on the blueprints I am finishing off.

I have the controls already ordered at Ultimarc, and I am currently preparing the computer I’m going to bundle inside the cabinet.

I have also a 21” CRT TV happily waiting to be dismantled and connected to the cabinet :-)

For running roms I’m using Mame, of course, apart of some other good emulators for Sega and Nintendo game consoles.

Paired with Mame I’m using Mamewah, which is a Mame front-end that let you browse your rom list with the arcade controls, rather than with a keyboard and a mouse. It let you use other emulators as well, so we can select any rom, from any emulator we have installed, without leaving Mamewah.

In the following posts I will be explaining each step of the construction of the cabinet.

Wish me luck :mrgreen: