Posted in October 22, 2009 ¬ 8:15 amh.Chris Richards
What: A plugin for jQuery that makes serializing input elements easy. Once serialized you can send the elements back to the server with AJAX. Why: There is a big problem with jQuery’s built in $.serialize() method. It only uses the input elements name attribute. In practice I found that the name attribute is rarely used, [...]
Read the rest of this entry »
Posted in September 20, 2009 ¬ 1:24 amh.Chris Richards
The last version of my Canvas app let you pick different brushes and draw on the grid. If you played around with the line brush you might have noticed a small bug. The line erases everything it passes over. This is because the line has no idea what the image was supposed to look like [...]
Read the rest of this entry »
Posted in September 14, 2009 ¬ 7:00 pmh.Chris Richards
This time I’ve taking the actual drawing out of the canvas object so we can have different brushes. I’ve also included a bit of code to get the color from the current cell and compare it with a hex color.
Read the rest of this entry »
Posted in July 15, 2009 ¬ 11:24 amh.Chris Richards
If you’ve played around with the demos, then you might have noticed a little bug. If you click down in one square and let the mouse up in another square, the square you clicked down in will stay green. I haven’t addressed this issue in earlier examples because it’s not actually a bug. What I [...]
Read the rest of this entry »
Posted in July 12, 2009 ¬ 1:40 pmh.Chris Richards
Last time we managed to create a very simple grid and change colors when you clicked on a cell. But, being a first attempt the grid wasn’t flexible and it had a lot of duplicated code. In this post we are going to improve it.
Read the rest of this entry »
Posted in July 12, 2009 ¬ 12:45 amh.Chris Richards
I’m going to need a Grid, so let’s start with a simple grid. A 2 by 2 grid will work just fine. There’s three ways to draw the grid, one is to draw filled rectangles, another is to just draw the outlines of the rectangles, and finally we could just draw a few lines. It [...]
Read the rest of this entry »
Posted in July 11, 2009 ¬ 12:43 amh.Chris Richards
One of the biggest problems I’ve been having with taking the KnitProject to the next level is drawing with JavaScript. This is where the Canvas element comes in. If you’re an IE user you can leave right now, Unless you download some plugin, none of this will work. Frankly I don’t care about IE and [...]
Read the rest of this entry »
Posted in July 10, 2009 ¬ 9:13 amh.Chris Richards
The keyPath I talked about last time is just to useful to wait on. So I added it. This lets you easly get values from DBObjects within other DBObjects. So on the death date example from last time. return (DateTime)((DBObject)valueForKey(“user_info”)).valueForKey(“column_death_date”); is replaced with return (DateTime)valueForKeyPath(“user_info.column_death_date”);
Read the rest of this entry »
Posted in July 9, 2009 ¬ 2:10 pmh.Chris Richards
I think it’s time for a demonstration. In this example I show two ways you can use joined tables within the object. I also so why the KeyPath would be a useful addition to the object. In User.BirthDate I’m joining two columns from the table users_info directly into the User object. There are problems with [...]
Read the rest of this entry »
Posted in July 9, 2009 ¬ 8:34 amh.Chris Richards
Note: I really shouldn’t call this refactoring because it’s an api change. My SetProperty() and GetProperty() methods are really just my weak attempt to add KVC (Key Value Coding) to the DBObject. This is something built in to objective-c. So I want to rename these methods to reflect their true nature. (The word Property was [...]
Read the rest of this entry »