Thursday, November 5, 2009

Xubuntu 9.04 running smoothly on a 1999 iBook

My friend Shaun gave me an old iBook to play around with, and after messing with it for about a week, I gave up on it. It was incredibly slow, especially with networking. I looked online and did lots of optimizations, and got it to run a bit faster, but it was just painful to use. Since I didn't have the OS reinstall CD, I figured I was out of options.

About a month ago, I started playing around with Linux, and am really getting into it now. I did a few searches and found that there's PowerPC builds of Ubuntu. Given the modest hardware specs (300MHz G3, 192MB RAM), I decided to try Xubuntu 9.04 (alternate install). Xubuntu doesn't have all the slickness of Ubuntu, but it usually works really well on old hardware (I've got it zipping along on an old 700MHz PIII box w/ 192MB RAM, that functions as my DVR (using Mythbuntu)).

I'll give a rundown of the problems I encountered below (mostly related to the iBook itself, not Xubuntu), but the bottom line is after ~3 hours, I have a very decent-performing and very usable laptop now.

Problems
- The CD drive wouldn't recognize a CD. I reset the PRAM and shot come compressed air onto the laser. Holding the "C" key down on boot still didn't work, but holding the "Option" key down gave me a boot menu - the CD took a while to show up, but it eventually did.

- The battery wasn't holding a charge. There were two problems here - the power cord was a bit frayed and had to be positioned just right to work (temporarily solved with electrical tape), and the PMU needed to be reset.

- Wireless wouldn't work. Wireless issues Ubuntu turned me off of Linux two years ago, but I was hoping that since this was a PPC build, that they would have the Apple Wireless stuff figured out. And they do, except that Xubuntu didn't support the wireless encryption scheme I was using. Fortunately, this was an easy fix - just install and configure wicd (it's in the repositories - no need to download it from the web site).

Done - working laptop. I kind of feel bad having deMAC-ed a Mac, though (I was a HUGE Mac fanboy back in the day). Maybe I'll put a dock application at the bottom of the screen as an homage :-), or just go all out and do this.

UPDATE: Just found this helpful link that lists all distros that support the PowerPC architecture:

Wednesday, September 30, 2009

Moving to Linux, at least temporarily

Something was up with my Windows install, and for the life of me I couldn't figure it out. The sound was very choppy, Windows startup time and Internet browsing were incredibly slow. I ran every virus/spyware/malware scanner I could think of, cleaned the registry out carefully with CCleaner, reinstalled my sound card drivers, removed always running apps that I didn't need, defragmented the hard drive, defragmented the page file and registry hives, etc, and still had the same problem.

About to reinstall Windows XP on my 10-year-old computer, I decided to give Ubuntu another shot, pledging to boot only Ubuntu for a week, and attempting to fix whatever issues came up. I had tried it at v7.04 and was generally impressed, but eventually scrapped it mostly because Windows was working fine for me, my Digital Audio Workstation wasn't supported, and there were no "killer apps" I could think of to keep me on Linux.

So I installed Ubuntu 9.04, and was about as impressed as I was with 7.04. I worked through a few initial issues, but everyone in the forums I was reading said something like, "[whatever issue] isn't a problem on Linux Mint". After reading that for about the 5th time, I decided to make a Live USB of Linux Mint 7, and was completely blown away. Pretty much everything just worked out of the box, and the interface looked absolutely stunning and more user-friendly. What really sold me, though, was that it was based on Ubuntu 9.04, so it's got lots of built-in support.

So I wiped Ubuntu and installed Mint, and mostly haven't missed Windows at all. I still do have a full-screen video issue using the generic video drivers - the "nv" drivers work, but only give me a resolution of about 320 x 240. UPDATE: Installing the latest nv driver fixed this.

Most of the programs I want are available on Linux - Firefox, Photoshop (via Wine), Picasa, and Netbeans, mostly. But I can't find a DAW that supports MIDI to work. I spent quite a bit of time reading up on this, and it looks like I need a realtime Linux kernel, which can be installed with apt-get, but it seems like nobody can get it working with Linux Mint. I did find this video, but it looks very complex (though promising). I've got to spend a lot more time with it, but I may just set up a Windows partition with only my DAW on it.

The "killer app" for me so far is not having to really worry about viruses, spyware, etc. nearly as much (the computer is used by a number of people). I do have ClemAV running now, and am looking into whether or not I need more protection, but I like what I've read so far - that Linux out-of-the-box is leaps and bounds above Windows in regards to these things.

And my son LOVES the Linux Education games - GCompris and Childsplay. To my surprise, he was WAY into the Childsplay letter finding game, which is great because he's working on his lower case letters now. I can't wait to hack these games a bit and put in some customized graphics for the kids.

Friday, July 10, 2009

Quick SQL --> Excel export w/ column names

I know there's lot of ways to do this, including an SSIS/DTS package, but here's another quick way I pieced together for ad-hoc exports with that I haven't seen outlined before:

1. Run the query in SQL Server Management Studio (w/ "Results to Grid")
2. Copy all data from the grid (right-click on the unlabled box at the top left of the grid, choose "copy"), and paste into second row in Excel.
3. Back in SQL, run this query:

SELECT sc.name
FROM syscolumns sc
INNER JOIN sysobjects so
ON so.id = sc.id
WHERE so.name = '[table name]'
ORDER BY sc.colid

4. Paste the results into Excel in a new sheet.
5. Copy the row, then "paste special" --> "transpose" into the first row in the original worksheet, so that they paste as columns.

This will probably break down for very large tables, but I just did this with 96 columns, and 10,000+ rows without issues.

Some more ways to accomplish this:
http://www.mssqltips.com/tip.asp?tip=1202

BTW, not sure why there's not a "Results to .csv format" in SQL Server Management Studio. "Results to Text" seems rather useless...

UPDATE: Dave Kearns points out an even easier way to do this:

In SQL Server Management Studio, go to "Tools" --> "Options" --> "Query Results" --> "SQL Server" --> "Results to Grid" --> check "Include column headers when copying or saving the results"

Friday, April 17, 2009

Forcing label values to be displayed to the right of a bar (ASP.NET 3.5 chart control)

As I've previously written, the new ASP.NET 3.5 chart control is great. However, a minor thing that doesn't work well is displaying value labels for bar charts. It displays the value to the right of the bar except for the longest bar when it determines that it wouldn't fit within the scale. So, if you have a bar with a value of 98, and you have your axis interval set to 25, it will display "98" in the bar. This doesn't necessarily look good, depending on what color the bar is, and it is also inconsistent with the other bars.

Here's my solution (C#):

Chart1.DataBound += delegate(System.Object o, System.EventArgs ea) {
double longestBarLength = Chart1.Series[0].Points.FindMaxByValue().YValues[0],
padding = 10d,
roundedUpBarLengh = Math.Ceiling((longestBarLength + padding) / 25) * 25;

Chart1.ChartAreas[0].AxisY.Maximum = roundedUpBarLengh;
};


I'm determining the longest bar length w/out looping thanks to a nice built-in function "FindMaxByValue()" which gets me access to the DataPoint object with the largest value, and I'm just grabbing the Y Value from it (in my case, there's only one Y value).

Then I specify a set padding to make room for the value label to be displayed on the right side of the bar (10 seems to work well for numbers in the 100's at least). Lastly I'm pushing the value whatever the longest bar length is to the nearest 25 and setting the axis max value to that number.

This all needs to be done after the data is already there, obviously, so this is all wrapped in the databound event handler.

I'll add pics later.

Thursday, March 26, 2009

Great .NET 3.5 Charting Control from Microsoft

I don't know how I missed this when it was released a few months ago, but this control is awesome - it generates very professional-looking charts that you used to have to pay hundreds of dollars for, and it looks just as good as the best charting tools I've seen.

The organization scheme seems a little convoluted to me, but it probably just seems that way because I was just trying to do a simple 3D bar chart, and the scheme is set up to allow a very high level of customization. I also ran into a few web.config-related snags while getting my code up and running, but nothing that I couldn't fix within a few minutes of searching the web.

Example screenshots and everything you need to get started are here.

Wednesday, February 18, 2009

Interesting SAP JCo error

Exception Details: com.sap.mw.jco.JCO$Exception
Type conflict when calling a function module (field length).

Possible Source of Error:
Class Name: com.sap.mw.jco.rfc.MiddlewareRFC$Client
File Name: MiddlewareRFC.java
Method Name: nativeExecute
Line Number: -2


Line Number -2? Those SAP guys sure are tricky with their coding before the file even starts.

BTW, SAP JCo is a major nightmare to get working. If somebody brings you a JCo project and says "this should be easy", my advice is to run away as fast as you can.

UPDATE: I solved this problem, no thanks to the error message. I was trying to pass in a field as an Export instead of an Import. Which makes perfect sense, expect the original VBScript/COM code that I am re-writing this from uses the call "[function].Exports()" for an import (and the code works!).