My old ThinkPad keyboard rocks: it has a trackpad and a trackpointer, types nicely, has a palm rest, and is generally awesome. It does not, however, have a Windows button: this makes using it under... well, anything... difficult.
I'm currently developing with a company-bought Ubuntu laptop after having used OS X for the last three years almost exclusively. Like Windows and OS X, it pretty much
Today I started receiving the following error when I tried to sftp to my localhost, both from the command line and from the Ruby Net:SFTP library:
$ sftp ftpuser@localhost
Password:
Received message too long 1399157792
Trivial digging revealed that ftpuser's .bashrc script was writing to stdout, which apparently is enough to confuse sftp all 'round. I modified the command it was running to
$ sftp ftpuser@localhost
Password:
Received message too long 1399157792
Trivial digging revealed that ftpuser's .bashrc script was writing to stdout, which apparently is enough to confuse sftp all 'round. I modified the command it was running to
Posted by
Unknown
at
5:10 AM
Struts 2 claims that "actions can be POJOs". Developers find out pretty quickly that not extending ActionSupport means you lose some Struts 2 functionality (primarily I18N and validation).
One source of confusion is what "POJO" means. POJOs don't mean you don't extend a base class. POJOs are classes not directly tied to unrelated libraries, specifications, etc. For example, Struts 1 actions were
One source of confusion is what "POJO" means. POJOs don't mean you don't extend a base class. POJOs are classes not directly tied to unrelated libraries, specifications, etc. For example, Struts 1 actions were
I was unable to log in to the Apple App Store while trying to update Xcode on my MBP.
Here's an Apple discussion thread regarding possible solutions.
What ended up working was signing out, clicking "Store -> Create New Account", accepting the Terms and Conditions, then canceling out of new account creation and signing in again.
While deleting the network interface plist, cookies, etc. was
Here's an Apple discussion thread regarding possible solutions.
What ended up working was signing out, clicking "Store -> Create New Account", accepting the Terms and Conditions, then canceling out of new account creation and signing in again.
While deleting the network interface plist, cookies, etc. was
I was running a specific rspec over and over during a tight development cycle. The way our system was set up it was taking 30+ sec to run a single spec file, which made running them onerous.
We had Spork running at one point, but it wasn't working for me, with a "undefined method 'flush' for nil:NilClass" error (and a couple of others depending on the incantation):
After upgrading Spork (we
We had Spork running at one point, but it wasn't working for me, with a "undefined method 'flush' for nil:NilClass" error (and a couple of others depending on the incantation):
After upgrading Spork (we
Ever write a trivial spec like this:
And get something totally baffling back, like this?
Backstory: Refactoring some pre-written classes to use metaprogramming to create some methods and values. I wanted specs in place before starting the metaprogramming to avoid breaking things.
In retrospect, I should have figured this out sooner. In my defense, I love the Olympics and was distracted. The
And get something totally baffling back, like this?
Backstory: Refactoring some pre-written classes to use metaprogramming to create some methods and values. I wanted specs in place before starting the metaprogramming to avoid breaking things.
In retrospect, I should have figured this out sooner. In my defense, I love the Olympics and was distracted. The
Singletons are evil, and here's why.
Fair enough. Yet they exist, and they're not intrinsically evil--just misused. Can we mock enough to make testing them feasible? Yep, and here's a Contrived Example™ that shows how (and why we might want to).
"Embedded" singletons or utility classes can make testing is problematic. Injected singletons are different; then it's an issue of whether or not it
Fair enough. Yet they exist, and they're not intrinsically evil--just misused. Can we mock enough to make testing them feasible? Yep, and here's a Contrived Example™ that shows how (and why we might want to).
"Embedded" singletons or utility classes can make testing is problematic. Injected singletons are different; then it's an issue of whether or not it
(Because it's like "racetrack", and it makes Rake tasks faster, and... oh, never mind.)
Tired of waiting for Ruby to spin up just so you can run a "routes" command, or your latest "db:migrate"?
Use rake-sh and start up a rake console for running tasks without the initial spin up. It'll take a "rake routes" from four seconds down to under a second. Rake task completion? Naturally. Use "t" for
Tired of waiting for Ruby to spin up just so you can run a "routes" command, or your latest "db:migrate"?
Use rake-sh and start up a rake console for running tasks without the initial spin up. It'll take a "rake routes" from four seconds down to under a second. Rake task completion? Naturally. Use "t" for
Remember when I had a Rails 3 custom validator quandary? My bottom-line question was "how should I access a specific error condition, cleanly, in both an action, and a template?" I sketched a few solutions, ranging from checking for a specific error message to providing a function that indicates if the error has occurred.
For now, I want simple boolean methods on the model to encapsulate the
For now, I want simple boolean methods on the model to encapsulate the
Entry-level overview of one way to add trivial Ajax functionality to a Rails 3.0 app, originally written for a specific audience. The repository is on github.
Let's say we have an Article model with an "approved" flag. We need to be able to toggle this flag. Normal scaffolding would have us view the article, click a checkbox, and submit. We'll keep that functionality, but add a simple
Let's say we have an Article model with an "approved" flag. We need to be able to toggle this flag. Normal scaffolding would have us view the article, click a checkbox, and submit. We'll keep that functionality, but add a simple
This question on stackoverflow led me to believe that if I actually ran rake test that my example app's tests would fail--and they did, with the same error. (Why I wasn't running tests from the beginning? Meh!) The tests throw up wads of stack trace, headed with this:
SQLException: no such table: user_sessions: DELETE FROM "user_sessions" WHERE 1=1
What's causing this error? We created our user
SQLException: no such table: user_sessions: DELETE FROM "user_sessions" WHERE 1=1
What's causing this error? We created our user
Posted by
Unknown
at
9:24 AM
I'm prototyping some calendar/date stuff for a Rails app in standalone scripts, and want access to both normal Rails things (in this case, ActiveSupport's date math, like Date.today - 3.days) and my own classes within the prototyping directory. I'd like to continue using TextMate's "Run" command to run the current buffer as a Ruby script, since it's convenient. I'm using rvm; my prototyping
Posted by
Unknown
at
3:00 AM
This is a continuation of my first authlogic/Rails 3 post.
Authlogic users have both "login" and "email" properties by default. I wanted to allow users to log in via their email address or nickname. I tackled this in two steps. First, switch to logging in using the "email" property. Second, create a "nickname" property, and allow users to log in with either one. (Yes, I actually wanted to call
I've started a simple Rails 3 + authlogic example project on github, mostly for myself to experiment with. Right now it's basically a copy of this post's implementation (and unfinished at that), but I'll be expanding it over the next few days in various ways.
As it stands, the "application" (I use the term loosely) consists of a home page (root path) requiring login, and login/logout actions.
As it stands, the "application" (I use the term loosely) consists of a home page (root path) requiring login, and login/logout actions.
(Not checkboxes, in my case, but a checkbox example is easy, and more common.)
Originally I thought I needed accepts_nested_attributes_for, but that seems to be mostly for when we're creating the related objects, which I'm not--I need to save relationships to existing objects.
My example (github) uses a simple product/category relationship. We need to get a product's categories, we need to get
Originally I thought I needed accepts_nested_attributes_for, but that seems to be mostly for when we're creating the related objects, which I'm not--I need to save relationships to existing objects.
My example (github) uses a simple product/category relationship. We need to get a product's categories, we need to get
Throwing this out there to see what people thing--I suspect there are better, cleaner ways to do this, and I'm wondering what they are.
$.fn.click1 = function(fn) {
$(this).data('clicked', false);
$(this).click(function(o) {
if ($(this).data('clicked')) return false;
$(this).data('clicked', true);
fn(o);
return false;
});
};
(I return false because I know I don't
$.fn.click1 = function(fn) {
$(this).data('clicked', false);
$(this).click(function(o) {
if ($(this).data('clicked')) return false;
$(this).data('clicked', true);
fn(o);
return false;
});
};
(I return false because I know I don't
I'm trying to figure out the "best" way to support discovery of custom validator errors on a Rails 3 model.
My model has both standard and custom validators. I need to check for validation errors from the custom validators, in both controller and template.
My slap-dash solution was to add an additional error message keyed to the field name suffixed with a validator-specific extension. For
My model has both standard and custom validators. I need to check for validation errors from the custom validators, in both controller and template.
My slap-dash solution was to add an additional error message keyed to the field name suffixed with a validator-specific extension. For
I push the command line on people, because it's generally the most efficient way to do several different things. My devs resist me, although I don't understand why... part of it is that most places I've worked at are Windows houses. No problem, say I: Cygwin to the rescue. Seriously, gang, I'm not just making this up.
(I'll grant, however, that there are some Finder/Explorer replacements that
(I'll grant, however, that there are some Finder/Explorer replacements that
Two FB apps, both using FB.ui to publish to a stream. One worked, one didn't, nobody knew why. I needed to know.Nutshell: FB JS code was inadvertently included twice (not by me, which always makes things more difficult). This caused the app_id and app_key values in the FB.ui call to go away--everything else was there, but two pieces critical (obviously) weren't. Note that the app code didn't
Several sites describe the process necessary to get TextMate to use either a wrapped (via the rvm wrapper command) or an rvm-specified default Ruby interpreter (including gemsets, basically anything you can use with the rvm use command).
Following just those steps never worked for me, even when I explicitly gave a wrapped TM_RUBY: it would still do an exec ruby in there and blow up. I've
Subscribe to:
Posts (Atom)