Written on
April 22, 2007
by
Chris Heald
Rails has the really nice ability to store an AR model object in the session for easy access. Additionally, it obeys the following rules:
- If obj.new_record? == true, then any associations on the object will be saved in the session as well.
- If obj.new_record? == false, then any associations whether association.new_record? == true or false will be nilled before the session is saved, to prevent the session from growing to extreme sizes.
I have an object that is created, things associated with it, saved in the session, previewed, confirmed, and then saved. This works beautifully, because the entire way through, .new_record? == true for the object. However, after saving the object, reloading it from the database, and then adding an association to it, I found that saving the object to the session stripped my association! This was extremely irritating, and it took some sludging through the Rails core code to understand what was going on.
Now what I’m doing is:
- The saved object is loaded from the DB and saved to the session
- The new association is created with obj.build_association and then saved to the session
- On each page load, if the association exists in the session, then it is re-associated with the model.
This seems really ugly and hackish, but it works. If there’s a better way, please let me know what it is.
I’ve been beating my head against the wall on this problem for about four hours now, and it finally hit me.
Posted in Uncategorized, Ruby/Rails, Software Development
|
No Comments » | View blog reactions
Written on
April 21, 2007
by
Chris Heald
Oh, to be a chump.
My system suffered massive hardware failure, and I’ve rebuilt it and managed to salvage scraps off of it (including the blog DB!), but it’s got a long way to go yet.
Stay tuned.
Posted in Uncategorized
|
No Comments » | View blog reactions
Written on
April 17, 2007
by
Chris Heald
For years now, I’ve used Ahead’s Nero Burning ROM as my CD/DVD burning solution, and it’s worked well. The quality seems to have deteriorated in the past few years, though, putting it more in line with the software that I originally sought to avoid by using Nero - EasyCD Creator, abomination that it is.
I downloaded a Fedora Core 6 ISO today, and needed a way to put it onto a DVD. Rather than searching for my Nero discs, I decided to look and see what Sourceforge had to offer. My first hit was InfraRecorder. It looks extremely promising. Clean, simple, no-nonsense CD/DVD burning, no ugly cruft, and it’s open source, to boot.
I’m writing the ISO right as we speak, but it seems to work well so far. If you’re looking for a new way to burn discs, you might consider giving it a shot.
Posted in Software Development
|
No Comments » | View blog reactions
Written on
April 12, 2007
by
Chris Heald
See the Prototype announcement and the
Scriptaculous announcement for more info and changelogs.
In short, it’s a lot faster, memory leaks are fixed, and there are a number of new features including sound support (which I don’t think I’d use, but which is still cool). I tried it out tonight in my personal work, and the effects are significantly smoother. My browser didn’t experience any hitching during the various effects (it normally does), and the AJAX stuff seems faster too, but I didn’t benchmark it.
This is beta, so standard caveats apply. Also, the standard rails “javascriptincludetag :defaults” won’t work - there are a number of new files, so you’ll need to set up the includes manually yourself.
I did it like so:
<%=javascript_include_tag "prototype" %>
<%=javascript_include_tag "builder" %>
<%=javascript_include_tag "scriptaculous" %>
<%=javascript_include_tag "dragdrop" %>
<%=javascript_include_tag "controls" %>
<%=javascript_include_tag "effects" %>
<%=javascript_include_tag "slider" %>
Enjoy!
Posted in Ruby/Rails, Software Development, Javascript/AJAX
|
No Comments » | View blog reactions
Written on
April 10, 2007
by
Chris Heald
Simply type “San Francisco real estate” or “homes for rent in Manhattan” in the Google search box. Below the sponsored links on the search results page it will say something like “Find results for homes for sale in manhattan in Housing search.”
Click on that to get a beautiful Google map populated with listings.
It’s a slick little app, and very certainly an improvement over most of the existing real-estate searches, as it lets you visually see where the stuff you’re looking at is located, rather than having to go look it up on a map yourself.
read more | digg story
Posted in Software Development, Javascript/AJAX, Google
|
No Comments » | View blog reactions
Written on
April 6, 2007
by
Chris Heald
I’ve managed to get FastCGI running through Apache, and will be testing its performance in the context of Rails in the next few weeks. I haven’t done any formal testing, but it feels faster than my current Apache ProxyLoadBalancer -> Mongrel setup.
Read the rest of this entry »
Posted in Ruby/Rails, Apache
|
No Comments » | View blog reactions
Written on
April 6, 2007
by
Chris Heald
Firebug is an amazingly-useful web development and debugging tool that no web developer should be without. There’s a great article over at Coding Horror about it, if you want to learn more about it.
If you are a user, though, please update to the latest version (1.0.4 at the time of this writing) as a nasty vulnerability has been discovered that would give malicious page authors privileged access to your machine if you’re running Firebug.
Posted in Software Development, Javascript/AJAX, CSS
|
No Comments » | View blog reactions
Written on
April 4, 2007
by
Chris Heald
I’ve updated my GlovePIE script considerably. It’s a lot smoother now.
- Holding “A” and casting will attempt to cast. This causes the Wiimote to rumble.
- Jerking back on the line will reel your catch in. Also causes some mild rumble.
- The nunchuk joystick moves the cursor/acts as mouse.
- “Z” is left click now. “B” is right click. Holding both of them puts you into run mode, and the joystick can steer your character just as you would with the mouse. Holding “C” rather than “Z” will put you into strafe mode, which doesn’t move the camera, but which allows you to strafe side to side, or back up.
- The plus and minus buttons zoom the camera in and out
- I fixed the “casting lag” that was present in the first video
Feedback and suggestions are welcome! Updated code is behind the cut.
Read the rest of this entry »
Posted in Gaming, World of Warcraft, Wii, Hacks
|
8 Comments » | View blog reactions
Written on
April 4, 2007
by
Chris Heald
I’m back with another entry in my series on web design. If you missed it, here is part one.
Most every professional web site out there employees Javascript to some degree. With AJAX catching on as it is, Javascript is becoming more and more popular. Unfortunately, this means that more and more sites are breaking one of the fundamental rules of web design.
Read the rest of this entry »
Posted in Software Development, Javascript/AJAX, Design
|
No Comments » | View blog reactions
Written on
April 4, 2007
by
Chris Heald
Jeff Atwood has a good article today about the various open-source licenses. It’s definitely worth a read, especially if you don’t want to spend excessive amounts of time trying the decipher lawyerese (which is similar to programmerese except it reads like it’s written on a pay-per-word basis) when trying to figure out how you want to license your code.
He also touches on why developers should always license any code they release for others to read and possibly use, which is a rather important piece of the whole puzzle. He says:
Because I did not explicitly indicate a license, I declared an implicit copyright without explaining how others could use my code. Since the code is unlicensed, I could theoretically assert copyright at any time and demand that people stop using my code. Experienced developers won’t touch unlicensed code because they have no legal right to use it. That’s ironic, considering the whole reason I posted the code in the first place was so that other developers could benefit from that code.
Lots of developers - myself included - tend to not think about that kind of thing when we publish some code somewhere. We assume that because we published it without indicating any restrictions, there is an understanding that it may be used freely. This isn’t the case, though, and the lack of a license can actually hinder the progression of knowledge by preventing legality-aware developers from using your code.
Posted in Software Development
|
No Comments » | View blog reactions