I think I'm leaning toward C# and .net as a concentration language for learning web development. I would like to learn good programming fundamentals and I've looked at pretty much everything else. The four I've narrowed it down to have been C#, Python, Ruby and PHP. Is there a reason to stay away from C# (and I don't think the cost iss...
If I say:
x = "abc"
this seems like a declaration, definition and assignment, all at the same time, regardless of whether I have said anything about x in the program before.
Is this correct?
I'm not sure what the correct terminology is in Ruby for declarations, definitions and assigments or if there is even a distinction between thes...
I have a one-to-many relationship between my Profile class and Photos class. Profile holds the user's information and photos holds the user's pictures. Currently, the "Upload photo" link shows at the bottom of the profile view. I want to have the link show up on a separate view instead of cramming everything on the same form. Should I ju...
On clicking a slot , I change the contents of the slot to provide user feed back, then call some code which takes several seconds to run. However the changes to the slot do not render until after the 'slow' process has completed. Is there any way I can force the rendering to happen before the 'slow' code runs.
In the following example t...
Is there solution for '0000-00-00 00:00:00' problem, without changing table?
I have "[]" in this query:
dbh.select_all("select j.n, j.name, j.dsc, j.flag, j.td from job j where j.td='0000-00-00 00:00:00'")
I look solution for this: http://rubyforge.org/tracker/index.php?func=detail&aid=22243&group_id=234&atid=967
...
I'm a C(++)/C# programmer and I would like to learn a scripting language to create small tools (text processing, build scripts, a little web development, etc). I would like to learn either Ruby or Python. Is there a good reason to chose one over the other?
I looked at some sample code in both languages and they seem very similar to me....
I have the following code :
require "gtk2"
# adds a page to the notebook with the given label
def create_page(nb,label="untitled")
# create a textview
tx = Gtk::TextView.new
# append it
nb.append_page(tx,Gtk::Label.new(label))
end
Gtk.init
window = Gtk::Window.new
window.set_default_size(800,600)
window.signal_connect...
I have a small rails app that is using acts_as_list to implement drag and drop via ajax.
The app has 3 main models: forms, sections, and questions. As it is designed, forms have many sections, and sections have many questions.
I want a user to be able to do 3 things:
reorder the sections in forms
reorder the questions in the secti...
I want to parse a random website, modify the content so that every word is a link (for a dictionary tooltip) and then display the website in an iframe.
I'm not looking for a complete solution, but for a hint or a possible strategy. The linking is my problem, parsing the website and displaying it in an iframe is quite simple. So basicall...
In the current app I'm building I've got a textarea where a user will enter a comma-delimited list of email addresses.
I'm currently splitting the list into an array and then saving one by one. But if, say, I have this input...
[email protected], test@example, [email protected]
... then [email protected] will be saved, but saving test@ex...
Hello there!
I need to mimic what MySQL does when encrypting and decrypting strings using built-in functions AES_ENCRYPT() and AES_DECRYPT().
I have read a couple of blog posts and apparently MySQL uses AES 128-bit encryption for those functions. On top of that, since this encryption requires a 16-bit key, MySQL pads the string with x0...
I'd like to create a before_filter method in my application controller like this...
def check_role(role_name)
unless logged_in_user.has_role? role_name
flash[:notice] = 'Access to that area requires additional privileges.'
redirect_to :back
end
end
However, it doesn't look as though before filters can take parameters.
Is ...
I have a situation where the header partial is called by the standard layout. (This is fairly common I assume) In the header is a search box - just like on stackoverlow. However, when the user is on the search page, I want to remove the search box from the header.
What I attempted to do was put a method in the ApplicationHelper.rb file...
Hello, I am currently still in school and taking a class on implementing data structures in c++. In my spare time I enjoy programming in "higher level" languages (mostly Ruby with some c#).
So since these higher level languages manage the memory for you, what would you use data structures for? I can understand the need for queues and st...
I'd like to create a graphic image on the fly based on user input, and then present that image as a PNG file (or jpg or gif if necessary, but PNG is preferred).
This is actually for an astrology application; what I'd like to do is generate the chart in PNG for display.
Python or Ruby is fine; in fact, the library available may determin...
Since both ruby and Haskell supports FFI,
Is it possible to call Haskell code from ruby, may be through FFI ?
Is there any Haskell binding in Ruby ?
...
I want to add a method to the Array class in a rails app. Where should I put this method?
EDIT to be clearer, obviously I put it in a file somewhere, but how do I tell the rails app about where to find it?
...
I'm writing a lightweight IDE. I chose Ruby+Gtk2 for the task. I already have a minimal prototype for it, but right now, most of the code is inside my window class. I'll soon start working on the "real deal", but I would like to know what design patterns should I make use of. I'm planning for plugin support too, so that the app will be e...
I just learn Ruby, and i wonder how to generate Reports and Invoices (with Logo, adressfield, footer, variable number of invoice-items (sometimes resulting in more than one page), carry over of the amount to pay from one page to the next, free-floating 2-column text (left-and-right-justified) below the resulting cash-informations).
Curr...
How is this explained? Can I replace self with some other object?
...