Marc Peabody

pie sneak
Sheriff
+ Follow
since Feb 05, 2003
Marc likes ...
Mac Ruby VI Editor
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
11
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marc Peabody

Probably the safest thing is to call delete or gsub on the file content string before running your comparison to make these kinds of minor adjustments.
5 years ago
For all practical purposes, you'll probably never catch or throw. begin/rescue/end is primarily used and it's idiomatic in Ruby to simply return null or other default value from a method in *some cases* where Java would choose to throw an exception.
5 years ago
Also of note: Rubyists rarely, if ever, use a for loop. The more common idiom is to call each or one of the other iterator-based methods directly on the array.
6 years ago
The ScwcdLinks says:
(Yes, SCWCD 5 uses the J2EE 1.4 specs and API. It doesn't matter what else you may have seen/read/heard. Just trust us.)

I think I was the one who wrote it there. We had inside information. The exam did not change between versions 1.4 and 5, which isn't surprising because not much actually changed in the specs between those versions - so... you could study either version of the specs and you should be fine.
You can make the id attribute the same as the name attribute.

What have you tried so far?
I'm not going to rewrite the entire thing for you. I want you to solve this problem.

Do you know what I meant when I said "View Source" in your browser? If so, have you tried it? What did you see?

Also, realize that you can put actual static text as part of a name to make it easier to retrieve the data:
name="upd${tempIndex}"
6 years ago
JSP
The JSP page directive sets the contentType of the response. You're inspecting the contentType of the request.
6 years ago
JSP
The parameter names aren't the same. You can see this by selecting "View Source" in your browser. You'll see that the parameters are NOT named things like "temp31" but rather are names like "1".

You also are susceptible to a SQL injection attack the way your putting the submitted answers directly into a database query.
6 years ago
JSP

Mohamed Sanaulla wrote:

Katrina Owen wrote:I second Marc's suggestion about Sinatra. I use Sinatra almost exclusively these days, both for little experiments as well as at work, where we write small, self-contained services that expose everything via a RESTful API.


I have been planning to explore Sinatra for writing simple RESTful APIs which are then used by my application running on Android. I like its simplicity.


That's a perfect use case. My first exposure to Sinatra was through creating RESTful services for small iPhone apps.
6 years ago
I'm not terribly familiar with CouchRest but here's my guess from a quick glance.

I think you need to define your author as another type and reference it accordingly:


This might mean that you have to always make your Couch records get saved in the more complicated array format that you used, even when there's only one author. I suppose you could try it both ways and see if it works.
6 years ago
I would suspect you could simply call .attributes on your object to achieve what you need.

Worst case scenario, fire up an irb console and do this to see what methods are available to you:
(YOUR_OBJECT.methods - Object.new.methods).sort

Better yet, add this code to your .irbrc file:


Now you can just open an irb console and simply type the following to get it:
YOUR_OBJECT.m

This saves me lots of time very often!
6 years ago
Bundler is totally the way to go in Ruby-land these days.

That said, if you don't need the full Rails stack - perhaps all you're writing is a very tiny service app - then I highly recommend trying Sinatra:
http://www.sinatrarb.com/

It's super easy to get something started in Sinatra and it is compatible with deploying to Heroku.
6 years ago
We threw together an online version of the Ruby Koans too for the especially lazy.

http://koans.heroku.com/
6 years ago
Assuming that by modules you mean gems, then Bundler is your best bet:
http://gembundler.com/
Rails 3 ships with Bundler. If you're not using Rails 3, you can still install Bundler as a gem.

A normal bundle install will only save gems to your local system. However a bundle package will include the gems in the project itself:
http://gembundler.com/bundle_package.html

You will likely still use warbler but do so after running bundler.
7 years ago