Mon, Aug 10, 2009 12:12 AM
The latest package of
Wordcraft, the
PHP/MySQL based blog software that runs this site, is available for
download
from Google Code. Just some minor bug fixes and cosmetic
stuff. Its getting a little use in the wild. That is
always fun to see.
Fri, May 22, 2009 11:34 AM
First there was
LAMP.
But are you using GLAMMP? You have probably not heard of it
because we just coined the term while chatting at work. You
know LAMP (Linux, Apache, MySQL and PHP or Perl and sometimes
Python). So, what are the extra letters for?
The G is for Gearman -
Gearman is a system to farm out work
to other machines, dispatching function calls to machines that are
better suited to do work, to do work in parallel, to load balance
lots of function calls, or to call functions between languages.
The extra M is for Memcached -
memcached is a
high-performance, distributed memory object caching system, generic
in nature, but intended for use in speeding up dynamic web
applications by alleviating database load.
More and more these days, you can't run a web site on
just
LAMP. You need these extra tools (or ones like them) to do
all the cool things you want to do. What other tools do we
need to work into the acronym?
PostgreSQL replaces MySQL in lots
of stacks to form LAPP. I guess
Drizzle may replace MySQL in some stacks
soon. For us, it will likely be
added to the
stack. Will that make it GLAMMPD? We need more
vowels! If you are starting the next must use tool for
running web sites on open source software, please use a vowel for
the first letter.
Thu, May 7, 2009 11:57 AM
Last year I was surprised to be
going to Velocity. Read the post, it was an
adventure. But, I
really like the conference. It is the perfect conference
for me. While a good majority of my work is done coding
PHP/MySQL apps, I tend to focus on architecture, frameworks,
performance and that kind of stuff. So, a web performance and
operations conference is just perfect.
Last year, I was on a panel with
some
great guys. I was able to share just a bit about my
experience dealing with the instant success of a web site.
This year, my proposal was accepted to talk more about dealing with
success of a web site. The talk will be focused on my
experience at
dealnews.com and
from working with power users for
Phorum. Here is the summary:
Lots of people talk about scaling and performance. But,
are they preparing for all the things that could
happen? There are multiple problems and there is not
one solution to solve them all.
Everything is running fine and BAM! – your site is linked from the front
page of Yahoo! What do you do? How can you handle that
sudden rush of traffic. Requests per second are running
5x normal levels. Servers have CPU spikes. Daemons are hitting the
maximums. You are running out of bandwidth. How could
you have been prepared for this? What are the tools and
techniques for this type of sudden rush?
Or, lets say you have just come out of a meeting where
everyone discovered that your site is growing in
traffic 70% – 80% year over year. That means that 1
million page views this month will be nearly 3 million
this time in 2 years. How can you plan for that? You
don’t want to redesign the whole architecture every 2
years. What methods could be used to deal with this
constant long term growth?
While there is no magic bullet for either of these
scenarios, there are techniques used by many sites out
there to help you get through these situations. This
session will cover some of these techniques and talk
about their pros and cons.
I must admit, this if the first time since 2000 that I am a
little intimidated to speak at a conference. The
people that present and attend Velocity are so
awesome. I just hope I don't disappoint.
Wed, Apr 8, 2009 08:00 AM
There are several key changes in Wordcraft 0.9.1. The two big
things are:
-
Tokens on post forms in the admin to help ward off
CSRF attacks.
-
Database schema updates automated.
The first comes as a result of us doing the same work on
Phorum recently. I realized I needed the same protection in
Wordcraft. The second was done out of neccesity as I changed
the datetime fields in the database schema into int fields.
Not sure why I ever made them datetime fields. Unix
timestamps are much easier to work with. It saves many
strtotime() calls and will make eventual time zone settings much
easier to implement.
In addition to those two big ones, there were some notable small
ones:
- HTML 4.01 validation fixes
- Ensuring UTF-8 on all encoding function calls
- Protection against hitting the back button when writing a
post (most annoying on Macs as the back button and the
beginning of line keystroke is the same).
And there were other a few
other bug
fixes.
I will or course need many more testers and users before I can ever
declare this software as stable. If you need a simple blog,
give it a try.
About Wordcraft
Wordcraft aims to be a simple, lightweight blogging
application. Wordcraft is written exclusively for PHP 5+ and
MySQL 5.0+ using only the PHP mysqli extension, UTF-8, and HTML
4.01 to achieve that simpleness.
Mon, Feb 23, 2009 08:00 AM
I am pleased to announce the release of
Wordcraft
0.8. I have managed to release about once a month since
November. I also have actually gotten some feedback and
tickets posted. Thanks to those that have tried it out.
I have decided to go back to YUI's Editor. I tried TinyMCE in
the last release. But, using it full time I found it messed
with my HTML too much for my liking. When I would switch to
raw HTML mode and add something like a <code> tag, it would
be lost when saving the data back into the WYSIWYG editor.
I also converted the admin HTML to HTML 4.01 Transitional. I
never use XHTML anymore these days. So, I was writing invalid
XHTML inadvertantly.
I worked on the session handling some more in this release.
Users should stay logged in to the admin better now.
I put comment blocks in all the files and documented every
function. This should help anyone wanting to dig in and help
out.
I fixed several bugs reported by users (or maybe just testers, not
sure). Thanks for that and keep the feedback
coming.
Sun, Feb 22, 2009 06:00 PM
To some kick ass DBA or someone that works on MySQL internals, this
is probably a no brainer. But, for just joe schmoe power user
types, we wonder about these things. We could not find the
answer on the internet, so I decided to blog about it. We
expected the result we found, but I think it's good
information.
Have you ever had to make changes to several indexes or columns in
a table? With
Phorum, we
keep a series of scripts that run queries to upgrade the database
as we make changes. Recently I had to delete about 12 keys
and add about 7 back in their place. I initially thought to
make two sql statements. One to delete indexes and one to
create new ones. But, Thomas, one of the other developers,
wondered if that was really any better. So, I decided to run
some tests.
First I altered a table with 70k rows, dropping one key. That
took 16 seconds. I then added a key to that same table.
Again, about 16 seconds. So, I then dropped a key and added a
key in one query. Again 16 seconds. So, I decided to go
for the ultimate challenge. I dropped 12 keys and added back
12 keys all in one query. TADA! 16 or so seconds.
The table was an InnoDB table, so I repeated after converting the
table to MyISAM. Again, all the alters took about the same
time, regardless of the number of changes.
Update
I was told in the comments that the data was
not big enough for a real test. I hold to the fact that
because, as Eric Bergen pointed out, the most time is taken in
copying the data, the data size is not that important here.
However, I tried it out on a table with 750k rows just to
see. Dropping 4 keys on a table with 12 keys took 1min
46sec. Adding 4 keys to the same table, (now with 8 keys)
took 1min 52sec. Adding 4 keys and dropping 4 keys in one
alter table took 1min 49sec. So, looks like I was
right. For fun, I decided to drop all the keys except the
primary. That only took 28sec. That is what I
guessed. The slow part is copying the table to a new
table. That includes filling in indexes. It is much
faster to write a table with indexes than it is a table with 12
indexes. However, that was not my use case and not the reason
for my testing. But, it is good information to attach to this
blog post.
Mon, Jan 12, 2009 08:00 AM
I am happy to announce Wordcraft
0.7. There are two big changes in this release.
On the front end, I added a simple search. It just uses a
LIKE clause. But, I figure a lot of blogs never reach
1,000 posts. Even at 10,000 posts, a LIKE would not be
too bad. On the backend, I have switched the post editor
to TinyMCE. YUI's
editor is decent, but it needs polish. Perhaps my time
with Wordpress just made me more familiar with it.
TinyMCE does save XHTML. I put some code in the PHP side
to use Tidy if it is available to convert it to HTML 4.01,
which I prefer.
Also in this release:
- Fixed an XSS issue in tag.php.
- Fixing a parsing issue with anchor tags when doing
pingbacks.
- Fixed an error when the remote site can not be contacted.
- Fix for pingbacks with nice URLs enabled. Was blocking
pingbacks.
Mon, Jan 5, 2009 12:08 AM
So, my Haystacks teammate
Brian DeShong tagged me in his
list of seven. We won
that trivia contest by the way. It was a real team
effort.
So, here goes my seven things:
- I have six kids. Okay, let that sink in. Yes,
six. Logan(12), Macy(11), Molly(9), Parker(7), Collin(3),
and Hudson(6 months). I know what causes it. Yes,
it is hard at times. But, there are those moments when
you are sitting in the yard or in the den and all is right in
the world. The best program I will ever write will not
compare to what have done with my children. They are
truly my greatest project. My wonderful wife blogs about
them at Moonmania.
- I started my career as a Visual Basic programmer. PHP
and VB are very much alike. Neither is OOP, yet people
keep trying to make them so. You can write truly powerful
applications if you know what you are doing. Much of the
outside community thinks poorly of the language. In both
cases I was way too busy making cool things and getting stuff
done to care or pay attention.
- I play disc golf.
It is a great sport. It reminds me of the Open Source
community in that it is a very community driven sport.
The courses are installed and maintained by the players,
usually on public land such as parks. The tournaments are
run by local players. The sport is largely managed by
players. I maintain the web site of one of the larger
regional (maybe the largest)
tournament series in the world. I have played in
most cities that I have visited including those I go to for
conferences. We have a group of 9 or so people at
dealnews that play on a semi-regular basis when the weather
is right.
- I never graduated college. The VB work and then the
PHP work got in the way. It is a regret in some
ways. But, I can't tell you what I would have changed
about how my life has gone. Perhaps I will go back and
finish my degree at some point. Sadly, in this world,
there are doors that are closed to you no matter how brilliant
you are if you don't have a simple piece of paper. I know
people with that piece of paper that ended up working fast
food. But, they could get an interview where I could
not. They would not get the job, but I can't even get in
the door.
- I have contributed two PHP internals functions.
mysql_fetch_assoc and the now deprecated
set_file_buffer. In the case of
mysql_fetch_assoc, I was fixing what was IMO a bug.
mysql_fetch_array originally returned only an associative
array. Someone decided it should return the data in
both associative and numeric forms. mysql_fetch_row
already existed to return numeric keys. So, I simply
copied it and added mysql_fetch_assoc. That was the
real wild wild west days of PHP CVS. You either had
full access or you didn't have any access. I did not
keep my development up on PHP so I lost karma on the core
later. My C is not super polished. Still I will
admit I liked being part of the club.
- I watch pro wrestling. There I said it. Guilty
pleasure. The Tivo makes it easy. 2 hour show only
takes about 40 minutes. Heh, I skip most of the
wrestling. Not everyone is entertaining. My great
grandmother would sit and watch it every Saturday night.
I was hooked from that point. I won't get going on
it. I would lose you guys. FWIW, I am a big fan of
mixed martial arts too. That stuff IS real and very
exciting.
- I am a compulsive code rewriter and/or write it myself kind
of guy. It is something I struggle with every day.
It is why I started Phorum
and Wordcraft.
Luckily, the guys I work with at both dealnews and on Phorum
are good programmers. My biggest problem is opening a
file I last worked on 5 years ago. The way we write web
applicaitons has evolved so much in the 11 years I have been
doing this. I am using the same language, but have such
different ideas. I can only imagine what the next 11
years will bring.
I will be tagging these seven. Forgive me if I get a title
wrong.
-
Brian
Aker. The creators of sites like Facebook and
Digg may have had some great ideas. But, without guys
like Brian Aker, they would be nowhere. He makes the
things that make dealnews, Facebook and Digg
possible. And he continues to contribute with Drizzle
and the new C based gearmand.
-
John
Allspaw. John manages the operations team for
Flickr. He is a smart guy. He and I see eye to
eye on a lot of web performance topics.
-
Joe Stump. Joe is
the lead architect for Digg. I have not met Joe in
person. But, I have heard him interviewed and we are
on the same page about a lot of things. I have
started using some of his contributed PHP code
lately as well.
-
Alan Kasindorf aka
Dormando. Alan works for operations at Six
Apart. They bought Danga. They formerly owned
Live Journal. He has kind of become the care taker of
memcached, gearmand and all those other cool things that
Danga created. The community is helping him more each
day, but he still does a lot of work for those
projects. Including, but not limited to coding.
-
Jay Pipes.
I think I saw him on someone else's list. But, I am
putting him down anyway. Jay has been good to me over
the years. It is cool that someone can chair the
MySQL Conference, go around talking to user groups and
commit code to fix MySQL bugs. Jay is great because
he and I can disagree on just about everything when it
comes to programming then toast our beers. You need
people like that in the world.
-
John
Allen. I work with John at dealnews. He has
learned the search engine optimization and marketing world
the way I learned programming. John posses skills
that I don't. We butt heads on a regular basis about
things. But, the end result is always better than
what existed before we started. I have learned many
things from him.
-
Daniel Beckham.
Daniel is my partner in crime at dealnews. We have
been a two headed monster (yeah, a monster. Just ask
the CEO.) for 8 or so years now. Unfortunately,
Daniel does not blog or twitter or much of anything like
that. So, we likely won't see his seven things.
Many of the things I have blogged about when it comes to
building dealnews' architecture were thought of and done by
both of us. I am just a show off extrovert that needs
a lot of attention. So, I do all the blogging and
talking at conferences.
And, I am told I need to post this for my taggies to follow:
- Link your original tagger(s), and list these rules on your
blog.
- Share seven facts about yourself in the post - some random,
some weird.
- Tag seven people at the end of your post by leaving their
names and the links to their blogs.
- Let them know they’ve been tagged by leaving a comment on
their blogs and/or Twitter.
Wed, Dec 17, 2008 01:26 AM
I am pleased to announce the release of
Wordcraft
0.6. I have been using it for a month or so now and I am
learning some things.
I had been having trouble logging in lately from multiple
places. So, instead of trying to work on the built in session
handling I had written, I took my own advice (use stuff that
exists) and just switched to PHP sessions. All the cookie
stuff is worked out and I can get a lot done with just a little
work. PHP sessions make me a little nervous. If you
have lots of applications installed on the same site that use them,
you can get some odd behavior. But, why reinvent the wheel
right?
I have found myself wanting to save a post while working on
it. To do that before, I would have to uncheck the Published
box. To solve this, I changed the behavior of the Save
button. When pressed it now saves the post, but with the
published flag set to 0. This lets you save a post while
working on it quickly. I then added a Publish button to the
post form. The Publish button will save the post with the
published flag set to 1. If a post is already published, you
just get an Update button that will save whatever is set in the
form.
From a code perspective, I have made all the code use the same
array for user data. I had a separate one for the core, one
for the template and one for the admin before. That was
getting complicated. So, they all just use the same one
now.
The last thing I did was add meta refresh tags to the admin success
pages. I like having a success page to tell me something
worked. But, I really want it to move along after it is
done. It does that now. It is set to 3 seconds. I
may knock that down a bit. That 3 seconds starts after the
page is fully loaded. So, it can be more like 5 or 6 if stuff
has to load.
Sat, Dec 13, 2008 12:37 AM
I have had the privilege to go to the
O'Reilly Open Source Convention 4 of the past 5 years. During that time, it has been held in beautiful
Portland, Oregon. Well, the
OSCON 2009 web site is up and they are moving it to
San Jose, CA. I have never been to the
San Jose Convention Center. The pictures look nice. I have only been to San Jose at all to get off a plane and go to the
Santa Clara Convention Center. I hope San Jose has more to offer than Santa Clara. The Santa Clara Convention Center is nice. And the hotel it is attached to is also quite nice. I have attended an
Apachecon in 2001 and two
MySQL Conferences (2007 and 2008) there. But, outside of the convention center, there is not a lot of fun stuff to do. You have to travel a good distance to find good medium to high end restaurants. It is in the middle of a lot of large office buildings with names like Yahoo!, Intel, AMD, nVidia, etc. on them. The other space is taken up by apartments. But, I did not start this post to dig on Santa Clara.
I will miss Portland. It is a neat town. Lots of good food. Lots of good beer. Easy to navigate once you get used to the bridges. If you like public transport it is quite accesible. There is good
disc golf in the area too. That was always a plus.
But, here is to new beginnings in San Jose. May it be as fun and educational as Portland has been these past few years.