Tuesday, November 23, 2010

Howto: Install TRENDnet Wireless Network Card on Ubuntu 10.04 LTS (Lucid Lynx)

Ubuntu Lucid (10.04) - TRENDnet Wireless PCI Adapter

apt-get install ndiswrapper-utils ndisgtk

# install windows drivers (select 32 or 64 bit drivers)
# (*.sys file should also be present near net819xp.inf)
ndiswrapper -i /path/to/drivers/Windows\ 2000/net819xp.inf

# test install
# should output something like:
# net819xp : driver installed
# device (10EC:8190) present
ndiswrapper -l

# bring up ndiswrappwer
sudo modprobe ndiswrappwer

# add ndiswrapper to /etc/modules
# add a new line with text: ndiswrapper
sudo gedit /etc/modules

# configure wireless interface
sudo gedit /etc/network/interfaces

# type the following info (example for WPA or WPA2 encryption):
auto wlan0
iface wlan0 inet dhcp
wpa-ssid wlan_home
wpa-psk xx00-xx00-xx00

# restart networking
sudo /etc/init.d/networking restart

DONE!

Wednesday, November 17, 2010

Google IMAP and SMTP client settings

imap.gmail.com 993 SSL/TLS
smtp.gmail.com 587 STARTTLS

Sunday, November 7, 2010

Saturday, November 6, 2010

Romanian political parties statistics

Comparative charts:

PDL, PSD, PNL
PDL - Democratic Liberal Party (en) - Partidul Democrat Liberal (ro)
PSD - Social Democratic Party (en) - Partidul Social Democrat (ro)
PNL - National Liberal Party (en) - Partidul National Liberal (ro)

PDL, PSD, PNL, UDMR, PRM, UNPR
PDL - Democratic Liberal Party (en) - Partidul Democrat Liberal (ro)
PSD - Social Democratic Party (en) - Partidul Social Democrat (ro)
PNL - National Liberal Party (en) - Partidul National Liberal (ro)
UDMR - The Democratic Union of Hungarians in Romania (en) - Uniunea Democrata Maghiara din Romania (ro)
PRM - The Greater Romania Party (en) - Partidul Romania Mare (ro)
UNPR - National Union for the Progress of Romania (en) - Uniunea Nationala pentru Progresul Romaniei (ro)

How to redirect non-www to www

Howto 301 ( permanent ) redirect non www to www

301 (permanent) redirect all non-www requests to www.

Apache webserver with mod_rewrite enabled; apache.conf or .htaccess file.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^mydomain.com/? [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

This will redirect requests to all pages to www. domain.

Friday, November 5, 2010

Javascript email obfuscator

Javascript email obfuscator function:

function obfEm(_a_id, _part1, _part2, _innerHTML, _part3) {
    if(document.getElementById(_a_id)) {
        var txt1 = _part1;
        var txt2 = _part2;
        var txt3 = _part3;
   
        var ar_mt1 = ['m', 'a', 'i'];
        var ar_mt2 = ['l', 't', 'o'];
   
        var em = new Array();
        em[0] = txt1;
        em[1] = '@';
        em[2] = txt2;
        em[3] = '.';
        em[4] = txt3;

        var ems = em.join('');
        var mts = ar_mt1.join('') + ar_mt2.join('');
       
        document.getElementById(_a_id).href = mts + ':' + ems;
        document.getElementById(_a_id).innerHTML = _innerHTML.length > 0 ? _innerHTML : ems;
    }
}

Javascript email obfuscator HTML:

<script type="text/javascript">
obfEm('a1', 'contact', 'office-space', 'person-name-optional', 'com')
</script>

<script type="text/javascript">
obfEm('a2', 'contact', 'office-space', '', 'com')
</script>

Tuesday, November 2, 2010

Change blogspot title format for posts

1) Go to Design -> Edit HTML

2) Locate section "<title><data:blog.pageTitle/></title>" and replace it with the following:

<title>
<b:if cond='data:blog.pageType == "item"'>
<data:blog.pageName/> - <data:blog.title/>
<b:else/>
<data:blog.pageTitle/>
</b:if>
</title>

This will display the title for post pages like this:
"<data:blog.pageName/> - <data:blog.title/>"
Post 1 title - Main blog title

Choose Preview & Save Template or just Save Template.

Gropi cosmice

1 noiembrie 2010 - Schmalkalden, Germania



1 iunie 2010 - Guatemala

MySQL UNIX_TIMESTAMP howto: date and datetime fields operations (common)

MySQL UNIX_TIMESTAMP examples

• set date to current date for all items having dates bigger than 24 hours in the future
UPDATE table_name SET data = now() WHERE UNIX_TIMESTAMP(data) > UNIX_TIMESTAMP() + 24 * 60 * 60;

• delete all entries older than 30 days (having date smaller than current time minus 30 days)
DELETE FROM table_name WHERE UNIX_TIMESTAMP(data) < UNIX_TIMESTAMP() - 30 * 24 * 60 * 60;

Both above examples make use of UNIX_TIMESTAMP function.

"Uniunea Europeana" in presa din Romania

Numar aparitii "Uniunea Europeana" in presa din Romania.