?

Log in

Happy Below are the 10 most recent journal entries recorded in the "Happy" journal:

[<< Previous 10 entries]

March 5th, 2010
11:49 pm

[Link]

mac annoyance: perl programming
I know that a Mac is not really a programmer machine, but alas I would be one to try to do it.

I set out to do some data analysis, summarizing some spreadsheets of survey results, and from experience PERL is a good choice of tools for doing fairly quick analysis. I started by trying to install the Text::CSV module using a package manager, and I couldn't find a built in package manager to use, so I installed Fink and used it to install the package, which is not named the same as the equivalent PERL module on Ubuntu. Edit: I have found the module in MacPorts, so I will use that one instead.

As far as I can tell there is no PERL package builder available, something that makes packages from CPAN modules that can be installed by a package manager, for easy upgrade and removal in the future. Ubuntu (using Debian's one) and Gentoo both had one, and I would prefer not to use the CPAN module to do it since it does not seem to track what is installed for maintenance. As a result the selection of modules available with good management is very limited.

At least I can set up vim to act properly, with syntax highlighting and indentation rules.

Current Mood: hungryhungry
Tags:

(Leave a comment)

February 5th, 2010
06:53 am

[Link]

Feather open source
I recently started posting the fether backup system publicly, using the strategy of building it up from scratch, simplifying as I go, and keeping it all public, it is now called the happy archive system, since archiving is easier than backups, and that is what I usually use it for anyways.

The code is on git-hub at http://github.com/sarah-happy/happy-archive and being actively developed.

Some days I am importing functionality from the original project, other days I am changing what has already been imported in the hope of making it simpler or safer.

Current Mood: hungryhungry
Tags:

(Leave a comment)

January 11th, 2010
06:01 pm

[Link]

encoding video for stock windows
I was asked if I could re-encode a video in a .flv file for windows today, and I said I should be able to.

After trying the encoder I use for the iPod, there was no video in windows media player, so I did some research and found a list of codecs that are supported in windows media player by default.

The command I ended up with in the end is:
ffmpeg -i "$file" -acodec copy -vcodec msmpeg4v2 "$file.avi"

The mp3 encoding already in the flash video file was good for media player it seems, just the video needed to be changed and the container format needed to be changed. The resulting video is a tiny bit distorted when there are large changes in the image, but that should be fine.

Enjoy.

Current Mood: hungryhungry
Tags:

(Leave a comment)

December 25th, 2009
12:49 am

[Link]

Model View Presenter explained
I recently spent a day trying to use the Model View Presenter design pattern for graphical user interfaces to build a text box which searches a suggestion list using a pop up window positioned below the text box.

Based on the reading I did along the way I knew that the Presenter should have no dependency on the graphical components, and as such can be used in unit tests; also the View should have no logic that would need to be tested, since it can generally only be tested manually.  I still had the problem of where to create the graphical components, and how to build the thin view, in the rest of this article I will try to explain what I didn't know when I started.

The objective of the Model View Presenter design pattern is to maximize the testability of graphical interfaces, including the responses to user interactions.  This extra testability comes at the cost of additional layers and interfaces.

The first important part that I needed to understand is that the View part from the Presenter's point of view is just an interface which is very simple and designed for the needs of the presenter.  The real implementation of the View often uses the adapter design pattern to translate the simple interface to the more complex interface of the graphical components, it also must be kept as simple as possible with as little logic as possible.  In my case there was a callback channel on the view, called a handler, which the presenter listened to.  There is also a Fake view implementation that is used in testing, it only tracks state, and passes on user events generated by the unit tests.

The next important part that I needed to understand is that the model and view are provided to the presenter at construction time, and the presenter subscribes to the model and view through listeners (the handler is a listener that there can only be one of registered).

To make testing most effective the model may be an interface with several implementations: one implementation could be the real model, another could be a fake model, and finally another could be an adapter to a model.

For testing the presenter is wired up with fakes, user actions are simulated, and state changes are checked.

The testing setup is: presenter ( fake view, fake model ).

The production setup is: presenter ( view adapter ( graphical component ), model ).

Assuming the fakes behave properly, which should be very simple, then the user interactions can be unit tested.

For convenience the real system can use factories to wire up the parts.

If I get motivated, I may create a complete example of this in Java.

Tags:

(Leave a comment)

December 10th, 2009
08:48 pm

[Link]

I'm so used to case sensitive systems
I found out two things tonight.

First, the file system on a Mac is not case sensitive.

Second, I have two files in my feather project that differ in only case.

There is a problem here.

Tags:

(2 comments | Leave a comment)

October 7th, 2009
08:44 pm

[Link]

college
I started heavy duty equipment / truck transport repair last month, and I am impressed with the pace of the course, there is 6 hours a week of theory, and 16 hours a week of shop time, the theory and shop exercises are following each other quite closely.  There is also not very much homework.

The whole class goes to the same classes at the same times, kinda like junior high.  It is nice to be going as a group because there is no way to get lost, or really be late unless most of the class is also late.

The size of the class is nice too, only 22 people.

I like this college thing.  By the time I am done (after two years) I will be in a new career.

Current Mood: sicksick
Tags: ,

(Leave a comment)

August 26th, 2009
05:15 pm

[Link]

Brownies
Josie and I made brownies a while ago, and the recipe she had was very quick and easy, the next day the page of the book she wrote it on got soaked and she couldn't read it any more, so here is a copy transcribed from pictures.

Vegan Brownies

2 cups unbleached all purpose flour
2 cups white sugar (or other)
3/4 cup cocoa
1 teaspoon baking powder
1 teaspoon salt
1 cup water
1 cup vegetable oil
1 teaspoon vanilla extract

1. Preheat oven to 350 f
2. Stir together flour, sugar, cocoa powder, and salt. Pour in water, oil, and vanilla, blend well, spread evenly in a 9 x 13 inch baking pan.
3. Bake for 25 to 30 minutes in preheated oven, until top is no longer shiny, let cool about 10 minutes before cutting into squares.

YAY
BROWNIES!

Current Mood: hungryhungry
Tags:

(2 comments | Leave a comment)

July 25th, 2009
04:14 pm

[Link]

Reefer Madness
I am watching the colorized version of the classic "Reefer Madness" movie, and caught two subliminal frames with "4" and "20" on them.  The movie is kinda funny with how bad people treat each other.  I haven't seen anyone react to taking the reefer like the people do in this movie.

In the driving scene I was thinking "who gave him speed".  Is nobody in this movie smoking anything pure?  What did they lace those drugs with?

The movie smells like propaganda, which of course it is.

(Leave a comment)

02:20 am

[Link]

There may be a skunk in my neighbourhood, the air spells like the sweet aroma of scared skunk.  I don't think it is the smokable variety because that smells better.

Current Mood: sleepysleepy

(Leave a comment)

July 23rd, 2009
06:27 pm

[Link]

stranger test
I just read some very good advice: http://lifehacker.com/5320196/use-the-stranger-test-to-reduce-impulse-purchases

The Stranger Test is an excellent way to frame the financial significance of the purchase. How does it work? A reader from Five Cent Nickel explains:
When considering a purchase, picture a stranger offering you [the cash value of the purchase] or the item in question. Which is of greater value you? Which would you choose?
 

Current Mood: hungryhungry

(Leave a comment)

[<< Previous 10 entries]

Powered by LiveJournal.com