Archive for the ‘dev’ Category

My C is more better now!

Friday, December 12th, 2008

I have pushed an update for my silly php extension to github for anyone that wants to have a looksie. I’ve optimized the human_interval_precise function to only declare two variables (the long to hold the number of seconds passed in from userspace and the char array that gets passed back). Still need to figure out a sensible max length for the return value and replace the arbitrary char[60] I have in there now.

I’ve also added a human_interval (not precise) function for approximating in the largest possible units. However, I just realized as I was writing this that I forgot to make it round in any way, so it probably comes up with fairly bogus results right now. Fail. Good thing this is just an exercise, and I’ll have another 3 hours on a shuttle to kill on Monday… and on Tuesday… and on Wednesday…

As I said before, I’m also working on a redo of the WordPress theme, as well as another more “grown up” C project.

Also, did not get laid off. Best of luck to all that did. Crazy times we live in.

PS: just saw on my nifty little wordpress toolbar that 2.7 is available. FUCKING ROCK! New design coming with the quickness.

Learning to walk after running for 4 years: from PHP to C

Sunday, December 7th, 2008

In an effort to stop being such a fucking noob, I’ve seriously taken up C. As a natural transition/crutch, I have started with PHP extensions. The PHP API basically picks your droppings up after you with a plastic bag, so it’s pretty easy. Using ext_skel gave me pretty much everything I needed, since I’ve only written one function so far and have not done anything fancy.

The extension is called “human,” short for “human readable.” The first function, human_interval_precise, simply represents a number of seconds in the largest “precise” time units possible. That is, thousands of seconds are converted to weeks, days, hours, minutes, and seconds as needed. The source is here.

Lessons

I’m obviously still a giant noob, but there are some things that I have picked up along the way (mostly via Crowley) that made things a lot clearer. Hopefully my posting this will help other noobs following in my footsteps.

“Pointers are just numbers”

Yup. Just the number of memory blocks from the start of the segment of memory you’re dealing with. “Pointer math” is really just math: p+5 really is just the position in memory 5 blocks away from the start of p. The size of the blocks is determined by the pointer type, so if you have a char pointer, the blocks are 1 byte.

an array is just a pointer to a set of consecutive memory blocks

The name of the array is just the pointer to the first element. This is particularly important with char arrays. When I do the following in my code, I am just adding output to the end of an already existing “string.”

sprintf(retstr+strlen(retstr), "%dd ", days);
The K&R section on the relationship between arrays and pointers is incredibly useful.

Always remember to initialize your strings

Nothing says “FAIL” like running your PHP function more than once in the same script and seeing it return its result appended to the end of the result from the previous call. A simple

*retstr = 0;
at the top of the function takes care of the problem. Otherwise, your char pointer ends up pointing to memory that isn’t claimed by anything else, but isn’t cleared either. In the case of consecutive PHP function runs, it just happens to be the previous output. It could end up being any sort of useless garbage.

I started writing this entry a few weeks ago and got sidetracked by a bigger and more interesting project/thanksgiving. As a result, I don’t remember what else I was going to write, so I’ll just wrap it up. More C learnings coming soon. It has been a humbling experience to say the least.

i’m branching out: c, python, maybe even java…

Sunday, June 8th, 2008

Though I had made my mind up a while ago to start seriously hacking other languages besides PHP, I saw something today that really reinforced that decision: average programmer salaries.

Erlang $99,000 (added 8 June 2008) … Java $79,000 Python $78,000 Perl $77,000 Ruby $74,000 COBOL $73,000 (added due to demand)
JavaScript $72,000
ColdFusion $64,000 (8 June 2008)
Delphi $64,000 PHP $64,000 …

Yikes!

where the eff have i been?

Wednesday, April 16th, 2008

As I’ve previously mentioned, I am at MySQL 2008 in Santa Clara. I’ve been busy going to the talks, hanging out, and soaking in the weather.

Coding wise, I’ve been at a standstill – I had to do a bunch of stuff for work, came up with a mess of ideas that I had to filter and decide what I actually wanted to work on, and then realized I didn’t want to start working on anything else until I finished ked_duffel, or at least got it to be usable. That itself became a bottleneck as I struggled to figure out how to handle variables within files, but I’ve come up with what I think is a relatively elegant, cheap, and maintainable solution, so I’ve started development. I’ll post details as I implement the stuff

The Conference

I have learned quite a bit of stuff. As I work at a place where we don’t have dedicated DBA’s, but are getting to the point where at least minimal optimization and scaling are becoming a necessity, it was great to hear some talks about efficient scaling, caching, and proper monitoring/query analysis and optimization. Of particular interest and use were the memcached talk and the various discussions of stored procedures. Though only useful in the future (it’ll be a while before MySQL 5.1 is available to us), partitioning also seems like something that would help us out a great deal.

All in all, I’m getting my (read: Yahoo’s) money’s worth and having a good time. I have generated lots of ideas on how we can drastically ameliorate a lot of our performance issues and make our database much more maintainable.

One thing that kind of sucks is that a lot of the talks about monitoring/alerting ended up a waste, as they talked about opensource products that we had looked at and ended up developing our own due to scale issues.

oEmbed, or what I did instead of reading for class

Friday, March 28th, 2008

Like I said, I was writing a wordpress plugin. I wanted to automatically highlight code posted within <pre> tags. And no, I didn’t want <code> tags b/c those aren’t part of the native wordpress editor toolbar – the goal was to be able to embed highlighted code while just being completely lazy and staying the “Visual” tab.

This got boring really quickly, especially once I saw that someone had already done something similar, except weak and pointless. If I’m going to upload “code snippets,” why don’t I just run them through enscript while I’m at it and paste the damn output?

Anyway, then I thought “Hey, this flickr plugin I’m using kinda sucks and isn’t very good about letting me pick which size of photo I want to embed.” It’s a global setting. FAIL.

So then I thought “If Crowley’s drunken ramblings about some sort of open standard for embedding media had any actual substance, I could easily improve this.”

They did. He was talking about oEmbed.

I’m gonna cut this story short because I’m fucking burned, but here’s what I posted on Cal Henderson’s website’s discussion:

I’m messing around with oembed on flickr – not seeing a way to specify which size of the image I want to embed. I tried some combinations of changing the URL and maxwidth/maxheight settings in the request, but to no avail. I tried: www.flickr.com/services/oem… www.flickr.com/services/oem… www.flickr.com/services/oem… All three return the same thing: [ the xml output of this request ] Are we not there yet? I was thinking of making a flickr oembed wordpress plugin. It’ll still work, but will be limited to the one size. Is there a way to work this? Would it be possible to set up server side logic @flickr which actually checks the /sizes/foo part of the URL and returns the appropriate URL/size info? I haven’t thought about it long (and it’s late) but that seems to be in line with the standard – would only have to change the url GET var in the request, putting all the logic on the providers side and just spitting out the right image. Cheers. Mike.

Project ADD

Wednesday, March 26th, 2008

Just had another “AWESOME” idea today that fits nicely with my desire to create something that can stay with an app as it grows. Once ked_core functionality is more or less finalized (sooner rather than later), I’m going to start hacking up a pecl extension that will mimic ked_core’s behavior perfectly, thus allowing the developer to simply comment out the require_once statement in index.php having installed the extension, maintaining the exact same behavior, but with less overhead, since the framework’s core will now be compiled.

As Crowley put it, that is overkill. I know. But I need to learn how to write PHP extensions :)

I realize that I’ve started more projects in the last month than I have in the last 2 years. I am going to prioritize things a little bit – I want to focus on ked_duffel (the SVN delivery system) to start out, then once that’s functional use it to update mihasya.com’s framework files, then tinker with the framework a little bit, using duffel to test it on mihasya.com.

Once I’m happy with its functionality, I’ll start compiling a pecl skeleton and trying to fill it out, making heavy use of my rollover minutes – to call Crowley with dumb C questions.

Of course, all of this is going to have to wait a little bit – I realized recently that nearly two weeks had passed without me having done any paid work. Someone has to pay for Crowley’s lapdances, so I am going to dedicate a bit more time to Yahoo! stuff in the coming couple of weeks.

Actionless Views: The Quest For Perfection

Monday, March 24th, 2008

The idea here is being able to route ked_core to a static template w/o executing any action or having defined one. For example, if you want your header to just be static HTML and want that in a separate header.tpl file, there’s no reason you should have to define controller->header() just to access that.

I went through several iterations on this code (some of it is in svn, though not all – I had to start the repository over b/c I forgot to add trunk/ branches/ and tags/ :( ) so here is my approximate thought process.

Step 1: Check the .tpl exists

I should have had this check anyway, but before I did not realize the need – there needed to be an action defined for the view to be rendered anyway, so I focused on that, and that seemed to take care of itself. The following line would just throw an Exception

$reflector = new ReflectionMethod($this, $action);
which would then just be handled and displayed nicely with ked’s exception handler.

But now I really do need to actually handle this on its own, since the action might not even exist – WHAT WILLS WAE DO THARN?!

The Wrong Way:

if (ked::$smarty->template_exists($tpl)) { ...
No. That is clearly a file system operation that will be run every single time, even though we know that 99% of the time, unless the developer is a total and complete dunce, the template is there. Then there’s the additional fs read to load the template.

The Right Way:

The right way looks sort of hackish, but bear with me. Smarty is really dumb about how $smarty->display() works. It never returns anything. If it fails to load the template, it prints a warning. Can’t really check to see if it succeeded in any robust way, so this will do:

...
ob_start();
ked::$smarty->display($tpl);
$viewContent = ob_get_contents();
ob_end_clean();
if (!$this->_skipAssign) ked::$smarty->clear_all_assign();
if (strpos($viewContent, "<b>Warning</b>:  Smarty error: unable to read resource:")!==false)
  throw new kedException('The view "'.$this->_view.'" was not found')
...
I just check for the presence of the warning and throw an exception if it’s there. Now, normally, I am not a fan of throwing exceptions, but in this spot it’s ok, and I’ll explain later why. The short explanation: because we’re not catching it.

Step 2: Make _execute Not Choke On Absent Action

The Wrong Way:

This is where I originally threw an exception, but a comment by David Hall made me pause.

...
try {
  $reflector = new ReflectionMethod($this, $action);
} catch (Exception $e) {
  $this->_skipAssign = true; //tell _render to skip smarty->assign related steps for this.
  return false;
}
...
So here, we just try to create a ReflectionMethod as we normally would for the action, but if we see an exception, we just return; out of _execute and go on to _render. It’s sort of sloppy (because what if ReflectionMethod’s __construct() threw an exception for some other reason) and the real problem is this: we are creating and catching an exception in framework code. Every time an actionless view is called, this will happen. David pointed out that the exception is itself an object and can be quite heavy.

The Right Way:

This caused me to revert to my original intuition for how to do this:

...
if (!method_exists($this, $action)) {
  $this->_skipAssign = true; //tell _render to skip smarty->assign related steps for this.
  return false;
}
...
We just check if the method exists; if not, we set a variable that tells _render to forego assigning template variables that would have been set in the action had it existed and return false. (Right now, just returning would suffice, but I feel a disturbance in the force that tells me that this false value will come in handy somewhere down the line).

Step 3 (bonus): Make _render More Efficient

I alluded to this in an earlier code snippet: now that we can know for sure if an action has been executed, we can do this:

...
ob_start();
ked::$smarty->display($tpl);
$viewContent = ob_get_contents();
ob_end_clean();
if (!$this->_skipAssign) ked::$smarty->clear_all_assign();
if (strpos($viewContent, "<b>Warning</b>:  Smarty error: unable to read resource:")!==false)
  throw new kedException('The view "'.$this->_view.'" was not found');
$this->viewContent = $viewContent;
$this->_skipAssign = false; //reset this to make sure subsequent actions don't get tainted
...
We check the bool we set earlier and forego template var assignment if it’s set to true. Once again, the exception is fine because we’re not catching it, and this is meant for exceptional cases that are supposed to grind our application to a halt. Unlike the case in _execute, this wont’ be called every time there’s an actionless view – just in the case of an error.

What Did We Gain From All This?

Well, I listened to a bunch of really fucking good music on my ipod while doing this, so that’s good enough for me. But seriously, I also ordered like 6 Threadless shirts.

Also, as a side benefit, the framework now supports actionless views without any extra file system operations. It is also wise enough not to bother assigning template variables if the template is static. You also don’t have to define anything special in the controller (in fact, nothing at all is needed there) or in the template to accomplish it – just put the static .tpl file in the right folder under inc/tpl/views.

I also used the word “tainted” in the comments… which is pretty close to “taint”… which is the area between the ass and the balls. That’s a wrap on the day.

So What Happened Last Night?

Monday, March 24th, 2008

Fail, that’s what happened. A big fat sack of fail.

So as I was working on mihasya.com, I was simultaneously tinkering with ked_core – a natural thing to happen, since mihasya.com is a test for how ked_core actually does when used in practice (it kicks ass, fyi). I got the idea to permit actionless views (more on how, once again, I did that better than you later), so I got all excited and immediately hacked up the code. So now I had this code that was directly applicable to mihasya.com (a lot of the inner pages don’t do much, so don’t need a controller function defined) in the ked_core svn, but not on the site.

The problem is: now that ked just ships as a big hunk of folders with the internal files and the site’s own files mixed in, the separation gets tricky. Also, my blog/ folder (the WordPress install) had to go under mihasya.ked/www/blog, as that was what my mihasya.com folder was symlinked to… Long story short, I straight up deleted mihasya.ked. That was fine, I thought, because I still had all that code in svn…. OOOOPS. Thank goodness for database storage.

Where This Leaves an Ambitious Mother F@#$%#

Well, this is a problem I gots ta solve. It’s plagued me for years, as applications come shipped in huge tarballs that just extract like they’re kings of the world. If you want to selectively update something, you have to cp files one at a time. Fuck that.

How do I elegantly, and from within the framework, permit the developer to upgrade ked files, but not affect his own? This could be solved easily by some sort of package manager like apt or rpm, but we don’t have that luxury. Or rather, I won’t give myself that luxury. This will be solved with bash, php, and svn in the spirit of minimalistic requirements. After all, it has to work on Dreamhost :)

What I Intend To Do

This is how it’s goin down, homegirls: I am going to write a shell script which will fetch a special file from a predetermined svn location (the repository doesn’t have to be static, as I’m sure ked will have thousands of mirrors as it sweeps the market ;) ) The file will contain a listing of files which are internal to ked. It will probably just look something like this:

...
inc/controllers/internal
inc/core
inc/tpl/layouts/internal
...
The script will check the internal files on the repository for updates (including a self-update), download them to a separate copy (to avoid messing up your own .svn folders, if any are present) and copy them into your own dev tree.

One problem I’m already seeing before I even start hacking this up is that www/index.php contains configuration information that I refuse to move into a conf file (extra file read) that might get overwritten in this way, but I can probably figure out a way to handle that without quite developing a full blown package manager variable manipulation deal. Or maybe I’ll just do that. Cuz I can, son!

Stay tuned for more on this and other ked shenanigans.

Dreamhost + SVN + WebSVN = WIN!!!

Sunday, March 23rd, 2008

I recently set up my public Subversion repository – I decided that setting up a sourceforge or google code account for my stuff would just be lame, given that I have my own website that I’ve recently started putting effort into making presentable. By default, however, svn displays a very basic browser that doesn’t really give any info and is just ugly:

crowley’s ugly svn

My 5 year old step-nephew (moptop from here on out) can do better than that. Here’s my how-to for setting up a baller ass looking Subversion tree like this one. Also, I just like ripping on Crowley.

Things we’ll be using:

  • Dreamhost panel’s svn manager
  • Subversion
  • WebSVN – a kick ass php web-based SVN browser
  • Enscript – a GNU app for highlighting source code.

We’ll start with the hardest, yet optional part:

Optional: Installing Enscript

If you want WebSVN to have broad highlighting support, follow this how-to to install it before we begin.

Setting up Subversion

  1. create a subdomain using this page. Mine is svn.mihasya.com.
  2. go to the dh svn manager and set up you repository. The two examples I’ll use are ked_core and mihasya.com. Make sure you make the repository a “public project”. Set up a username or however many you need. Your respositories can now be found at http://your.svn.subdomain.com/repository_name and locally at /home/username/svn/repository_name
  3. Do the usual commit/import routine so your repository isn’t empty.

Installing WebSVN

This part is easy. From your DH home folder run: (you should obviously replace the URL with teh latest WebSVN tarball and the svn.mihasya.com with the appropriate subdomain’s folder.

$ wget http://websvn.tigris.org/files/documents/1380/39378/websvn-2.0.tar.gz
$ tar -zxvf websvn-2.0.tar.gz
$ mv websvn-2.0/* svn.mihasya.com
$ rm -Rf websvn-2.0
WebSVN is ready to go. Going to your.svn.subdomain.com should now load WebSVN with no repositories.

Configuring WebSVN

Also easy. Now that your WebSVN files are in your subdomain’s folder (/home/mihasya/svn.mihasya.com for me) find the includes/distconfig.php and rename it to includes/config.php.

In that file, find the lines that look like this:

// $config->addRepository('NameToDisplay', 'URL to repository (e.g. file:///c:/svn/proj)');
Copy that, without the comments naturally, and change it to point to your repository. My example:
$config->addRepository('ked_core', 'file:///home/mihasya/svn/ked_core');
Save and refresh the WebSVN page – your repository should now appear. You could be done here, but if you’re not lazy, you could really be a rockstar. Like me.

Optional: Setting up Highlighting Using Enscript

By default, my understanding is that WebSVN only highlights PHP – probably just uses PHP’s highlight functions ;) Remember how we (might have) set up Enscript earlier? Well, now find this line:

// $config->setEnscriptPath('Path/to/enscript/command/');
Uncomment it and replace it with your path from step 1. Mine:
$config->setEnscriptPath('/home/mihasya/packages/bin');
Then find this and uncomment it:
// $config->useEnscript();
Enable Additional Extensions

If you’re like me and use Smarty with somethign like .tpl for files that are really mostly html, do this in the same section to tell Enscript what known filetype to associate that extension with:

$extEnscript['.tpl'] = 'html';

Optional (but awesome): Block Ugly UI Using Rewrite

There is still one problem to be solved. Going to http://svn.mihasya.com/ked_core still goes to the stupid old SVN interface (the one Crowley is using above). You can’t be doin that if you wanna be a rockstar. However, there is one thing it remember (which I initially didn’t): you use the exact same URL when running svn commands. Nothing a little RewriteCond magic can’t fix. Put something like this in the .htaccess file in your svn subdomain’s root folder (where we copied WebSVN earlier):

[ UPDATE: turns out you have to put the RewriteCond statement before every rule (if someone has a better way of doing this, holler); also added the [NC] flag to make the condition not case sensitive, just to be safe ]

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^SVN [NC]
RewriteRule ^ked_core$ /listing.php?repname=ked_core [R,QSA]
RewriteCond %{HTTP_USER_AGENT} !^SVN [NC]
RewriteRule ^mihasya.com$ /listing.php?repname=mihasya.com [R,QSA]
That second line makes sure that the URL isn’t being called by a Subversion client. Browsers will be directed to the pretty new interface, while svn will operate as usual. Fucking WIN!

Conclusion

Now you can be cool like me and show off your code off your own domain with a sweet ass interface. Not like the chumps with that generic garbage… Explore includes/config.php some more if you want to tailor things more to your tastes.

WebSVN TreeWebSVN Single File

Writing (another) MVC Framework

Sunday, March 9th, 2008

Over the past couple of weeks, I was hacking up an MVC framework, mostly for my personal use. I am gonna post the code once I’m done, however. I have decided to go back basically to the drawing board with it, and don’t feel like starting right now (on “vacation” in SF) so I’ll just write about it instead.

Why? Aren’t there enough?

Yes, but I can never quite get what I want. Here’s a breakdown of my reasons.

Complexity/Usability

Cake does too much. Zend is a little more lean, but does things in a dumb way that requires lots of typing for really simple things (Zend:RD Frameworks::YUI:JS Libraries), Symfony just just didn’t appeal. There’s actually a pretty good feature comparison for 10 frameworks here. My basic complaint is that they all have too many checks for features. I think I just disagree with the use of the word “framework”

I’m a big fan of the 37signals guys and their general design/development philosophies. However, I think that with Rails they’ve strayed from their own philosophy of doing less, at least from the point of view of an external developer. From their perspective, it’s fine because they build Rails to do EXACTLY what they need, so it works great for them. But for a developer starting to develop his own application, Rails is the Microsoft Office of frameworks, and all the PHP frameworks followed Rails into intense complexity, even calling themselves “ports” of Ruby on Rails.

I’m all for not solving the same problem twice. But I don’t think very many problems are ever the same in the strict sense.

Scale/Performance

The more built in features your framework has built in, the more difficult it is to “stray” from the framework. Cal Henderson (OH SNAP, NAME DROP!) writes in his book on scalable websites about striking a balance between OGF (One Giant Function) and OOP.

As you move further right [towards OOP], you gain maintainability at the expense of flexibility. As you move left, you lose the maintainability but gain flexibility. As you move too far out to either edge, optimizing your application becomes harder, while architecture becomes easier. (13)

Cal classifies things like Rails towards the right; in my opinion Rails along with PHP clones like “PHP On Trax” Undecided fall way too far to the right.

Relatedly, this causes a concern for scale. Sure, it’s nice to be able to develop your application quickly and save the $$ and time (so, once again, $$) from your development budget, but you gotta remember – servers cost money, and your application will need servers for as long as it’s live. If you are lucky and your app takes off, you will very quickly realize that every extra little bit of overhead adds up. If your framework just decides to load sqlite on every page view even though you aren’t using it, you’re going to notice (I’m sure there IS a way to turn this off, but Rails would not function until I installed the sqlite3 gem despite the fact that my entire database.ini was mysql). Every file read/write ends up counting.

My goal in creating this framework was to balance usefulness with performance. It does what I think are crucial things to rapid development, but everything that the most basic application ever can live without is left to plugins. If your application doesn’t use databases, you don’t have to define any database confs.

Also, features like “AJAX” are not appropriate to a PHP framework. A PHP framework should facilitate PHP development. Not write JS code. Not rewrite URL’s (hello, mod_rewrite), etc.

Ease of Installation

I’ve only had to install Rails, Cake, and Zend and was just underwhelmed by how much work it took just to get things started. In my interpretation of it, a rapid development framework should allow for a quick start. If it takes me days just to get the damn thing to “Hello, World!” it’s really not worth it.

Dogfood: The Best Reason

The other frameworks just don’t suit my needs. I’m about to knock out a couple of quick freelance projects before I fully transition from student to “real person”; one is very small and simple with minimal db interaction and a tiny CMS component. The other is quite a bit more complex, with a fairly elaborate hierarchy of pages. The first one obviously doesn’t fit the bill for any of the existing frameworks. The second seems like it (I initially was planning to use Cake when the project was first discussed last spring) but actually messing around with cake proved that I would absolutely hate doing an entire project in it. I needed something simple that I could use over and over on projects of varying complexity without taxing the simpler ones with excess complexity.

So Tell Me More!

OK OK! Here’s a little info on the yet-unwritten barebones mvc framework.

The Basics

My baby is due in about 2 weeks. She’s going to weigh in at about 300 lines, probably including doc blocks. Yup. No more. I agree with Crowley’s assessment: if it breaches 300, start cutting back. That is exactly what happened. I was getting a little trigger happy with the plugin system and just starting confusing myself. “Uh oh,” I thought. “If I’m confused, how will an outside user feel trying to figure this out? Actually fuck em – if I’m confused, I’ve written a bad framework, because it should satisfy me first and foremost.”

I’m going to name it Ked. Why that name? Because it’s short easy to type – 2 of the letters are on home row. Just try it: ked ked ked ked::dispatch ked::$settings… it just rolls off the fingers.

There is, however, a metaphoric component – I didn’t get three liberal arts majors for nothing. Keds are my favorite type of footwear. They are very basic, they are comfortable as fuck, they are good for most situations in life (well, if you’re a programmer and don’t have to dress up for work, anyway), and they will rarely let you down. They are perfectly designed to fulfill a very simple function – cover your feet as you walk around. You can, however, put diamonds or Gucci fabric on your keds if your needs call for it. They’ll still be keds, and will still serve their basic telos but will now also serve as a fashion accessory. If you went to high school in the 2000′s, you just think keds are cool no matter what, but that’s neither here nor there.

This framework will aim to be the ked of frameworks – dependable and simple, yet perfect for its one function and extensible to fill whatever other role you need it to.

The goal is to require as little work for every page view as possible, allowing developers to add additional functionality on a per-controller and even per-action basis.

So what’ll it do?

Well, here’s a list of things it won’t do:

  • Make you a mayonnaise sandwich
  • Interpret and route pretty URLs. Use mod_rewrite, it’s faster.
  • Write your XHTML/CSS and JavaScript for you
  • Load a bunch of code to handle databases that you don’t use on every load
  • Make you type 2 lines of code to do something dumb like set a template variable.
  • Make you change your Apache config. Though using some Apache settings is recommended from a performance stand point, Ked will run on anything that runs a reasonable configuration of PHP5.1+ (5.0 might work, but I haven’t thought about it)
  • Wipe your sysadmin’s ass by being backwards compatible to PHP4. Ked will use some very new and cutting edge tricks to make your life easier. If you are on a host that still runs PHP4, find a new host. Adding checks for PHP4 fail will inevitably inflate the otherwise trim code base.

Fine, here’s what it WILL do:

  • Separate logic from presentation (DUH) and direct traffic appropriately
  • Provide an easy way of passing variables. $this->var in the controller will bind to {$var} in the Smarty template (don’t worry, not all $this-> variables will be accessible from Smarty)
  • Use Smarty. Smarty rules. Don’t fight it. Though someone is welcome to write a plugin that allows Ked to run w/o Smarty.
  • Uhhh… oh yeah, allow some funky plugin interaction.

Pretty short list huh? Yup. It’s a ked.