GoSMS Pro as default messaging app

GoSMS Pro is a nice and extensible messaging application which is probably the best among those handling SMS and MMS.

Installing it is simple and using it is simpler, but how to replace Messaging (the default Android app?).
1) Open messaging, go to Settings, scroll down till Notification settings and uncheck Notification.
2) Open GoSMS, go to Settings, Notification settings and check the first checkbox (Enable notification).
3) Go to Applications, open the menu and choose Modify. Drag the Messaging icon into the applications list, and the GoSMS icon in the bar.
4) Pay attention to move the app into main memory! If installed in SD it will disappear from the bottom bar after next reboot. (From Settings->Applications you can move it)

Rimuovere un proxy ancora attivo su apt-get

All’università devo usare un proxy per connettermi ad internet e su Ubuntu imposto gli indirizzi dalla scheda Proxy di Network, per ritornare a toglierlo una volta a casa.
Mi è successo che fosse solo apparentemente tolto (internet ed altre connessioni funzionavano), ma quando sono andato ad aggiornare apt-get mi ha dato un sacco di 404 anche sui repository Universe.
Dopo un controllo sui file di repository (come sources.list) ho trovato un riferimento alla questione dei proxy. In effetti aprendo diversi file ho trovato ancora gli indirizzi impostati dalla scheda, perciò li ho rimossi.
I file che ho controllato erano:

/home/Utente/.gconf/system/http_proxy/%gconf.xml
/etc/environment
/etc/apt/apt.conf
/etc/bash.bashrc
/home/Utente/.bashrc
/etc/apt/sources.list

Da questi ho rimosso tutti i riferimenti al proxy che erano presenti.

Non avendo avuto effetto, ho trovato qui la soluzione che finalmente ha posto fine al problema: nel file /etc/apt/apt.conf ho inserito la linea

Acquire::http::Proxy “false”;

Riuscendo finalmente ad aggiornare i miei pacchetti (e incidentalmente a far andare Dropbox che aveva smesso di funzionare).

Totale delle email in Gmail

Gmail non fornisce in alcun modo semplice il numero complessivo delle email presenti nella casella. Bisognerebbe andarsi a cercare l’ultima email presente e a quel punto avremo un numero preciso.
C’è un modo di farlo velocemente? Si.
Adesso ci sono diversi schemi di presentazione delle email: quello classico dove tutte le mail sono presenti in ordine di arrivo, e quelli ‘filtrati’ (prima email da leggere / importanti / speciali, i filtri li trovate vicino all’etichetta Posta in Arrivo in un menu a tendina) dove abbiamo due spazi distinti, quello superiore per le email scelte, quello inferiore per tutte le altre.
Nel caso abbiate attivo uno di questi filtri, dovete accedere all’elenco completo delle mail cliccando a destra di “Tutto il resto” il link con scritto ad esempio “1-25 di molti”.
Avremo nella barra degli indirizzi un link del tipo
https://mail.google.com/mail/?shva=1#section_query/in%3Ainbox

Adesso nella barra degli indirizzi andiamo ad aggiungere /pX dove X è il numero complessivo di pagine che vi potreste aspettare di avere (ad esempio /p100), anche se non è esatto pazienza, basta che sia maggiore, infatti Gmail lo sistema automaticamente sull’ultima pagina. Inserendo 100 ad esempio mi è andato sulla pagina 56, dove ho scoperto che me mie email erano 5542.
https://mail.google.com/mail/?shva=1#section_query/in%3Ainbox/p56

DVB-T su Ubuntu

Uso una scheda Hauppage WinTV-900 (quella senza HD) e mi sono messo a provare a farla funzionare sul mio netbook con Ubuntu 11.10.
Ho usato diversi software, tutti abbastanza complessi da configurare (leggi non ci sono riuscito): MythTV, Zapping, XawTV. Infine ho provato Kaffeine (sarebbe per KDE ma vabbè, le librerie KDE ce le ho per altri programmi..)

1. Firmware
Sul forum ubuntu-it ho trovato i firmware

cd /lib/firmware
sudo wget http://kernellabs.com/firmware/drxd/drxd-a2-1.1.fw
sudo wget http://kernellabs.com/firmware/drxd/drxd-b1-1.1.fw
sudo wget http://www.steventoth.net/linux/hvr1500/xc3028-v27.fw
sudo reboot

2. Kaffeine e pacchetti

Installiamo Kaffeine (da dove vedremo il Digitale Terrestre) ed altri pacchetti utili in seguito (w-scan fa la scansione dei canali).

sudo apt-get kaffeine libxine1-all-plugins linux-firmware-nonfree w-scan

3. Scansione dei canali

In teoria Kaffeine dovrebbe dare una lista dei canali, ma non sempre è aggiornata, per questo ho usato w_scan col comando

w_scan -f t -k -t 2 -x -c IT -E 0 >> ~/.kde/share/apps/kaffeine/it-comune.dvb

che mi va a salvare i canali nella cartella di Kaffeine

4. Inserimento dei canali in Kaffeine

Nella nuova versione non ho capito come farlo automaticamente, pertanto sono andato a copiare nel file standard l’output trovato:
-con gedit ho aperto ~/.kde/share/apps/kaffeine/it-comune.dvb e ~/.kde/share/apps/kaffeine/scanfile.dvb e ho copiato dal primo tutte le righe che iniziano per T nella sezione del secondo relativa al mio comune (sostituendo quelle dopo [dvb-t/it-Comune] )

5. Buona visione!
Ultimo passo, avviate Kaffeine, andate in Digital TV, in configure selezionate il vostro comune nella scheda “Device 1″ e confermate. Dopodichè schiacciate il secondo tasto “Channel”, fate Start scan, selezionate i canali nella colonna di destra e aggiungete.

Updated sIF Guestbook and Virtual Reality

When validating my site also the pages with these two application were examined.
So, after some work using TotalValidator and some HTML5 techniques I completed a refresh of the code.
In particular in VR application I also updated the third-party libraries included, patching some bugs (for istance now it highlights areas on hover), and in Guestbook I used the new tags introduced by HTML5 to produce better output.
The release is available at the site, here for the guestbook and here for the virtual reality.

From Google Maps to OpenStreetMap on your website

Some time ago, I wrote a simple guide to make a slippy map for a website using Google Maps API.
Since I started adding geographical data in OpenStreetMap, I wanted to offer an alternative to my visitors and I studied some examples to make this possible, changing them to ease the transition of previously used GMap data to the new layout, writing functions similar to those of Google Maps API, except for the Adsense part.
OpenStreetMap is available as a slippy map via OpenLayers.

-Include the javascript libraries

<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>

-Make some space and init

<body onload="init();">
<div style="width:100%; height:90%" id="map"></div>
</body>

-Write the functions
1. coordinates object: the style used by Gmaps was a simple function which gives an object from the coordinates in the ‘lat,lon’ form, so we must write two functions, the one which gives the object and the one which swap the coordinates.

function coordinv(lat, lon)
{
return coord(lon, lat);
}
			
function coord(lon, lat)
{
var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
return lonLat;
}

2. marker creation: as in Gmaps we must pass the layer, the coordinates, the text which will appear in the popup plus a custom marker image (if you want it fixed you can add it)

function createmarker(layer, geo, text, img)
{
var feature = new OpenLayers.Feature(layerMarkers, geo);
feature.closeBox = true;
feature.popupClass = OpenLayers.Class(OpenLayers.Popup.AnchoredBubble, {minSize: new OpenLayers.Size(200, 100) } );
feature.data.overflow = "hidden";
feature.data.popupContentHTML = text;
			
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(img,size,offset);
var marker = new OpenLayers.Marker(geo, icon);
marker.feature = feature;
  
var markerClick = clickev;
marker.events.register("mousedown", feature, markerClick);
layer.addMarker(marker);
}

3. event for the popup

function clickev(evt){
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
map.addPopup(this.popup);
this.popup.show();
} 
else {
this.popup.toggle();
}
OpenLayers.Event.stop(evt);
};

-places: there’s a nice feature of openlayers to read from file, but to reuse the gmap data it’s simple using a function which draws directly on the layer, coordinv specifically substitutes the GLatLng function

function places()
{	
var img='http://www.openstreetmap.org/openlayers/img/marker.png';
createmarker(layerMarkers, coord(lon, lat), 'ahoy!', img);
createmarker(layerMarkers, coordinv(lat, lon), 'ahoy!', img);
}

-init: the code to initialize the map, in the function we start a map with the choice Mapnik/Osmarenderer/Cyclemap and a layer for the markers, lastly we center the map and we call the places function to populate the markers layer.

var lat=startlat;
var lon=startlon;
var zoom=startzoom;

var map; 
		
function init() {
map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Attribution()],
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
} );
 
layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
map.addLayer(layerMapnik);
layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");
map.addLayer(layerTilesAtHome);
layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");
map.addLayer(layerCycleMap);
			
layerMarkers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(layerMarkers);
  
map.setCenter(coord(lon, lat), zoom);
places(layerMarkers);
}

We successfully converted a Gmap into an OSM map.

Sources: the OSM wiki and OpenLayers Examples

Alcuni hack css per Internet Explorer 9

-Centrare un div
Normalmente per centrare un elemento div basterebbe definirlo con una classe e impostare ad auto margin-left e margin-right. Su IE non è così facile, la soluzione che viene proposta è di centrare il testo della pagina -nel body- e rimetterlo a sinistra dentro l’elemento da centrare

body
{
text-align: center;
}
.divclass
{
text-align: left;
}

-Eliminare il bordo dalle immagini con link
Internet Explorer fa comparire un bordo sulle immagini con link di colore azzurro. Per rimuoverlo basta semplicemente dirlo nel css

a img {border: none; }

-Div con contenuto variabile (espandibile)
Abbiamo un div che contorna esclusivamente il contenuto, per espanderlo a tutta pagina visualizzata basterebbe impostare min-height:99% e height:auto, su Internet Explorer si modifica aggiungendo !important all’height che abbiamo già e metterne un’altra che ribadisca il 99%.

.divclass
{
height: auto !important;
min-height:99%;
height: 99%; 
}