Google Translate

English French German Spain Italian Dutch Russian Portuguese Japanese Korean Arabic Chinese Simplified by : BTF, ed. by JRD (me!)

venerdì 16 dicembre 2011

Install Google Chrome on Ubuntu

Installing the Google Chrome browser on a Ubuntu linux OS is not exactly straightforward, simply because not all of the required dependencies are met. So here is a good way to get it done (I'm using Ubuntu 11.10 Oneiric Ocelot Server x64 with desktop installed):

1. Download the correct version for your system from
2. Using synaptic to install it won't work, so press CTRL+ALT+T to open up a terminal. Navigate to your downloads folder (usually something like "cd Downloads", or if you're not in your home folder "cd  ~/Downloads".
3. Install using: "sudo dpkg -i name_of_the_package.deb" and press ENTER. The package is usually named along the lines of "google-chrome-stable-current....deb". You could just type the first few letters like "goog" then press TAB, and terminal will complete the name for you. If it doesn't find a correspondence, then type "ls" and press ENTER to see the downloaded files in the folder. After you give the "sudo dpkg" command, you will be prompted for your password, type it in and press ENTER.
4. The installation won't complete because of the missing dependencies. So now you just do "sudo apt-get -f install", and the missing dependencies will be automatically installed for you and probably the google chrome package will complete installation too. There you go!
Now just type in "exit" and press ENTER to go back to your desktop.

In a nutshell, after you've downloaded your file, open a command line with CTRL+ALT+T, and:

username@ubuntu:~$ cd Downloads
username@ubuntu:~/Downloads$  sudo dpkg -i google-chrome-stable-current_amd64.deb
username@ubuntu:~/Downloads$  sudo apt-get -f install

and that should be it! 

venerdì 2 settembre 2011

How to center a google gadget (or ajax load it)

I came across this problem myself when trying to insert the "Directions" gadget from Google Maps into a website. Googling the problem "center google gadget on page" shows that there are a number of other people looking for a solution to this too, and no one seems to have the right answer. Well I found it. Here goes.

  1. Paste the generated script tag for the google gadget in a separate file (for example, for the directions gadget, I created a file called "directionsgadget.html").
  2. Wrap the script tag in a div tag. Look at the values sent in the script tag and find the ones that set the height and width of the gadget. In the directions script I found:
    Set the inline style of the div tag such that the div's width is equal to or slightly larger than the gadget's width, and you are going to center this div using the margin property, like so:
    <div style="width:325px;margin:0 auto;">
      <script .... />
  3. On the page where you want the gadget, add an iframe where you want the gadget to appear and set the src attribute to point to the file that you have just created (the one with the div-wrapped script tag for the gadget), and set the inline style of the iframe so as to center it pretty much the same way we did with the div. Like this:
    <iframe src="path/to/directionsgadget.html" style="width:330px;margin:0 auto;text-align:center;"></iframe>
  4. Voilà! You have your gadget and you have it centered!

  5. Have you ever tried loading via ajax contents that contain a google gadget, and you're not seeing your gadget?
    Guess what. This IFRAME method of loading the gadget fixes that.
    The reason it doesn't load when you are loading via ajax is that you can't load script tags that point to external sites via ajax because of cross-site scripting limitations in browsers (a good security measure). BUT... if you put your script tag in a separate file, and load it into your contents using an iframe... SHABAM! Your gadget is loaded even when your contents are loaded via ajax! You have overcome the cross-site scripting limitations!

martedì 12 luglio 2011

Installing packages in mingw

So I don't really understand completely the difference between cygwin, mingw and the likes yet... But I'm fiddling around trying to install node.js in a Windows environment which brought me to mingw.
So I'm installing packages on mingw from the mingw command prompt using "mingw-get install nnn". I'm looking at a list of suggested packages from here: Some packages are installed fine, others give errors "unknown package". Well doing a "mingw-get update" I noticed that a number of packages were tied to msys. So I tried something new: "mingw-get install msys-nnn". Guess what. It worked!

venerdì 17 giugno 2011

linux all the way for compiling!

So I've never had much experience in compiling with C# or C++. I just recently had a try at it, I was interested in Google Talk and Google Voice functionalities, Google gives you their library libjingle to compile. They don't give it to you ready and compiled, you have to compile it.

Ok, so let's go for it. I have Visual Studio Express (the light free version), so I try downloading all the necessary components and I try compiling it. Guess what. You can't with Visual Studio Express. It doesn't have all the necessary libraries. So you either have to get into the libjingle code and modify it so it'll work with VS Express, or you get the Professional version of Visual Studio with the full libraries. Guess what. I find out that Visual Studio 2010 Professional costs 1 grand. $1,000 ? No, I'm just joking. It doesn't cost a thousand dollars. It costs $ 12, 000 dollars! And this time I'm not kidding. Yup, 12 GRAND.

Now is that crazy or what? Yup, that's crazy. That's what makes me say, Linux all the way. I've had a look at Linux in the past few years, though I never did get into it a whole lot because I only have one computer to work with, and I do use quite a bit of Microsoft Windows functionality, especially when it comes to video / audio compositing. No, not editing. Compositing. There are some Linux tools out there, but they aren't quite the thing you can find on Windows. Unfortunately, you have more possibilities on Windows when it comes to that. Or for 3d design. Yeah, you have Blender for 3d design... But Blender isn't Cinema 4d for example. Simply said, I'm unfortunately still stuck on Windows.

But $ 12,000 dollars to be able to compile a library? I'm not a developer who works for a company that produces software to sell. I don't get anything out of it economically. I just like to learn. And who knows, I might offer some free services if I get to know enough about certain technologies. I'm a freelancer and nothing, I mean $0 and no cents goes into my pockets.

So $12,000 to compile a library is absolutely absurd for me. But I guess not only for me. Even for developers who do put something into their pockets this seems to be pretty far-fetched. It's a sign that Microsoft is just a money guzzling, avid company. They don't seem to be very wise about competition either. They're losing ground very quickly. Here's what developers have to say (some of which work for Microsoft from what I read):

martedì 22 marzo 2011

Where not to go to ask questions about php or javascript programming

Wooooooooowww, I just had a heck of an experience trying to create a worthwhile dialog on a php forum to clear up a few of my own doubts. Through Google Groups comp.lang.php came right up into sight, so I figured it might be a good place to ask a question, I figured there would be a number of people who know their stuff and get me off on the right track.

So I pose my question, very simply and straightforwardly. Well well well, some know-it-all stuck up geeks start answering me and write comments about everything EXCEPT the main point of my question. I stood up to this and tried illustrate my situation and my question as explicitly as possible so as to avoid any misunderstandings as to what I was actually asking, and what do I get? Another series of answers about how I'm stuck up, know-it-all, and too condescending when I'm the one who doesn't know what he's talking about and they know their stuff and all...

And guess what, after going back and forth a few times I actually began getting some results. Until someone joined in on the conversation and brought down to the mud again. What a bickering bunch of folks over there on usenet! It must be a big group of 60-70 year olds who all they know how to do is show off, pick on people, try as hard as they can NOT to help, bicker, and then stomp their legs because you don't humiliate yourself enough in front of their great wisdom and knowledge.

Guess what usenet, you can bathe in your own egotistical closed-minded confrontations that don't lead anywhere and don't actually build anything on the web. If the world wide web is going anywhere nowadays, it's notwithstanding you guys that's for sure.

What a completely useless conversation that was. I think it should be called uselessnet, not usenet.

Finalmente il calendario liturgico di rito latino in formato iCal!

Lo scorso anno avevo preso contatto con diverse realtà ecclesiali presenti in web, che offrono la liturgia quotidiana, e spiegavo lo standard per il formato calendario "iCal", chiedendo quali potevano essere le possibilità per creare un calendario liturgico in formato iCal, compatibile quindi con applicazioni di calendario tipo Google Calendar, o applicazioni Macintosh... Se il calendario liturgico è appunto un calendario, perché non pubblicarlo in formato calendario standard per il web o per le applicazioni web / mobili / desktop ecc.? Ero del parere (come lo sono tuttora) che era un ottimo modo per condividere e consultare il calendario liturgico. Come diverse case editrici stampano i "calendarietti liturgici" dove troviamo le festività cristiane, le letture del giorno, e indicazioni per la recita della Liturgia delle Ore, perché non trasportare l'idea del "calendarietto liturgico" in formato elettronico standard, in formato iCal?

Non molti mi hanno dato più di tanto retta. Se ne sono interessati in modo particolare Francesca Favero e Roberto Zago del sito e abbiamo iniziato una conversazione costruttiva a questo proposito e a proposito di altro.

Ebbene proprio pochi minuti fa ci tornavo sull'idea e ho deciso di googlare: "Calendario Liturgico iCal", e questa volta escono risultati. Qual'è il primo risultato? Dal sito !

Potete scaricare qui il calendario liturgico in formato iCal (non ci sono i colori liturgici o indicazioni per la liturgia delle ore; ci sono le festività e i santi con l'indicazione del grado della celebrazione liturgica, e nella descrizione dell'evento ci sono le letture del giorno):

Io l'ho appena importato in Google Calendar, e ora attraverso Google Calendar potrà essere presente anche sul sito parrocchiale
Se chiunque altro desidera incorporare la versione Google Calendar l'ho reso un calendario pubblico a questo indirizzo:
(per il feed XML)
(per la versione web)

Per incorporare il calendario nel tuo sito puoi utilizzare questo codice:
<iframe frameborder="0" height="600" scrolling="no" src="" style="border: 0;" width="800"></iframe>


Vuoi iscriverti con l'agenda di Yahoo? Se hai già fatto accesso al tuo account Yahoo! basta andare a questo indirizzo: (oppure dalla pagina dell'agenda, clicca su "Agende" nella colonna di sinistra, e seleziona "Iscriviti all'agenda"); poi inserisci l'indirizzo del file ics ( e cliccare su "Avanti". Nella schermata successiva dai un nome al nuovo Calendario ("Agenda") e Salva. Non poteva essere più facile!

Calendario IPOD / IPHONE

Vuoi importare il Calendario Liturgico nel calendario del tuo Apple Ipod? Segui queste semplici istruzioni prese dal sito della Apple:
Copiare su iPod il documento iCal (.ics).

venerdì 11 marzo 2011

D'Orazio's Triangle (or Pascal's Triangle modified)

I think I may have made an interesting discovery.
I have been putting mathematical problems to my programming skills in the past couple weeks on my personal website . One of the problems that I translated into php code was Pascal's Triangle. I was intrigued to find out that highlighting the odd numbers in Pascal's Triangle creates a Sierpinski Triangle. And I began wondering. What if Pascal's Triangle was slightly different? What other kinds of results can be obtained by highlighting the odd numbers?

So I thought I would try something very simple. You can see an example of Pascal's Triangle here:

You see that Pascal's Triangle has invisible zero's outside the triangle that are added to the ones along the outer rim.
And I wondered, what if instead of having ones on the outer rim, we had incrementals (1,2,3,4...)? Pascal's has incrementals, but on the second diagonal going inwards, such that the two diagonals with the incrementals cross at the top resulting in two ones right next to each other.
And if instead the two diagonals didn't cross, but started off from the same 1, thus being the outer edges of the triangle? We get slightly different results in the addition that is being done.

So now I try to highlight the odd numbers, and then also mod 3, and I make an interesting discovery: the first 33 lines are sort of like Sierpinski's triangle with a sort of fractal pattern, but from line 33 on we get a hyberbola. Well isn't that awesome! What does it mean? I have no idea. But I thought it was interesting...

Ok I figured out in the meantime an error in my coding that was causing this behaviour of forming a "hyperbola" when highlighting mod 2 (=odd numbers) or mod 3. It has to do with the way php handles big integers. There is a limit on integer representation in php due to the number of bytes that a large integer occupies. I've read up that x64 machines can represent larger integers then x32 machines, since they have more "byteroom" to represent the integers. After that limit is reached, all larger integers will be represented as a float rather than in decimal notation. Float numbers don't have the same precision as decimal integers, so this inexact representation, when modded, turns out to have not more and more odd numbers, but more and more "odd looking" numbers (!). The amount of these "odd looking" numbers grows pretty constantly, which gives a hyperbola look to the highlighted cells.
Even though it's an "error" in the php math, which can be corrected using other math functions provided by php such as bcmath, I still think it's sort of neat. I suppose it could be interesting to consider the bitwise representation of these large integers, which leads to the hyperbola look (odd numbers can usually be determined by examining the bit-endings in the binary value of the integer: a 0-bit ending represents an even number and a 1-bit ending represents an odd number; the php bitwise operator "&" can be used for this purpose). Perhaps more experiments can be done with binary representation rather than with decimal representation to see what comes of that.

Instead the correct way of coding the php math functions (using bcmath, which utilizes string representations of large integers so that they will not lose their precision, and in such a way that there is practically no other limit than the available memory for calculation) gives us an odd-number highlighting a little different from Sierpinski's triangle, because the highlighted triangles seem to grow almost exponentially...

giovedì 3 febbraio 2011

Flatnux 2 in arrivo!

Per il momento il mio sito personale, che uso più che altro per la sperimentazione (non sono ancora arrivato ad usarlo come archivio personale), non è molto accessibile... Infatti comincio a provare le prime versioni "beta" o test di una nuova versione di Flatnux che Alessandro Vernassa sta sviluppando. Non soltanto un ultimo aggiornamento, ma una riscrittura vera e propria. Pare che questa versione sarà tutta basata sul nuovo motore (classe php) xml database scritto da Alessandro Vernassa, e dovrebbe pertanto presentare notevoli migliorie per amministratori di sito flatnux e soprattutto per sviluppatori flatnux.
La nuova versione userà di default il mod rewrite per presentare all'utente finale url più "belle" da vedere, senza tutti i parametri per le variabili php GET.
Pare che darà anche la possibilità di caricare le sezioni via ajax, scelta oculata a mio parere perché velocizza il caricamento delle sezioni evitando di ricaricare ogni volta tutta la pagina durante la navigazione. Certo che non sarà semplice implementarlo in maniera completa e affidabile quando ci sono informazioni che vengono scambiate tra sezioni e blocchi per esempio.
Altra caratteristica è che tutto il codice del CMS è diventato rispettoso del XHTML strict, e direi che questo è un ottimo passo in avanti perché gli standard del web stanno migliorando sempre e già si comincia a guardare verso l'HTML5, che non è però ancora del tutto definito. Intanto adeguarsi al XHTML strict è una scelta molto utile, soprattutto quando ci si serve di strumenti serviti da API esterni (per fare un esempio, la "barra sociale" di Google Friend Connect richiede per forza un DOCTYPE XHTML strict, e così anche le funzionalità XFBML di Facebook Connect).

Questo cambiamento potrebbe comportare per tutti i "flatnuxiani" un periodo di transizione onde aggiornare i propri siti alla nuova versione, perché non è possibile installare la versione 2 come aggiornamento dal pannello di controllo, necessita di un'installazione "pulita", ex novo. Pertanto bisognerà transizionare i contenuti dai propri siti nella nuova installazione. Ci vorrà un po' di pazienza ma credo che ne varrà la pena.

Una nota pertanto anche ai "parrocchiani" di San Lino, vorrà dire che in un prossimo futuro anche il sito parrocchiale (che non ha al momento aiuti per l'aggiornamento dei contenuti!) subirà la transizione alla nuova versione del CMS, bisognerà pertanto ri-elaborare i contenuti del sito.

Anch'io da parte mia dovrò rivedere il tema "open social" che ho cominciato a sviluppare per Flatnux, per adeguarlo a Flatnux 2, considerando che anche le funzioni di base del CMS verranno ridefinite e la stessa struttura del CMS subirà delle modifiche.

Seguirò man mano lo sviluppo per aiutare Alessandro con osservazioni su eventuali errori / bug / correzioni da apportare, attendiamo speranzosi i risultati! Si possono scaricare le ultime versioni di test alla pagina