Archive

Archive for the ‘Computing’ Category

php: Whats your commenting style?

August 14th, 2007 ^Lestat 89 comments

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.

php, comment, code, script, php+script, php+comment

Categories: Programming, php Tags:

So you wanna kick my butt??

May 31st, 2007 ^Lestat 1 comment

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!!

Categories: Computing, Internet Tags:

You can help predict media success

May 31st, 2007 ^Lestat No comments

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.

MediaPredict Dashboard
(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 ;)

Categories: Computing, General Interest, Internet Tags:

Get paid to test with google

May 22nd, 2007 ^Lestat No comments

Via googlfied:

bloggerlogo.jpg
According to Blogger Buzz Google is looking for user experience research blogging with google blogger. As mentioned in the FAQ you first need to sign up. After you have signed up you may or may not be selected depending on what they are looking for:

For each study, we need to make sure that we invite people who match our target user profile for the product we are researching. We also want to get a good balance of ages, backgrounds, and levels of experience, so please be honest with your answers. It’s easier for us to match you to a suitable study when we have more information about you, so if you fill in as much of our sign-up form as you can, it’s more likely that you will be invited to participate.

There are different experience sessions where you will work with a google researcher 1 on 1, on the phone, or in a group. It looks like some of the research will be done in person at google. Except you have to find your own way there. The pay looks pretty decent too.. “typically we pay $75 for each hour that you spend with a Google researcher”. The FAQ also mentions the average time commitment is in the range of 1-1.5 hours during business hours.

I think this is great customer service. It seems they want to see how users view and work with their goods. It also gives an opportunity for users in the test to request features, changes to existing features, as well as having features removed. I wonder if this is a result of googlecanyouhear me?

All in all I think this is a smart move and I’m quite curious what will come out of this.

google, blogger, blog

Categories: Blog Adventures, Computing, Internet Tags:

XP: svchost.exe & 100% CPU workaround

May 9th, 2007 ^Lestat No comments

I ran into this little problem last month while running windows update on several workstations. You know that little yellow shield down by your clock in the taskbar ? For some reason, a few workstations seemed to have locked up. When I peeked into the task manager->Processes, one of the “svchost.exe” processes were consuming 100% CPU. Coincidently, these workstations also had a fresh install of Office 2003 professional.

After MANY hours of monkeying around, I found a ‘remedy’ for this. I use that term loosely because it did work, though I don’t know if there’s a better or more proper fix. This should be performed if you have errands to run or are going to bed…. A watched pot never boils.

This can get you by and operational if you don’t have time to perform the updates:

  1. Go to start->run.
  2. Type in services.msc and hit return.
  3. When the services window pops up highlight the Automatic Updates service.
  4. Double click it.
  5. Change the startup type to manual, and click the stop button.

Performing the updates:

  1. Go to Microsoft Update.
  2. Run it.
  3. At this point the yellow update icon will show up in your taskbar again and doing any task will seem painfully slow.
  4. Go get coffee, or watch a movie.
  5. Come back and click to install any updates recommended.
  6. Here is where you go to bed, or go shopping.
  7. After a few hours the updates will complete and you will be good to go.

*If you disabled the updates as above you’ll want to return them to their original state. If you don’t you will not receive automatic updates in the future.
You can do this by opening the services window, changing the startup type back to Automatic, and clicking the start button.

svchost.exe, cpu, Windows Update

Categories: Computing, Windows Tags: