2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 27,000 views in 2012. If each view were a film, this blog would power 6 Film Festivals

Click here to see the complete report.

Advertisements

How to setup Apache Virtualhost

The term Virtual Host refers to the practice of maintaining more than one web site on one Apache machine or server.

Go to your apache configuration files:

cd /etc/apache2/sites-available

Create a configuration file for your new site. For an example site, http://www.hello.com:

vim hello.com

Add this content to the hello.com file

<VirtualHost *:80>
ServerAdmin me@myserver
DocumentRoot /var/www/hello_webroot/
ServerName www.hello.com
ServerAlias hello.com *.hello.com
CustomLog /var/log/apache2/example.com.log combined
</VirtualHost>

you can also customize to make the log inside webroot

Activate the site by issuing the following command

sudo a2ensite  hello.com

Now reload Apache

sudo /etc/init.d/apache2 restart

or

sudo service apache2 restart

And youre done 🙂

Happy Hacking

Fixing arduino stk500_recv(): programmer is not responding error

Screenshot from 2012-12-13 12:19:59

avrdude: stk500_recv(): programmer is not responding

In Debian squeeze and Ubuntu you may get an error like this while trying to upload your program…..To fix this error

First install arduino software with all its dependencies from the package manager

sudo apt-get install arduino arduino-core

Next, we’ll get a compatible (2.2pre2-3 or newer) version of librxrt-java to allow Java to handle the I/O (rx/rt);

you can check the files at this link

http://ftp.debian.org/debian/pool/main/r/rxtx/

Now download the file

wget http://ftp.debian.org/debian/pool/main/r/rxtx/librxtx-java_2.2pre2-11_i386.deb
sudo  dpkg  -i  librxtx-java_2.2pre2-11_i386.deb

Now add yourself to the ‘dialout’ group:

sudo adduser `whoami` dialout

and log out and log back in, or reboot.  This is necessary for access to the serial (USB) port.

download the Arduino software, with it’s recent 1.0 release, from the Arduino.cc website.

We extract that software, enter the folder, and run the software:

tar -xvzf  arduino-1.0-linux.tgz
cd arduino-1.0/
./arduino

Plug in your Arduino board via USB to your computer, wait a few seconds to register the new device, and again launch the Arduino software:

 ./arduino

Go to the Tools menu, Board submenu, and select whatever your board is
Finally, again click the Tools menu, Serial Port submenu, and select correct device.

Now try uploading….. 🙂
Happy Hacking 🙂

Squid user authentication

200px-Squid-cache_logo

You can configure Squid to prompt users for a username and password. Squid comes with a program called ncsa_auth that reads any NCSA-compliant encrypted password file. You can use the htpasswd program that comes installed with Apache to create your passwords.

Create the password file. The name of the password file should be /etc/squid/squid_passwd, and you need to make sure that it’s universally readable

touch /etc/squid3/squid_passwd

chmod o+r /etc/squid3/squid_passwd

Use the htpasswd program to add users to the password file. You can add users at anytime without having to restart Squid. In this case, you add a username called admin

htpasswd /etc/squid3/squid_passwd admin

New password:

Re-type new password:

Adding password for user admin

Find your ncsa_auth file using the locate command.

locate ncsa_auth

/usr/lib/squid3/ncsa_auth

Edit squid.conf…..specifically, you need to define the authentication program in squid.conf, which is in this case ncsa_auth. Next, create an ACL named ncsa_users with the REQUIRED keyword that forces Squid to use the NCSA auth_param method you defined previously. Finally, create an http_access entry that allows traffic that matches the ncsa_users ACL entry

#
# Add this to the auth_param section of squid.conf
#
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid_passwd

#
# Add this to the bottom of the ACL section of squid.conf
#
acl ncsa_users proxy_auth REQUIRED

#
# Add this at the top of the http_access section of squid.conf
#
http_access allow ncsa_users

May be a modified my acl &  http_access will be like this

acl my_network src 192.168.1.0/24
acl ncsa_users proxy_auth REQUIRED
acl work_hours time SMTWHFA 07:00-21:00

http_access allow  my_network ncsa_users work_hours

Restart squid 🙂

Screenshot from 2012-12-10 11:51:15

 

 

 

 

 

 

If denied…..

Screenshot from 2012-12-10 11:51:24