|
Programming
|
|
Written by Nate Lyman
|
|
Thursday, 04 March 2010 18:45 |
|
Every year the folk at PHP|Architect put on a great conference PHP Tek. This year Tex-X will be in Chicago and has a killer schedule lined up. This year, myself and a handful of co-workers went to Code Works in San Francisco, which was also put on by the PHP|Architect folks. TEK-X promises to build off the sessions we attend there and much more.
|
|
|
Announcements
|
|
Written by Nate Lyman
|
|
Thursday, 25 February 2010 23:51 |
|
Sorry for the lack posts lately, but I've been really busy at work lately. The good news is I'll be done soon, soon being March 2nd. After that I'll have a lot more time.
At that time I'll hopefully be able to show off what I'm working on.
|
|
Programming
|
|
Written by Nate Lyman
|
|
Saturday, 20 February 2010 07:50 |
|
This post isn't a stab at OOP at all. This post is to simply show the differences in performance between Arrays and Objects. For most applications it probably doesn't make a huge difference but if you're working on a large web application or backend job microseconds count.
I will use a snippet of code that does exactly the same thing but store the data in an object and an array. First lets look at using an object.
Show/Hidden php code
<?php
$start = microtime(true);
$a = new stdClass;
for($i = 0; $i < 100000; $i++){
$a->$i = "TEST";
}
$end = microtime(true);
print("Processed in ".($end-$start)." seconds\n");
?>
Output: Processed in 0.081549167633057 seconds
Now, lets examine the difference if you use an array with string keys.
Show/Hidden php code
<?php
$start = microtime(true);
$a = array();
for($i = 0; $i < 100000; $i++){
$a["key$i"] = "TEST";
}
$end = microtime(true);
print("Processed in ".($end-$start)." seconds\n");
?>
Output: Processed in 0.089761018753052 seconds
As you can tell, the array with string kess performs worse than an object. Lets examine using a numeric key.
Show/Hidden php code
<?php
$start = microtime(true);
$a = array();
for($i = 0; $i < 100000; $i++){
$a[$i] = "TEST";
}
$end = microtime(true);
print("Processed in ".($end-$start)." seconds\n");
?>
Output: Processed in 0.049083948135376 seconds
Look at that, nearly twice as fast as both objects and arrays with string indexes. For the seasoned programmer this comes as no surprise, but for a more junior programmer this is something to keep in mind. Yes, an assiciative array makes for cleaner code, but can have a pretty big impact on performance at scale.
|
|
Technology
|
|
Written by Nate Lyman
|
|
Friday, 19 February 2010 18:09 |
|
Let people say what they want about Twitter and the impact of Social Media on websites, but there is a real impact these sites can have on your blog or website.
Last weekend I created a Twitter account for That's What She Said. I then configured the site to post quotes as people post them directly to Twitter. That alone I saw a 14x increase in traffic over the next few days. Next, I created a hourly job that searches Twitter for relevant hash tags and follows the users that have posted with the hash tag. This step bumped up my traffic an additional 4x.
Starting two days ago I also began seeing my natural search clicks increase by 20x. The new "real time" search on Google has been sending me a good portion of that traffic.
It's also worth noting that you shouldn't be "spammy" with how you post your links. You need to do it in a controlled manner, as in, 1 or 2 tweets an hour. You want to give your site presence to your followers without spamming them.
All and all I spent about 4 hours on making the changes to that site and reaped pretty huge rewards almost instantly. From an ROI standpoint that is very promising, I've seen about a 50% bump in clicks on ads as well.
|
|
Programming
|
|
Written by Nate Lyman
|
|
Monday, 15 February 2010 10:41 |
|
Tonight I was updating "That's What She Said" by having the site post new quotes to twitter in real time. In researching the Twitter API, I explored writing my own Twitter API Class. It would be easy enough but I decided to see what was out there first. I am extremely glad I did.
Tijs Verkoyen has written an excellent Twitter API class, that will do pretty much anything you could ever want to do on Twitter. Not only is it well written, but it is equally well documented.
After the jump, I'll dive deeper into the implementation.
|
|
|
|
|
|
|
Page 1 of 6 |