Posts

Showing posts from March, 2013

Are good solutions always expensive?

Almost every day I'm confronted with dilemma's and problems that need an adequate solution. Many people inside my company ask me advice about how solving problems or finding the best solutions for. Sometimes finding solutions means make investments or spend money to buy goods or services for the company. Expensive solutions seems almost always to be the best but… is that true? Before I take a decision on a matter I keep always a story in my mind about the NASA and the Russians; I don't know if this story is true, but I think it's a great example how sometimes things work. Read… "When NASA first started sending up astronauts in the cold space, they quickly discovered that ballpoint pens would not work in zero gravity. To solve this the problem, NASA scientists spent a decade and $12 millions to develop a pen that writes in zero gravity, upside down, underwater, on almost any surface including glass and at temperatures ranging from below freezing to 300 C. The …

Mysql backup shell script

This is a shell script that allows you to backup your MySql databases and mail a compressed file to you. Of course if the backup becomes huge, you can better set the mail option off.
In the script you can give the database(s) you want to back up in an array. The script iterates the array and select the tables to back up.

In the given folder there are 4 sub folders for back up rotation. Every day is the new back up dumped in folder 01. 

Here below the script:


#!/bin/bash # modify the destination directory to suit your environment export DB_BACKUP="/var/www/backup" # rotation ###################### # remove day 4 rm -rf $DB_BACKUP/04 # moves day 3 to day 4 mv $DB_BACKUP/03 $DB_BACKUP/04 # moves day 2 to day 3 mv $DB_BACKUP/02 $DB_BACKUP/03 # moves day 1 to day 2 mv $DB_BACKUP/01 $DB_BACKUP/02 # makes dir 01 for day 1 mkdir $DB_BACKUP/01 # end rotation commands ######### # define array of the database to bak up array=( db1 db2 ) # loop …

How to get a Mustek 600 CP scanner working in Ubuntu

I have an old scanner Lifetek that I bought years ago at the Aldi market. It is an old scanner I know, but I do not need some spectacular job, just sometimes a simple scanning job. The scanner does not work over USB, as I said it's a 'grand fa'. I faced the problem to get it working in Ubuntu under 'sane'. After some research I came to know that Lifetek is a sub brand that Mustek made for Aldi.

With the following i was able to shake it alive:


1. Edit /etc/sane.d/mustek_pp.conf, by uncommenting the right line: # # Uncomment/customize to your needs ... mine was the first one # # scanner Mustek-600CP 0Ã�378 cis600 #scanner Mustek-1200CP 0Ã�378 cis1200 # scanner Mustek-1200CP+ 0Ã�378 cis1200+ # scanner Mustek-600-IIIEP 0Ã�378 ccd300 # 2. Edit /etc/sane.d/dll.conf by uncommenting mustek_pp: mustek #mustek_pp --- THIS LINE FOR NO USB SCANNER mustek_usb 3. Save the following script as /etc/init.d/mustek: #!/bin/bash chmod 777 /dev/lp0 # Does it hurt? chmod 777 /dev/parp…

Broadcom wireless on Unbuntu

I got a lot of headache when I had to reconfigure the wireless of my wife's laptop after installing xubuntu. My wife's laptop is a Dell Vostro 1000 with a Broadcom card (BCM4311). This is a issue because it is not supported out of the box. After a lot of trial and error (a lot of) I found the way of getting it work. Here below the commands:

open a shell box and digit:

sudo apt-get update
sudo apt-get remove --purgebcmwl-kernel-sourcesudo apt-get install linux-firmware-nonfreesudo modprobe b43sudo reboot After these commands the pc should reboot and you should have your wireless up and running. Do not forget to check that the laptop hardware wireless is ON.

If it doesn't work... please do not shoot on the pianist!

Secure GET

This class can generate and validate URLs to prevent tampering.

It takes an associative array of parameters to pass in a link.

The class assembles the link parameter keys and values and adds an extra parameter which is the SHA1 value of all parameters adding a secret prefix and a suffix salt values.

The class can also verify if the parameter values are correct in a page of the previously generated URL checking against the passed SHA1 value.

Download the package at www.phpclasses.org:

http://www.phpclasses.org/package/7336-PHP-Generate-and-validate-URLs-to-prevent-tampering.html

The class:


class secure_get { var $arr_get; var $salt1; var $salt2; var $sha1; var $link; function __construct(){ $this->salt1 = 'e5dg6hyt7u8fgigg802s'; $this->salt2 = '4nfgs5asdd320dkjh7kd'; } public function secure_make($arr=array()){ $this->sha1 = $this->salt1; $this->link = '?';…

About "Real scripting"

Hi everyone; I'm a rich internet applications developer and I will publish in this blog everything I think is useful to avoid you some headache. Useful scripts in php, shell, vbs and JavaScript. I will publish other info too that maybe will help you in your search journey on the web. If you need professional developing you can reach me also on my website www.zanfi.nl

Today I was implementing the Gapi Google analytics php interface and I struggled in a issue in the account settings.

This is the url of the class:

http://code.google.com/p/gapi-google-analytics-php-interface/

In order to get you data from Google you have to fill your account data (see below):

define('ga_email','youremail@email.com');
define('ga_password','your password');
define('ga_profile_id','your profile id');


Right, everything OK till the ga_profile_id; this id seems to me almost impossible to find in your dashboard. I tried the id's of the tracking code that you ha…