Archive: June 05, 2003
Bruce Almighty was actually far better than expected. Recommended!
ONJava.com: Nukes: the Open Source Java CMS. Just what the title says, they cloned PostNuke in Java. Since I wasn't familiar with how PostNuke worked, I learned some things. Worth taking a look at anyway.
I don't know what it is with me and humor links today, but I've been stupidly laughing at things all afternoon. I'm kind of tired and in a daze, so...
Via 0xDECAFBAD, The Credit Card Prank.
Non-Mozilla/Firebird users: beware of popups.
CNN: New system could speed up Web downloads
I hate it when you have "popular" articles (like from CNN) that don't go into anywhere near enough detail to let you understand the technology (since the writer probably doesn't either)
Update
Via Erik, Via Cameron, The History of the Internet. Much funnier than I expected.
2000: The internet is finally given purpose when Scientists Mathew Chapman and Michael Chapman complete their research and bring Homestarrunner technology to the internet.
Cox & Forkum have another one of their great political cartoons up on their site. And this is just funny.
Oliver has some comments:
It's like the US is headed toward the edge of a cliff and instead of turning around and going a different direction, they simply build a ledge to delay dropping off into the abyss.
This is the type of story people against gun control, like myself, love to see. Individuals protecting themselves effectively with guns.
As his back door was kicked in Monday afternoon, a South End homeowner - confined to his bed because of a disability - called 911 with one hand and grabbed his 9 mm Glock handgun with the other.
Within seconds, a burglar was in the bedroom and inching closer.
"He didn't stop coming toward me until he was looking down the barrel of a 9 mm," said the 64-year-old homeowner, who didn't want to be identified out of fear for his safety.
The burglar, disguising his face with a handkerchief, backed off several steps and called out to someone else.
"I thought he was going to take off, but he turned back around and he said, 'I'm going to get you,'" the homeowner said. "That's when I shot him."
The homeowner said he has kept a gun in his home for years for protection. He had not fired it outside of the range before Monday.
"I didn't shoot him to kill him," said the homeowner Monday evening as he lay on his side in bed. "I'm thoroughly convinced this guy would have killed me."
Via John Hawkins. And his comments hit the mark:
If you're for strict control, then you're for taking the gun out of that man's hand and leaving him at the mercy those criminals. There are a lot of good reasons to oppose gun control, but one of the most important ones is that gun control legislation helps criminals and hurts law abiding citizens.
Of course gun control isn't going to keep guns out of the hands of criminals -- because duh they're criminals -- they don't care if the law says they can't have a handgun. So who gets hurt? The law abiding citizens who want to do the right thing. But what happens when your wife, your daughter, your mother gets trapped in dark alleyway by some leering thug? If you're for gun control you just shrug your shoulders and hope she doesn't get hurt too much. If you're pro-Second Amendment, you hope she pulls a handgun out of her purse, cocks it, and says "I don't think so" while the punks who were menacing her run away in terror. That's the difference between people who are pro-gun & people who want to take guns away from the American people.
I'm sorry, but I have to link to the Panda Dog again. It's too cute.
CNET: Palm to acquire rival Handspring.
That's ironic. It's like Apple buying Pixar, but moreso.
I'm bored, and I think this is really cool, so I just wanted to show you some code snippets from my CMS.
Check out my login form at http://www.keithdevens.com/admin/. Here's the code that produces that:
<?php #the login function is part of my Administration class, # which is beyond the scope of this post :) function login(){ global $cms; if(!$a = &$cms->getAction('administration.logIn')){ echo "<p>Couldn't get login action</p>"; }else{ $cms->incLibrary('formhelper'); $fh = &new HtmlFormHelper($a); $fh->setWidget('password',HTMLFORMHELPER_PASSWORD); $fh->printDefaultForm('Log in'); } } ?>
Get rid of the obvious error handling and setup code and that's four lines. Now, for the "action" itself:
<?php class administration_logIn extends Action{ function construct(){ $this->setActionName('administration.logIn'); $this->addField('username',array('title'=>'Username','required'=>true)); $this->addField('password',array('title'=>'Password','required'=>true)); } function validate(){ global $cms; $a = &$cms->getModule('authentication'); if(!$a->validateLogin($this->get('username'),$this->get('password'))){ $this->addError('Your username/password combination did not validate'); return false; }else{ return true; } } function process(){ global $cms; $a = &$cms->getModule('authentication'); $a->logIn($this->get('username'),$this->get('password')); } } ?>
I never want to go back to writing forms the "old" way again.
Obviously, there's a lot of other code behind the scenes. My CMS intercepts any posted Actions and passes request data to them, and then you have the authentication module which keeps track of your username and user_id and maintains that info in a session. And of course you have the Action base class, and the HtmlFormHelper class. All of said code I may make available someday. The point is that the interface is simple. It rules.
Hey, Keith implies he gave me the idea. No fair! You may have been thinking about the idea before me, I dunno, but I've been wanting an easier way to do HTML forms for ages.[1]
Actually, when we had last talked about it, I was trying to do the form thing simply by abstracting away the code that would print the form HTML into functions. I later got the idea to make a form "model" (the Action) that can represent every type of form possible So I separated the HTML generation from the form definition, validation, and processing, and that worked really well.
Footnotes:
[1]: More importantly, however, this makes it easier to do HTML forms correctly. It can actually be pretty hard to write a correct Action, but once you do, it's correct, and not mingled with all your HTML. No more writing <input type = "radio" <?php if($value == $foo){echo 'checked = "checked";}?> value = "<?php echo $foo;?>" /> all the time, hooray!
Artima.com: Python and the Programmer, A Conversation with Bruce Eckel, Part I.
Two years ago, Eckel gave a keynote address at the 9th International Python Conference entitled "Why I love Python." He presented ten reasons he loves programming in Python in "top ten list" style, starting with ten and ending with one.
In this interview, which is being published in weekly installments, I ask Bruce Eckel about each of these ten points. In this installment, Bruce Eckel explains why he feels Python is "about him," how minimizing clutter improves productivity, and the relationship between backwards compatibility and programmer pain.
This makes me feel a ton better, because I can't remember this type of stuff either:
They say you can hold seven plus or minus two pieces of information in your mind. I can't remember how to open files in Java. I've written chapters on it. I've done it a bunch of times, but it's too many steps. And when I actually analyze it, I realize these are just silly design decisions that they made. Even if they insisted on using the Decorator pattern in java.io, they should have had a convenience constructor for opening files simply. Because we open files all the time, but nobody can remember how. It is too much information to hold in your mind.
Another number that used to be bandied about is that programmers can produce an average of ten working lines of code per day. Say I open up a file and read in all the lines. In Java, I've probably already used up my ten working lines of code for that day. In Python, I can do it in one line. I can say, "for line in file('filename').readlines():," and then I'm ready to process the lines. And I can remember that one liner off the top of my head, so I can just really flow with that.
Real interesting interview.
|
Generated in about 0.071s. (Used 7 db queries) |
new⇒Court rejects death penalty for raping children - Yahoo! News
:)...
Keith: Jul 4, 11:32am