Monday, December 31, 2007
Sunday, December 30, 2007
Expectations is a new unit testing library for Ruby.
Some very interesting ideas in there, a couple simple examples from their webpage are:
expect 2 do
1 + 1
expect NoMethodError do
I like that, that's pretty readable.
Saturday, December 29, 2007
Programming Language Theory Texts Online. Mmm. Nice.
I'm having lots of fun reading Knuth's The Art of Computer Programming. I'm slowly making my way through the math chapters, and when I get tired of that, I skip ahead to read a bit about MIX or about trees.
Thursday, December 27, 2007
Sensitivity to Electromagnetic Radiation is getting to be more of a problem. This is very interesting. I would say that just to be on the safe side, don't be hanging out with too much electromagnetic radiation around. Do what I do and have your servers in the kitchen.
Yes, my development and test web server is sitting in my kitchen. I'm the only one on my block to have a Linux kitchen server. :)
Wednesday, December 26, 2007
Tuesday, December 25, 2007
test/spec has it's own "assert_include" which is part of ZenTest. In
the default Test::Unit, you check if an array "a" contains an element
assert_send [a, :include?, @truffles]
This is a bit nicer in zentest:
assert_includes @truffles, a
And is very pretty indeed with test/spec:
Monday, December 24, 2007
Just In Time at wikipedia.
For the Sunshine Organics site, I had to come up with a description for items from local grocery suppliers who delivery exactly the number of items on Wednesday morning that the customers have ordered over the weekend. I looked around for a good metaphor, for a while I used "direct_order", but now I call those GroceryItems "jit_items", for Just In Time items.
That article about JIT on wikipedia is just fascinating, a really good read, actually.
1978 - MTS mainframe at the University of Alberta
1981 - SuperPET
1983 - VIC-20
1985 - Apple II
1987 - Mac Plus
1987 - IBM PC - MSDOS
1991 - UNIX - University of Alberta
1992 - SGI - IRIX
1993 - Linux
After 1993, it's been all about Linux, with lots of SGI thrown in, some Sun, some AIX, some Windows, but basically all Linux.
I was listening to a Geek Entertainment TV podcast about the C64, and I'm glad I didn't get into the C64, having a VIC-20 taught me a lot, and got me onto the Apple II, which led to the Mac Plus. If I had stayed on the C64, I might have got stuck in the nostalgia for the system, kind of like a lot of Amiga and Atari people got stuck. It's all about the future.
Luckily, with Linux, you grow with the future, and that's all because it's free.
I've had so many times in my life where I've had to give up all the knowledge I learned about a system because it wasn't free, that's no fun.
People who are on Macs now with OSX are going to find that out, it's really painful when a developer stops supporting some software that you took a long time to learn, all that investment of time and knowledge that you made just disappears. After the first few times that happens, you start wishing for a more solid foundation.
Free Software is that solid foundation.
There's a lot of software that I keep updating, like I have the most recent version of Firefox all the time. But some of it, I just like the old version, like my enlightenment-0.16.5. It's 10 years old now, but I have it so perfectly customized to me, and there is nothing else that can do exactly what I want. If this was commercial software, I would be sad out of luck, but with Linux and the GPL, I have the source, and I can just keep tweaking it to make it run on the most modern linux distribution (Fedora 7 in my case).
I love Free Software.
For the Sunshine Organics website that I'm redoing, one of the design decisions I made was to have separate Rails servers for each city, the added complexity of keeping track of all the cities in one database just got too complicated.
So now I'm working on having multiple Rails projects being launched out of one directory, some of those websites will be normal websites, and some of them will correspond to sites where they don't have a warehouse to stock groceries, these will be called "sub" websites.
I've found a few resources to help me in launching multiple Rails projects from the same directory, basically it boils down to having different RAILS_ENV environment variables set for each one.
Deploying to Multiple Rails Environments - from "my hovercraft is full of eels"
Guide to environments in Rails
dry out your database - For this one, it's an interesting idea, but I find it way too convoluted. I just repeat the section, and find this much clearer:
What I did:
I made a new entry in database.yml for cv_development:
Then I copied over the existing development.rb file:
cp config/environments/development.rb config/environments/cv_development.rb
export RAILS_ENV=cv_development && rake db:migrate
Made a new mongrel configuration file called "mongrel_cv_cluster.yml"
Then started mongrel:
mongrel_rails cluster::restart -C /home/sness/nDEV/sunshine/config/mongrel_cv_cluster.yml
Saturday, December 22, 2007
I've been thinking recently about comments in code and the stories that these comments tell.
For a long time, I've considered it very important for code to have lots of comments in it, after all, computer code is not just a set of instructions for a computer, it is a conversation between the developers of the code, what they were thinking of when they designed it, and where it is going.
The problem though, is that often code changes and the developers don't change the comments in the code at the same time, leading to a mismatch between the story that the code is telling and the story that the comments are telling.
I'm wondering if a way around this could be to have more descriptive comments and stories in the testing code for an application.
I've noticed that when I'm writing a program and when I'm writing tests, I'm in two different frames of mind, when I'm writing code, I'm trying to build a beautiful and fast system, and am focused on beauty, and tons of code comments sometimes obscures the beauty of the code, especially when I'm writing in a very expressive language such as Ruby.
When I'm writing tests, I'm thinking about the whole story of the application, what I was thinking when I developed the code, what I was thinking when I made changes to the code. It's a more "meta" mind space.
What do you all think?
Tinderbox has gained functionality and shrunk in total lines of code. This is great, the way that projects should move.
Friday, December 21, 2007
An interesting post at 24ways about diagnostic styling, they talk about making CSS rules to highlight problems with your code.
I think I would do it by writing a script to parse the XHTML and display the errors, but this approach would be good for someone like a designer who prefers information in a visual form.
I think both ways are good, just choose whichever one works for you, or perhaps both.
Thursday, December 20, 2007
Wednesday, December 19, 2007
Steve Yegge has another blog rant about how huge programs are a bad thing. I totally agree.
Here's a quote from the article:
"But you should take anything a "Java programmer" tells you with a hefty grain of salt, because an "X programmer", for any value of X, is a weak player. You have to cross-train to be a decent athlete these days. Programmers need to be fluent in multiple languages with fundamentally different "character" before they can make truly informed design decisions."
A very interesting discussion of scientific laws at the New York Times. Talks about the whole Platonic idea of perfect forms existing somewhere out there, and if the laws that we see, like the law of gravity, are universal, or are just constructions of our mind.
Monday, December 17, 2007
The Free Lunch Is Over : A Fundamental Turn Toward Concurrency in Software.
I once debugged a threaded, parallel version of FPC for solving the Human and Mouse genomes, and let me tell you, bugs in threaded code can be almost impossible to track down. The bugs don't happen deterministically, but probabalistically, and when you have 40 machines all updating different parts of your datastructure at different times, it becomes quite difficult to track down bugs.
We need to find better ways of doing this.
I'm thinking that Functional Programming might be a good way to do this.
Faster Chips Are Leaving Programmers in Their Dust.
Genetic Programming, anyone?
Seriously, think of the cell, it is the most parallel processing machine anywhere, all the proteins and cellular machines are little Functional Programming machines, all working together, and GP is a great way to build robust systems like this.
ooh, this is actually pretty awesome, YUI pages, a plugin for Rails that gives you some sweet sweet syntatic sugar for making YUI Grids in Rails.
I was all ready to dismiss it, as I like my HTML, but it actually looks awesome, and I could see myself using it.
Increase the fonts you have available for webpage design with font matrix.
What the article is saying is that you probably have more fonts available than just the websafe fonts, because your clients have probably installed programs that come with their own fonts, like when you install Microsoft Office 2007, you get Bakersville Old Face, and 100 other fonts.
Hmm, an interesting idea, but in practice I'll be sticking with Arial.
Sunday, December 16, 2007
A good article at The New York Times about Google and Microsoft battling it out.
As a fervent Free Software proponent, I used to not be too fond of Microsoft, but now I see that by making standards in hardware, they actually were the ones that created a field where Linux could develop and prosper.
All I know is that I personally try to use only Free Software everywhere. Over the years there have just been too many times when I got really comfortable in a certain software program, only to have it taken away from me after the company failed, or I had to use a different software platform.
The software I use now is all Free Software, and I know that everything I learn I'll be able to use in 20 years from now, and this makes me want to learn the software more and more deeply.
The software I use 99% of the time:
Ruby on Rails
opera (not free)
All of this software I've modified and have it working really well together. I have a sweeeeet setup.
Saturday, December 15, 2007
Friday, December 14, 2007
A story in the New York times that talks about how we may fall in love with robots someday.
That's so old news. What I'm imagining is falling in love with an AI. The robot part is just physical, I fall in love with the mind, myself.
But then, I'm an alien from a distant star system, so YMMV.
Thursday, December 13, 2007
Wednesday, December 12, 2007
Tuesday, December 11, 2007
Whale song at Wikipedia. Wow, so neat how toothed whales make sound, and very interesting that they have no idea how baleen whales make sound.
An interesting fact is that toothed whales can make two different sounds at the same time. That is going to be interesting to analyze.
The rovers find evidence of a past hospitable environment for life on Mars.
Monday, December 10, 2007
Sunday, December 09, 2007
They've just found bacteria that make nanotubes, they make arsenic-sulfide nanotubes with unique properties.
A few years ago I did a bit of thinking about how to make bacteria
make carbon nanotubes. What you want to do is to find a secretory
system that exports some kind of molecule, like the bacterial
secretory system that some bacteria use to get rid of antibiotics.
Then, you change the inner pore into a machine that uses ATP to add
carbon atoms one by one onto a small nanotube primer. With this, you
could build nanotubes as long as you like, just keep feeding the
bacteria and let them go.
This is the future, and we're only a few decades away from this,
making biologically derived nanomachines. Real nanomachines (and
sub-nanomachines) aren't going to look like the machines we see
everyday, the atomic and quantum world is very different from the
macroscopic world, and we need to take our inspiration for
nanomachines from ideas that have been around for 3.5 billion years.
Saturday, December 08, 2007
Open source software package takes aim at high-cost math programs is an article at Network World that talks about Sage, a new open-source program for doing math, kinda like Matlab. Sweet.
I should look into integrating this with Marsyas, which already has support for linking to Matlab.
I just heard a very interesting interview on Quirks and Quarks with Dr. Rebecca Dunlop about Humpback Whale vocalizations.
I'm so excited to be getting into the field of studying marine cetacean sounds, I think this is a very fertile area and could really benefit from some new computer codes to help. Dr. Dunlop just used a stats program to help her do this research, and there's so much more we could do with Marsyas. So cool!
I had a model that linked to another model in Rails, and I wanted to order the first model by a field in the second model. Here's what I came up with:
has_many :set_bin_items, :include => :produce_item, :order => 'produce_items.fruit DESC, produce_items.fruit_bin_only'
Friday, December 07, 2007
I just bit the bullet and upgraded to Rails 2.0, and so far I'm very happy, development views are generated much faster.
I only needed to change a couple things, my acts_as_authenticated plugin had a "redirect_to_url" that stopped working, and some "link_to" with a nil object as the object to the link also gave me some problems.
I was happy to see that all my .rhtml files still kept working even though Rails 2.0 might prefer me to use "file.rhtml.erb".
I was just listening to a very interesting podcast with Avi Bryant talking about Smalltalk. He says that Smalltalk and Ruby are actually the same language, but just with different syntax, kind of like Hindi and Urdu.
So, I would really like to learn Smalltalk, I'm looking at the smalltalk website and at squeak. I had checked out seaside, and wasn't very impressed, but I should perhaps give it another chance.
Thursday, December 06, 2007
Wednesday, December 05, 2007
Tuesday, December 04, 2007
Yay! The Spirit Rover got out of the sand trap and is heading for it's winter haven on Mars.
I've been following these plucky little rovers from the beginning, and I'm just amazed at how long they've been going. I like to think about these little robots, halfway across the solar system (at Conjunction) motoring around on Mars, what a cool time we live in.
Monday, December 03, 2007
Sunday, December 02, 2007
Saturday, December 01, 2007
It is the Teachings that survive the Teacher. It is the Teachings that survive the Rituals. Constructing a Cathedral to God is building for the Ego, the lower self. Constructing a Cathedral to share the Teachings, to Serve humans, to promote Peace, to end poverty, war, loneliness and despair, inequality....... this is the true monument to God. There are scant few of these...
There are no problems. There is nothing wrong. Everything is unfolding as it should. Everything happens in its own time. Space and time are illusions. They really do not exist. They're stationary. Causation doesn't exist either. No thing has a cause, therefore no thing has an effect. Cause and effects are again products of your own mind. When the mind is quiet, karma ceases. Samscaras are non-existent. There never was a cause for anything. But if you feel that in a previous life you did something wrong and now you are paying the price, or if you think that you did something wrong in this life and you're paying the price, then you'll pay the price, because that's what you think.
- Robert Adams
Wow. My mind has just been blown. I learned about John Zorn's Cobra today, it's a musical game which has a bunch of musicans and a prompter, there are various cards, hand signals and hats, and music is made.
An article at the BBC about Cobra, and a Cobra class.
Friday, November 30, 2007
Thursday, November 29, 2007
Everyone would probably agree that feelings of appreciation and gratitude are positive states, but did you know that they also have a profound effect on your physical body? Both of these states, as well as those of compassion, forgiveness, happiness, non-judgment, patience, sincerity and caring are all heart-centered feelings, which immediately affect your heart rhythm. The heartbeat becomes more synchronized and coherent, which improves hormonal balance and immune system response.
The heart has its own independent nervous system, referred to as ?the brain in the heart,? say Doc Childre and Howard M artin in their book, The Heart Math Solution. There are at least forty thousand neurons in the heart-as many as are found in various sub-cortical centers of the brain. Childre and Martin go on to say that, the heart's electromagnetic field is by far the most powerful produced by the body; it's approximately five thousand times greater in strength that the field produced by the brain. The heart's field not only permeates every cell in the body, but also radiates outside of us; it can be measured up to eight to ten feet away with sensitive detectors called magnetometers.
(Scott Beebe) - www.energeticawakening.com
There is no good and no evil. In every
concrete situation there is only the
necessary and the unnecessary. The
needful is right, the needless is wrong.
The situation decides.
Every situation is a challenge which
demands the right response. When the
response is right, the challenge is met
and the problem ceases. If the response
is wrong, the challenge is not met and
the problem remains unsolved. Your
unsolved problems - that is what
constitutes your karma. Solve them
rightly and be free.
- Nisargadatta Maharaj
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
"I Am That"
Talks with Sri Nisargadatta Maharaj
The Acorn Press, 1973
Wednesday, November 28, 2007
Again Rails has proven the old adage:
"Those who do not know history are doomed to reimplement it, badly"
They thought they were being so tricky with gems, but now we see the problems, there is something totally hosed at gems.rubyonrails.org, and it refuses to install Rails 1.2.6 for me. No thank you, I don't want to use Rails 1.99 beta for my production code, thank you.
Thus concludes my rant for this evening.
CSS Sprites - I had heard about them but never understood, and this article has a great description of them. They are one huge image that you load just once that contains a whole bunch of smaller images that you move to where you need it. Can provide big speedups for users.
Tuesday, November 27, 2007
An excellent planetwaves horoscope for me for November 2007:
Aquarius (Jan. 20-Feb. 19)
There is a dialog that needs to happen, and you seem to be holding back. You seem to have grievances, or grief, that is troubling you, and you would go a long way toward resolving it both inwardly and outwardly if you initiate the discussion that you want so badly. The problem is that it may seem nobody is listening -- but that will not be true for long. People are listening and you need to both notice that they are doing so, and take advantage of that fact. Then, basically, you need to take a chance on love. Not romance; actual love, and passion, and on the simple truth that the future is different than the past as long as we make it so.
It's true, someone did listen. Thank you.
A very interesting article about how some billionaires are very frugal.
This last two years of working for myself I've made a fraction of what I was making working for other people, and I'm also the happiest I've ever been. I love living frugally now, and find it so freeing to not be in debt. The easiest way to have money is just not to spend it. It's hard to believe it took me so long to learn, it's so simple, but very hard to do in this society where we are under huge marketing and advertising pressure by people who want us to buy things. Resist this urge, my friends, you don't need all that stuff they're selling, you'll be happier living more simply.
Wow, I'm a total convert to Integration Testing in Ruby on Rails now. It's so powerful and very cool. I've been unit testing for about a year now, but just graduated to functional and integration testing, and it's amazing, especially integration testing, which simulates a person with a web-browser interacting with your application.
Monday, November 26, 2007
Sunday, November 25, 2007
I'm also using the excellent Yahoo Grids CSS for doing the layout. Wow, after so long of doing all that CSS layout by hand, using YUI Grids/Fonts/Reset CSS is just so much better.
They solve so many problems for you, problems most of us don't even know exist, and I for one am using YUI CSS in all my new projects.
Saturday, November 24, 2007
A friend was teaching me some belly dancing moves a couple nights ago.
"Wait", you say. "Belly dancing for men?".
"Well yes, of course.", I say. "It's quite traditional. The trick is that you have to act like a fierce LION!"
Belly Dancing for Men
Masculine Belly Dance
Belly Dancing Resources
I really enjoyed learning some belly dancing moves, and found that there was quite a bit in common with Yoga. I love the body control and independant body part movement, which also reminds me of drumming.
Neato! A new hobby for sness!
Some good articles about testing in Ruby on Rails applications:
Integration Tests at clarkware.com
Rails Integration Testing
Integration test file uploads - This didn't actually work for me, but YMMV.
multipart_post - This one did work for me for uploading files in Integration tests, and integration_test_file_upload.rb is the file you install in RAILS_HOME/lib
Integration Testing by Jamis Buck, excellent article.
Friday, November 23, 2007
A friend told me about the book Listening to Whales: What the Orcas Have Taught Us by Alexandra Morton, I've got to read this book!
Wednesday, November 21, 2007
A great article at A List Apart about Web Design. They make the excellent point that Web Design is not Print Design, Illustration, Poster Design.
"Web design is the creation of digital environments that facilitate and encourage human activity; reflect or adapt to individual voices and content; and change gracefully over time while always retaining their identity."