Skip to main content

Posts

Showing posts from December, 2008

Script to generate an RSS feed from RenWeb's announcements

The following ruby (jruby) and sql code will get the Announcements from RenWeb and create an RSS feed file from them. The scripts needs the JDBC ActiveRecord gem. If you have any questions on how to run this script, please write a comment below. Both files are released under the MIT license . main.rb: require 'rss/maker' require 'cgi' require 'rubygems' gem 'activerecord-jdbc-adapter' require 'jdbc_adapter' class AnnouncementsDistrict :jdbc, :username => "YOUR ODBC USERNAME", :password => "YOUR ODBC PASSWORD", :driver => "com.microsoft.sqlserver.jdbc.SQLServerDriver", :url => "jdbc:sqlserver://THE URL TO CONNECT;DatabaseName=YOUR DATABASE NAME") set_table_name("AnnouncementsDistrict") #Gets an sql query from a file def self.get_sql_query_from_file(filename, params_hash_for_sql_query = nil) fi = File.open(filename) sql_query = fi.read if pa...

How to create a yahoo datatable in rails

To create a Yahoo Ajax Datatable (with local datasource) from a rails view, I had to do the following. First I had to add this helper method to the Application controller: module ApplicationHelper #Outputs the javascript code necesary to create a yahoo datable # from a plain datasource # column_array: and array of 2-item arrays in the form: # ["name_wihout_spaces", "Text to show in the column header"] # data_rows: an array or rows. Each row is an array that has the values in the # order specified in the column_array. def to_yahoo_array_data_source(column_array, data_rows, custom_div_id = "myContainer", custom_col_var_name = "data_cols", custom_datasource_var_name = "data_source") column_items = [] column_array.each do |column| column_items Next I added the required javascript libraries to the application layout: <html> <head> <title>Email De...

Strange behavior with the up,left,space bar key combo

I was checking if the up and left arrow and the space bar was pressed in my game code to allow the player to move and turn and shoot at the same time. Turns out that in GameMaker 7, if the user holds up+left+space bar keys at the same time, either the up or the left arrow key event will be ignored. I had to change the shoot key to the key to go around this weird behavior.