Questions Recently Asked by Carl Mercier /users/recently_asked/5 Questions Recently Asked by Carl Mercier Fri, 21 Nov 2008 12:01:49 -0800 $5.00 - I am doing flash[:error] = "Hello World!" in my controller, and it shows prop... http://www.guruza.com/question/528/reward-5.00 I am doing flash[:error] = "Hello World!" in my controller, and it shows properly in my view. However, flash[:error] is only deleted after the -second- time it is shown, which means that if I enter a wrong password, then navigate to the "lost password" page, I get a message saying "Invalid username or password" on -both- pages. What's the deal? AFAIK, Rails is supposed to delete the flash after it is rendered the first time. Fri, 04 May 2007 11:59:34 -0700 $0.00 - I am trying to create tests for a class I have in /components. I have put my... http://www.guruza.com/question/487/reward-0.00 I am trying to create tests for a class I have in /components. I have put my test file in /test/unit/custom_test.rb but it doesn't run when I do 'rake test'. What's wrong? \ Thu, 01 Feb 2007 11:10:30 -0800 $1.00 - Ruby / Ruby on Rails: I am building a database wrapper in a class. I want... http://www.guruza.com/question/483/reward-1.00 Ruby / Ruby on Rails: I am building a database wrapper in a class. I want to expose a string array of people (ex: ['john','jane','lucie']) which basically wraps a comma-delimited string column in a legacy database (names are in the db as: 'john,jane,lucie'). I'd like to be able to do: foo.people[1] = 'mark', foo.people.pop or even foo.people.push('richard') and have the changes reflected in the database. How do I hook into an array to be able to perform the underlying database operations? I'm not quite sure how to implement this correctly. Mon, 15 Jan 2007 10:40:57 -0800 $0.00 - I am trying to use sqlite3 for my dev database with my Rails app (1.2rc2). I... http://www.guruza.com/question/482/reward-0.00 I am trying to use sqlite3 for my dev database with my Rails app (1.2rc2). I am on OS X so sqlite3 is installed by default (I even installed the lastest version with darwinport), and I have done gem install sqlite3-ruby. However, when I try to do anything that has to do with ActiveRecord, I get errors. Here's an example: >> Domain.new ActiveRecord::StatementInvalid: ActiveRecord::StatementInvalid from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:273:in `table_structure' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5848/lib/active_support/core_ext/object/misc.rb:23:in `returning' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:272:in `table_structure' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:210:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:760:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:2048:in `attributes_from_column_definition_without_lock' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/locking/optimistic.rb:45:in `attributes_from_column_definition' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:1490:in `initialize_without_callbacks' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/callbacks.rb:225:in `initialize' from (irb):1 Any idea? EDIT: The funny thing is that I use sqlite3 and it works great with another project I started some time ago... Mon, 15 Jan 2007 07:58:30 -0800 $65.00 - I'm having a weird problem with IE (6 or 7), but it works fine with every oth... http://www.guruza.com/question/431/reward-65.00 I'm having a weird problem with IE (6 or 7), but it works fine with every other browser I tried. My pages take -forever- to load in IE. For example, a 1kb gif will take like 6-7 seconds to load. I can't figure this one out, anyone has an idea? The site is at http://ajaxwhois.com and Apache/Django is under the hood. I tried disabling Javascript, but no luck. Thu, 19 Oct 2006 21:01:22 -0700 $5.00 - I'm trying to deploy a Django app to a Ubuntu server. When I try to run the ... http://www.guruza.com/question/395/reward-5.00 I'm trying to deploy a Django app to a Ubuntu server. When I try to run the dev server, here's what I get: python manage.py runserver Validating models... Unhandled exception in thread started by Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py", line 1039, in inner_run validate() File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py", line 1003, in validate num_errors = get_validation_errors(outfile) File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py", line 815, in get_validation_errors from django.db import models File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/__init__.py", line 11, in ? backend = __import__('django.db.backends.%s.base' % settings.DATABASE_ENGINE, '', '', ['']) File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py", line 13, in ? from MySQLdb.converters import conversions File "/usr/local/lib/python2.4/site-packages/MySQLdb/converters.py", line 40, in ? import array ImportError: /usr/local/lib/python2.4/lib-dynload/array.so: undefined symbol: PyUnicodeUCS2_FromUnicode I compiled everything from source (ie: no apt-get). Wed, 13 Sep 2006 01:08:11 -0700 $5.00 - My site spans ajax requests that take a while to execute on the server. Howe... http://www.guruza.com/question/360/reward-5.00 My site spans ajax requests that take a while to execute on the server. However, this request becomes invalid if the user makes another request before the first one is completed. In order to save server resources, I'd like to be able to kill the 1st server request when the second one is sent. I was thinking about polling the session to see if a certain criteria is met. If it is, I'd just abort the current call. How would I do that? I guess I'd have to launch a second thread when the ajax request starts (on the server side) and that thread would poll the session every 100ms or so. If the criteria is met, it would kill the request. I'd like to see a code example of this. Wed, 30 Aug 2006 00:25:10 -0700 $1.00 - how do i profile a url? for example: script/profiler "http://0.0.0.0:3000/he... http://www.guruza.com/question/354/reward-1.00 how do i profile a url? for example: script/profiler "http://0.0.0.0:3000/hello/world" ? Mon, 28 Aug 2006 13:09:52 -0700 $5.00 - I need a little getting my CSS straight for this page: http://sandbox.carlme... http://www.guruza.com/question/353/reward-5.00 I need a little getting my CSS straight for this page: http://sandbox.carlmercier.com/test.htm Basically, the left and right sections are filled dynamically. Sometimes the left section will be longer, and sometimes the right one will be longer. Right now, the footer is at the bottom of the screen, but when the text in either the left or right section gets longer than the browser height, the footer gets in the way (ie: the footer is over the text). You can see this behavior by resizing the browser. I don't want this to happen. I want the footer to be at the very bottom of the page (bottom of the browser window), but I also want it to move down if there's too much text in the content areas. Moreover, my page doesn't show up properly in IE (but works great in Firefox), I'd like some help getting it right in all browsers. Mon, 28 Aug 2006 10:16:05 -0700 $0.00 - I'm trying to set a default controller in my Rails routing. The default cont... http://www.guruza.com/question/343/reward-0.00 I'm trying to set a default controller in my Rails routing. The default controller should be 'main'. For example, I want /about to route to /main/about. Here's what I have, but it doesn't work: map.connect ':controller/:action/:id', :controller => 'main' Can anyone help? Fri, 25 Aug 2006 00:48:14 -0700 $5.00 - When i start WEBrick, it simply says "=> Booting WEBrick..." then returns... http://www.guruza.com/question/289/reward-5.00 When i start WEBrick, it simply says "=> Booting WEBrick..." then returns to command line. Any idea why? I am using OS X and Ruby 1.8.4. I tried reinstalling Ruby, didn't help. Here's what I get when I run script/console: LLoading development environment. /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__': no such file to load -- lib/partial_classes/string.rb (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require' from ./script/../config/../config/environment.rb:51 from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup' from /usr/local/lib/ruby/1.8/irb.rb:54:in `start' from /usr/local/bin/irb:13 Mon, 31 Jul 2006 09:34:08 -0700 $10.00 - I'm pretty new to development for mobile devices (ie: cell phones) and blueto... http://www.guruza.com/question/274/reward-10.00 I'm pretty new to development for mobile devices (ie: cell phones) and bluetooth so please bear with me. I'd like to know if this is currently technically possible. I'd like a certain device (lets say a computer) to send a bluetooth signal to a nearby cell phone (or any similar device). When the phone receives the signal, a Java app would take over the screen and display some information (based on what was sent from the computer). This would most likely imply that the Java app would always be running in background on the phone. Am I 20 years ahead of my time or this is already possible? Thanks! Wed, 26 Jul 2006 20:27:25 -0700 $10.00 - I have a small business lan that is composed of a D-link Router, and 2 hubs. ... http://www.guruza.com/question/237/reward-10.00 I have a small business lan that is composed of a D-link Router, and 2 hubs. Both hubs are plugged directly in the router using their uplink ports. The computers plugged in hub #1 can connect to SQL Server (using a username and password, not Windows Authentication) just fine, but the ones connected to the second hub can't. I get a "Server doesn't exist or access denied" error. I use the same connection string, username and password. Of course, the computers on the second hub can access the network, internet and so on. I can even ping the server from them, but for whatever reason, I can't connect to Sql Server! What could it be? I'm a little lost now... Thu, 13 Jul 2006 10:26:10 -0700 $3.00 - I'm creating a very simple Rails app that will become my online phone book. ... http://www.guruza.com/question/230/reward-3.00 I'm creating a very simple Rails app that will become my online phone book. I just want to scaffold the whole thing as much as possible since I don't need anything fancy. I have a People table, and a Phone_Numbers table in my db. Phone_Numbers has a person_id field. Here's my Person class: class Person < ActiveRecord::Base has_many :phone_numbers end and my PhoneNumber class: class PhoneNumber < ActiveRecord::Base belongs_to :person end However, when I run the scaffolding, I cannot add/edit phone numbers when I edit a Person. Is this normal? I thought scaffolding would do this automatically, but maybe I was expecting too much from this. Thanks! Sat, 08 Jul 2006 17:21:10 -0700 $2.00 - I'm trying to figure out what would be the correct regular expression to retu... http://www.guruza.com/question/131/reward-2.00 I'm trying to figure out what would be the correct regular expression to return "this.is.what.i.want" from the following string: "My identifier: this.is.what.i.want\n". Thu, 29 Jun 2006 10:39:55 -0700 $2.00 - How do I install the french dictionary (as well as the English one) in OS X (... http://www.guruza.com/question/89/reward-2.00 How do I install the french dictionary (as well as the English one) in OS X (English installation). I write in French just as much as in English, and having both would be very handy. Thu, 08 Jun 2006 20:23:16 -0700 $2.00 - How do I install the french dictionary (as well as the English one) in OS X (... http://www.guruza.com/question/90/reward-2.00 How do I install the french dictionary (as well as the English one) in OS X (English installation). I write in French just as much as in English, and having both would be very handy. Thu, 08 Jun 2006 20:23:16 -0700 $2.00 - How do I install the french dictionary (as well as the English one) in OS X (... http://www.guruza.com/question/88/reward-2.00 How do I install the french dictionary (as well as the English one) in OS X (English installation). I write in French just as much as in English, and having both would be very handy. Thu, 08 Jun 2006 20:21:56 -0700 $5.00 - Just testing something... http://www.guruza.com/question/60/reward-5.00 Just testing something... Thu, 01 Jun 2006 07:08:38 -0700 $0.50 - Should I go to bed or not? http://www.guruza.com/question/37/reward-0.50 Should I go to bed or not? Thu, 18 May 2006 08:07:47 -0700