Posted by Nicholas Rahn
Wed, 23 Aug 2006 10:03:00 GMT
Work on the next version of Grism is proceeding nicely. It has been a while since the last version (v0.7.1 came out in May), but I have not been completely dormant during that time. :-)
The bulk of the work on the upcoming version (to be numbered v0.8.0) is being done on the portfolio. I am adding a “cash” line so that you can track not only the stocks you own, but any uninvested portion of your portfolio. You can deposit or withdraw from the cash pool using a new “Cash Management” dialog, accessible from the portfolio’s menu-bar. Additionally, when adding (buying) or removing (selling) a stock, the amount of the transaction (value of the stock and transaction fees) is subtracted or added to the cash pool.
There are a number of other, smaller changes in the upcoming version. Lots of small bugs have been corrected and many interface niceties have been added. Among the most interesting is the selection in the “folders” tree (tree view of watchlists and portfolios on the left-hand side of the interface). Now the selection can not be removed (something must always be selected) and it should behave better when “Watchlists” or “Portfolios” are collapsed.
Finally there have been a large number of changes under the hood. Most notably is that the watchlist and portfolios are now stored in a database rather than in CSV files. When you run Grism for the first time after upgrading, the data in the CSV files will automatically be moved into the database.
The watchlist/portfolio database uses mongoose, a pure-Ruby, file based database management system. It is a bit like SQLite, in that it does not require a daemon process, but it is written in pure Ruby so there are no external libraries to install. The author has also written the KirbyBase pure-Ruby database management system which Grism currently uses to manage a stock’s historical price data (used to draw the price chart). Mongoose is reportedly faster than KirbyBase and has an ActiveRecord like API. It is also now receiving more active development than KirbyBase. For these reasons, we will probably replace KirbyBase with Mongoose during an upcoming (but not v0.8) version of Grism.
Other under-the-hood changes are meant to clarify Grism’s internal design. A significant amount of refactoring on the class hierarchies has been done. In lieu of a design document, this should help anyone who wants to get a grasp on the code.
Future Directions
So where is Grism headed? As I mentioned previously, v0.8 will contain a number of changes to the portfolio. At the moment, I haven’t decided exactly where to stop for this version. There are a number of small things left to do that I’m pretty sure will find their way into v0.8 (remove/sell dialog, short-sell support). Beyond that, however, is the idea of an historical log of all transactions that occurred in the portfolio. Probably, part of this will find its way into v0.8, but it will only be an under-the-hood change and won’t be made visible until the next version.
Looking toward v0.9, I currently see working on the portfolio’s historical log and the move to Mongoose from KirbyBase for the historical price data. For v0.10, I was imagining beefing up the charting capabilities. There are also things such as adding (lots) more user preferences, possibly even having preferences for individual watchlists and portfolios. I’m imagining preferences for things like configurable columns, no-value portfolios (a portfolio where the value amounts were not shown, only percentages were), chart colors, etc.
But anything beyond v0.8 is really up in the air yet. If any of the faithful Grism users have any preference or ideas, don’t hesitate to speak up!
Posted in Grism, Tech
Posted by Nicholas Rahn
Sun, 20 Aug 2006 12:56:00 GMT
Seduced by the new Apple MacBook, I was powerless to resist when Firefox presented me with the AddToCart button. I configured mine with a 2.0GHz processor, 1GB of RAM and the big 120GB hard drive. And I choose white, of course. Not black, you say? Well, had I wanted a black laptop, I would have bought a Dell or a StinkPad and condemned myself to joining the uncreative horde of tech-cool wannabees. White is it. White is the way. Tech-cool, here I come!
After it arrived, it was only a matter of days until I realized that Mac OS was just not going to cut it. Don’t get me wrong, it’s definitely usable, much more so than Windows, but it’s missing things that I get without too much trouble from a good Linux install. Virtual desktops, complete keyboard (re-)mapping, standard tools like SVN and CVS, applets, and the list goes on. You can of course get some or most of these things from the darwin ports project or other open source projects, but my goal was not to learn some new packaging system and spend countless hours configuring things to my liking. My goal was to get a working development environment up and running on my super-cool new MacBook laptop. And the easiest way for me to do that was to install Linux!
So I set out to install Ubuntu Linux (my new favorite Linux distro) on my new MacBook. Since the MacBooks are Intel processor based and use newish boot loader technology, there are no Linux distros that support out-of-the-box installation. You have to get your hands a little dirty to make it work. Nothing that Gentoo users aren’t used to, but it does take a little familiarity with some low-level installation concepts. If you are not comfortable with setting up partitions, configuring a boot-loader or performing administration tasks from the command line, you should probably just stick with Mac OS.
I should mention a couple of things before we begin.
- The information here comes from a number of different sites. I used the information on these sites to get Ubuntu Linux installed and to dual-boot with Mac OS X on my MacBook laptop. YMMV. If you are going to attempt to install Ubuntu on your laptop, you should keep these two sites handy:
- I wrote down each step while I was installing on my laptop. I’m probably not as meticulous as I should be, but hopefully I didn’t forget anything important. Keep the two sites I mentioned above handy and be ready to call upon your other Linux installation experiences in case things stray from the path outlined below.
- If you are trying this install on a MacBook Pro, Mac Mini or any other type of Mac that is not a MacBook, you should look to other sites for guidance. If you are trying to set-up a triple-boot, you should also look to other sites. The Mactel-Linux site is a good place to begin for either of these situations. Even if you are trying to set-up a Mac OS X—Ubuntu Linux dual-boot on a MacBook just like I did, I don’t guarantee that these steps will work. This is just a list of the steps that I use to get things working on my MacBook. As I mentioned before, YMMV. However, at the very least, the steps below should get you going in the right direction.
Let’s install!
Backup
As with any install, the first thing to do is to backup any and all of your data. I’ve lost data to stupid mistakes before so I can tell you first hand that you will not regret taking the time. Backup early and backup often.
Get Ubuntu
Download and burn the Ubuntu CD. The ISO images work both as a live CD and as an installation CD. You should use the Ubuntu v6.06.1 LTS version as it has some improvements for the MacBook that v6.06 does not have.
Partition your disk using Boot Camp
- Download the Boot Camp Beta from Apple’s site and install it on you MacBook.
- Go into Applications -> Utilities and run the Boot Camp Assistant.
- Follow the Boot Camp instructions. You can choose the “I already have a Macintosh Drivers CD” since everything we need is on the Ubuntu CD.
- When creating a second partition with Boot Camp, re-size the partitions to your preferred size. I choose to have a 34 GB Mac OS X partition and a 60GB Windows XP partition.
- Note: the 34 GB Mac OS X partition is really about 51 GB since Boot Camp subtracts the space already used by Mac OS X.
- Restart Mac OS after partitioning is done.
Install the boot menu
- Download rEFIt. I choose the Mac disk image. If downloading did not automatically mount the disk image, do that now.
- Install rEFIt. Be sure to read the installation instructions on the rEFIt website first. Open a terminal window and execute the following commands:
% sudo cp -R /Volumes/rEFIt/efi /efi
% cd /efi/refit
% ./enable.sh
Plug-in
Ensure that your MacBook is plugged-in to your local Ethernet. Access to a wireless network during the Linux install is not supported.
Boot-up the Ubuntu Linux CD
Reboot with the Ubuntu CD in the computer. Once you are in the
GNOME desktop, double-click on the “Install” icon to start the Ubuntu installer. Follow the installation normally, noting carefully the following steps:
- Step: Prepare disk space—Select “Manually edit partition table.”
- Step: Prepare partitions—
- Delete the
/dev/sda3 partition. This is the Windows XP partition that was created with Boot Camp.
- Select the unused space and click on the “New” button in the menubar.
- Create a new ext3 partition, leaving about 1GB space after it.
- Using the last 1GB of space, create a new linux-swap partition.
- There should now be 4 partitions on the disk:
/dev/sda1 (fat32)
/dev/sda2 (hfs+)
- New Partition #1 (ext3)
- New Partition #2 (linux-swap).
- Click forward to repartition the disk.
- Step: Prepare mount points—
- Don’t mount the ”/mount/EFI System Partition” Partition 1 [sda1].
- Just select the empty option for both the Mount Point and Partition.
- This should leave you with only 2 mount points:
/ Partition 3 [sda3]
swap Partition 4 [sda4]
- Continue with the installation. It will take a few minutes.
Boot Loader
At the end of the installation process, the install will fail when trying to install GRUB. This is OK. It will say that the installer crashed. This too is OK
You should now find yourself back in the GNOME desktop environment again. Open a terminal (Applications -> Accessories -> Terminal) as we now need to do a few things by hand. In the terminal, execute the following commands:
% sudo mkdir /mnt/ubuntu
% sudo mount /dev/sda3 /mnt/ubuntu
% sudo mount -t proc none /mnt/ubuntu/proc
% sudo mount -o bind /dev /mnt/ubuntu/dev
% sudo chroot /mnt/ubuntu /bin/bash
We have just created an environment that looks exactly like your Ubuntu Linux system will look after we re-boot. In this same window, run this command:
% sudo apt-get install lilo lilo-doc linux-686-smp linux-restricted-modules-2.6.15-23-686 linux-kernel-headers
This installs lilo and a kernel that is more tuned for the MacBook’s processor.
Now use the nano editor (since emacs is not yet installed :-) to create the /etc/lilo.conf file. It should contain something like this:
boot=/dev/sda
default=Ubuntu
map=/boot/map
delay=20
image=/vmlinuz initrd=/initrd.img
append="quiet splash"
root=/dev/sda3
label=Ubuntu
read-only
Open a new Terminal window and run:
% sudo parted
On the parted command line, execute the following commands:
(parted) print
(parted) set 3
Note that the "3" is the number of the
root partition (/dev/sda3) of the Ubuntu Linux install.
Flag to change? boot/hidden/raid/lvm/hp-service/msftres? boot
New state? on/[off]? on
(parted) quit
Close this Terminal window.
Go back to the first Terminal and run the command:
% sudo lilo
You can safely ignore the warning.
Now exit the environment and unmount the partitions with these commands:
exit
sudo umount /mnt/ubuntu/proc
sudo umount /mnt/ubuntu/dev
sudo umount /mnt/ubuntu
Restart the computer.
Synchronizing the partition tables
When the computer starts up, you will see the rEFIt menu. It has a very nice, Mac-worthy, graphical display.
There should be two large icons: a Mac OS X apple and a Linux penguin; and several smaller icons below. Selecting one of the large icons and then hitting return will boot you into that OS. By default, without input, Mac OS X will boot in 20 seconds.
Before booting for the first time, you must synchronize the MBR/GPT partition maps. Do this by selecting the Partitioning Tool, the small disk drive icon below the two OS icons, and hit return.
You will be asked if it is OK to synchronize the partition tables. You should answer yes. Now, select the Linux penguin and boot into Ubuntu Linux.
Installing important software
Login to Ubuntu with the username and password you created during installation. Open a Terminal and run the following command, typing your password when asked:
% sudo dpkg-reconfigure debconf
On the first screen select “Dialog” and hit return. Choose the defaults on the next screens.
Now, start up the synaptic package manager (System -> Administration -> Synaptic Package Manager), typing your password if asked.
- Turn on the Universe Repository (Settings -> Repositories -> Channels) in synaptic.
- Search for the package,
915resolution, and install it. You will have the native MacBook resolution the next time you reboot.
In your Terminal window, load the wireless module:
% modprobe new_wlan_scan_sta
Then in synaptic, search for “network manager” and install the network-manager daemon package and network-manager-gnome frontend applet package. The next time you login, you will see a small applet icon in the panel. It allows you to select your wireless or wired network.
It should be noted that the wireless drivers for Linux are not as good as the Apple drivers and so it will probably take longer to connect to the wireless router and you will probably see less signal strength under Linux than you do when running Mac OS X.
Now add the following apt sources/channels in synaptic (Settings->Repositories -> Add -> Custom):
deb http://ubuntu.desrt.ca/ ./
deb-src http://ubuntu.desrt.ca/ ./
Click the “Reload” button in the synaptic menubar, then search for “macbook”. Install the macbook-backlight and macbook-backlight-hal packages. These packages allow you to change the display brightness. Run the power management preferences dialog (System->Preferences->Power Management) and you can change the display brightness based on whether you are running on AC or battery.
You can also use the command-line program macbook-backlight if you make it setuid root:
% sudo chmod u+s /usr/bin/macbook-backlight
If you are interested in having sleep work, you will also want to install the laptop-mode-tools package if it is not already installed. Once installed we will need to make some small modifications. Due to an init script order error, the /usr/sbin/laptop-detect script will not detect that we are on a laptop. A quick fix for this is to edit the script and place ‘exit 0’ on the second line. This will make laptop-detect always report that we are on a laptop (which is the case here).
Another is to modify the ACPI configuration in /etc/default/acpi-support. Here you should uncomment the ACPI_SLEEP=true line (first configuration variable in the file). Then set ENABLE_LAPTOP_MODE=true (last configuration variable in the file).
Now reboot and you should have a working Ubuntu Linux installation to go with your Mac OS X.
One last thing to note is that Linux will often produce a kernel panic during boot. This is due to an APIC timing problem. If you reboot, normally the timing problem goes away (you may have to reboot more than once). A more permanent solution is to recompile the kernel to use a timing frequency of 1000Hz instead of 250Hz, but I will leave the details of that process as an exercise for the reader (hint: comment #152 on this page has some pointers).
From here, there a countless things you can do with your new Linux system, but I’ll leave that up to you. If you have problems with Ubuntu, their forums are a good place to start looking for help.
Again, thanks to the following two sites as they formed the basis of the information found in this post.
Posted in Tech | Tags MacBook, Ubuntu