Monday, 27 November 2006

Italy, what a desolating country

We are ruled by ignorants.

We are mortifying for the rest of Europe.

We are definitively a sad country, left in the hands of people who does not have any idea of what they're talking about. Never.

Please, nuke us.
Really.
We are useless, when not worst.

Bad monday morning.

Friday, 27 October 2006

Firefox 2, a couple of useful hacks


The Mozilla Foundation has finally released the official second version of the famous browser. There are plenty of new interesting features, but also a couple of steps behind.

A first new feature, hard to comprehend, is the overriding of websites' accesskeys. I cannot understand why a browser -which should HELP people navigate in the most accessible way- has been reprogrammed to ignore the accessibility keys. By the way, it is sufficient to enter configuration page by typing this address:

about:config

and look for this keys:
  • ui.key.chromeAccess
  • ui.key.contentAccess
  • ui.key.menuAccessKey
The first key is the user preference for the Firefox keyboard shortcuts. You can completely disable them (assign "0"), use them with SHIFT (assign "1"), ALT (assign "2") , CTRL (assign "4") or define a combination with a logical OR (i.e.: if you want to assign SHIFT and CTRL for Firefox shortcuts, set this key to 1 OR 4 = 5).

The second key is the user preference for the webpages accesskeys. It's equal to the previous one. If you want to use accesskyes correctly, just assign it to ALT (so, set it to 2).

Finally, you have to activate this preferences setting the last key to -1.



A second innovation of Firefox 2 is the placement of a closing button on every tab, just like Opera. I don't agree this choice, it's much more comfortable the single "X" on the right to close many tabs in sequence, and if I want to close a single tab I can always middle-click it.

To bring the clock back, just set to 3 this key:

browser.tabs.closeButtons

You're done. :)



Finally, you can observe my first job in the cybernetics field: a simple webpage generating Coven's automata. Maybe you can find it interesting, check it out!

Wednesday, 4 October 2006

I need more time!

I always considered time as the nearest asymptote to divinity. It features every typical God's peculiarity: has ever existed, it can't be handled and modifies reality in any moment.

And, like every God, it runs against me.

I need more time.

One week is not sufficient. One day is definitively NOT sufficient!

To work, to study, to play, to live.. I need an extra day every week! Maybe I can call it gloveday.

Sunday Monday, happy days
Tuesday wednesday, happy days
Thursday Friday, happy days
Gloveday comes, computer runs, I'm ready to program you!


This week, I started lessons of Cybernetics at University. The matter is truly amazing but very difficult. I'm going to sacrifice additional time to God, three days every week. I will need extra time to study it and to give the damned, years pending calculus exam.

In the meanwhile, my band is starting recording sessions and we're gonna play live in November. I wanted to finish the Powerglove project in time for the next live event, but God doesn't wanna allow it.

Maybe I should kill some lamb?

Friday, 15 September 2006

Direct Shit

MSDN says: Building DirectMusic Projects
Projects need to include the Dmusici.h header file, which contains declarations for the DirectMusic performance layer.

Yeah! Once in a lifetime, Microsoft did something easy to use and clearly explained! Let's download the tiny SDK and just do it!

#include <Dmusici.h>

int main(int argc, char *argv[])
{
  return 0;
}

Here's the result:

warning: "MAKEFOURCC" redefined
warning: this is the location of the previous definition
error: declaration of `WLOOP _DMUS_REGION::WLOOP[1]'
error: changes meaning of `WLOOP' from `typedef struct _rloop WLOOP'
make.exe: *** [main.o] Error 1

Well.. GG! I'm tired after ONE line of code!

Ok, forget 'bout DirectMusic.

Redo from start - Multithreading in C++ && OO

The Win32 API for threading have been designed for C, therefore they don't fit very well the use inside classes. In highest-level languages (such as Java), threading is implementable simply extending the Thread class and overriding the run() method. In C++, things are slighly more complex, expecially because it is impossible to reach classes methods from an isolated static function.

So, it is necessary... once again... pull up socks and use the _beginthreadex API.


class Threader
{
  public:

  // this is the method called by main
  static unsigned __stdcall ThreadStaticEntryPoint(void * pThis)
  {
    Threader * pthX = (Threader *) pThis;
    pthX -> EntryPoint();
  }

  // this is the real thread method
  void EntryPoint()
  {
    // put thread's job here
  }
};

int main() {

  unsigned int uiThread1ID;

  // let's call thread. the NULL are useful parameters, but not obbligatory
  HANDLE hth1 = (HANDLE)_beginthreadex( NULL, 0, Threader::ThreadStaticEntryPoint, NULL, NULL, &uiThread1ID );

}


You can find an excellent and more extended explanation on Code Project.

Don't forget to include process.h!