BSDnexus
5Aug/11Off

dpkg tips

dpkg is package manager for Debian, and found in most of its derivatives. Programs such as apt and aptitude are front-ends to dpkg. Following are some handy to know dpkg commands.

Package Listing

To display all currently installed packages (including version numbers) or a specfic package:

dpkg -l [package_name]

Package Querying

To show details about a specific package:

dpkg -p {package_name}

To find out which files are installed by a package:

dpkg -L {package_name}

To find out which package installs a particular file:

dpkg -S {/path/to/file | part_of_filename}

Package Removal

To remove a package but retain the configuration files:

dpkg -r {package_name}

To remove a package including the configuration files:

dpkg -P {package_name}
10Jul/11Off

AcerAspireOne Touchpad on Debian

AcerAspireOne with Debian Logo

When installing Debian "Testing" on the AcerAspireOne the touchpad does not register a single tap of the pad as a left mouse click. To rectify this add the following line to the file /etc/modprobe.d/psmouse.conf

options psmouse proto=imps

According to this Ubuntu source, some setups may be better with exps instead of imps.

5Jul/11Off

apt autoclean

Debian apt package management

To have apt-get/aptitude auto-clean all the downloaded .deb files after running an "update" (to keep as much free space as possible) simply add the following to /etc/apt/apt.conf.d/00autoclean

Aptitude::Autoclean-After-Update;
7Jun/11Off

ownCloud private web storage

ownCloud logo

ownCloud is a webdav based application allowing you to store files on your own personal server on the Internet and access them via http or webdav. Installation is as follows:

Ensure apache2, php and mysql are installed

$ apt-get install apache2 php5 mysql-server php5-mysql sqlite php5-sqlite

Download the latest stable (or the experimental version via git if preferred). At time of writing, the latest stable version is stable version 1.2 and install to the webserver directory:

$ wget 'http://owncloud.org/releases/owncloud-1.2.tar.bz2'
$ bunzip2 owncloud-1.2.tar.bz2
$ tar xvf owncloud-1.2.tar
$ mv owncloud /var/www/

Appropriate permissions need to be set so that the webserver has full control of the directory. On debian or ubuntu this is:

$ chown -R www-data:www-data /var/www/owncloud

Next you need to decide upon the database used, the administrator user and password. This is done through the "first run wizard" which will appear the first time the owncloud directory is browsed. Sqlite requires no configuration, while selecting MySQL will require additional information to build the tables.

ownCloud first run wizard

ownCloud first run wizard

After configuration, the standard login will be presented:

ownCloud login page

ownCloud login page

once logged in files are displayed and options to upload or create directories are available under "More Actions":

ownCloud file listing

ownCloud file listing

The web interface is now functioning as well as access via webdav. Since KDE supports webdav it is possible to configure access to the server storage space via the "Network" place as follows:

Select "Add Network Folder"

Select "Add Network Folder"

Select the "webdav"access method:

Select WebFolder (webdav)

Select WebFolder (webdav)

fill in the details, notice that the folder field is set to "/owncloud/webdav/owncloud.php" (this assumes the installation was to /var/www/owncloud on a debian or ubuntu system)

Enter configuration details

Enter configuration details

Upon saving the details a prompt for the password will appear and an option to "Remember password" so you don't have to re-enter it whenever accessing the folder:

Enter password

Enter password

The share will now appear in the "Network" places:

ownCloud in Network places

ownCloud in Network places

And can be used like any other folder on the system within KDE:

ownCloud access via webdav in KDE

ownCloud access via webdav in KDE

The files themselves are stored in a per-user directory in a sub-folder of the owncloud directory entitled "data"

28May/11Off

GRUB2 splash image

Sample GRUB splash image

GRUB2 supports background images being displayed during the selection phase of the boot process. A wide variety of formats are supported, including jpg, png and tga. The image size should be 640x480 pixels.

Place the image in /boot/grub and run the command update-grub, looking for the indication that the image was found:

$ update-grub
Generating grub.cfg ...
Found background image: splashimg.png

The next time the system is boot the custom image will be displayed. My example image can be found below

Sample GRUB splash image

Sample GRUB splash image

17May/11Off

Debian and libdvdread

DVD Logo

In order to watch all DVDs on Debian, the libdvdcss needs to be installed. This is not distributed with Debian due to certain restrictions, however, if the restrictions do not apply to you then the following correctly installs the necessary files. First is the installation of libdvdread itself

$ apt-get install libdvdread4

In order to install the CSS codings it is necessary to manually obtain them. /usr/share/doc/libdvdread4/README.Debian directs downloads from http://unofficial.debian-maintainers.org/ which then has a link to http://archive.debian-maintainers.org/unofficial/packages/libdvdcss/ from here is a directory entitled "current_i386" (among others) and inside is the deb file required for download. At time of writing the full path is: http://archive.debian-maintainers.org/unofficial/packages/libdvdcss/current_i386/libdvdcss2_1.2.10-1_i386.deb (note that the dev and dbg based deb files are not required for playing DVDs)

Once downloaded the CSS must be manually installed with dpkg

$ dpkg -i libdvdcss2_1.2.10-1_i386.deb

No further configuration is required

27Apr/11Off

iFrames and cookies

While developing something for facebook I noticed that the PHP session of my code was vanishing - but only in InternetExplorer. After searching, it seemed the issue was to do with iFrames (as facebook opens the code in an iFrame). If the domain of the website inside the iFrame doesn't match the domain of the browser (esentially the site hosting the iFrame), then all cookies from that website are declined as they are seen as third party and potentially dangerous.

At present it appears that IE is the only browser to act in this manner, implementing Platform for Privacy Preferences (P3P) Project. However, there are two ways to resolve the issue. The first is to reduce the security settings of the browser, which is not very practical for the developer; and the second is to implement a P3P header with specific tokens set to allow the cookies. For PHP, this would be:

header('P3P: CP="CAO PSA OUR"');

These tokens are better explained here. I have since also found a facebook developers discussion on this issue here.

Tagged as: , , No Comments