php: Whats your commenting style?
I was writing up a few scripts and as I was adding my commenting I noticed I tend to comment differently depending on the difficulty of the script and how many different parts or procedures there are to it. I don’t have a set convention, but I suppose as with all things it would make things easier on myself and others if I had some kind of standardization…
For larger ‘areas’ that contain functions or a series of procedures that extract or parse sections of data I’m now starting with this:
/*** * * This is a comment. * Here I leave notes about the section and what it does. * I may also include notes to myself here. * Note: This could probably be done more eficiently * */
As there are more breakdowns within these sections I’m using this:
/* [ Parse out the text file ] */
And further drilled down I use the more inline commenting
/* [ Print data] */
$parts = explode("|", $the_array); // get the parts
$color = false; // set color var for shading every other row
print("<table>");
// loop through data & print
foreach($parts as $key => $row){
// CSS Note: shading <tr>'s with css mostly works with nice browsers
// For IE 6+ one needs to shade the <td>'s
if($color){
print("<tr class=\"rowColor1\"> "); // start row with color 1
$color = !$color; // unset the color so it alternates next loop
} else {
print("</tr><tr class=\"rowColor2\"> "); // start row with color 2
$color = true; // set the color so it alternates next loop
}
print("<td>$row[first_name]</td></tr>"); // print cell data and close the row
}
print("</td></tr></table>");
The inline comments still seem a bit ‘messy’ to me. But for now it will work.
One of the reasons I decided to standardize is because even with commenting and extra line spaces in the scripts it was still difficult to sort out what exactly was going on. Another thing that tripped my thought was having a glance at phpDocumentor. It seems to function on how you comment your code. I did try to install it but for some reason it was way over my head. It looks like a neat tool but I rarely seem to write more than 4 different files and those are often less than 300-400 lines.
I’ve yet to test it in comments but my plugin to allow code viewing is much like bbc code. [code lang="php"] // comment [/code]
So whats your style? Is there a standard? What have you seen that looks the cleanest? Leave a comment… with some comments ;-)
Update 12/3/07 Elizabeth Naramore has written a nice article on the effectiveness of comments in your code over at the Chris Shiflett blog. It’s a great read on WHY commenting is good in your code.
Can you count to One Million?
Ever wonder how long it would take you to count to one million? Jeremy Harper is in the process of finding out…
The idea started as a “what if” and has now become a reality.
Jeremy is aiming to count for 16 hours per day (minus break time). Depending on the day’s distractions, we anticipate 12000-15000 numbers per day.
He counts aloud in his home and clicks a hand held device which updates the number on a monitor sitting next to the main camera. His house is stacked with webcams and switches to cover most the viewable area of his home. He counts as he does trivial house duties like dishes and tidying up. He will not be leaving his house until it’s done. Mostly the times I’ve seen him actually counting, he’s pacing in front of his monitor. At the time of this writing he is at 408,262…
The site didn’t work very well for me in firefox. I tried it on 3 different workstations. I’m guessing the video is in a windows native format. I tried Internet Explorer and things went much more smoothly.
Cleverly he and his ‘team’ have it set up in such a way that you can purchase adspace for select targeted numbers. So far it’s a pretty impressive list. Jeremy will personally read advertisments (for the right price) before the selected block of numbers. You can bid for space above his couch, even the bathroom door! The advertising proceeds will go to PUSH America:
Not only is the count to a million a crazy record breaking stunt, but it’s also a great way to raise money and awareness for a great cause. Push America is an amazing organization whose mission is to serve people with disabilities.
According to millioncount.com Jeremy has taken part in charity bike rides in the past to raise money for other good causes as well. Apparently his employer has also allowed him the time off to do this as well.
I’ve been popping in from time to time to see where he’s at. It kicked off on 06-18-2007 and They are estimating it will take 3-4 months to get there. 408,711… 408,712…
Lifest 2007 – Pillar!
The drama group that I’m privledged to co-lead is blessed with the opportunity to put on our most recent play, The Hiding Place (the Corrie ten Boom Story), at Lifest 2007 on Thursday night. One of the nice perks is that I get 1 free event pass. That is a pass for the entire week. Unfortunately due to rehearsing etc I can only go tonight. But we have family in town and are going to go see the action.
I’m REALLY excited about the last headliner of the night. Pillar! If you are into metal this is a show to see. Here’s a vid from them at GodTube.
Update 7/12/07:Excellent show. It’s more than what I expected. They have a great live show. Also heard some new tracks to their upcoming album. It’s a definite buy!
So you wanna kick my butt??
The folks over at Picktogame.com have a way for you to make games and have fun. Its easy to use and intuitive. Of course it’s still in Beta. The downside is that I noticed the signup isn’t secure (https).
What are you waiting for? Go ahead and get busy!!
You can help predict media success
You can predict media success, or can you?
In this day and age one sometimes wonders who is behind what media is pushed for success. Who are the ‘experts’ that push and market a movie that flops? What are they thinking that we will like? Enter MediaPredict. MediaPredict is a site that allows people to predict the success of new media.
The site is basically a media rating game. After registering you are given $5,000 play money. You use the money to invest in media you think will succeed or fail. It’s played much like a stock market where you can even short sell. The value of the stock(media) is a value based upon others buying and selling the commodity. This represents it’s probability of succeeding out in the world.
(Dashboard – My first purchase)
In the screenshot above I was able to buy shares of a book that I thought would be successful.
It appears that MediaPredict is relatively new. The choices available to work with currently seems limited to new publishers, books, music artists, and a few television sit-com pilots.
The media can be just about anything ranging from books, movies, music and television. Up and coming, and mainstream media is included in the system. Here is an example of a music artist;
-
New music artist
- - Will the artist get a record deal?
- - If the artist has a deal what are it’s chances of success?
- - Will a single reach the top 5/10/100?
There is a deadline or time limit for each ‘project’. Obviously there are dates for record releases and such.
The goal I’m sure is to add this source to the portfolio of marketing gurus around the world. I’m not sure of how much data MediaPredict has to offer now other than the popularity of it’s net savvy users. Of course the demographics are a bit different as well. So I suppose it could be a worthwhile added resource.
Features I’d like to see
I couldn’t find a way to add another source of media to the site. So for now it seems that only MediaPredict has the power to add/remove new media. I hope this can be changed in the future.
I would like to see MMORPG category added to the list or tag cloud of choices.
Another feature that would be nice to have is current media, and the prediction of it’s future from now. There is a lot of media and sites out there that started of well, and began to stink after a few episodes or albums. One hit wonders.
Features I don’t want to see
Social networking within MediaPredict. There is already no value to any positive gains you get from playing the game. You win fake money that can’t be used for anything other than bragging rights or just feeling nice about participating. The game itself is interesting. But to add social networking with equally useless winnings and badges is a total turn off for me.
I’d like to see MediaPredict stick to what it is. I think they’ve got something here. Maybe MediaPredict should add themselves to their own market ;)
