Archive

Posts Tagged ‘tutorial’

How to make a Flash Line Chart in Rails using Ziya

February 16th, 2008

Ziya is pretty cool, and the documentation is slowly starting to surface. I was annoyed that I couldn’t find a good example paste of how to make a line chart. Then I watched the screencast. It’s the first example he does, so I’m posting it here so those who can’t watch it can actually find out how to do it.

I’m going to operate on the precondition that you’ve installed Ziya and included it in your controller properly. Do the bar chart example before going any further.

Now, make this function in your controller:


def refresh_chart
  chart = ZIya::Charts::Line.new
  render :text => chart
end


Uncategorized , , , , , , ,

Hacking a WRT54G v8 With DD-WRT

October 6th, 2007

So, last month sometime, BrainSlayer got DD-WRT working on version 8 of the WRT54G. Now this was great news to me when I read it since I’ve been wanting to get rid of the crappy LinkSys management from the beginning. Some of the procedure worked, and some of it didn’t for me.

Do not try this if you don’t know exactly what you’re getting into.

Read more…


Uncategorized , , , , , , , , ,

Fulltext Indexing Wikipedia with Sphinx

September 15th, 2007

So, earlier this year, I decided it would be cool to mirror Wikipedia. So, I successfully set up a local copy on my system, and it’s been just sitting there ever since. But lately, I’ve been interested in fulltext indexing offered by various indexing engines, and Sphinx has looked especially tasty. So, I figured I’d sit down and try it today.

I pointed it at my 16GB of Wikipedia text in my MySQL database.

Read more…


Uncategorized , , , , ,

How to make a Mephisto Plugin

February 26th, 2007

So, I figured I might as well provide a quick tutorial on how to make Mephisto Plugins currently. Many of the old plugins are broken, so there needs to be a resurgence of plugin development. Here’s the basic structure of the Tag Cloud plugin:


mephisto_tag_cloud
 - init.rb README
 - lib
   - mephisto_plugins
     - tag_cloud.rb

As you can see, the structure is very simple. Here’s my code for init.rb


Liquid::Template.register_filter(MephistoPlugins::TagCloud)

That’s it! No require or anything! Next, I edited lib/mephisto_plugins/tag_cloud.rb:


module MephistoPlugins
  module TagCloud
    def size_tag(tag, largest = 2)
      size = (Tag.find_by_name(tag).taggings(true).length + 18).to_f / 18
      size = largest if size > largest
      "<span style='font-size: #{size}em'><a href='/tags/#{tag}'>#{tag}</a></span>"
    end
  end
end

Holy crap that barely any code at all! So, the moral of the story is that it’s very easy to make the plugins once you figure out what to do.

Uncategorized , , , , ,

Doomsday Clock Tutorial

January 13th, 2007

I decided today that I need to make a tutorial to build your own doomsday clock. After seeing this picture, I felt it was necessary:

Uncategorized , ,