Archive for the 'Configurations' Category

The AskApache blog has a great comprehensive guide to .htaccess. A must read for anyone who does a lot of work with Apache.

http://www.askapache.com/htaccess/apache-htaccess.html

For some reason, Firefox started to display a blinking cursor, like web pages I have been viewing were editable. Thinking that some errant plugin was causing this behavior, I manically disabled a few I had recently installed. However that didn’t fix the problem.

Good ole Google to the rescue.

Firefox has a ‘feature’ that lets you select text with more visual feedback. I guess the little one must have been hitting keys and turned this on.

Turning it off is easy! Press F7 to turn off caret browsing.

Alternatively, type “about:config” in the URL area, then filter for “caret“. Change accessibility.browsewithcaret to “false”.

In case you were wondering, I just invented the phrase PVPN - Personal Virtual Private Network.

I use Hamachi to connect my work, home and laptop PCs and I’ve found it invaluable over the past few years for a number of reasons. Music over VPN, Remote Desktop/VNC over VPN, and more. So now, I’d like to join my N800 to this growing network to make easy and secure access and file transfer wherever I am connected.

Fortunately the folks at Logmein have compiled a client for the N770, and this also works on OS2008 on the N800 (Let me know on the N810).

This is an alternate take on the wiki article at Logmeinwiki.

Note: For the commands below I will have assumed that you have already installed the openssh server so you can access the N800 via an SSH client with root access. You can also use the built in Xterm and gainroot but it is a pain in the ass typing all of those commands in via the touchpad. If you are using gainroot some of the directories below will change, for example Hamachi will install in /home/user/.hamachi instead of /root/.hamachi. Also I downloaded the client to my memory card in /media/mmc2/ but you can put it anywhere.

Your login should look like this:

BusyBox v1.6.1 (2007-09-27 18:08:59 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

Nokia-N800-51-3:~#

Make sure wget is installed:

apt-get install wget

Make to get the latest Logmein Client from http://files.hamachi.cc/linux/nokia-770/.

Just follow my process below for installing the Hamachi client and joining your network.

Nokia-N800-51-3:/media/mmc2/tmp# wget http://files.hamachi.cc/linux/nokia-770/hamachi-0.9.9.9-20-lnx-n770.tar.gz
--10:31:47-- http://files.hamachi.cc/linux/nokia-770/hamachi-0.9.9.9-20-lnx-n770.tar.gz
= `hamachi-0.9.9.9-20-lnx-n770.tar.gz'
Resolving files.hamachi.cc... 72.5.76.16
Connecting to files.hamachi.cc|72.5.76.16|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 116,020 (113K) [text/plain]

100%[==========] 116,020 256.95K/s

10:31:48 (256.33 KB/s) - `hamachi-0.9.9.9-20-lnx-n770.tar.gz' saved [116020/116020]

Nokia-N800-51-3:/media/mmc2/tmp# tar zxvf hamachi-0.9.9.9-20-lnx-n770.tar.gz
hamachi-n770-0.9.9.9-20/
hamachi-n770-0.9.9.9-20/LICENSE
hamachi-n770-0.9.9.9-20/README
hamachi-n770-0.9.9.9-20/LICENSE.tuncfg
hamachi-n770-0.9.9.9-20/LICENSE.openssh
hamachi-n770-0.9.9.9-20/LICENSE.openssl
hamachi-n770-0.9.9.9-20/hamachi
hamachi-n770-0.9.9.9-20/tuncfg/
hamachi-n770-0.9.9.9-20/tuncfg/Makefile
hamachi-n770-0.9.9.9-20/tuncfg/tuncfg.c
hamachi-n770-0.9.9.9-20/tuncfg/tuncfg
hamachi-n770-0.9.9.9-20/CHANGES
hamachi-n770-0.9.9.9-20/install
Nokia-N800-51-3:/media/mmc2/tmp# cd hamachi-n770-0.9.9.9-20/
Nokia-N800-51-3:/media/mmc2/tmp/hamachi-n770-0.9.9.9-20# sh install

install: line 7: HAMACHI_DST: not found
Copying hamachi into ..
Creating hamachi-init symlink ..
Copying tuncfg into /sbin ..

Hamachi is installed. See README for what to do next.

Nokia-N800-51-3:/media/mmc2/tmp/hamachi-n770-0.9.9.9-20#
Nokia-N800-51-3:/media/mmc2/tmp/hamachi-n770-0.9.9.9-20# cd
Nokia-N800-51-3:~# tuncfg
Nokia-N800-51-3:~# hamachi-init
Initializing Hamachi configuration (/root/.hamachi). Please wait ..

generating 2048-bit RSA keypair .. ok
making /root/.hamachi directory .. ok
saving /root/.hamachi/client.pub .. ok
saving /root/.hamachi/client.pri .. ok
saving /root/.hamachi/state .. ok

Authentication information has been created. Hamachi can now be started with
'hamachi start' command and then brought online with 'hamachi login'.
Nokia-N800-51-3:~# hamachi start
Starting Hamachi hamachi-lnx-n770-0.9.9.9-20 .. ok
Nokia-N800-51-3:~#

Hamachi is now running on our little tablet!

But it has not joined our network at this point, so we follow the logmein Hamachi documentation to do so.

Nokia-N800-51-3:~# hamachi set-nick DaveN800
Setting nickname .. ok
Nokia-N800-51-3:~# hamachi login
Logging in ....>....... ok
Nokia-N800-51-3:~# hamachi join YourNetwork
Password:
Joining YourNetwork .. ok
Nokia-N800-51-3:~# hamachi go-online YourNetwork
Going online in YourNetwork .. ok
Nokia-N800-51-3:~#

And now…checking other Hamachi clients, shows our little device is online!

hamachi on n800

Now we need to tell our tablet to put hamachi online whenever we restart the system and also set the keepalive lower.

To lower the keepalive:

Nokia-N800-51-3:~/.hamachi# echo "KeepAlive 20" >> ~/.hamachi/config

This is all great, and you should be online now. But you would need to start Hamachi on every reboot which isn't going to cut it. We will add the Hamachi start process to the init scripts. Add the following lines to the file '/etc/init.d/rcS' right before the line which says 'exit 0'

<code>/sbin/tuncfg;/usr/bin/hamachi -c /root/.hamachi start

In order to do this, use VI.

vi /etc/init.d/rcS

  • Press capitol ‘G‘ to scroll to bottom of the file
  • type ‘i‘ to enter insert mode
  • hit up a few times to a blank line before exit 0, or hit enter at the beginning of the line to create a new line.
  • Paste the above line into the file
  • Press “esc” using the special xterm button, or hit escape if you are using ssh.
  • type “:wq!” — this command enters the command, mode, tells it to write the file, then quit and execute

That should be all you need! Power off the N800 and power it back up. After restarting your N800 you should see it connect to your PVPN Hamachi network and be online!

Let me know if you have any problems or comments about the above installation procedure!

If you upload those new fancy-shmancy file formats to your web server - namely .docx, .pptx and .xlsx - and you are running Apache; chances are that your web server doesn’t know how to serve those files because they are unknown file formats. Your browser may try to download them as a .zip file (IE) or just display the binary format (Firefox) which ends up looking like jibberish with some XML data.

It’s relatively easy to fix this problem, you just need to tell apache how to handle those files.

Find the file mime.types, this may be in /etc/ or in /etc/httpd/conf/.

Add the following line to this file:

application/vnd.openxmlformats docx pptx xlsx

In one line:

echo "application/vnd.openxmlformats docx pptx xlsx" >> /etc/httpd/conf/mime.types

Restart both Apache and your web browser. Clearing the cache doesn’t work (I learned the hard way :))

Your file should now be downloaded properly to your PC.

Found an encyclopedic list of “stupid” .htaccess tricks. Includes many useful ones such as being able to stop hotlinking of images and replacing with your own, increasing speed and security and general good-to-know htaccess information.

Stupid htaccess tricks

I just read this in the Postfix Release Notes… and thought I had to share.

[Incompat 20060806] Postfix no longer announces its name in delivery
status notifications. Users believe that Wietse provides a free
help desk service that solves all their email problems.

Who said coders don’t have a sense of humor? :)

…and other MySQL Oddities.

If your MySQL binary log files are a “Growing” problem… there are a few simple steps you can use to curtail their growth and save your disk space from these huge files.

They probably look like:

mysql-bin.000001
mysql-bin.000002
mysql-bin.000003
mysql-bin.000004
mysql-bin.000005

And around 1 gig in size each.

These files are generated when you have log-bin=mysql-bin or other log-bin= line in your /etc/my.cnf configuration file.

There are two ways to fix this problem:

The first is to stop the MySQL server from creating these binary files. The only reason you would need the binary log files is if you are doing mysql replication from a master to a slave. In this case, these files are necessary, at least until the slave(s) has caught up with the master. To stop this from logging, comment out (using #) the line containing ‘log-bin’.

The second is to continue logging - this is necessary as stated above if you are performing SQL replication.

You can add a line to your /etc/my.cnf file which will only keep these files around as long as necessary. The line is:

expire_logs_days = X

Where X is the number of days you’d like to keep them around. I would recommend 10, but this depends on how busy your MySQL server is and how fast these log files grow. Just make sure it is longer than the slowest slave takes to replicate the data from your master.

Just a side note: You know that you should do this anyway, but make sure you back up your mysql database. The binary log can be used to recover the database in certain situations; so having a backup ensures that if your database server does crash, you will be able to recover the data.

If you are a Google user - meaning Gmail, Google Docs, Google Calendar, Google Reader, etc - then you should know that by default, once you log in your sessions are typically not encrypted between your browser and the Google servers.

For some more technical information on this, check out dmiessler’s post on the subject.

He mentions using bookmarks to make force your browser to use Google’s secure connections - however I’ve noticed that occasionally depending on how you arrive to your Google services that you will switch to an unencrypted session without warning.

For that reason, If you are using Firefox and greasemonkey, I highly recommend installing the “Google Secure Pro” userscript. It automatically switches you from using http:// to https:// to ensure your data is encrypted to Google’s servers. This will increase your security greatly from using the unencrypted connections, which is good if you transfer confidential data over e-mail - like most normal people do!

The situation is: you have an web application or URL that you would like to force your users (or yourself) to use the secure https protocol rather than the unencrypted http protocol. This is easy to do with Apache and .htaccess.

Create or add to the .htaccess file in the root of the web directory you would like to force redirect for. Add the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

This says that if https is off, reload the page at the same location using HTTPS instead.

Technorati Tags: , , ,

Windows Mobile 5 did not seem to have an easy way to have YouTube mobile videos (3gp files streaming over rtsp protocol) play to your phone.

However with Windows Mobile 6 Professional and HTC’s “StreamingPlayer” software - playing YouTube Mobile videos, at least through PIE (Pocket Internet Explorer) is easy.

If you don’t have HTC’s StreamingPlayer - check here. After installing the software, you may also need to modify your registry in order to allow rtsp streams to be opened by the player. Here is a link to the registry entries you need to make - again courtesy of XDA-Developer’s forum.

Save the above text to a .reg file, and import to your device (for example, using RegEdit for WM6)

Hopefully if all went well - when you visit http://m.youtube.com, and click play video, the HTC player will launch and play the video. After the video is done the player will automatically close and bring you back to the browser.

Note that for the above to work, you need to either have wifi access or an unlimited data plan for your wireless account - because streaming video WILL take up a lot of data!

Update 8/8/2007:

Screenshots!


Windows Mobile and YouTube main screen
Main Youtube Mobile Screen on WM6

YouTube Mobile and Video Page
Video Page on WM6

YouTube Video playing on StreamingPlayer
Video Playing

Widescreen Youtube video
In Landscape mode - you can see the quality of the video is not that great even over WiFi

For another great article on getting this working, check here.

  • Welcome to systemBash, a technology and system administration blog by David Drager. If you enjoy this sort of content, can can subscribe to the RSS using the link to the right.