Friday, October 16, 2009

iPhone OS3.1 ruined my iPhone

I can't believe after so many good things with the iPhone os3.1 has totally ruined my iPhone to the point where I am considering selling it as soon as any decent alternative exists.
I'm too angry to provide to many details, and the disgust is all over the Internet.
Battery life.. great sucking sound. Doesn't get recognized by iPhoto anymore.
Itunes account, messed up, can't upgrade any apps because it iTunes doesn't "respond".
Data connections drop all the time. The phone hangs on phone calls now too.

The Apple puts out 3.1.2. So far it has solved none of these problems.

Whatever you do, do not upgrade to this release.

Sunday, June 14, 2009

IPhone 3.0

I'm typing this on my iPhone 3G with 3.0 on it. It's working pretty good so far. Ok I love it. This is way late, so I'm just pressing send - New one shipped today, comes tomorrow!

Horizontal keyboard in email is great, along with email search. Features long overdue. The spotlight all phone search is better than I thought too. It searched contacts and all my email as well app names etc. Everything worked as expected except for a few applications.
I did upgrade early so hopefully moat of these things will be fixed by Thursdays release.
The first killer was etrade pro didn't work but they put out an update and that's working now.
Skype called out an os error and didn't seem to work.
Camera zoom just crashed when opened. That was a bummer too.

Text free is having crash trouble but has worked a little. (Updated: They released a new version and its working great with push service, no more receiving the emails.)

Several games just don't work anymore. Still waiting for updates on those.

Wednesday, May 20, 2009

select field with default value in rails

I wanted to make a select box from a list in the database, and I wanted the default value for a field to be the person logged in. Should be simple and it was, but the api didn't have any example, so here is what I used.
I'm using form_for so my code was different than the docs too, maybe this is in there somewhere..
<% form_for(@task) do |f| %>
<%= f.label :user_id %>
<%= f.collection_select(:user_id, User.find(:all), :id, :name, {:selected => session[:user_id]})

If there is a better way let me know.

Tuesday, May 19, 2009

Rails - Dealing with nil in views

I've been working on the task management application and after creating my initial databases and views started to make the UI more friendly. Each task in the application has an owner. I'm doing this with two tables, one called tasks and one called users. The task table has a reference to the user called user_id. When you pull the task index view you end up seeing the ID reference instead of the person's name. That's not too helpful.
My first attempt was to put code like this in the view:

in view/index.html.erb


Owner:
<%=h User.find(@task.user_id).name %>



The problem is when the user_id doesn't have a value or the value is not valid. Lots of ways to solve this, like add a validation when a task is created that says it exists, but what if you want to make the task but don't know who should own it yet? And what if you delete a person, because they leave the company. Need some routine to reassign their tasks. But in any case, index shouldn't crash.
My first thought, and I think a bad one was to put exception logic in the view. As soon as I started typing, I knew that was bad.
So I came up with this simple solution in the model:

in model/task.rb
def owner
begin
User.find(self.user_id).name
rescue
"None"
end
end

Regardless of the reason for the crash its caught and index will keep working. It doesn't depend on other routines to make sure this piece of code doesn't fail. Best of all, you could write a test on this too. Not a big deal here, but if it got more complex you might want it.
The view is much more readable like this:
<%=h @task.owner %>

One last thing I think I should do is log something in the exception. That assumes someone would notice a problem in the log, but its not a bad practice.

If you have a better way to resolve this, let me know.

Saturday, May 16, 2009

New Project

I've tried basecamp and actionmethod and these are pretty good tools. They are free and you should check them out. I use Microsoft project every day. Its not a good tool. I hate to say that, but its just a pain. There are other tools for sprinting all that, which are neat. If you have a good one, let me know, but either way, I'm writing a new one. We aren't selling tool, but it needs to do some things we want to do - basic stuff.
We want to track tasks, but we also need to report on tasks for the project. Actionmethod didn't have the team reporting we wanted. We also need to track the time spent on each item. The time reporting key for us. Basecamp had most of the features we wanted, but didn't have the time reporting. We looked at time reporting tools, but they were focused on tracking time and reporting it, but not really the task management.
The final straw was when using MS Project I tried to sort a plan by start date. Couldn't make it work in MS Project 2003. We have groups of tasks, that have summary tasks and a few columns of data. The report features in MS Project kept pushing the print out to two pages side by side. That is too much of a pain too. But the big deal was the sort was actually wrong. The summary tasks kept creating problems.
We just wanted an easy way to log in and see, what work do I have to do today. Then for the manager, what work got done this week and what is not getting done. So we can communicate with clients who might be impacted. Of course we need to bill hours so we need to track the time and we want to be able to analyze the time to make better estimates next time. Sounds so simple.
If you have a great tool for this, let me know. For now I'm building one in Ruby on Rails, I'll let you know how it goes.

Wednesday, May 13, 2009

Upgrading Ubuntu 8.10 to 9.04

I finally pressed the button. It kept calling to me day after day, upgrade available. Finally I pushed it. Everything was running great in 8.10, so I'm not sure what I really hoped to gain, but two things that I wanted were OpenOffice 3.0 and better dual monitor support. Things I could probably live with out, but I did it anyway.
It really did seem to go well. After the reboot the system came up, just like I expected and I was off and running. I quickly installed CouchDb using apt-get which I'm not sure was available in 8.10. It might be, but its not in 8.04. That's another story.
I went to use Skype today and no mic. ouch. I haven't found the fixes yet, but when I do, I'll try to post them here.
Other than that, seemed to be so painless, I hardly noticed the change.
If you read this, let me know your favorite features in 9.04.

Saturday, May 9, 2009

Pentaho Kettle doesn't cut it - update

Admittedly I'm a Pentaho newbie, trying to evaluate the software and to some 'simple' tasks. The demo's and samples worked well, but the put the test Kettle just didn't add enough value as an ETL to warrant its use. To be fair, I have used WebMethods and some other tools but have usually found it more simple to just write the code. There always seems to be something unique enough that the tool just can't handle where writting the code work, or worst yet a defect that you can't work around.
In the case of Kettle, I just have a problem I can't work around. Its open source so in theory I can debug the original code and create a patch. Unfortunately I was trying Kettle because I thought it would be simple and I was in a hurry. So I don't have time to debug at that level, since writing the code might take as long as writing the blog entry. Because I didn't buy the Pentaho version, I don't have a support option.
Here is what I wanted to do. Open a file that included a single string that was compressed with gzip. That string contained XML and I wanted to put that XML into a database. Seemed simple. I used the load file and gzip decompress, did a preview of my decrypted string and seemed to look good. I had to sent it to Javascript to make a modification to the XML before I could parse the XML. That is where the trouble started. The resulting string was not whole, it had parts missing. I couldn't figure out why, but Kettle is truncating my string at 4600 char when it really has closer 8600. I tried setting the length of the field to 10000, but that did not work. I gave it 4 hrs of debugging and some time on IRC but there is no obvious solution yet.
Reading the 'documentation', I use that term loosely, did not help with this problem. In fact even for open source documentation, there were a lot of issues. I understand that the wiki is going through some changes, so stuff is moving around in an attempt to make the documentation better. Clearly the code is moving faster than the documentation. So for now I'm going to post the issue to the forum, and write my own because I have a job that needs this done!

Update:
I wanted to update this post based on what I did to resolve the issues I was having. I did join the IRC Channel, which I would recommend, but that did not solve the problem. The string problem so far as I can tell is truly there. What I did to solve my particular challenge is make the make the XML well formed via a bash script before loading it into kettle and then use the XML input functions. That worked like a champ in under 5 minutes. That said Kettle was easily able to deal with the XML and create the output I wanted.
Looking forward I will continue to work with the Pentaho toolset. Hopefully the work on the documentation by community will continue to pay off for the tool. I have for my part tried to update the Pentaho wiki when I could. I will continue to do that when I can, or post what I can here. This is not a simple project to document, it changes quickly and getting started is considerable undertaking.
To summarize, I'd say if you are working on a straight forward task the tool performed well. The debug features and the documentation are two areas that require improvement in order to be commercial class tools in my opinion. The debug features and improvements would probably be the most helpful if I had to prioritize them.

Tuesday, February 17, 2009

Dashboards (CDF) with Pentaho

My first day trying to make a dashboard with Pentaho. There is a lot in this project and the documentation could certainly use some work, even from just navigating it. The IRC group ##pentaho has been extremely helpful in getting me started.
Before you start you need the Pentaho bi-suite installed and working. I'm using version 2 stable on Linux.
Then you download the CDF. That link goes to the wiki and has a link to the download. There are directions to use the installer, which is a jar file. Stop your server before you start this process.

I did the java -jar CDF.installer.jar and followed the directions.

When it asks for your solution directory, they mean pentaho-solution directory.

It says you finish and you restart the server. Then log in to localhost:8080 and you might see the CDF directory available in the browser on the left of you web browser window. I did not.

What I to do was go to the tools menu -> Refersh -> Refresh data sources.

Then everything showed up for me and I could run the examples.

Let me know if you start using CDF.

Thursday, February 12, 2009

Dual Monitors with Ubuntu 8.10 and nVidia 9600GT - Sweet

First thing, it does work. I say that because it was touch and go for a while. It took 12 hrs to get this working, so get some coffee and plan to be really persistent before you even think about it.
Second - It could go super easy, but it might not. So back up your xorg.conf before you start. I know that would stupid to say - because I didn't! I'm all in but you might want to think twice about it.
My goal was to get my Quad running 8.04 with 4GB ram running dual monitors - Viewsonic widescreens.
If you are going to try this make sure you follow the directions that fit your hardware and distro. I saw a lot stuff about compiling everything, and that was old and not needed.
I got the card, put it in and tried to boot up. I got a nice black screen, so it didn't start off well. I was on 8.04 at the time. I tried installed the nVidia drivers via ssh and followed the instructions, but it just wasn't working. After a few hours, I gave up and did an upgrade to 8.10. That took a couple of hours but went smooth.
Then I did the reboot and up came failsafe mode or 640x480. This time I could follow the normal 8.10 directions. Go to hardware drivers and select the proprietary nVidia driver 177 I think was recommended and I took that one. I restarted X but still 640x480. I rebooted :) still 640x480. :(
I ran dpkg-reconfigure xserver-xorg a few times with and without -phigh. Don't do this, that will never work. I found that it drops a vanilla xorg.conf onto your machine and doesn't specify the driver as nvidia with the a bus entry - you don't need to know this if you don't do it. If you did do it, go back to the version that was installed with the proprietary drivers.
I went into xorg.conf and deleted all the lines that set the resolution to 640x480 and restarted X (ctrl-alt-backspace). Wham it worked. It restarted with one monitor in 1680x1050. Then I had to open nvidia-settings.
Do this from the command line as sudo or you can't rewrite the xorg.conf file.
Once I did that twice, I was able to just select the second monitor to activate it and it defaulted to 1680x1050. I hit save and was a afraid to touch it anymore.
First impression is the card was great, X performed so well, I was surprise. As good as using my MacBook and a second screen.

Couple of things I still need to do:
1. Turn on Compiz and see how it goes.
2. My background was stretched across both monitors and I don't like that.
3. I think I need to fix my Xvnc, that seemed to stop working.
4. Onc LCD shows as a CRT. I think that is affecting the brightness. Not sure why that's wrong.

On the plus side, I'm not using the IBM on-board graphics card anymore and that freed up an mtrr which you only get 8 of and I kept getting warnings about being out. Then I only had 1M uncachable entry. It didn't solve my memory problems, but its an improved situation.

Looks cool too.

Saturday, February 7, 2009

Ubuntu 8.04 remote access from MacBook

I wanted to get into my Linux box from my MacBook. This solution should work from other computers as well.
On you linux box follow the directions here.
Pretty basic and I did them remotely from mac over ssh.
One thing is for the MacBook you should change the resolution 1024X768 to 1280x800 and then you can use fullscreen mode. I'm using it now to type this blog. This was done in the Xvnc file you created in the docs above.
This runs over ssh. They don't really tell you how to do that on Mac, they give the Putty Windows instructions.
Its just a simple tunnel:
ssh -L 5901:localhost:5901 username@host.com

Then I used Chicken of the VNC which I had already downloaded. You just connect to localhost. Then it will get forwarded via ssh to your server.

Gnome crashed for me on my first login. I created a new remote login and then loaded
gconf-editor
from the shell. I had to go in their to apps/gnome_settings_daemon/plugins and made the mouse and keyboard plugins inactive.
I did this on a new login, becuase i didn't want to mess with my existing. I also wanted to tweak some settings, like a basic color background and no theme. This way I could turn off any animation etc that would just slow down vnc.
This change stopped the crashing and system has been working well. I made one last change, I went in to the login window settings and under the remote tab, I set it to be the same as local.
Would I wan to do this all the time, probably not, but it is certainly functional as I have had no trouble writing this blog over a remote vnc session.

Good luck

Fixing xvidcap crashes on Ubuntu

Using xvidcap from the Ubuntu repository doesn't seem to work too well, at least for me. The version in the package tree is 1.1.6. That version would never achieve the frame rates I wanted but even worse it crashes all the time. It was crashing within 5 secs some times. Hardly enough time to make any type of video. I think I have it working on my machine now and I thought I would share what I did.
I did search the repository for updates, but for 8.04 1.1.6 is the latest. I found the 1.1.6 is the latest for 8.10 too. I was looking for an excuse to upgrade, but this won't be it.
I also found that others were having this problem on Ubuntu and that in theory there was a fix in 1.1.7. When I went to sourceforge I found 1.1.7 was there and .debs existed. I didn't mess those and just got the source. At the end I created my own .deb. I got the source because its a video based app and I just wanted to do it. If you try the new .deb and it works, let me know.
I'm going to assume that you have build-essentials and checkinstall as you would to compile any programs on Ubuntu. That's all on Ubuntu's site.
I download and unpacked the source. tar -xzvf xvidcap-1.1.7.tar.gz and cd to the new directory.
Then I ran configure like normal with these flags.
./configure CFLAGS="-march=native -O2 -pipe" MAKEOPTS="-j5" -prefix=/usr
You need gcc 4.2 or higher which is on Ubuntu 8.04 to use the -march=native. Basically it will pick the best opts for your architecture, which wasn't that hard, but this is easier. I went with 02 hoping for better performance. My guess is that it would have already been compiled with this by default but I'm not sure. I have a quad so I used -j5 or cpus + 1.
When it was done I still did a make -j5. It compiled so fast I thought it didn't work.
When I tested it in src it didn't work. I wasn't happy, but it looked like a path problem looking for a shared lib, so I did the install anyway.
I ran sudo make install and all went well. I tested the program and it was working well. Better than I expected using mp4 DIVX at 24 fps and getting them all. My test was capturing a youtube video playing on my screen.

When that was done I still ran

sudo checkinstall -D make install

which reinstalled and made the .deb package. xvidcap 1.1.7-1 is now showing in my Snaptic package manager so I can uninstall it if I want later.

I think you can run checkinstall before the sudo make install and then run dpkg -i package.deb but I have never done it that way. maybe some day. Anyway xvidcap 1.1.7 is running on my Ubuntu 8.04 very well as far as I can see.

BTW - I was not using sound capture.
Good luck and let me know if you have success or failures with this.

Friday, February 6, 2009

Running Visual Studio and Vista on Ubuntu



I installed Virtualbox today with Vista. It installed by following the basic instructions with no issues. I am using the binary edition for personal use only. I simply added their source to my apt/source.list and installed virtualbox-2.1. Created a new virtual machine and put the Vista disk in my DVD. It all loaded just like a fresh install. I did make the mistake of not making my hard drive big enough, so I'll have to reinstall to get to use the new larger drive. You can't make the drive larger later.
Once I loaded Vista, I was able to turn on 3D support for my video card and networking worked right away. The screen resolution was bad in the beginning but I followed the instruction to install the additional tools and I could resize my screen as needed. I included a screen shot using the seemless mode, where the Vista and Linux windows appear side by side.
My only disappoint was in the seemless mode alt-tab uses either window or Linux but not both. Hardly a great complaint. At this point I was just pretty happy that it was working. I only set the RAM at 1024 Meg which I thought would be to low but it wasn't. You can change this later, so that's not too big a deal.
Seemless mode was interesting but the system performed better when in windowed mode. So while it looked neat to try out since alt-tab doesn't work, I might as well have a desktop and the window performance.
For a free tool I thought this was great. The personal use edition has a few features I still need to try. They say it will load VMware VM's. I couldn't get that to work with an older W2K VM I had. They also say you can install the 64-bit version of an OS as a guest on a 32-bit host to try it out. So you know I have to install 64-bit Ubuntu this weekend!

mod_rails on ubuntu

It didn't take too long but I did get mod_rails running on Ubunutu 8.04. The instructions on the Phusion site are adequate and don't need to be repeated here, but a few things are left out that I got a little hung up on.
First for Ubunutu the configurations typically go in etc/apache2/conf.d, so I created a new passenger.conf and put in there the LoadModule and other directives they said in the install script. Then I thought I was ready to go, but it didn't work.
I was converting from Mongrel and had proxy statements left over in my virtual host config. I took these out reload and the site came up, but I couldn't log in.
One last item to note. I couldn't connect to my database. I noticed rails was logging to production and not development.
In passenger.conf I added a line to set RailsEnv development. Just add that to the bottom of the config if this is your dev box. For your production box, the default is production but you might want to set it to be clear.
I ran my first load test on our application and I was impressed. The application is serving as many transactions per minute as with mongrel it takes up some memory pretty quickly to do it, but it does release it without crashing the server and that is good thing.

Skype on Linux

I was using Skype on my mac because it had a microphone and cam built in but it was getting sort of anoying to be on my linux desktop and need to have my laptop to skype, so I broke down and got a logitech headset for use with Skype on Linux. Skype started like a champ. I added the skype repository to my apt-source in etc so I could just use apt-get to do the install and get updates.
My skype out call went pretty good except I noticed the mic volume was low. I thought it was Skype but it was a simple fix.
I opened gnome-volume-control from shell or double click the volume settings. That opens the control panel. On mine microphone was not on there. I had to go to preferences and add microphone and also add Mic Boost. Then I could adjust those just fine. Not a skype problem at all.

Thursday, February 5, 2009

Mongrel 1.1.5 on ubuntu 8.04 and rail 2.1.1

We host our production environment using Ubuntu 7.04 and mongrel 1.1.4 for our Rails applications. We setup our test server with Ubuntu 8.04 and mongrel 1.1.5 and noticed the server was crashing all the time. As I started to dig into this, I noticed that mongrel was chewing up all the memory with haste. We then turned off all the rails apps and just let mongrel go for a couple of days. It ate up all the memory until it killed our VPS. If we shutdown mongrel all the memory comes right back. Just to repeat, this application has no usage. The ports are not even open. Its just a rails stack with Mongrel running and its eating all the memory. So when the guys online tell you its not mongrel, don't believe it.


So I started working on some upgrades to make sure we were at the latest versions.

I updated Ubuntu first by doing a simple:
sudo apt-get update
sudo apt-get upgrade

We did have several packages that needed to be upgraded. This ended in ruby being at version:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

Then I needed to upgrade rubygems from 1.2.0 to 1.3.1
I couldn't use
gem update --system
I used these instead:
sudo gem install rubygems-update

sudo update_rubygems


Mongrel 1.1.5 is the latest gem I could see but I did a gem install mongrel just for fun. It recompiled and installed 1.1.5

I then did:
gem install rails
That brought me to rails version 2.2.2.
I next did a gem update for the rest of the gems. I wasn't really interested in doing all of those one at a time. There were quite a few. They shouldn't matter, because the application is not getting used at all. But if you want to see here is what was updated:
Gems updated: RedCloth, ZenTest, net-ssh, capistrano, columnize, fastercsv, highline, rubyforge, hoe, libxml-ruby, memcache-client, net-scp, net-sftp, net-ssh-gateway, packet, rmagick, ruby-debug-base, ruby-debug


To start my simple scenario I started two mongrels and let them sit. After mongrel was started the system had 102,260K free with both mongrels taking 9.4% of the memory. Now we wait.
At 1 hr of no usage we are down to 100,028K of memory. The question is when will it stop? The answer that is usually prescribed is to use Monit and kill the mongrels and restart them. No problem. I prefer to not think restarting a process is a solution to the problem, while its a fix, its not ideal.

Update: At the end of day 1 memory is now at 31456K. Now killing process.

My answer for right now is to switch to mod_rails. mod_rails has been shown in performance tests to beat 10 mongrels. I'll let you know the process to get rid of Mongrel. I understand that 37 Signals has now switched to mod_rails as well.

Let me know your experience with either of these tools.

Wednesday, February 4, 2009

Hello World

I really just wanted to start recording my usage of Ubuntu, OSX and my iPhone. Much of the content will be so that I can remember what I did, and hopefully I can give a little back to community which has helped me so much.
I think it is important when discussing Linux to make sure you are aware of the physical setup of the machine, because your mileage can vary with Linux and different hardware. Currently I'm running Ubuntu 8.04 on Intel Quad with 4GB. I boot from a SATA drive but also have software RAID 5 that I used for a long time before SATA drives were invented. I use a TV card, but because I have ATT cable now I can't get any basic channels as of yet. I'll be trying to figure out how to do this again. I recently purchased nVidia 9600GT to run my dual display. I'll post my experience getting that to work. I made a classic mistake and bought a Lexmark printer before checking online if I could use it with Linux. I can't. But it works with my mac just fine, probably have to figure out if I can share that in some way. I normally only buy HP because of their support for Linux but my last HP broke in just over a year and was hardly ever used. That ticked me off so I have a different brand now.
I think a site that basically listed the ideal hardware maybe configurations of that hardware for Linux would be great. Maybe people could upload their configs, their distro and any issues they had so that buyers could easily buy the right hardware. Links to online shopping might help fund the hosting of the site.

I'm currently working on a few projects. I am installing and working with Pentaho as an end user tool. I'd like to find some contracting work with Pentaho in the short term. I'll also be setting up VMWare as soon as I get an XP license. Sadly I have two in use, but need another one. I have an extra Vista license, but I don't want to use Vista. I'll be using some video and graphics software on Linux to see how those projects compare to my OSX versions.

In general, I'm a Unix guy. I have well over 10 years of experience compiling kernels but at that point its time to stop counting. Gentoo is my favorite distro. Unfortunately, it really fit my needs as a hobbyist but I could no longer justify using it for my production work environment. It has turned out that it is just easier to support Ubuntu and Ubuntu has run very well for us in production. Their desktop version is great, its a breeze to install and maintain. Then we deploy to the server version and everything is usually the same. I use my Mac as my family computer. My loves it, and its easy to support at home. Some of the developers use OSX for development as well, and I do sometimes. We have not had issues developing on OSX and deploying to Ubuntu yet. We have been writing Rails application primarily and have some PHP and Java work. As work on those projects I may write any articles that took me some time to figure something out.
I love my iPhone. I didn't think I would like it this much but I do. I want a ssh client to connect to my Ubuntu server for those crunch moments. Its a great phone. Nothing more to say about that.
If you have some Ubuntu questions or interesting topics. I'll see if I know the answer, just leave a comment.