Tag Archives: php

PHP Frameworks: Introduction to Kohana 3 and HMVC

14 Jun

I’m hoping by now most of us developers have decided to move to a framework. I’ve used CakePHP for a few apps, hands down hated it. Code Igniter is a good framework, but when if you wanta make me drool like most of you watching that Kate Beckinsale video, give me Kohana Php.

Kohana Php was a great framework in version 2. Problem is it got even better in version 3. Not leave your woman and go on the 3 month coding frenzy good, but still damn good. Although if your woman is Kate Beckinsale or the lovely Punkita, you’d be a fool to do so ;)

Anyways enough chit chat

Kohana Php: http://kohanaframework.org/

Introduction to scaling applications with Kohana Php 3 and HMVC: http://techportal.ibuildings.com/2010/02/22/scaling-web-applications-with-hmvc/

Kohana Php 3 has crapp documentation. Why? Because they decided it’d be better to get the new framework in your hands and hopefully have some help with the docs. Good call. There is however the unofficial Kohana Php 3 wiki: http://kerkness.ca/wiki/doku.php

Between the video and the framework, someone better be happy.

Wordpress: Formatting get_the_content() return data

14 Jun

Guess whose finally back? Me! That said, you know how get_the_content() and the_content() return the post content, but get_the_content() doesn’t apply the_content() filters? Yeap it’s a pain, rather it was. Thanks to Web Templates NU you can save some time and add the following to your themes functions.php file.

function get_the_content_with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
	$content = get_the_content($more_link_text, $stripteaser, $more_file);
	$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]>', $content);
	return $content;
}

Read all about it here: get_the_content() function using formatting filters

wordpress: WP-Testimonials

18 Jul

came across this yesterday.

WP-Testimonials is a plugin for WordPress that lets you display your customer/client/product testimonials on your blog.

You may add, edit or remove testimonials through the “Manage” navigation tab in the admin area. The plugin includes the option to display a random testimonial in your sidebar using PHP code for older templates or using a widget for newer themes. The widget is built-in with the plugin, so you have no additional files to worry about.

Testimonials can also be displayed all on one page. A template file is included that will need to be uploaded to your theme directory. Once in place, simply create a new page and select that template from the drop-down.

check it out :
http://www.sunfrogservices.com/free-php-script-downloads/wp-testimonials/

importing xml to mysql with php

18 Jul

i prefer to handle data either in arrays or classes, or better yet, arrays with classes.

That said. get an xml to array script, like this one made by : Razzaque Rupom. It’s my favorite.

http://rupom.wordpress.com/category/phpclasses/

vonage – javascript needed, makes me wonder

26 Jan

so today I needed a friends number, but then realized i didn’t have their new number in my redial list, so of to vonage to grab it. everything was fine until I got to their ad splash page. I happened to disable javascript because i was working out some php parts of an ajax application. so guess what happened at the splash page? nadda. weird you would think vonage would be accessible and gracefully downgrade.

which brings me to the question… if alot of the companies I’d expect to do things correctly aren’t…. who is? following standards, graceful downgrading is pretty dang simple if your being paid to build something. I’ve found graceful downgrades, and a basic following of standards is all thats needed to be accessible and work with 90% of the web browsers out there. That said of course it takes more to build a mobile dedicated site, but thats another rant.

Databases are hammers; MapReduce is a screwdriver.

11 Jan

From: http://scienceblogs.com/goodmath/2008/01/databases_are_hammers_mapreduc.php

A bunch of people have sent me links to an article about MapReduce. I’ve hesitated to write about it, because the currently hyped MapReduce stuff was developed, and extensively used by Google, my employer. But the article is really annoying, and deserves a response. So I’m going to be absolutely clear. I am not commenting on this in my capacity as a Google employee. (In fact, I’ve never actually used MapReduce at work!) This is strictly on my own time, and it’s purely my own opinion. If it’s the dumbest thing you’ve ever read, that’s my fault, not Google’s. If it’s the most brilliant thing you’ve ever read, that’s my credit, not Google’s. I wasn’t asked to write this by Google, and I didn’t ask their permission, either. This is just me, the annoying geek behind this blog, writing solely on my own behalf, speaking for no one but me. Got it?

Check It Out:
Good Math, Bad Math : Databases are hammers; MapReduce is a screwdriver.

security: donate a mx record to the honeypot project

12 Dec

It’s the holidays and everyone is all about giving, why not give to the honeypot project?

we all have a few domains we’ll never use for mail, why not put them to use killing spammers? Well not the death kinda killing, but you get the point…

From: http://www.projecthoneypot.org/manage_mx_entries.php#donate

In order for us to create honey pot addresses that spammers cannot tell from real addresses we need as many donated domains as possible. You can help us by donating an MX entry for a domain you control. You may setup your donation such that it will not affect existing mail or web traffic coming to your site. For more information, please see our FAQ.

Check It Out:
Project Honey Pot

facebook shares their memcached patches and linux tweaks

12 Dec

Facebook so rocks, they have posted not only their memcached patches, but also explain what they needed to change in linux to properly utilize them. facebook +1, myspace – well they still suck

From: http://www.facebook.com/note.php?note_id=39391378919

If you’ve read anything about scaling large websites, you’ve probably heard about memcached. memcached is a high-performance, distributed memory object caching system. Here at Facebook, we’re likely the world’s largest user of memcached. We use memcached to alleviate database load. memcached is already fast, but we need it to be faster and more efficient than most installations. We use more than 800 servers supplying over 28 terabytes of memory to our users. Over the past year as Facebook’s popularity has skyrocketed, we’ve run into a number of scaling issues. This ever increasing demand has required us to make modifications to both our operating system and memcached to achieve the performance that provides the best possible experience for our users.

Check It Out:
Engineering @ Facebook’s Notes

pardon the delay

11 Dec

pardon the delay in getting out parts 2 and three of the php scaling tut (yes I’m benchmarking so much it needed its own page!), but I have about 5 other tuts started (half in my vista firefox, go figure) and should have all of them released within the next 2 weeks :)

couchdb: couchdb 101

11 Dec

So after 3-4 days of research and study I’m compiling a list of links that helped me finally understand couchdb. Still bunches to learn, but hopefully it will save others from 4 days of googling.

Start

The very first thing you should read is the work in progress online couchdb book:
Relax with CouchDB [http://books.couchdb.org/relax/]

Now that your started

The following sections are grouped by what I left the article better understanding. They may cover other areas, but then again more knowledge leads to better understanding right?

JSON

Just in case you don’t understand json:

http://webt.wordpress.com/2007/10/01/json/

Couch MapReduce

fyi: hashes

Depending on what language your coming from you may know hashes as arrays or associative arrays. When they say reduce returns a single value, they are referring to the hash value it returns (scratched my head for a while)

If your coming from php an easy way to connect the dots is to think of how serialize creates a string that represents your object. Only in couchDb this is a json string

I had my eureka moment here:

http://www.ibuildings.com/blog/archives/1291-Some-thoughts-on-CouchDB.html

Just in case you didn’t eureka:

http://rrees.wordpress.com/2008/03/09/couchdb-querying-data/

Damien Katz explains more on couch’s mapreduce ( check the part 2 near the end as well ):

http://damienkatz.net/2008/02/incremental_map.html

MapReduce Method

In case you didn’t know mapreduce isn’t something couch invented, you can learn more about mapreduce below.

explains the mapreduce method in detail:

http://code.google.com/edu/parallel/mapreduce-tutorial.html#MapReduce

the mapreduce white paper:

http://labs.google.com/papers/mapreduce.html

mapreduce lecture (didn’t watch, but it was recommended by google, so why not):

http://www.youtube.com/v/-vD6PUdf3Js

using couchdb

blog db example / couchdb “joins”:

http://www.cmlenz.net/archives/2007/10/couchdb-joins

user permissions system example / offers rdbms comparison:

http://kore-nordmann.de/blog/couchdb_a_use_case.html

aimee’s 8+ couchdb on rails series (links to part 1, but your good from there):

http://aimee.mychores.co.uk/2008/09/07/post/320/

couchdb internals

Ricy ho’s overview:

http://horicky.blogspot.com/2008/10/couchdb-implementation.html

Related discussion where btrees are further discussed (as well as some decent bantering):

http://www.reddit.com/r/programming/comments/792hf/couchdb_implementation/

Ayende Rahien has an indepth series on couch db called: reading erlang

http://ayende.com/Blog/archive/2008/09/24/reading-erlang-inspecting-couchdb.aspx

http://ayende.com/Blog/archive/2008/09/24/more-couchdb-reading-btreelookup.aspx

http://ayende.com/Blog/archive/2008/09/24/more-couchdb-reading-btreequery_modify.aspx

http://ayende.com/Blog/archive/2008/10/04/reading-erlang-couchdb-from-rest-to-disk-in-a.aspx

http://ayende.com/Blog/archive/2008/10/04/erlang-reading-couchdb-digging-down-to-disk.aspx

http://ayende.com/Blog/archive/2008/10/06/reading-eralng-couchdb-streams.aspx

The most important part

Use it damn it! get planning, hacking, pop locking and start playing with couch

sources

Sources not referenced already:

http://damienkatz.net/2008/09/peek_into_couchdb.html

http://jan.prima.de/plok/