Archive for the 'Uncategorized' Category
Tuesday, December 15th, 2009
There’s quite a bit of messy, “hey guys, I’m learning Ruby!” text-parsing code in Racing on Rails. Users must wrestle with a fussy and inflexible interface, and developers can’t improve the code without making more of a mess.
To my surprise, clean-up required more than just plugging in FasterCSV. While nice for parsing CSV, it doesn’t handle tabbed-delimited files well, nor does it like any data changes after parsing (my plan had been to just shove Spreadsheet-parsed data into FasterCSV, because I like FasterCVS’s API).
So, I need something more: support for tabs and Excel, data manipulation, and formatted output from a common interface. More concretely: read race results and event schedules from Excel and text files, and then massage data before saving it all with ActiveRecord. I also need to turn a list of race results into pre-formatted text.
You’d think someone would have been done this before, but my Google skills failed to find them. And, there were some decent, well-tested ideas mixed in with my lousy Ruby code.I took a whack at extracting the code into its own gem. Voila, Tabular: http://github.com/scottwillson/tabular
Sunday, May 18th, 2008
If you see an error like this when starting Apache …
httpd: Syntax error on line 53 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_dav_fs.so into server: /usr/local/libexec/apache22/mod_dav_fs.so: Undefined symbol "dav_hook_gather_propsets"
Make sure that LoadModule dav_module … precedes LoadModule dav_svn_module and LoadModule dav_fs_module
Friday, May 16th, 2008
Well, not quite. But my uncle just pointed out that the original (The) Butler Press was founded 100 years ago.
Wednesday, August 8th, 2007
The Spring man himself, Rod Johnson, gave this talk. He looks better in person than he does on this book cover.
O’Reilly-mandated audience poll:
Using Spring: 90%
Strong knowledge: 50%
Written a BeanPostProcesser: Me + someone else (not that I remember what it was for)
33% of the audience use Spring for data access.
Use Spring version 2: 40%
Use Spring version 1: 10%
Rod says: Spring is easy to customize because of its component model.
What is Spring? Well, it’s a Java framework that makes it easier to work with J2EE, and offers alternatives to the weak spots or omissions in J2EE. That’s my description. Since this was an “advanced” talk, the presenter offered:
Core components with Inversion of Control (IoC), but IoC is really just an enabler.
- Consistent patterns
- Portable (decouples your business logic from infrastructure)
Gives you: Universal POJO programming model
Spring uses good APIs abstractions like DataSource, and replace bad ones like JTA. and Spring uses configuration meta-data to wire together POJOs.
Rod shows us an example of using AOP pointcut using matching rule. Man, I don’t know. Pointcuts makes sense when I really stare at them, but they are nasty looking.
With Spring and AOP, you can add remoting to any POJO without forcing the POJO to know about it. Likewise, you are not forced to make all service classes remote. Nasty magic AOP and XML config aside, this really is pretty cool. A big practical advantage when you are working with code or writing tests.
Now we talk about FactoryBeans. Rod asks: “who can tell me what a Spring FactoryBean does?” Weak audience response. Uh oh, Rod can tell that we’re not really advanced Spring users. Contempt. (A FactoryBean creates other beans.)
Back to our feature tour programming. You can add the JMX API to you Spring beans. “Very cool.” Of course, only 5% of the audience use JMX.
Spring can use weave any bean with aspects. Example: can audit calls to particular method. Yikes, another pointcut example. I still find the syntax confusing as hell. But, the EJB interception model “sucks” because it’s not typesafe.
We start to pick up to whirlwind tour pace. Rod is cramming his 90-minute JavaOne presentation into 45 minutes.
There are (will be?) new extension points:
- New XML tags to produce zero or note Spring bean definitions
- Tags for transactions
What’s coming in Spring 2.1;
- increased use of annotations for config. and can mix XML and annotations
- JCA 1.5
- Improved JPA support
- Aims: Make Spring still easier to use
Wednesday, May 30th, 2007
I have to say that all the RailsConf keynotes I went to were good, and I heard that the others were good, too. Is that level of quality sustainable? I hope so.
Dave noted that EuroRailsConf was the most profane conference ever. He thought this was a bad thing.
We all were getting a bit loopy at this point, so my notes are short and fragmented. Here’s what I can piece back together.
Ze Frank talked about what to do when you have many amateur authors. This was an interesting problem that we wrestled with back in the day at Gap Inc.’s intranet. You can ignore them (obvious bad consequences). You can try and control them, but this doesn’t scale. You can shut them down (draconian). He suggests that you instead facilitate conversation. Which sounds fine, but fuzzy now that I write it down here. Should have gone to his talk, I guess.
Dave warned about Cargo Cult programming — definitely a danger in the Rails community. He then listed some assumptions we should question:
– The web browser: it’s a freakin’ full-duplex mainframe terminal!
– Object-oriented programming. The world is not hierarchial, it’s chaotic. Why are we so class-centric? Try to write a program without classes and you might be surprised by how it works.
– Relational databases
Wednesday, May 30th, 2007
This talk was practical advice on how to do just what the title says: contribute to Rails.
Josh comes from a Smalltalk background. He also worked on OpenDoc, “A technology that no one has heard of it.” You are wrong, my friend — I remember when it was all the buzz at MacWorld Boston ‘96, and my boss was wondering if we should become OpenDoc developers. Ah, CyberDog, we shed a tear for you.
Anyway, Josh now works at Java Card.
The session’s audience:
15% use the Rails Trac
10-15% opened a ticket
10% contributed a patch
5% had patch accepted
Prerequisites for contributing: Rails Trac account, Subversion, subscribe to the Rails Core discussion list.
1. Create a local, vanilla Rails projects for this work
2. svn co to vendor
3. Set up tests
4. Ensure tests run
You need to use TDD, follow code style, write docs, write tests, and ensue that the rdoc builds. Use SVN diff to generate patch. Create a Trac ticket with [PATCH] in the subject.
How to get some patch accepted
– Make tiny changes
– Discuss big patches first on Rails Core
– Need good code
– Need tests
– Get buy in for Rails developers
“Get used to disappointment. “There’s a backlog.
Wednesday, May 30th, 2007
Here’s a real advantage of a conference over email: I learned that Charles Nutter has an awesome Midwestern accent! I’ve got a whole new voice in my head while I read his posts, and there are a lot of them. Does Charles Nutter sleep? He seems to churn out emails and blog comments about JRuby 24/7.
On to the talk. For the record, I am not sure how I feel about the whole Rails running on JRuby inside a WAR on Glassfish stack at the enterprise data center. Sounds like a tall, tipsy stack of dinnerware to me. But I do like JRuby. It’s been really handy at C o n – w a y for calling EJBs, using mainframe proxies, and running JUnit test suites. And there’s a real possibility that the Java VM could become a great VM for Ruby.
This session’s poll:
25% of the audience are Java developers
25% ex-Java developers
15% ex-Perl users
Who uses which database?
10% MS SQL Server
Why use JRuby instead of C Ruby?
– Unicode support
– Native JVM threads
– The big pain point …
What are the biggest differences?
1) Database support. Ruby MySQL works about the same. JRuby can use JDBC, of course, and JNDI to look up connection pools. DB2 support is not 100%? (Works pretty good for me.) Oracle ActiveRecord tests are not 100%
2) Native Ruby extensions don’t work out of the box. Need porters.
3) Command-line performance because Java start-up time is slow.
Charles and Thomas demoed Goldspike, a way to package a Rails app into a J2EE WAR:
And they demoed a Glassfish gem! Hm, well, theoretically, if all this just works, it could be pretty cool. Though I dread digging through the stack trace.
Wednesday, May 30th, 2007
Vonage seems to have done a really nice job of integrating Rails with their legacy J2EE apps (cracks me up to write “J2EE apps”). This talk was somewhat of a rehash of Mapping Rails to Legacy Systems, with more details about the REST bits.
Turns out that Vonage essentially implemented Rails 2.0’s ActiveRecord six months before the Rails team.
Wednesday, May 30th, 2007
Another good guy and kindred spirit, Jarkko’s central point was how to build an effective framework for developers. Or, precisely, what are the principles that make Rails’ framework effective? Good stuff, but not enough for a full-length RailsConf session. Don’t mean to sell you short, Jarkko — I’ve spent a bit of time recently building an internal testing framework while using Rails, so maybe the principles feel obvious.
It really boils down to the carrot-and-stick approach: make it easy for developers to do the right thing. And the right thing should be sensible, terse, and as intuitive as possible. The “wrong” thing should be hard to find, documented with warnings and deprecations, and lead to many more lines of code. (This is certainly characteristic of Rails. Whenever it takes me more than 3-4 lines of code for something simple, I immediately suspect that David’s already thought of a better way to do it.)
Carrot: How dead simple it is to write an automated test in Rails
Carrot: All the magic REST methods
Jaarko says that you should ask: “How does this help the user kick ass?” He’s the lead a developer at dotherightthing.com, and he wrote, “Beginning Ruby on Rails E-Commerce.”
Saturday, May 26th, 2007
I finally rallied some focus and motivation, and released Test Dictionary on SourceForge. This is a very small Java lib jar that is handy for generating realistic test data:
String name = Dictionary.getRandomProperName();
String word = Dictionary.getRandomWord();
String word = Dictionary.getRandomWordTermCommonNameOrConnector();