Archive for the ‘Computing’ Category

HTTP status code for 404 - page not found in Joomla!

Monday, August 11th, 2008

In case you are setting an error.php page in Joomla! to customise the 404 Page Not Found” error page, remember to add the following lines in your your template index.php page, before the DOCTYPE line:

if($this->error->code = '404'){
	header("HTTP/1.0 404 Not Found");
} ?>

The reason is that when a request is made for a page on your site, Joomla! returns the HTTP status code “200 - the server successfully returned the page” also for error pages. This is problematic for those working with Google Webmaster Tools and trying to get a sitemap resolved.

Information found (after weeks of search) here. That is: “When all else fails, read the instructions”.

UPDATE 12.8.2008: Forget what I have written above, at least in case you use SEF, it doesn’t work. That is, the if loop is inexplicably matched all the time, so it returns a 404 Page Not Found also for existing pages :(

UPDATE 27.8.2008: Following this suggestion on a Joomla! Forum thread, I managed to do the trick. The best way is to create the error.php page not in the way it is suggested on the Joomla! web site, but in the following way:

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

if (($this->error->code) == '404') {
  echo file_get_contents('http://www.yoursite.com/
                            error-404-page-not-found');
} 

where error-404-page-not-found is your customised “404 Page Not Found” error page. This will return a 404 page for any error it occurs. To prevent to show the 404 page for other errors, paste the full code showed in the post.

Beautiful is better than ugly

Wednesday, August 1st, 2007

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one — and preferably only one — obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

Tim Peters, “The Zen of Python”

New photogallery

Saturday, June 30th, 2007 · english

Ed ecco a voi la nuova galleria fotografica di Littlecamels.com! Mau si starà già mangiando le unghie dall’invidia appistoia.

Informazioni per gli smanettoni: ho integrato Gallery2 in Wordpress tramite il WPG2 plugin, impazzendo e impazzando non poco per farlo funzionare come volevo (Gallery è un applicazione veramente completa per la visualizzazione di gallerie fotografiche, e pertanto estremamente complicata da configurare).

Free software again!

Monday, May 28th, 2007

Almost a year ago I was talking about free software, that is, how to be legal with your computer application licences and still not to pay anything.

So I decided to write a separate page about the free software I use in my laptop, because I know I’ll need that list to reinstall all of them the next time I break my hard disk.

Broken discs

Wednesday, March 21st, 2007

hard discSunday evening I was listening to a radio programme in Podcast with my laptop. At a certain point it froze. Nothing working. Hard shut down and straight to bed. The next day the horrible truth: starting the computer, black screen and just few lines:

Windows cannot be started: missing file
in C:\windows\system32

I got it straight away: the hard disc was gone.

(more…)

Running a Linksys WRT54GL in client mode

Thursday, November 30th, 2006

WRT54GL Need to run a WRT54GL wireless router in client mode? I'm so happy I made it myself work, that I decided to write down the steps, since it isn't that easy after all.

N.B.: I'm just writing here the exact steps I have done to make the WRT54GL work in client mode, that is, making it capable to connect a wireless network and give access to internet to the computers cabled to it. For a more detailed description of the process (in case the procedure below doesn't work for you), please refer to the OpenWRT manual (especially installing OpenWRT on WRT54GL and how to run in client mode) and to the OpenWRT forum.

The firmware version I'm using is White Russian (RC6), Kernel Version Linux version 2.4.30. It should, however, work also with newer versions.

(more…)

Spam, spam, spam!

Sunday, November 26th, 2006

spam!Computing post, engineer's style :)

Question: I use an e-mail program to read my e-mail and I'm pissed off of getting every half an hour the announcement "you've got mail!" just to see that it is a spam message. Is there a way not to see these spam messages at all?

Answer: Yes, there is. At least for two e-mail readers, SeaMonkey and Thinderbird.

(more…)

Useful programs

Thursday, August 24th, 2006

ComputerLong time since the last nerdy post.

Here below follows a list of useful programs that I have installed and actively use on my computer. Most of them are open source, so this could be useful for those who don't want to buy software, you'll realise that nowadays it is possible to do almost everything with open source or freeware programs.

All these programs are available for MS Windows. About the availability for other operating systems, please check their own websites.

(more…)

Impazzendo per Wikipedia

Tuesday, May 16th, 2006 · english

Squash_Wikipedia_Design_3.png

Ultimamente sto diventando un po' Wikipedia-dipendente. Cerco di controllarmi, ma è troppo affascinante.

Wikipedia è un'enciclopedia libera. Ciò significa due cose:

  • non costa niente (è su internet e più essere liberamente letta)
  • chiunque può modificarne il contenuto, o aggiungere nuove voci.

Se il primo punto può risultare abbastanza chiaro, forse il secondo lo è un po' meno. Sì, ognuno può modificare ogni singola virgola di ogni voce dell'enciclopedia. Come? In cima a ogni pagina (anche sulla pagina iniziale) c'è una linguetta con sopra scritto "modifica". Basta cliccarci sopra e modificare/aggiungere ciò che si vuole.

Ma. Ma allora cosa succede se cancellassi una parte del testo, o anche tutta una pagina? E se aggiungo delle stronzate?

Ebbene, tutto ciò è possibile. Bisogna tenere di conto però che non siamo soli su Wikipedia. Ci sono un sacco di altre persone che aggiungono, modificano, controllano continuamente. E ogni cambiamento è memorizzato. Non ci vorrà molto prima che un'altra persona (chiamata in gergo wikipediano) noterà dei cambiamenti che hai fatto, e li processerà. Ci sono anche dei programmi automatici, chiamati bot, che analizzano continuamente il testo, e nel caso siano stati introdotti cambiamenti non consentiti, riporteranno la pagina alla versione precedente alle tue modifiche.

In ogni caso, essendo Wikipedia un'enciclopedia, magari non sei interessato a introdurre modifiche, ma solo a leggerla. Bene, allora buon divertimento! Ma non diventarne troppo dipendente come me :)

Io lavoro principalmente sulla Wikipedia italiana traducendo pagine sulla Finlandia. Se ti interessa, puoi partire a leggere dal Portale finlandese, che ovviamente esiste anche in lingua inglese. Sì, perché Wikipedia è disponibile in quasi tutte le lingue!

Firefox, Thunderbird and the Mozilla mess

Tuesday, December 7th, 2004

product-firefox.pngproduct-thunderbird.pngI gave up. Few weeks after my complaint about the Firefox affaire, I decided to switch from the Mozilla suite to Firefox (browser) and Thunderbird (mail, news and feed reader, version 1.0 just released). It seems the Mozilla suite will be released in 1.8 alpha versions for still a long time, before they will eventually decide to switch the whole SeaMonkey project to be Firefox and Thunderbird based and release Mozilla 2.0.
And what about the Mozilla Suite roadmap? No information about the future releases.
However, I still think that this is a temporary solution for me. On one side I have to recognise that Firefox and Thunderbird are definitely better (more developed) than Mozilla, but still, they are two different programs and I’m not used to it. Maybe my problems sound silly, but since the browser and the mail reader are the programs I use the most, it’s a big (and annoying) change. Just the shortcuts as an example:

  • They removed the ctrl-q shortcut (why???) in Firefox to close all the windows (only in Thunderbird it is still present, and of course, it closes only Thunderbird)
  • By pressing ctrl-n in Thunderbird you get a new compose-message window (in Mozilla you get a new browser window)
  • (related to the previous) I’m used to close all the browser windows when I don’t need them anymore and keep only the mail window open. Try to guess what I have to do now when I do that :)
  • In Thunderbird, by right-clicking to a link in an e-mail, it’s not possible to choose “open in a new window” of the browser
  • Still in Thunderbird, there is no “Next-unread-message” button, neither “Mark-all button” (useful for the newsgroups)
  • In Firefox: why in the heck they have removed the shift-left click to perform the “save as” command?

Update: Just found a presentation directly from the Mozilla Developer Day 2004 called Mozilla 2.0: Roadmap and Directions. Well, the presentation doesn’t work… and it’s also with frames…