Hello World for Ruby on Rails

Posted by andy gaskell on Aug 15th, 2006

I’m just getting started with Rails so I went looking for a Hello World example. Eventually I came to this post. I’m going to go over the equivalent example using the RIDE-ME IDE.

1. Create a new project. Click File – New – Project.

2. Enter C:\ in the Location textbox. Enter HelloWorld in the project name. Click OK.

New Project dialog

3. Click File – New – Controller. Enter Hello for the name of the Controller. Click OK.

New Controller dialog

4. In the Project Explorer window, expand app, expand views. Right click the hello and click on Add New RHTML Page.

Adding a new RHTML page

5. Name the file index.rhtml. Click OK.

Naming the new RHTML page

6. Type “hello world” in your rhtml page. Save the file.

7. Press F5 (or click Run) and in a few seconds the web server starts and a browser window launches. Change the URL to http://localhost:3000/hello.

8. Hello World!

I hope to post more short projects as I work my way through the PickAxe and Agile Web Development with Rails books.

Setting a default button using Master Pages in ASP.NET

Posted by andy gaskell on May 2nd, 2006

This one’s pretty easy, but wasn’t apparent to me at first. Put this code in your Page_Load to set a default button in master pages:

this.Form.DefaultButton = this.YOUR_DEFAULT_BUTTON.UniqueID;

Formatting data in databound controls

Posted by andy gaskell on Apr 18th, 2006

I’ve been trying to format DateTime and currency in asp.net 2.0 databound controls (DetailsView and GridView). After some googling I was able to get it figured out.

To format DateTime values, you might expect to use a tag like this:

<asp:BoundField
     DataField="BeginDate"
     DataFormatString="{0:d}"
     HeaderText="Begin Date" />

and have a result like this:
10/10/2004

but instead you get a result like this:
10/10/2004 12:00:00 AM

Here’s the fix – add HtmlEncode=”false” to your BoundField tag:

<asp:BoundField
     DataField="BeginDate"
     HtmlEncode="false"
     DataFormatString="{0:d}"
     HeaderText="Begin Date" />

The same idea applies to formatting currency, I’m assuming other types of data formatting as well. Here’s Microsoft’s explanation.

Technorati Tags: , , , ,

« Prev - Next »

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Buy Generic Methotrexate No Prescription Viagra Walmart Best Online Pharmacy For Cialis Generic Buying Femara Canadian Pharmacy No Prescription Needed Alesse Purchase No Prescription Mircette Cheapest Levitra From India Buy Tablets Actonel Online No Prescription Antibiotics Online Ordina Viagra Tricor No Prescription Acheter Diabecon Viagra Ou Equivalentes Amoxil Buy Online Cheap Cafergot Order Buy Best Generic Baclofen Tablets Without a Prescription Seroquel Order Online No Perscription Purchase Lexapro Online Without Prescription Buy Viagra Online Tabs Cheap Generic Substitute Viagra Purchase Lexapro Purchase Viagra In Australia Buy Viagra In Canada Fast Canadian Pharmacy Toronto Zithromax Order Bupropion Next Day Delivery Canadianlab Viagra Tablets Buy VentolinZovirax And Cost Levitra 20mg Tablets Generic Viagra Free Pills Viagra Professional Buy