Archive for the ‘Linux’ Category.
July 26, 2010, 4:57 pm
I just spent way too much time trying to debug PHP’s get_browser() on an openSUSE 11.2 server. All I wanted to do was display a funny little note about what web browser a user was surfing with, as in, “You are using Opera… AWESOME!
”, or “You are using Firefox… good
”, or even, “You are using IE… that’s sad
“.
I had this working just fine on openSUSE 10.3 and openSUSE 11.0, but the 11.2 server was giving me “Default Browser” for any browser I used. I debugged and looked over the configuration/logs again and again, but for some reason it appeared that while get_browser() was seeing the correct php_browscap.ini file, something was going awry.
I finally stopped the debugging process when a Google search landed me on Jonathan Stoppani’s Browscap PHP Project. I made a few minor modifications to my code in order to his class, and now my browser detection is working great – even on the stubborn openSUSE 11.2 server. Thanks Jonathan!
November 21, 2009, 10:05 pm
About 1.5 years ago, I made the switch from SuSE Linux to a MacBook Pro running OS X 10.5. Here are some brief notes I made regarding the transition:
- OS X’s Spaces gives you virtual desktop functionality. I don’t think it offers the same depth of customization, but it works just fine for my needs. One feature I like is to left-click and grab a window, then use ctrl-[1-8] to move the window to one of my eight “spaces”. On my Linux system, I had to navigate a menu to accomplish the same thing.
- The program that I replaced Gaim/Pidgin with is Adium. However, I now see that Pidgin appears to have an OS X client…
- I miss being able to copy text by highlighting, and paste via the middle mouse button. With OS X you need to do
command-c for copy and command-v for paste.
- Speaking of the
command key, it annoys me. I’ve been trained my entire life to use ctrl, but OS X makes you move one or two keys over to use a different key. Which brings me to the next topic…
- The
home and end keys have the obnoxious behavior of jumping you to the top and bottom of a window, as opposed to the start or end of a single line. You can change the behavior in Cocoa apps (more succinct info), but all 3rd party applications (Eclipse, Firefox, etc) seem to require individual adjustment via other means.
- Not having focus-follows-mouse is incredibly painful; Steve Yeggae agrees.
- Quick notes on the hardware:
- Two fingers to scroll, pinch to zoom out, un-pinch to zoom in – I like the multi-touch pad, even though trackballs are typically “how I roll”.
- The auto-dim/brighten of the display and the backlit keyboard is really cool.
- The display is gorgeous.
- The case gets uncomfortably hot for a device that theoretically sits in your lap.
- The only way to access the
alt key is via the fn key.
- If you have more than one user, do yourself a favor and
Preferences -> Accounts -> Login Options -> Show fast user switching menu
- iTunes is disappointing in that it has no native FLAC or OGG support. Additionally, iTunes servers are apparently “listen-only”; you can’t copy files!
While OS X certainly has a proprietary, somewhat locked-down feel to it, the slick and user-friendly interface more than makes up for it. This is the same reason why I usually run Opera instead of Firefox – I prefer a high-quality computing experience.
April 24, 2009, 2:31 pm
I have two Hanns-G JW199D (19″ 1440×900) LCDs connected to an nVidia GeForce 8400 GS video card. They worked great until I upgraded from openSUSE 10.3 to 11.0; Xorg seemed to have problems configuring the LCD connected to the video card’s VGA port. The image was cropped and at an odd, fuzzy resolution, but the LCD on the DVI port was fine.
I examined /var/log/Xorg.0.log and found this:
(WW) NVIDIA(GPU-0): Unable to read EDID for display device CRT-0
I was fairly certain that this had always been the case, and that the monitor in question was being configured from the “Monitor” and “Modes” sections. But after fooling around with modeline generators and tweaking xorg.conf, I was unable to create a configuration that would give back my 1440×900 display.
Finally I thought, can’t I just apply the EDID data from the working monitor to the problem monitor?
I fired up nvidia-settings and used that to dump a binary copy of the EDID. Then I grabbed read-edid and ran the parse-edid which conveniently generated a “Monitor” section for me. I integrated this output into xorg.conf and I was back in action!
March 26, 2009, 7:04 am
I have two 500GB IDE drives that I will use to create a software RAID1 (mirrored) array. How should I connect them to maximize performance?
I’ve used software RAID on my personal file servers for years and ask myself that question every time I make changes. Google has never given me a satisfactory answer, probably because there are so many variables involved that the answer is too system-dependent. Even defining “performance” itself can be a little tricky.
This time I am going to do the work and figure out the best configuration for myself. To start with, here are my system vitals:
- AMD Athlon XP 1700+, 256MB RAM
- IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
- Mass storage controller: Promise Technology, Inc. PDC20268 (Ultra100 TX2) (rev 02)
- openSUSE 11.1, kernel-pae-2.6.27.19-3.2.1
- RAID1 file system: reiserfs-3.6.19-116.62
- Two WD5000AAKB HDs (EIDE, 500 GB, 100 MB/s, 16 MB Cache, 7200 RPM)
So here are all the places I could potentially connect the two drives:
| IDE slot |
Abbrev. |
| Primary master |
Pri M |
| Primary slave |
Pri S |
| Secondary master |
Sec M |
| Secondary slave |
Sec S |
| Ultra100 TX2 IDE1 master |
IDE1 M |
| Ultra100 TX2 IDE1 slave |
IDE1 S |
| Ultra100 TX2 IDE2 master |
IDE2 M |
| Ultra100 TX2 IDE2 slave |
IDE2 S |
I used bonnie++ -x 8 -u root and averaged the results to measure performance. I only examined configurations that were interesting to me, excluding “Pri M” because that is the location of the root drive. Here is what I found:
| 1st HD |
2nd HD |
Write1 (KB/s) |
Read2 (KB/s) |
Seeks/s3 |
| IDE1 M |
IDE1 S |
21191 |
75227 |
235 |
| IDE1 M |
IDE2 M |
24061 |
75505 |
386 |
| IDE1 M |
Sec M |
35582 |
75802 |
296 |
| Sec M |
Sec S |
53798 |
74863 |
233 |
| Sec M |
Pri S |
75426 |
75150 |
396 |
1 Block Sequential Output (put_block)
2 Block Sequential Input (get_block)
3 Random Seeks (seeks)
The most obvious thing that I glean from this is that writing to the software RAID becomes faster when 1) the drives are on separate channels, and 2) the drives are on the IDE bus instead of the PCI bus. Similarly, random seeks per second improve significantly when the drives are on separate channels. This all makes sense to me – hardware configurations that increase the opportunity for parallel operations are more efficient.
However, there’s one thing I don’t really understand: if the Ultra100 TX2 is capable of the same read performance as the main IDE channels, why is it not capable of the same write performance?
In the end, I think I’ll go with the {Sec M, Sec S} configuration. Here’s why:
- Although {Sec M, Pri S} offers the best performance, I don’t want to clog up both IDE channels with RAID traffic.
- Despite this obsessive performance analysis, the server is question is basically just a personal jukebox – I really don’t need screaming speeds.
There. I feel better now.
March 25, 2009, 8:38 am
Ubuntu seems like it’s the latest and greatest in the world of Linux distros, but it just didn’t measure up to openSUSE during my install fest last night. I run openSUSE at work so I figured I would get some variety at home by using Ubuntu on my personal file server. I tried installing Ubuntu 8.04 server twice and finally gave up. My gripes:
- Don’t ask me questions throughout the installation – ask them all up front and then just do it.
- No, I don’t want to set a special password for MySQL. I don’t want to do it now, nor the subsequent three times you prompt me at various points during the installation.
- Freezing the system halfway through installation of GRUB is a dealbreaker, namely because I can’t complete the install.
So with some relief I dropped in my openSUSE disc and the install blew through like a breeze. Surely my comfort level with openSUSE helps, but the SuSE brand has been around a long time; it includes all those little fixes and exception handling that are a part of mature software.
March 16, 2009, 5:13 pm
This is what the PHP docs say about the zlib.output_compression INI directive:
Whether to transparently compress pages. If this option is set to “On” in php.ini or the Apache configuration, pages are compressed if the browser sends an “Accept-Encoding: gzip” or “deflate” header. “Content-Encoding: gzip” (respectively “deflate”) and “Vary: Accept-Encoding” headers are added to the output. In runtime, it can be set only before sending any output.
Seems pretty straightforward, except that enabling this directive on an openSUSE 10.3 server (and an openSUSE 10.2 server) resulted in a bunch of gibberish as output. Meanwhile, the compression worked just fine on my MacPorts-enhanced MacBook.
After flailing around on Google and php.ini, I eventually eliminated SSL and the firewall as reasons for the problem. During this process I wasted a good amount of time on this bug. Basically, the docs say that you can set zlib.output_compression in your script at runtime, but in reality it doesn’t work.
I finally got down to business with Live HTTP Headers and figured out that enabling zlib compression on my openSUSE servers certainly compressed the content, but did not send the requisite “Content-Encoding: gzip” response header. Sending the header manually within my script (e.g. header("Content-Encoding: gzip");) would correctly turn the gibberish into uncompressed form.
Having already spent hours mucking around with this, I went with a quick and dirty solution:
ob_start('ob_gzhandler');
echo $page->toHtml();
ob_end_flush();
I hunted around Google for this problem, but only found PHP4 references from years ago. Maybe it’s time to ditch openSUSE on my servers… Ubuntu LTS might hit the spot.
December 9, 2008, 1:51 pm
These past few years I’ve been frustrated with the media players that modern Linux distros have been pushing. I have my music organized nicely in a familiar directory structure and I usually just want to play an album. I don’t want to import my music, download cover art, do CDDB lookups, or otherwise integrate my audio into some big iTunes clone.
All I want to do is: 1) browse to directory and 2) play music in directory. Yes, the abstractions/features that iTunes clones offer are cool and useful, but I want simplicity on my Linux workstation. I’ve wrestled around with Amarok and Banshee, but generally end up getting annoyed. I don’t know what happened to XMMS, but when reading Linux Journal I saw a screenshot that contained an Audacious window – the look/feel appeared identical to XMMS.
Grabbing Audacious from my package manager, it’s obviously a fork or evolution or whatever from XMMS. Finally, I’m back to my simple music player.
Browse to directory. Play directory.
November 19, 2008, 1:12 pm
While I run Linux on the servers and IT workstations, I’m always looking for opportunities to deploy the OS and FOSS in general in a “user” context. I’ve made three attempts that all failed:
- The Web Browser: after an employee got some annoying Windows virus, and I was unable to reinstall due to some licensing problem, I finally stopped running in place and installed Ubuntu. This was the perfect opportunity as this employee primarily works through a web browser (Firefox, no less!). Turns out that the website that works with Firefox on Windows doesn’t work on Linux – not with Firefox… or Opera… or any other browser I tried. Yeah, the problem is probably due to some stupid crap that the website is doing, but this was one case where I was sure that Linux would work out. He still uses the machine from time to time, but it’s supplemented with his Windows laptop.
- The Scanner: an older scanner/copier/printer needed a computer attached to it. Perfect for Linux!, I thought, until I discovered that SANE couldn’t deal with it. No problem, I had a newer color scanner that should do the job… SANE didn’t support that either. And so off went Ubunutu and on went WinXP.
- The Office Suite: did a WinXP install for someone, knowing that they’d probably need some Windows-only apps. Having had some success showing OpenOffice.org to my girlfriend, I figured I’d install that instead of MS Office. After explaining to him that OOO is compatible with MS Office, the guy gave it a try. A week or so later, he said he was just more comfortable with MS Office and wanted to ditch OpenOffice.
It’s all pretty discouraging. In situations that seem ideal for Linux, in the end I’m forced to use Windows. Though to end on a positive note, I will say that I’ve had nearly global success employing Firefox and Thunderbird.
November 12, 2008, 1:42 pm
Using the spoils from the 2007 holiday season, I built a solid workstation/gaming system that has carried me through 2008. The vital statistics:
- AMD Athlon 64 X2 4800+
- 2 GB RAM
- GeForce 7600 GS (512 MB)
- Dual boot Ubuntu (64-bit) / WinXP
- Two 19″ CRTs
A few months ago I bought a MacBook Pro that currently has these main features:
- Intel Core 2 Duo (2.4 GHz)
- 2 GB RAM
- GeForce 8600M GT (256 MB)
- Mac OS X 10.5 with openSUSE 11.0 running in Parallels
- 15″ LCD (1440 x 900)
I am comparing these two, thinking about how much I love using my MacBook, and wondering why I am bothering to keep the desktop running at all. I almost never play Windows games, I’ve just now ordered a 22″ LCD to get dual-displays with the MacBook, and with just a little effort I could get OS X talking to the more “Linuxy” features of my network.
I think it’s time to go all out with the MacBook Pro. I’ll see if I can handle the annoyance of having to plug it in to a makeshift docking station. I’ll experiment with getting my development tools running in OS X (emacs, Eclipse, Apache, PHP, etc). It’s time for change. Yes we can!
July 12, 2008, 11:13 am
I recently had need to move my email from a VPS to my DreamHost account. I thought I could simply use Thunderbird to copy the folders, but that process didn’t work very well. The DreamHost wiki has an article about importing email, but I wanted to jot down the specific steps. The key was to use imapsync.
# SSH into your DreamHost shell
wget http://www.linux-france.org/prj/imapsync/dist/imapsync-1.255.tgz
tar zxf imapsync-1.255.tgz
cd imapsync-1.255
./imapsync --host1 mail.oldserver.com --user1 theoden --host2 mail.newserver.com --user2 'theoden@newserver.com'
# rerun the above command if the process dies (had to do this like 10 times)
# you'll know it's complete when you see a table beginning with "++++ Statistics ++++"
A few notes about this process:
- In my case I was moving mail to the same domain name (i.e., mail.example.com to mail.example.com). Obviously mail.example.com only points to one place, so I used an alias for the old mail domain; an IP address would probably work as well.
- Note that with DreamHost you need to specify the full email address as the username.
- You may have to subscribe to the sync’ed folders before they’ll show up.
- Thunderbird seemed to lose track of my Sent folder after I sync’ed. The Sent folder was present and explorable, but did not have a special icon associated with and sending mail would result in an error about being unable to copy to the sent folder. The problem seems to have gone away once I set the “Maximum number of server connections to cache” to 1.