Archive for the “Technology” Category

A frequent scenario I come across when administering Ubuntu servers is that I want to rsync a directory (e.g. a web site) from one server to another but the destination is not writable by my user account. I have permission on the destination via the sudo command but rsync does not have built in support for this. This is rather annoying as I don’t want to enable the root account on the destination just to use rsync and I don’t want to give myself more permissions on the destination since I already have them through sudo. I found some kludge on the web that mostly didn’t work for me so worked out a solution myself. I present the first version of sudorsync, an rsync command that uses sudo! Save this to a file and make it executable and use the same as the rsync command. I’m not an experienced bash programmer so any improvements or suggestions are appreciated.

#!/bin/bash

#************************************************#
#                   sudorsync                    #
#           written by Stephen Nichols           #
#         Email: ChinnoDog@lonesheep.net         #
#                August 6, 2010                  #
#                                                #
#        rsync using sudo on remote end          #
#************************************************#

BUILD=1		#will write routine to print this with -? later

stty -echo
read -p "[sudorsync] password for remote user: " REMOTEPASS; echo
stty echo

# update the sudo timestamp as part of the remote rsync command
rsync --rsync-path="echo $REMOTEPASS|sudo -S -p $(()) -v;sudo rsync" $*

Comments No Comments »

I realize this is a very specific post, but I figured that I had done the research already and someone else out there might find this useful.  When you go to HP’s site to download the driver for the M1522 printer (and some others) you find a bewildering array of choices such as the ones on this page.  Under the Software subheading you find the following:

  • HP LaserJet M1522 MFP Series Full Solution AM-EMEA1
  • HP LaserJet M1522 MFP Series Full Solution AP
  • HP LaserJet M1522 MFP Series Full Solution EMEA2
  • HP LaserJet M1522 Series Full Solution EMEA3
  • HP LaserJet M1522 Series Full Solution EMEA4

There is no further comments on what these are or what EMEA stands for.  After some Googling I finally found out that EMEA is a code for the supported languages.  It is contained in this post.  I have pasted it below for reference.

EMEA1 (Americas/Western Europe) English, Catalan, Hebrew, Italian, Spanish, Dutch, French, German, Portuguese
EMEA2 (Northern Europe) English, Estonia (English driver), Danish, Latvian (English driver), Lithuania (English driver), Swedish, Finnish, Norwegian
EMEA3 (Eastern Europe) English, Arabic, Bulgarian (English driver), Czech, Croatian (English driver), French, Greek, Hungarian, Kazakh (English driver), Polish, Romanian (English driver), Russian, Serbian (English driver), Slovak, Slovenian (English driver), Turkish, Ukrainian (Russian driver)
EMEA4 (Asia Pacific) English, Japanese, Indonesian – Bahasa (English driver), Korean, Simplified Chinese, Traditional Chinese, Thai, Vietnamese (English driver)
Thanks HP for making this so difficult….

Comments No Comments »

I finally purchased a VPS plan.  Dreamhost has been pretty great, and there is no denying that having a web site at Dreamhost is low cost and low maintanence.  And, getting unlimited bandwidth and hosting space as compensation for the one time the server went down was more than I could ask for.  And those one click installs… I will miss you. :-(  I will surely have more issues managing my own server, but the experience will be invaluable and I want the benefits that come with it.  At Digital Linx I get 2GB of RAM, 60GB of disk space, and 600GB of bandwidth for as low as $18.42 a month!  I think this is pretty good compared to some of the others out there.  I don’t think it gets much better than this.

Dreamhost Logo

Reliable web hosting with great features and service for a low price.
Digital Linx Digital Linx – Soon to be hosting this blog in Ubuntu 9.04 server with OpenVZ. See some great deals they posted on the WebHosting Talk Forums!

Comments 1 Comment »

The early versions of Adobe Air wouldn’t open links in twirl in Chrome when I ran it on Windows.  The current version won’t open links in Chromium when I run it in Ubuntu.  I found this article that indicates the problem and fix. Here is the two line version of the fix. Adjust it if you aren’t running Ubuntu 9.04 (Intrepid) or wish to use a different browser.

sudo perl -i.bak -p -e 's/firefox/browser/g' /opt/Adobe\ AIR/Versions/1.0/libCore.so
sudo ln -s /usr/bin/chromium-browser /usr/bin/browser

Note: This modifies part of Adobe Air, and you will probably have to rerun the first line if you install an Air upgrade. If this blows up your Air install just delete libCore.so and rename libCore.so.bak to libCore.so.

Comments No Comments »

I am totally slacking on blog postings.  I recently started using Ubuntu on my laptop as my main operating system and have a ton of things to figure out yet.  Here is an important one.  I figured out printing to PDFs though.  To print to PDFs:

apt-get install cups-pdf
mkdir ~/PDF
sudo chmod u+x,a+x,+s /usr/lib/cups/backend/cups-pdf

You might have to

sudo /etc/init.d/cups restart

after that.

Comments 5 Comments »

Bitlbee is a IRC proxy that allows you to connect to instant messenger services using an IRC client.  It emulates an IRC server so you can connect to it from your favorite IRC client and then plug in your account information.  You can install it on a server for shared use or install it on a workstation to connect to locally.  Unfortunately, it doesn’t work out of the box in Ubuntu.  Here is what I did to install it.

  1. Install bitlbee (duh).
    sudo apt-get install bitlbee
  2. Install xinetd if you don’t already have it.
    sudo apt-get install xinetd
  3. Now we need to copy bitlbee.xinetd into /etc/xinetd.d per the instructions.  Oops, we don’t seem to have that.  Make a temporary directory and download the source to get it.
    cd ~
    mkdir bitlbeesrc
    cd bitlbeesrc
    sudo apt-get source bitlbee
    cd bitlbee-1.2.3/doc
    sudo cp bitlbee.xinetd /etc/xinetd.d

    (you are done with the source)
    cd ~
    rm -rf bitlbeesrc
  4. The /etc/xinetd.d/bitlbee.xinetd we just copied still has its default settings.   Open it up in nano or your favorite editor and set “user = bitlbee” and “server = /usr/sbin/bitlbee”
  5. Restart xinetd.
    sudo /etc/init.d/xinetd restart
  6. Almost done.  If you connected to bitlbee now you would get permissions errors though.
    sudo chmod 777 /etc/bitlbee/bitlbee.conf
    sudo chmod 777 /var/lib/bitlbee

    (I would like to point out here that I KNOW that you don’t want to be setting 777 permissions everywhere.  I don’t think its particularly dangerous here.  I’m a noob. gimme a break. :-p )
  7. Everything is ready.  Connect to localhost on the default IRC port (6667).  Proceed with the quickstart guide written by pleia2 to add accounts.

Comments No Comments »

Once upon a time whenever I would move or rearrange I would get out my graph paper and draw each room to scale with doors and windows and outlets and the whole nine yards.  Then, I would measure all my furniture and I would draw that to scale on another sheet and cut out all the pieces.  I could then move them around the drawing of my room until everything fit nicely and I could see that yes, there was actually walking space in the room!  (Ok, maybe that says more about my shortcomings in interior design than anything else.)  Anyway, I didn’t do it this time when I moved into the house and I regret it.  I always wanted a faster way to do it but there wasn’t one.  Drawing it in a full fledged CAD package would take too long and it was difficult to get measurements right using drawing programs like Visio.

Awhile back I found Google Sketchup online.  Its a free 3D design package that is kind of a hybrid of the above mentioned application types.  Once you get used to the controls its pretty easy to build 3D objects.  It uses a very intuitive interface that allows you to draw things on the screen and then extrude them.  Its almost magic!  I have only recreated my office thus far, using crude blocks to represent most things that take up space.  This is sufficient for my purposes, though SketchUp is certainly capable of more.  Next: draw doors and build furniture!

Sketchup_Office This is a major improvement over my graph paper cutouts!  Though, there is some additional design time required for planning out the additional dimension.  This technique should be particularly useful in my office since it is so small.  I will be building up as well as out in order to be sure I have enough space.  I have included the actual SketchUp drawing below for anyone that would like to have a peek.  My sister used to put things in my cutouts that didn’t belong there.  I anxiously await the edited copy with a toilet where my desk is supposed to go.

Sketchup Drawing Office.zip

Comments No Comments »

Those of you who wish to download authenticated RSS feeds may find that your client doesn’t support them.  Or in the case of Outlook 2007, it supports them intermittently!  (Try adding a few LiveJournal authenticated feeds and then change your LJ password and see how many of them you can get to work again.)  I found this blog post that echoes the problems of authenticated feeds.

Here are two possible solutions to the problem:

  1. Use a news reader that is supports authenticated feeds.  I have installed RSS Bandit (per the suggestion in the above link) and I think its great.  I don’t know what other readers support authenticated feeds.
  2. Use FreeMyFeed to authenticate for you.  This is only slightly less convenient, but allows you to read authenticated reads in any reader.  Personally I may take advantage of this to read authenticated feeds on my Moto Q.

Comments No Comments »

It is a sad truth that running Outlook 2007 on Vista can cause even the fastest computer to slow down to a painful crawl.  When using Outlook with an exchange server the bottleneck is the OST file.  The amount of disk activity generated by outlook is significant.  The problem is, Outlook itself is not the only offender!  In Vista the indexing service also molests your OST file repeatedly while it sorts and indexes all the email, spam, contacts, calender items, and everything else that Outlook uses.  Add to that that Microsoft Communicator’s Outlook integration causes constant accesses to your OST file and you have an absurdly large amount of disk activity that never stops, even when you aren’t doing anything!

My solution: Put the OST file on a RAM drive!  Since the OST is causing a disk bottleneck, we will just get it off the disk.

Step 1: I am using 1.2GB of space on the exchange server.  In addition to consuming large amounts of disk space, it is causing the indexes mantained by Vista to grow ever larger and generate more disk activity.  So task #1 is to configure autoarchiving and then run it to reduce the size of your mailbox until it will fit comfortably into memory.  My target was 128-256MB.  That doesn’t sound like much relative to my 1.2GB, but it represents nearly all of the mail I access on a regular basis.  Compact your OST file when you are done to verify its size.

Step 2: I need a RAM drive.  At work I run Vista x64, which adds a further level of difficulty since I need a 64-bit RAM drive.  I found one that works nicely in this thread at PlanetAMD64.  There are others, but this one is free and it works.  In Vista x64 it creates an error on boot because the driver is unsigned but you can boot up anyway by pressing F8.  In Vista x86 you can disable driver integrity checks through the boot loader, but not in Vista x64 RTM.  There is a way to sign your own driver so this doesn’t happen; anyone have fast and painless instructions for this?

After you install it and reboot you will need to format it and save blank volume image.  The readme describes how to do this.  You can format it with the file system of choice.  I wanted something that would not waste too much space and be fairly fast so I used exFAT with a 1MB cluster size.  If that is what you want, use this to format your drive:

format r: /fs:exFAT /V:RamDrive /A:1M

If you are using Vista x86, exFAT support seems to be absent.  So if that is the case or you are just afraid of exFAT, use your file system of choice.  The bigger your cluster size, the better, but be sure you can utilize most of your drive.  Your usable disk space will be in multiples of your cluster size and you need room for your FAT.  (So on a 256MB RAMdisk if you have a cluster size of 16MB that is 256/16=16 clusters.  Except that a little bit is used for the FAT so that is only 15 clusters resulting in a usable disk space of only 16*15=240MB!)

When you are done, save the image to the registry using the command line in the readme file.

Step 3: Move your OST file to your RAM drive.  Right click on the Outlook icon and open properties, click on E-mail Accounts, double click on Microsoft Exchange on the email tab.  Click on More Settings on the wizard, go to the Advanced tab.  Uncheck “Used Cached Exchange Mode” and click Apply.  Click Offline Folder File Settings.  If the file name is greyed out you either have Outlook open or another application open that uses the OST file open.  Put in r:\outlook.ost as your file and click OK.  Re-enable Cached Exchange Mode and click OK and then get out of your dialogs.  Start up Outlook.  It will download a fresh copy of your mailbox and Vista will immediately begin indexing the new OST file.

OST In Memory

Step 4: If you made it this far, Outlook is running fast and the rest if your computer is running almost as fast as if you didn’t have Outlook open at all.  The only thing left to do is to make sure the OST file gets saved when you shut down and copied back to the RAMdisk when you start up.  If you used a RAMdisk other than the one I linked to, this might be done for you.  However, it is an easy enough task to do this yourself.  Create two .cmd files in the folder you are running the ramdisk4g out of called startup.cmd and shutdown.cmd.  Create the two files with the following text:

startup.cmd: copy /y “C:\Users\stephenn\AppData\Local\Microsoft\Outlook\outlook.ost” r:\outlook.ost

shutdown.cmd: if exist r:\outlook.ost copy /y r:\outlook.ost “%userprofile%\AppData\Local\Microsoft\Outlook\outlook.ost”
Then, open up the group policy editor (run “gpedit.msc” to get there quickly) and navigate to “Computer Configuration\Windows Settings\Scripts(Startup/Shutdown)”.  I trust you can figure out how to add the two scripts to your startup/shutdown sequence.

Vista Startup Script in Group Policy Editor

The End! If you loose or corrupt your OST file it won’t matter.  Just recreate it.  It is just a copy of the stuff on the server.  If you attempted to follow my instructions using a PST file, try not to wipe out your inbox forever. :-)

Note: “Disk activity” to r:\outlook.ost doesn’t show in performance monitor anymore.  Reads and writes to your RAM disk are completely absent.  Now you can search and destroy new bottlenecks.

Comments 1 Comment »