[ Content | Sidebar ]

Archives for dbcdb

updating web pages dynamically

I’ve now written my first AJAX code: if you go to a random web page in my book/game database, you should be presented with a list of blog posts that refer to that item. At least assuming that I haven’t accidentally used functionality that your favorite browser doesn’t support, which I hear is easy [...]

finished converting dbcdb to ruby

I’ve finally finished converting dbcdb from Java to Ruby. I’ve been using the Ruby version of the tool to write the database for about four months, but I’d still been using the Java version to write the web pages.
Nothing too deep going on here; I was actually done with everything but the indexes as [...]

xml, html output

My HTML output class is now at what I expect to be a reasonably stable state. It’s not by any means a perfect solution for the world’s HTML needs, but it can generate the output that I want without much excess typing, which is all that matters.
Actually, it divided into two classes this morning. [...]

generating html output

One decision that I had to make when doing the HTML output part of my book database: should I roll my own HTML generator, or use somebody else’s? I ended up going the ‘roll my own’ route, partly because it sounded like more fun, and partly because it would be easier to get the [...]

array.join

I was missing Array.join:

class Array
def process_and_interpose(initial, middle, last)
initial + (map { |i| yield i }).join(middle) + last
end
end

switched over to ruby version of the cli tool

I’ve switched over to using the Ruby version of the CLI tool for editing my book database; works great, as far as I can tell.
Short, too:

panini$ wc -l *.rb
9 author_writer.rb
18 book_writer.rb
11 closeable.rb
24 compound_author_writer.rb
21 connected_database.rb
30 connected_insert_row.rb
[...]

go refactoring!

In our last installment, we had this code:

def parenthesized_list(array)
array.process_and_interpose(”(”, “,”, “)”) { |element| yield element }
end

class Array
def process_and_interpose(initial, middle, last)
inject_with_index(initial) do |memo, element, i|
memo + yield(element) + [...]

parenthesized_list revisited

I previously lamented this code:

def parenthesized_list(array)
list = “(”
first = false

array.each do |element|
if (first)
list += “,”
else
[...]

ruby talking to mysql

My current programming project at home is to port my dbcdb code from Java to Ruby. So far, I’m working on porting over the CLI tool, which lets me update the database to add books that I’m reading, update information about them, etc.
Until today, I’d been using a fake database abstraction that I made [...]

i love ruby

Recent non-work programming projects: I’ve been getting back to working on dbcdb, converting the database editing part from Java to Ruby. And, last Tuesday, BayXP had a hands-on session where we all did some pair programming getting us exposed to Behavior-Driven Development in Ruby. (See the RSpec web page.)
I don’t have much to [...]

ruby notes 5: sql libraries

One of the things I need to do in Ruby is read and update data stored in an existing SQL database. Not wanting to reinvent the wheel, I thought I’d look at existing libraries that provide this functionality. The pickaxe book didn’t give anything useful, but I saved some posts in a newsgroup thread on [...]

ruby notes 3

[I suspect I'll be writing a fair amount about Ruby, and am too lazy to come up with clever names. And I don't want to rename old posts, so I'm retroactively declaring this to be Ruby notes 1 and this to be Ruby notes 2.]
I just learned about creating arrays of strings using %w{}. [...]

reflection

I was going to write about Ruby and SQL, but I’m having fun doing other Ruby-related stuff this afternoon, so I’ll write about that instead.
I was writing this unit test, for a class DeveloperWriter. And I got tired of typing DeveloperWriter.new(”arg”) all the time. (Actually, I got tired of typing new DeveloperWriter(”arg”) and [...]

first ruby experiments

I wrote my first Ruby code yesterday. It was a port of a date wrapper that I wrote in Java for dbcdb: its only job is to convert to/from written representations, and to have some special dates representing “I read this once, but I don’t remember exactly when” and “I’m in the middle of [...]

what to do next?

I’ve finished the last important code cleanups from my dbcdb code: I removed some proxy objects that had been used for lazy loading. I was really surprised to see how much that cleaned up certain aspects of the code: my Entity objects’ constructors got a lot cleaner, useless attribute setters/getters were removed, and in [...]

dbcdb: improved compound author links

I’ve deprecated the old compound author pages – they’re still there, but now nobody links to them. Instead, pages for books written by multiple authors link directly to the individual authors’ pages.
A matter of a change of a couple of lines of code. (Though all of my acceptance tests passed unchanged after that [...]

random dbcdb tweaks

Today’s dbcdb projects:

Improve the appearance of pages with long fields: now the long field doesn’t get forced to start on the next line. I’d hoped this would fix the Internet Explorer problem, but it doesn’t (though it improves it): for reasons that I haven’t yet investigated, I have to have the key float: left [...]

dbcdb: link changes

I’ve made a couple of dbcdb changes. Now every page contains a link to let you search for all blog posts mentioning it. Which required a bit of WordPress futzing: it turns out that WordPress doesn’t let you search for double quotes by default. Also, I replaced the ISBN and ASIN fields [...]

dbcdb: links!

My dbcdb pages now can have a list of external links attached to them. This is a feature that I’d been wanting to add for a while – until now, the links from within these blog entries probably served as more of an annoyance to my readers than anything else, since the information on those [...]

books with more than two authors

I can now handle books with more than two authors. Yay. Nice to be able to spend ten or fifteen minutes making a change that actually affects what books I can handle instead of spending months making a change whose effects nobody else can see.
Not that I’m done with the behind-the-scenes changes yet – I [...]