ruby

How to write a Perl, Python, or Ruby program to change the memory of another process on Windows?

I wonder if Perl, Python, or Ruby can be used to write a program so that it will look for 0x12345678 in the memory of another process (probably the heap, for both data and code data) and then if it is found, change it to 0x00000000? It is something similar to Cheat Engine, which can do something like that on Windows. ...

Form retaining values after refresh.

So I've inherited this legacy rails codebase and there's a bug i need to fix where a given form is retaining values (that have not yet been saved to the DB) even after Page Refresh. Use Case: User fills data in form but does not press submit. User Clicks refresh button on browser. The Values in the form are retained instead of refreshi...

finding json errors with ruby

i am using ruby gems json_pure and when i get parsing errors i am not able to determine the line number where the error is occuring. i was expecting to find a validator written in ruby that would tell me the line number. what is the best ruby approach to finding the json errors quickly? thanks! ...

How can we watch the Rails development log?

A member of my team is developing a Rails app on Windows XP. We are finding that when we run the app, either launching it within NetBeans or by opening a console and calling script/server, the Rails development log does not scroll by. There is only the Webrick startup message. The app is definitely running, but when we hit various pages ...

Ruby accessing outer variables in nested function

Hi, I'm sure there's a simple answer for this; I just can't seem to find it. I made a nested function in Ruby, and I was having trouble accessing variables from the outer function inside the inner function: def foo(x) def bar puts x end bar 42 end foo(5) I get: NameError: undefined local variable or method x' for main:Obj...

Rails flash message remains for two page loads

I'm using a flash notice in a Rails application, with the following code: flash[:notice] = "Sorry, we weren't able to log you in with those details." render :action => :new The flash message renders as expected on the 'new' action, but then it also shows on the next page the user visits (whatever that might be). It should only show on...

Is there any Ruby or Python interpreter for Lego Mindstorm?

I want to start coding in Python or Ruby. Since I own a Lego Midstorms kit I thought it would be nice to program against it. Are there any good translators / interpeters for the Mindstorms brick? ...

Simple cropping with Paperclip

I would like to crop images on upload using Paperclip to get square thumbs from the center of the original picture. I find out a method in documentation that seems to do exactly what I want: transformation_to(dst, crop = false) The problem is that I can't figure out where to use this method. It would be great to simply pass something a...

Formatting csv file data with html template

I have an csv file, the data, and an HTML file, the template. I want a script that will create an individual html file per record from the csv file, using the html file as a template. Which is the best way to do this in Ruby? Python? Is there a tool/library I can use for this in either language? ...

ruby glade/gtkbuilder example?

hello I was using ruby and glade2 to design the user interface for a while in the new version of glade3 i can use gtkbuilder format to generated xml file instead of libglade. is there any example? i searched google but i had no luck! ...

How do I model this multi-inheritance relationship w/ Ruby ActiveRecord?

Assuming I have 5 tables. Can ActiveRecord handle this? How would you set it up? The hierarchy: Account (Abstract) CorporateCustomer (Abstract) PrivateCustomer PublicCustomer GovernmentCustomer Edit: In nhibernate and castle activerecord the method needed to enable this scenario is called "joined-subclasses". ...

How can I create an all-in-one installer for Ruby on Rails application deployment on Windows?

Hi All, I'm in the process of deploying a rails application to Windows machines. I do all of my development with OS X and Linux, but the final app will actually run on Windows machines. That said, my client is looking for an all-in-one Apache(I had to talk him out of IIS)+Rails+Application deployment/installer. He wants to hand all o...

Modelling teams

Hello, I just wanted to get some feedback on better ways to model a team/team membership in rails. I currently have the following: class User has_many :teams, :foreign_key => "owner_id" #user owns this team has_many :memberships #user is a member of these teams class Team belongs_to :team_administrator, :class_name => "Use...

Filtering by date substrings in Rails

We have a grid control that allows a user to filter text in different fields. A number of these fields might be timestamps, like created_at and updated_at. Now, a user can do many different types of filters, including >, <, >=, <=, etc. So, a query that comes across from the control might look like: "created_at > 2009", or "created_at ...

Is it possible to reverse the included module in a class?

You include the modules in classes to extend the class functionality in terms of both adding class methods and instance methods to that particular class. module M def self.class_method_from_module 'from class_method_from_module' end def instance_method_from_module 'from instance_method_from_module' end end class C include M ...

How to find and display a group of objects with a specific tag using acts as taggable (redux)?

I want to display a list of articles in my tag's show view. I'm using the acts as taggable redux plugin in a Rails 2.3.2 and SQLite3 app. I've got as far as the basic example takes me, assigning tags and then displaying a list of them with the article. Now I want to display a list of articles belonging to a tag but get the following er...

Ruby on Rails: best method of handling currency / money

I'm in the process of learning Ruby on Rails and I've set myself the task of putting together a very basic shopping cart system. I have a table items that costs of a price column currently set to integer. I have no problem with inputting the data in cent, but when it comes to displaying the price in th view, well I obviously want it to b...

How can I run a Rake task as a Windows "scheduled task"?

I have a rake task I need to run as a daily job on a Windows XP machine. I discovered the Windows "scheduled tasks" control panel. I'm trying to figure out how to get it to run my Rake task. Two of the fields are "run" (with a browse button) and "start in". I tried to enter rake mycategory:mytask into "run" and my Rails project dir cont...

How does one convert a string to lowercase in ruby

I know this is simple, but how do you take a string and convert it to lower case, or upper case in ruby. ...

When you write a Titanium app, is the source code visible to users?

When you write an HTML/CSS/JavaScript app for Adobe AIR, the source files sit in a directory visible to anyone who looks. Appcelerator Titanium lets you code in JavaScript, Python, and Ruby. Is the bundling similar to AIR, with all the source exposed? ...