2008-11-10

Mythbuntu on a Via Epia SP8000e

A few years ago I got a Via Epia SP8000e to be a MythTV box. Here are the stats on the SP8000e:

  • Processor: 800 MHz VIA C3 Eden (fanless). Ubuntu reports:
    processor : 0
    vendor_id : CentaurHauls
    cpu family : 6
    model : 9
    model name : VIA Nehemiah
    stepping : 8
    cpu MHz : 800.222
    cache size : 64 KB
    fdiv_bug : no
    hlt_bug : no
    f00f_bug : no
    coma_bug : no
    fpu : yes
    fpu_exception : yes
    cpuid level : 1
    wp : yes
    flags : fpu vme de pse tsc msr cx8 sep mtrr pge cmov pat mmx fxsr sse up rng rng_en ace ace_en
    bogomips : 1602.28
  • "Integrated VIA UniChrome AGP graphics with MPEG-4 accelerator"

I had this running with Ubuntu Edgy Eft and MythTV 0.20 (I think), but it was giving me problems occasionally and the Edgy repositories have been closed down for a while so it was impossible to upgrade packages anymore. I decided to cross my fingers and try upgrading to Mythbuntu.

I started out with the Mythbuntu 8.04 install CD. Everything seemed to install without problems, and once I figured out how to do the MythTV setup properly I got it running. However, the Via C3 Eden is not very powerful, and without XvMC enabled it runs at around 70-90% CPU utilization playing back recordings. So, I tried to enable XvMC by selecting the Via XvMC as the decoder in a new Playback Profile. It didn't work, and I got the errors/problems described in this forum post and bug listing:

Problem :: VIA XvMC / MythTV 0.21 / Upgrade to Ubuntu 8.04

http://bugs.gentoo.org/show_bug.cgi?id=228473

I tried changing the libraries referenced in /etc/X11/XvMCConfig to libchromeXvMC.so.1 and libchromeXvMCPro.so.1 and that didn't fix it.

I tried doing an upgrade to Mythbuntu 8.10, and a fresh install of Mythbuntu 8.10, and still had the same problem with XvMC.

It seemed from the posts about this problem that it appeared with kernel 2.6.24, so I dug up the ISO for Mythbuntu 7.10 (its not listed on the Mythbuntu site anymore, but if you do some creative googling for mythbuntu-7.10-i386.iso you can find it). Mythbuntu 7.10 installed just fine and XvMC worked as soon as I selected Via XvMC in the appropriate MythTV Frontend setup screen (Settings -> TV Settings -> Playback something or other I think).

However, when I did a normal install of all updates Mythbuntu installed MythTV 0.21 and XvMC stopped working. I determined that with Mythbuntu 7.10 the backports repository is enabled by default, and that is where MythTV 0.21 came from, so I reinstalled Mythbuntu 7.10 from the CD, then on the Mythbuntu desktop I updated the software sources to remove backports, and then I was able to update all packages without getting bumped up to MythTV 0.21.

So, I finally have MythTV working on my Via Epia SP8000e using Mythbuntu 7.10.

If you look at the forum posting and bug report listed above Robert reports that this problem exists with Gentoo and Slackware, and that he has been able to get MythTV 0.21 working with post 2.6.24 kernels by compiling his own kernels with the memory allocator set as SLAB instead of the default SLUB. I have not tried this yet since I need some time for the scars to heal before I wade into battle with Linux again.

2008-10-27

Getting backlight to turn off on Dell Inspiron 8100 with Xubuntu 8.04 Hardy

All I wanted was to get the backlight to turn off when my laptop(Dell Inspiron 8100 laptop running Xubuntu 8.04 Hardy) was idle for a few minutes. Is that so wrong? Why did it take over 3 hours of googling and trying various things without really understanding what I was doing?

I did a whole lot of things, and I have no idea which ones were truly necessary or not, so I will start at the end, with the final change that actually got it to work, and work backwards from there.

I had everything configured properly but still the screensaver and turning off the monitor would not work. Then I found a Ubuntu Forums post that said that the gnome-screensaver module is turned off by default in Xubuntu 8.04 even though there is a place in the Settings Manager for configuring the screensaver! That would explain that all the changes I made to the screensaver configuration had no apparent effect! To make matters worse, apparently the gnome-power-manager settings for what to do when the computer is idle depend on the gnome-screensaver module to be activated, so power management is hobbled by default also. In any event, the fix is:

  • Settings -> Settings Manager -> Autostarted apps
  • Then click on Add to create a new entry
  • Then enter gnome-screensaver as the command (and any name and description you want)
  • Then exit out and restart the desktop (Ctrl-Alt-Backspace) to restart with the screensaver running.
So that was what finally got my gnome-power-manager settings to come to life.

Working backwards, here is how I configured the screensaver settings:
  • Settings -> Settings Manager -> Screensaver
  • Select a screensaver theme.
  • Set the slider for "Regard the computer as idle after"
  • Check the box for "Activate screensaver when idle."
  • Click on the Power Management button
  • On both the On AC Power and On Batter Power tabs set the slider for "Put display to sleep when inactive for:"
This will result in the screen saver kicking on after the time you set, and then the backlight turning off after the time you set Power Management screen. I couldn't find a way on these screens to go straight to turning off the backlight without going through the screensaver first.

However, after much fiddling around I was able to get the backlight to turn off without going through the screensaver first (at least not for long) by doing the following:
  • Set the screensaver to "Blank" on the screensaver settings page.
  • Start up gconf-editor from a terminal, then navigate to Apps -> Gnome-Power-Manager -> Timeout and set the values for sleep_display_ac and sleep_display_battery to both be 1.
This seemed to work to make the backlight turn off at the time set for the screensaver to turn on. Your mileage may vary.

Another thing I did was use gconf-editor to set the settings for Apps -> Gnome-Power-Manager -> Backlight -> dpms_method_ac and dpms_method_battery to "off". I think this may have been necessary to ensure that the backlight was told to turn off when the idle time setting was reached.

Other things I did earlier, but which I am not sure were necessary or not, were to install libsmbios-bin (sudo aptitude install libsmbios-bin) and then add dcdbas to /etc/modules (sudo nano etc/modules/ and then just put dcdbas on a line by itself). I read some posts that suggested these were necessary in order to allow Ubuntu to control the backlight on a Dell laptop, but who knows.

I learned that you can set more options of gnome-power-manager by installing gconf-editor (sudo aptitude install gconf-editor) then starting it by entering gconf-editor in a terminal, and then going

Changing wireless cards on Xubuntu 8.04

I have Xubuntu 8.04 running on an old Dell Inspiron 8100. I started out with a Netgear WG511 v2 wireless card, but it kept having trouble connecting to my router in spots where there should have been no problem connecting. So, I decided to "just" switch to another wireless card I had lying around, a Linksys WPC54g v2 which uses the ACX111 chipset. It was a long and painful process to get it to work, so I thought I would write down what I think I learned along the way.

First, remove the existing wireless card and reboot with a wired ethernet connection and make sure it works. This way you will be able to do research on the web and download files as needed.

Next make your computer forget it ever met your old wireless card, otherwise, like happened to me, it will assign the new card to wlan1 which could cause troubles. Linux keeps a list of every network device it ever met and what interface it assigned it to (i.e. wlan0, wlan1, etc). This list is at:

/etc/udev/rules.d/70-persistent-net.rules

Use sudo nano to edit this file and remove the entry for your old wireless card and then save the file. This will prevent Ubuntu from saving wlan0 for your old card and assigning your new card to wlan1. You could probably make everything work with your new card on wlan1, but you would have to find and change every configuration file that references wlan0 and to me it just seems easier to force your new card to be assigned to wlan0.

If your old card used ndiswrapper then you need to make your computer forget about the old card's drivers. To do this first find out the name of your old wireless card driver:

sudo ndiswapper -l

It should show you the name of the existing wireless driver. Then delete that driver from ndiswrapper like this:

sudo ndiswrapper -e

These steps should eliminate your old wireless card configuration so that you can proceed with installing your new card without creating any conflicts. I followed this guide for the WPC54g v2:

http://ubuntuforums.org/showthread.php?t=324148


If you have a different card just search for an guide on how to install it.

2008-10-08

The rewards of being disorganized

I often wonder why so many people make little or no effort to get their lives organized. Everyone agrees that getting your environment and affairs organized makes life easier, but so few seem to do it.

Then I had an idea. Maybe its psychologically more rewarding to be disorganized than it is to be organized, at least in the short term.

What gave me this idea is an New York Times opinion piece that described experiments regarding willpower:
http://www.nytimes.com/2008/04/02/opinion/02aamodt.html?partner=permalink&exprod=permalink
In this piece the authors assert that "the brain has a limited capacity for self-regulation, so exerting willpower in one area often leads to backsliding in others." They also said that modifying behavior in pursuit of goals uses up willpower: "The brain’s store of willpower is depleted when people control their thoughts, feelings or impulses, or when they modify their behavior in pursuit of goals." They discuss experiments showing that exercising willpower on one task results in reduced performance on a subsequent task requiring willpower.

So maybe getting organized, which naturally involves modifying behavior in pursuit of goals, is experienced by people as draining.

And maybe the surprises and emergencies that result from being disorganized are rewarding because they trigger an adrenaline rush (sorry no articles yet to cite for that proposition). There is something stimulating about quickly reacting to emergency after emergency, and that mode of living is so rewarding that we have movies and TV shows like Indian Jones and 24, that depict it.

The rewards of reacting to crisis, and the draining nature of proper preparation, could lead to a dynamic where a person would experience getting organized as unrewarding because (1) the exercise of willpower is draining, and (2) the reduction in emergencies leads to fewer rewarding spurts of adrenaline. Someone attempting to pull their lives together could simply find the experience to just feel wrong.

This could explain why the chronically disorganized tend to look down on the organized as living a dull and meaningless existence. In their experience attempts at organization left them feeling drained and unstimulated, and so they assume that the lives of organized people must be draining and unrewarding.

Well, are the disorganized people right? Are the organized not living life to the fullest? According to the New York Times piece people can grow their capacity for willpower by exercising it, just like you can make a muscle stronger with exercise. So maybe the organized people who have bulked up their willpower with regular exercises of willpower don't find being organized to be nearly as draining as the disorganized experience it to be.

2008-10-03

Why you need to over-save if your retirement funds are in the stock market

In recent decades the conventional wisdom has been that people should invest the majority of their retirement savings in the stock market. The conventional reasoning goes like this:


  • The stock market has a historic rate of return of 10% over the long term, which is much better than the other investment choices.

  • There is risk in stocks, and the stock market can drop in the short term, but it always comes back up in the long term.

  • Your retirement is off in the future, so you are investing for the long term and short term downturns don't matter.

  • Your retirement will last a long time so even in retirement you will be investing for the long term.

  • If you don't take risks your investments won't make enough money and you won't have enough money to retire when you want to, or to spend as much as you want to in your retirement years.

Do you find yourself nodding your head in sage agreement with this sound advice? Taking risks; getting high returns; thinking in the long term.

Now lets look at what the purveyors of the conventional wisdom have to say when there is big downturn in the stock market:

"Q. But what if I am about to retire? Then what?

A. Leaving the work force at a time like this creates big problems. Not only is your portfolio down, but you need to start withdrawing from it. So you are essentially locking in your losses.
If your portfolio has taken a big hit, it may be time to seriously consider delaying retirement. Working just a few years more can make a big difference. Or, a part-time job may keep you from having to dip into your portfolio before it recovers."


From "Is My Money Safe" New York Times, 29 Sept 2008

"Fortunately, you can soften the blows of retiring in a slumping market. Here are some ways to help make sure your savings last as long as you do:

WORK LONGER AND SPEND LESS. This may sound obvious, and somewhat depressing, but working just a few years longer can make a big difference.
"

From "Retire Now, and Risk Falling Short on Your Nest Egg" New York Times, 16 August 2008. See also "Retirees Filling the Front Line in Market Fears" New York Times, 22 September 2008.

Now wait a second. You were investing in the stock market so that you wouldn't have to work in your golden years, and so that you wouldn't have to pinch pennies. And now they are telling you that you need to delay retirement, and spend less in retirement exactly BECAUSE you were savvy and invested your retirement in the stock market? Our savvy strategy got us the the exact result we were trying to avoid?

The problem with the conventional wisdom is that it doesn't consider one of the most important realities of retirement: You will need to withdraw money from your retirement fund on a fixed schedule over a long period. There are invariably one or more substantial stock market downturns during any given 20 year period, and so invariably the person with all of their retirement savings in the stock market will have to sell some portion of their portfolio when the market is down at some point during their retirement. And once you sell when the market is down it is impossible to realize the long term average return on your portfolio because that long term average assumes you never sell.

Since you will need to be withdrawing your money on a fixed schedule the long term return of the stock market is irrelevant to you. You don't care if over time it will eventually return 10% for someone who never had to sell their stocks. What you care about is what the return will be if you have to start withdrawing a fixed amount every year starting at age 65. And guess what? No one can tell you what that rate of return will be because its impossible to calculate or predict. If you are really lucky the market will stay up for your entire retirement. But what is more likely is that there will be a substantial downturn sometime during your retirement, and you will need to sell stocks at a loss just to keep your up with your expenses, and then your retirement fund will be crippled for the rest of your retirement because you had to liquidate at a bad time, and you will be in the exact financial place you were trying to avoid.

Another reality that the conventional wisdom ignores is that things come up and you never know when you are going to need to suddenly make a larger than expected withdrawal from your retirement fund. People lose jobs. Family members get disabled. Your child gets mixed up with the law. The big house you bought with an adjustable rate mortgage loses value and you have to sell at a loss because you got transferred and in order to close the sale you have to pull money out of your retirement fund to make up the balance on your mortgage. Stuff happens, and if it happens during a market downturn you could be forced to sell stocks at bargain prices and be left in the exact situation you were trying to avoid.

At this point conventional wisdom follower is shaking her head and has a knowing little smile because she knows that even though stocks are risky people who invest in stocks are still going to be better off in the long run than people who invest their retirement in bonds or (horrors) CDs, because the stock market investors will still get a better rate of return on average and so no matter what the stock investors will probably have more money in retirement. Which will probably be true most of the time if you assume the same amount of money invested in stocks vs. CDs. However, what if the perceived high rate of return in the stock market causes someone to save less?

Imagine you are in your 20s and you are starting to make plans for retirement. You carefully calculate the annual income you want to have in retirement, and then you calculate how much you need to be saving now to reach that goal, assuming (of course) a 10% return since you are savvy and will invest in the stock market. Thanks to the high returns available to the savvy stock investor it turns out that you don't have to save that much of each paycheck, and so you can afford to spend lots of money on lattes and nice cars and big houses. Meanwhile your clueless neighbor invests everything in low yielding but safe investments, and since they need to save more of their paycheck they have a plainer car, make their own coffee, and spend less on their home. Fast forward 45 years. The stock market crashes just as you reach age 65 and suddenly your retirement fund shrinks to less than that of your clueless neighbor. You need to postpone your retirement, sell your nice car, drop the lattes, and pray the market recovers before you are 80. Your clueless neighbor's retirement starts right on schedule and she has exactly the amount of money for retirement that she was expecting.

Here are some illustrative numbers. I put together a spreadsheet using Robert Shiller's stock market data and compared two hypothetical people who steadily invested a fixed percentage of the US median household income every month from 1968 to 2008, the year they both plan to retire. One person put 10% of median household income in the S&P 500. The other invested 20% of median household income at long term interest rates. Here's how they compared last year:

October 2007
10% of income in S&P: $1.1 million
20% of income at long term rates: $762,000

The safe investor sure looks like a chump and the stock investor is looking forward to a relatively lavish retirement. But lets look again a year later:

23 October 2008
10% of income in S&P: $646,000
20% of income at long term rates: $802,000

The stock investor has seen her nest egg diminish to almost half its size a year ago and her life has been turned upside down. The safe investor has had no disruption. Note that the stock investor, even with the market downturn, got a higher rate of return than the safe investor. And the stock investor was able to spend more money during their working years. But that didn't protect the stock investor from having her her retirement plans thrown out the window. And if the stock investor retires on schedule, she will pull money out of the market when its down, which will reduce her overall rate of return in in coming years.

The moral of the story: if you save for retirement assuming a high rate of return from stock investments you need to be prepared to suddenly find yourself with much less money than you were expecting to have.

So whats the answer? The answer is that if you want to be sure of having a certain annual income in retirement then during your working years you have to save, and spend, at a rate that assumes a low rate of return. If you save like all your money was invested at 4%, and you spend in retirement like your money was invested at 4%, then you can probably afford to have some or all of your retirement fund in stocks since you will probably be able to sell stocks at a loss during a downturn and still have enough left over.

Another possibility is to start off investing all your retirement funds in the stock market when you are young, but then start moving money out of the stock market and into conservative investments starting 10-15 years before your planned retirement (when the market is up, of course) with the goal of having at least 5 years living expenses in very safe investments when you reach retirement.

2008-09-16

Bike racks at Tucson International Airport

I called the Tucson International Airport to find out if they have a bike rack there where I could leave my bike after biking to the airport to catch a flight. The woman said that there are bike racks "around back" near where the rental car lot, and that if I follow the signs for rental car return I should see the bike racks.

2008-08-02

How to upgrade packages on command-line Ubuntu installation

To bring a command line Ubuntu installation up to date with the most current versions of all packages:

sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude full-upgrade

To upgrade your Ubuntu Server from 7.04 to 7.10 follow these few steps and you’ll be presented with a menu that will walk you through the upgrade process.
sudo aptitude install update-manager-core
sudo do-release-upgrade

How to fix unsupported personality problem with HP LaserJet 1012

Copied from a forum posting:

First, I downloaded the pxl1010.ppd from

http://linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_1012

and copied it to the /etc/cups/ppd/ directory. It's the third link in the "Drivers" section of the page, and there's a brief description of how the problem was fixed.

2008-07-20

Fix samba share not mounting at boot

I had this annoying problem with an Ubuntu box where a Samba share that was defined in /etc/fstab would not mount at boot, and then the mount point would get corrupted the first time a program tried to write to the unmounted Samba share, and then the only way to fix it was to unmount it, delete the mount point, recreate the mount point, and then use sudo mount -a to remount it.

How I finally solved the problem was to delete the Samba share from /etc/fstab and replace it with a command line to mount it in /etc/rc.local which apparently is a script that automatically runs at the very end of the boot process.

Specifically I added the following to /etc/rc.local (all one line):
sudo mount -t smbfs -o username=defaults,password=defaults,uid=usersname,gid=groupname,fmask=770,dmask=770 "//10.10.10.110/DISK 1" /media/mountpoint

2008-07-18

A simple HTML-CSS scrolling data box with fixed column headers

I have a number of web pages where large tables of data are presented, and I wanted a way to display them so that when the user scrolled through the data the column headers would stay fixed and not scroll out of view.

My solution was to create a div with a fixed height and width and with its overflow property set to scroll, and then put the actual data table inside that div. Then I put the column headers in a completely separate table outside and right before the div. This way the column headers stay fixed on the page and the user can use the scroll bar that appears on the data div to scroll through the data without moving the whole web page.

The toughest challenge was figuring out how to get the column headers to consistently line up properly with the data columns, since the default behavior for HTML tables is for the columns to be sized based on the data in each cell, and so left to their own devices the columns of the data table would be different each time your data changed.

Just setting the width property of the table cells in CSS, alone, did not work since it appears to me that the default behavior is ignore the width property on td elements. After a lot of trial and error I discovered that the following combination appears to work for me:

- In CSS set the table-layout property for the data and column header tables to fixed.

- In CSS set the width properties for both the data and column header tables to be some value which is less than or equal to the sum of all of the column widths. If you don't do this (i.e. just leave the table width property blank or set it to more than the sum of the column widths) then the columns will not stay fixed in at least Firefox 2, though it will probably still work in IE7. I think this is because in FF2 even if you set table-layout: fixed in CSS it will expand the cells as needed to take up the whole width of the table, and if you don't set the table's width explicitly it will inherit the width of the div it is inside.

- Create a CSS class for each column and set the width property for each column to the right number of pixels, and then give each td of both tables the appropriate class.

Here is rough outline of the code elements. This particular code is not designed to be fully cut and paste, and its air-code, so just use it to understand the idea:


CSS

div.datagrid
{width: 1000px;
height: 400px;
overflow: scroll;
border: 1px solid black;
font-size: 11px;}

table.headers_and_data
{border: 1px solid black;
border-collapse: collapse;
table-layout: fixed;
width: 980px}

td.col_0
{width: 71px}

td.col_1
{width: 150px}

td.col_2
{width: 300px}

td.col_3
{width: 478px}

HTML

// Output column headers table
<table border="1" class="headers_and_data">
<tr>
<td class="col_0">Column 0</td>
<td class="col_1">Column 1</td>
<td class="col_2">Column 2</td>
<td class="col_3">Column 3</td>
</tr>
</table>

//Start a new div with specified height and overflow set to scroll so that table
// of items is scrollable (see style for this div) and then start data table.
<div class="grid">
<table border="1" class="headers_and_data">
<tr>
<td class="col_0">Mississippi</td>
<td class="col_1">Jackson</td>
<td class="col_2">Delta swamps</td>
<td class="col_3">Possum</td>
</tr>
</table>

2008-05-02

How to import POIs from Google Maps to Maemo Mapper

This is just one method and I haven't tried it with anything more complicated than a short list of POIs.

  • Go to My Maps in Google Maps and save all the placemarks on a new map.
  • Click the View in Google Earth link, and then save the KML file to your computer.
  • Go to GPS Visualizer and convert the KML file to a GPX file.
  • Save the GPX file to your computer, and then move it onto your N800.
  • In Maemo Mapper choose POI -> Import and import the GPX file.
  • Done (hopefully)

2008-04-27

Xubuntu 8.04 on Dell Inspiron 8100

Here are the steps I went through in installing Xubuntu on an old Dell Inspiron 8100. This is not a How-To!


  • Downloaded the CD for Xubuntu 8.04 from the Xubuntu site and burned to a CD.

  • Booted laptop from CD and chose the option for trying Xubuntu without making any changes. Successfully got the Xubuntu desktop, but the wireless card wasn't working.

  • Rebooted laptop with CD in drive and this time chose Install Xubuntu.

  • chose the right language, keyboard, and location for me.

  • On the partitioner options I chose guided, resize windows partition and create a new partition for ubuntu. However, this option failed after a long time of the system working on it, saying something about some write to disk failed. So I clicked the back arrow on the installer dialog until I got back to the beginning of the partitioner and chose to reformat the entire disk.

  • Rest of install finished without any problems. Removed install CD and rebooted into Xubuntu without any problems.

  • The little 'Restricted Drivers' icon was on the top toolbar, and when I clicked on it it said that NVIDIA accelerated graphics driver was available. I am a little scared of NVIDIA drivers on Linux due to some past experiences so I decided to leave this alone for now.


Getting the Netgear WG511 v2 wireless card to work.

  • The wireless card didn't show up under Networking, so I started following the instructions given here:
    https://help.ubuntu.com/community/WifiDocs/WirelessTroubleShootingGuide

  • First ran $lshw and saw that my wireless card was apparently detected as
    Product: 88w8335 [Libertas] 802.11b/g Wireless
    vendor: Marvell Technology Group Ltd.
    physical id: 0
    bus info: pci@0000:0d:00.0
    configuration: latency=0

  • According to the web page, if there is no driver listed under configuration that means no driver is loaded, which is what I suspected anyways.

  • Poked around a bit on google, doesn't look like there is a native linux driver for this chipset, so on to plan B.

  • Wireless card is Netgear WG511 v2. Googling this and linux led me to this blog entry:

    http://verens.com/archives/2005/02/21/installing-a-netgear-wg511-v2-marvell-chipset-in-linux/

    Unfortunately the link there to the Windows driver for this card are broken. Looked for the CD for the card and couldn't find it.

  • Went to the NDISwrapper website list of supported chipsets and found an entry for the Marvell chipset and a few entries for the card. Downloaded the drivers from each.

  • Used Synaptic to install ndiswrapper-common ndisgtk and ndiswrapper-utils-1.9

  • Downloaded drivers from here:
    http://www.parseerror.com/cache/drivers/WG511v2/WG511v2-cd/Driver/
    and then used the ndisgtk front end (Applications -> System -> Windows Wireless drivers) to install it. After that iwconfig seemed to show it as wlan0 so I guess it worked.

  • Next went to install WPA supplicant using Synaptic but it was already installed. So I went ahead and followed the instructions here for setting it up:
    http://ubuntuguide.org/wiki/Ubuntu:Feisty#How_to_enable_WPA_with_Ndiswrapper_driver

  • Success! Wireless is working using WPA.


Trying out the NVIDIA restricted driver. I noticed that the backlight was still on when the screen blanked after being idle, which meant that there would be no power savings from screen blanking, so I decided to go ahead and try the restricted NVIDIA driver (Applications -> System -> Hardware Drivers). I checked the NVIDIA box, let it do its stuff downloading and installing the driver, and then rebooted. Thank goodness the new driver worked!


Connecting to NSLU2 network attached storage device

  • Tried a bunch of variations on the mount command with no luck

  • On a hunch, opened up Synaptic and searched on smb and saw that the smbfs package is not installed by default. This packaged is needed in order to read and write from Samba/windows shares. Installed package.

  • Created mount point:
    $mkdir /home/andy/mount_point

  • Then mounted share (which has no password protection on it):
    $sudo mount -t cifs //10.10.10.123/DISK\ / /home/andy/mountpoint

  • Success! Able to get files from the NSLU2


Transferring Firefox Profile

  • Tried the old way of just copying my Firefox profile from another computer over the profile at /home/andy/.mozilla/firefox/jdkfjld.default but the bookmarks didn't come through

  • Tried deleting everything out of the Firefox profile and copying the old profile into it, and that seems to have worked, though I think there was probably a better way to get the bookmarks in since I think Firefox 3 uses a different system for bookmarks.


Installing MS core fonts and cleaning up font appearance.

  • Used Synaptic to install msttcorefonts. Got a message that I would need to install and configure x-ttcidfont-conf in order to use them in X-windows. However, after I installed msttcorefonts Times New Roman showed up as an option in Firefox for default font, and when I checked Synaptic it showed x-ttcidfont-conf as already installed.

  • Next clean up font rendering. Applications -> Settings -> Settings Manager -> User Interface, check 'Use sub-pixel hinting' and also changed 'Use hinting' setting from Full to Slight.

  • Much better; Fonts look a lot better on Firefox, not as blurry


Remove one panel and move the main panel to the bottom of the screen.

  • Applications -> Settings -> Settings Manager -> Panel, then in Panel Manager select Panel 2 and then click minus sign to remove bottom panel.

  • Move remaining panel to bottom by going into Panel Manager and clicking button for bottom of screen, then select Normal Width instead of full width to make it look more Mac Dock like (but not really)

  • Add icons for open windows to panel by right clicking on panel, then choose add new item then find and select Icon Box.

  • Slim down the Applications button by right clicking itm, choose properties, and then unchecking the box that says show title in button

  • Get a more Mac look by going to Applications -> Settings -> Settings Manager -> Window Manager and then select Agua or Agualemon.

2008-02-15

BASH scripts on Mac OS X

I learned today how to use a BASH script on Mac OS X.

Just create a text file and put #!/bin/bash on the first line, and then write the rest of your BASH script and save.

Then make the file executable by opening Terminal and running
chmod +x scriptname.sh

Then you should be able to run it from the Terminal command line.

To make it so you can run the script by just double clicking on it in Finder, just change the extension of the script file to be .command

See Introduction to Open Source Scripting on Mac OS X

2008-02-05

Proper Mapping of Modifer Keys for Synergy with Windows Server and Mac Client

Synergy is a great program that allows you to use one keyboard and mouse to drive a number of computers whose monitors are next to each other. See http://synergy2.sourceforge.net/. I have it set up so that my keyboard and mouse connected to my Windows box can be used on my Mac mini whose monitor is to the right of my Windows box monitors. When I move the mouse off the right edge of my Windows monitor it magically shows up on my Mac mini monitor, and if I then use the keyboard it magically sends to the Mac mini instead of the Windows box its physically connected to. I can also block and copy text between the two systems. At free its a heck of a lot cheaper than a KVM switch, and since switching between computers is as easy as moving the cursor from one monitor to the other, its a lot more convenient than hitting a switch to move.

In any event, the real purpose of this post is to show how to correctly map the modifier keys (Ctrl, Alt, Windows etc) when your Synergy Server is on a Windows box and your client is a Mac. By default, for me, the Alt key on my keyboard was acting like Command on my Mac. Here is how to get the Windows key on a keyboard connected to a Windows box to map to the Command key on a Mac.

Start up Synergy on the Windows box.
Click on the Configure button next to Screens & Links.
In the Screens box click on the name of your Mac, and then click the Edit button below the screens box.
In the Modifiers area assign Alt to Super and Super to Alt.
Click OK, exit Synergy, restart your Synergy server and it should work.

2008-02-04

Using Mac OS X Leopard Preview to Manipulate PDF Files

Update 2011-01-09: I finally got around to installing Snow Leopard on my main Macbook and discovered that Preview handles this stuff a little differently.  The instructions have been updated for Snow Leopard 

I do all my filing paperless, so I am in the habit of scanning batches of snail mail as a single PDF and then breaking out and saving pages as separate PDFs for filing, and sometimes combining multiple PDFs into a single PDF. In Windows I had always used Adobe Acrobat Professional to do this, but my personal Mac mini challenge was to replicate all the functionality I have in Windows in Max OS X Leopard.

I didn't see an obvious tool for this built-in to Leopard, so I spent a lot of time downloading and trying out various freeware applications (mostly Java based) for breaking apart and merging PDFs, but they are were all pretty awkward to work with. Then I decided to take a hard look at Preview to see if I could get it to do what I wanted. Here is what I found:

To extract a single pages of a PDF in Snow Leopard Preview:
1. Highlight the page(s) you want in the Sidebar and hit Command-C to copy to the clipboard (For some reason you can't seem to do this with multiple pages).
2. Then go File -> New from Clipboard (or just Command-N). A new Preview window opens up with just the single pages you copied.
3. Then do File -> Save As or Shift-Command-S to save the new PDF.
4. You can also drag the selected pages to the Desktop and it will create a new PDF of those pages.

To extract multiple pages of a PDF in Preview:
1. Extract a single page as outlined above.
2. Open your new single page PDF in Preview next to your already open source PDF.
3. Select all of the pages you want to extract in the Sidebar of your source PDF, and then drag and drop and drop them where you want them to go in the Sidebar of your target PDF. They show up in your target PDF where you dropped them.
4. Save your target PDF using File -> Save As or Shift-Command-S.

To combine multiple PDFs in Preview:
1. Open one PDF in Preview.
2. Drag the PDF file you want to add from Finder onto the Sidebar of the PDF you have open in Preview and drop it directly on top of the existing page (if it is a single page) or directly on top of the page with the binder showing (if the existing PDF is multiple pages).  In Snow Leopard, if you just drop the file on the sidebar it doesn't combine the PDFs by default; you have to drop directly onto a page.

2008-01-30

Getting started with my Mac Mini

After using MS operating systems for 20 years (DOS then Windows) I finally decided to buy a Mac to be used as my primary non-work machine. I got a Mac Mini 1.83 GHz Intel Core 2 Duo with 1 GB of RAM and Mac OS X 10.5.1. What follows are some notes on my thoughts and experiences over my first few days as a Mac owner.

The Mac font smoothing makes fonts look really blurry to me. Under System Preferences -> Appearance its possible to turn off font smoothing for font sizes 12 or smaller, and if you download TinkerTool its possible to use it to turn off font smoothing for larger sizes. After some playing around I decided to set the font smoothing cutoff at 16 pt. Turning off smoothing helps a bit, however, Mac's rendering of unsmoothed fonts is definitely not as good as Windows, and may not be as good as Ubuntu (I haven't done a real side by side comparison yet). According to various posts on the web the difference is explained by Apple deciding to optimize their screen fonts so they match the printed appearance as much as possible, while Microsoft optimizes for screen appearance. Since I maybe print out 6 pages of hard copy a year, you can imagine which approach I favor.

One thing about the Mac that surprised me was its lack of built-in support for working on mixed networks. After hearing about how everything 'just works' on a Mac, and how Mac OS X was built on some flavor of Unix, when I wanted to edit a PHP file on my Linux home web server I cheerfully clicked on mount network drive and typed in sshfs://10.10.10.120 expecting to quickly mount the drive from my Linux box using sshfs. Nope. SSHFS is not built-in in OS X Leopard. After poking around a bit it looks like Apple offers a download to add sshfs support, or you can use a shareware filemanager that includes sftp support, or you can use MacFuse from Google. I decided to give MacFuse a try, and so far it seems to work, though I haven't really given it a workout.

Other options I have discovered for working with sFTP/sshfs are to use a 3rd party file manager that includes support for it (I am trying out Forklift at the moment, but there are others), or for text files using the TextWrangler text editor which has built-in support for editing files over ssh.

I was also shocked that although I could mount an ftp volume in Finder it was read-only even though the ftp server was set to give me read-write privileges. According to the Apple website this is a feature, not a bug, and you have to use a 3rd party app to be able to upload files to an FTP server. I tried Filezilla, but didn't like its apparent lack of keyboard shortcuts for copying files Same with Fugu, another free application for sftp transfers. Downloaded beta of Forklift and so far it looks like what have been looking for. You can choose Commander keyboard shortcuts which gives you F5 to copy a file from one pane to the other like I am used to. I didn't get around to trying Cyberduck.

No luck getting my Xerox Documate 250 scanner to work with the Mac Mini. Apparently there are no Mac drivers for it, and just plugging it and seeing if it would work didn't. When I ran out of possible leads to pursue I went ahead and ordered the $86 OEM version of Windows XP from Newegg.com so that I can dual-boot XP on the Mac Mini so that I can scan PDFs. It may sound extreme, but I am a fanatic about being paperless and I gotta have my scanner. Anyways, I am sure that I will discover other things that I will need to have a copy of XP around for.

Once I committed to having a dual boot machine I looked into running both OSs at the same time using either VMware Fusion or Parallels. From posts on the web it seems they both work well and are more or less equivalent. However, one friend who uses Parallels remarked that it takes a lot of RAM to run two OSs at the same time, so I promptly went to Crucial.com and ordered 2 GB of RAM for the Mini, which showed up on my doorstep 2 days later.

Upgrading the RAM on the Mac Mini is not for the faint of heart. I followed the excellent directions at:
http://www.methodshop.com/gadgets/tutorials/macmini-ram/index.shtml
You haven't lived until you are prizing off the cover of your brand new expensive toy with a couple of plastic putty knives and hearing all kinds of snap-crackle-pop noises as the little tabs pop loose. To make things more fun, the RAM in the Intel Mac Mini is hidden underneath the hard drive and optical drive, so things have to be unscrewed, and a little cable carefully removed, to get at it. Although it was an intimidating process to launch into, in actual execution it went pretty smoothly and the whole thing took less than an hour from start to finish.

2008-01-29

IE7 puts a margin around form elements but Firefox doesn't

I was going nuts trying to figure out why IE7 put some unwanted white space around a table but Firefox rendered it properly with no margin, despite explicitly setting margins for the table as 0 in CSS.

After a lot of trial and error, and fruitless Google searches, I figured out that it was the Form element that I had inside the table that was causing the problem. Apparently IE7 puts a margin around a Form element by default but Firefox doesn't. To get rid of the unwanted whitespace I just added the following to my CSS:

Form
{margin: 0px}

2007-10-30

Font problems with Nvidia driver in Ubuntu

After I switched to using the Nvidia proprietary driver in Ubuntu instead of the nv driver, the font sizes on my system were all wacky (many, but not all, became too small). After some research I discovered that it was due to the DPI being set wrong in X. There is a great post here about what causes the problem and how to fix it:

nVidia versus fonts!

The short version is you need to figure out the DPI of your screen and then add the following lines to the Device section for your nvidia driver in xorg.conf:

Option "UseEdidDpi"   "false"
Option "Dpi" "92 x 92"

Replace 92 x 92 with the horizontal and vertical DPI of your display.

2007-10-07

Javascript date spinner control to roll ISO 8601 dates in a text field using arrow keys

I have a couple web applications where the user enters or edits dates in the near future or near past in a text field using ISO 8601 format (yyyy-mm-dd). I wanted a javascript function which would allow the user to quickly modify the date by a few days without having to delete an old date and type in a new one, i.e. just hit one key to increment or decrement the date by one day. Since I couldn't find anything out there to do this I wrote my own. The main function here is roll_dates() which gets called by the onkeydown event of a text field on a HMTL form.

I am a self-taught coder, a beginner with javascript, and I haven't carefully tested this, so please only use this as an example to help give you ideas for your own coding (i.e. don't blindly block and copy this into your own code and then be surprised when it doesn't work right or breaks something).


function date_object_to_iso_date(date_var)
{// Converts a date object to an ISO date (YYYY-MM-DD)
// Add 1 to month value since Javascript numbers months as 0-11
var month_var = (date_var.getMonth()+1)+"-";
// Add a leading zero if its a one digit month
if (month_var.length==2)
{month_var="0"+month_var}
// Add a leading zero if its a one digit date
var day_of_month_var = (date_var.getDate())+"";
if (day_of_month_var.length==1)
{day_of_month_var="0"+day_of_month_var}
var iso_date_var=date_var.getFullYear()+"-"+month_var+day_of_month_var;
return iso_date_var;
} // close function

function increment_date(date_var, var_amount)
{//Takes a date object and adds one day
date_var.setDate(date_var.getDate()+var_amount);
return date_var;
} // close function

function iso_date_to_date_object(iso_date_var)
{ //Converts an ISO date (2007-10-01) into a date object
var array_temp=iso_date_var.split("-");
var date_var=new Date(array_temp[0],array_temp[1]-1,array_temp[2]);
return date_var;
} // close function

function roll_dates(event_var, id_var)
{// Increments or decrements an ISO date using up or down arrow
// Designed to be called by the onkeydown event of a textfield
// i.e. onkeydown="roll_dates(event,'fieldid')"
var keynum_var = event_var.which;
// Only do rest of function if user hit up or down arrow
if (keynum_var == 38 || keynum_var == 40)
{var textfield_var = document.getElementById(id_var);
var iso_date_var = textfield_var.value;
// Use regular expression to check if ISO date was entered,
// and if not use today's date
var iso_check_regex = /20[0-3][0-9]-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])/;
if (iso_check_regex(iso_date_var))
{var date_var = iso_date_to_date_object(iso_date_var);}
else
{var date_var = new Date()}
// Increment or decrement value based on whether user hit up or down arrow.
switch (keynum_var)
{case 38:
date_var = increment_date(date_var,1);
break;
case 40:
date_var = increment_date(date_var,-1);
break;
} // close switch
iso_date_var = date_object_to_iso_date(date_var);
textfield_var.value = iso_date_var;
} // close if
} // close function

2007-09-30

Mount remote filesystem on Ubuntu Feisty using SSH

First install the ssh filesystem:
sudo aptitude update
sudo aptitude install sshfs


Create a mount point for the remote computer and make yourself owner:
sudo mkdir /media/remote_computer_name
sudo chown andy /media/remote_computer_name


Add yourself to the fuse group:
sudo adduser andy fuse

Log out and log back in so that the new group membership takes affect.

Mount the remote computer:
sshfs 10.10.10.120:/ /media/remote_computer_name/

There were additional steps listed on one HowTo that I didn't follow but it worked anyways:
http://ubuntuguide.org/wiki/Ubuntu:Feisty#How_to_mount_remote_host_folders_into_local_Ubuntu_machine_.28sshfs.29