Ruby: Convert to Integer

To convert a string or other object into an integer (number) do this: "23".to_i This will produce 23 (as a number) If you do something like this: "Hello".to_i You will get 0 returned, because Ruby can’t understand that object and translate it into a number.

Ruby: Convert to String

To convert a number to a string in Ruby, do this: 40.to_s

CakePHP: Layouts

photo credit: Vagabond Shutterbug If there are things you want to appear on every page of your website, built in CakePHP, you will want to use a layout. I generally use one layout for header, footer, search, and other static elements. You can use multiples, but most of the time you won’t need more than [...]

RubyNoob: The Genesis

Ruby Logo by hongiiv Today I am starting to learn Ruby, and that so I can next learn Ruby on Rails. I have flirted with the RoR language, been a long-time fan, but today I become a first-time caller. I am tired of being on the outside looking into the red-tinted party in the hizouse. [...]

Ruby on Rails: Rake commands list

For a list of rake commands, fire up the command line and type: rake -t

WordPress: Enable New 3.0 Menus in Older Themes

Enabling 3.0 Menu Support If you have WordPress 3.0 installed, but your theme is older and doesn’t support it, here’s how to make those fancy awesome new menus work in your theme… First, sign into the admin. This is located at www.yoursitehere.com/wp-admin Next, click on the Appearance Section. Click Editor Click Theme Functions (functions.php) on [...]

CakePHP: HTML Link

The HTML helper is pretty useful, here’s how you write a link in a view file: <?php echo $html->link(’click me’, array( ‘controller’=>’users’, ‘action’=>’index’ ) ); ?> The parameters in this are: title (what you actually click on) link location array(controller, action, id (if needed for edit)) (optional) attributes array

ASP.NET C#: DataTable Compute

If you want to perform a sum or count on the records in a DataTable, you can, very simply. You’ll have to have a DataTable with something in it, like results from a database, then you do this: // my DataTable is full of customer data and is named "dt" object newCustomerCount = dt.Compute("count(id)","CustomerID > [...]

MySQL: Create a table via code

To hand-code a table, or create a bunch of tables in a script, use this: CREATE TABLE `tablename`( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(255) NOT NULL ) You may note the “backticks” which are the little symbol on the same key as the tilde “~”, and are used to note the tablename [...]

SQL: LIKE Searches

There is no pause in there, “LIKE!…searches!” This is a no teeny-bopper zone (unless you want to program stuff, then by all means)! When you know only part of what you’re looking for in a SQL SELECT statement, especially for AJAX auto-complete queries, you will need to employ the all-consuming power of the “LIKE Search” [...]