Archive

Author Archive

Whose Career is a bigger disappointment Leinart or Roddick.

September 2nd, 2010

Skip Bayless Head Explodes

Skip Bayless Head Explodes

Graduating from Southern California, where Leinart won numerous accolades including the Heisman Trophy, Rose Bowl MVP, and Orange Bowl MVP, he was considered a top prospect in the 2006 NFL Draft. Everybody expected Leinart’s college career to carry over to the NFL.
Beating Pete Sampras, Michael Chang(at Roland Garros), and then world #1 Gustavo Kuerton, Roddick established himself as the next great american champion.

These two young, Roddick was 19 in 2001 and Leinart 24 in 2006, potential super stars had the world at their finger tips. Leinart was drafted 10th overall by the Arizona Cardinals, where he sat on the bench for the next 3 years attaining a passing rating of 71.7. After his break out year in 2001, Roddick broke into the top 10, won two titles, and made the quarters finals at the US Open. In 2003 Roddick became the world #1, won 6 titles in 8 finals, and won the US Open. In 2004 Roddick won 4 more titles, hit the worlds fastest recorded serve(155 mph). In 2005 Roddick won 98 consecutive service games before being broken. However, in 2006 Roddick dropped out of the top 10 for the first time in four years; though he did close out the year in the top 10. In 2007 he went undefeated in Davis cup play and helped to win the cup for the United States. 2008 Roddick said about a match with Federer “I came in knowing that nobody has beaten me 12 times in a row“; he had just beaten the World #1. 2009, Roddick finished once again in the top ten, joining Federer as the only player on tour to finish in the top 10 for 8 straight years. He is also the only player besides Federer to win a title every year for the past 9 years. Going 4-1 in Davis cup that year made him the second all time winningest American(31) behind John McEnroe(41).

Though he just lost in the second round of the US Open, Roddick has put a together a 4-0 record against top 10 players, beating current world #1 Nadal(then ranked 4). He has also won 2 titles in 4 finals this year.

To help ESPN I came up with a list of Career Let Downs in athletics.

Sports ,

Open VIM From PHP CLI

August 31st, 2010
Ever wonder how to open text editor from php similar to SVN/GIT do when -m is not passed as an argument.
Create a filename this is going to be a temporary file and is possible that many users
will be running this same script at the same time so randomly generated name is ideal.
Then write to this file, I use echo with the output sent to a file.  This will create the file
as well as send the information.  Then make another system call to open the file using vim.  Since this is running
from a command line there is no terminal name.  We run a system call “`tty`” to get the terminals name
and use that as output buffer for vim.  If you do not use this you will get the error “Vim: Warning: Output is not to a terminal”

Ever wonder how to open text editor from php similar to SVN/GIT do when -m is not passed as an argument.

Create a filename this is going to be a temporary file and is possible that many users will be running this same script at the same time so randomly generated name is ideal. Then write to this file, I use echo with the output sent to a file.  This will create the file as well as send the information.  Then make another system call to open the file using vim.  Since this is running from a command line there is no terminal name.  We run a system call “`tty`” to get the terminals name and use that as output buffer for vim.  If you do not use this you will get the error “Vim: Warning: Output is not to a terminal”

Web Development , ,

Hammered Forums – Forms in an MVC Framework

August 27th, 2010

My first attempt at a full scale project is named Hammered Forums, it currently has a working copy. Do not judge it based off this working copy, if you’re interested you can download the source.   It is currently an extremely rudimentary forums.

Jform Overview

The current development cycle covers the form class, JForm.  Jform will eventually be powerful enough to encompass the whole site with an easy to use api.  The problem with writing a form class in an MVC Framework is where to keep the form creation code.  Should it be written in the Model Layer for use throughout the site?  Should it be written in the controller because it contains business logic?  Should I write a fourth subset(MVC+F).

Each form implementation comes with its own benefit and its own draw backs.  Using the Model Layer to house your form code keeps your controllers  clean, and makes forms easy to find as they would be in the model they most clearly pertain to.  But often forms contain business logic e.g., login restrictions, posting restrictions,  these do not belong in the Model Layer.  Using the Controller Layer can lead to some confusion and increased size in the controller, but the biggest draw back is replication.  If you want a form on multipages you have to write it in each controller or place it in the base controller neither of which is an ideal solution.  Creating a fourth Layer seems most logical, but this dirties up your MVC Architecture.  For Jlog(the framework) and Hammered Forums JForm is implemented in the controllers.  The site should not contain many global forms so this should be a non issue in this development.  However, keeping business logic in the Controller Layer was the most important reason for this selection.

JForm The Idea

The original outline of JForm comes from JLogs predecessor Vanilla’s form handler.  While working with Vanilla’s form handler I came across several short comings, lack of a feature environment and poor functionality.  The forms did not allow for easy label creation in the View Layer, support multi form fields(form fields with array results), or let you put the same form multiple times on the same page.  The forms also only implemented basic form structures.  I wanted forms where I could specify email address and have email address validation on the fly.  I wanted the ability to seamlessly integrate with javascript addons.  The declaration of a JForm element as a Date should automatically include a Javascript popup calendar onFocus.

JForm The Development

Though still in process I decided to go with the two level approach. 1: The Form Wrapper, this is an object that’s main data structure is an array of JForm_fields.  If you want to perform an action on the entire form it would go through the Form Wrapper.  Then JForm_fields are the second levels, these objects each represent their own specific form element.  I started by writing the wrapper and changing my forms as I went along.  As I needed new JForm_fields I would write them.  They all inherit from a base class that contains basic setters and getters.  The names for the JForm_fields are separate from their indexes in the Form Wrapper this allows for easy implementation of multi-fields.

Web Development , , , ,

US Open – US Men’s Tennis Player Predictions

August 24th, 2010
Roddick – Quarters loses to somebody he should beat
Querrey – 1st round (Withdrawls from doubles)
Isner   – 3rd round( plays 15 sets 8 end in tie breakers)
Fish    - Quarters with ZOMG WTF wins
Genpri  - Round of 4th round Loss
Blake   – Wild Carded in, loses to qualifier first round
Dent    - 1st/ 2nd round loss
D Young – Loses in Qualies

0-5 against Fish?Based off current US Open Series results and passed Grand Slam Performance I’ve come up with how the top American Men’s Tennis players will do in the upcoming 2010 US Open.

Andy Roddick – The perennial top 10 finisher and number 1 American started off the year with a bang.  Finished the clay court season with his best winning percentage(66%).   But how will he perform?  Will this be the year he gets the crown again?  The first American Male Singles player to win a Grand Slam Title?  Is he going to repeat 2003?  No, Roddick will do well and reach the Quarters or the Semi Finals where he’ll lose to Federer/Nadal or one of the young and up coming players like Cilic, Berdych, or Fish?

Sam Querrey – America’s hopeful youngster, will he have his break through grand slam?  Sam has captured four titles this year, one on each surface. But Sam has performed poorly in top level events, losing first round in France and Australia. What should we expect from Sam in singles and what about Quisner you may ask? The big serving doubles team that has fared well against top competition, injury and withdrawals being their biggest opponent.  Expect Sam to lose in the first two round in singles and withdrawl from doubles.

John Isner – The last great college player?  John captured the heart of the american tennis fan at Wimbledon with his record setting 11 hour match.  He has always performed well at any level of play,  winning 1 title in 4 finals this year. What to expect from him?  Expect him to get to the 3rd or 4th round unless he is injured.

Mardy Fish – Who new 10 years after turning pro is when Mardy would turn on his game face.  Look for Mardy to goto the quarter finals, unless a bad draw hampers his progression.

James Blake – Lets be honest here, his career is over.  Blake will lose first round to a qualifier.

Taylor Dent – What Taylor Dent lacks in ground strokes and returns he more than sorta makes up for it with his serve and volley.  One of the true serve and volleyers left on the tour expect Dent to hit alot of aces and leave early.

Donald Young – Is this going to be the year that Donald lives up to his hype?  NO! Expect Donald to win a couple of rounds and then lose before the main draw starts.

Sports

New Layout

August 17th, 2010

This blog has been pretty lifeless and dull with small spurts of inspiration.  This week is one of those spurts.  I recently got a hold of a copy of http://www.sitepoint.com/books/wordpress1/.  Though I could probably figure most of it out, there will hopefully be some non straight forward information, and a more person and professional lay out and content coming to this blog.

Web Development

Sphinx Installation and Setup

August 17th, 2010

Sphinx is an open-source full-text search server, designed from the ground up with performance, relevance (aka search quality), and integration simplicity in mind. It supports multiple databases as well as files and streaming data. It has a command line implementation as well as API’s in many different languages. This guide will go over installation, setup, as well as some common problems that many first time users have while working with the LAMP stack. Read more…

Sphinx Search Engine Integration, Web Development , , ,

Calculating Business Week

August 11th, 2010

Need to calculate what day 10 business days ago was? This is how it is done.

Breaking it down
The function is passed the number of business days as an integer. It calculates the current day of the week 0-6, storing non-business days(Saturday and Sunday) as Mondays(1).

If the current day of the week is fewer than the given number of business days away from the previous non business day the function returns the number of business days. If this is not the case the function subtracts the number of business days already used this in week from the total number of business days(if today is Thursday then subtract 4 from the number of business days). The difference or remaining business days is divided by 5, the number of days in a business week. This number is then rounded down to the nearest even integer, it can be thought of the number of business weeks or the number of skipped weekends. Adding 1 accounts for the weekend that was skipped with the original subtractions. Multiplying the number of skipped weekends by 2 returns the total number of skipped business days.

skippedWeekend is added to account for days that were skipped if the current day is on a weekend.

Web Development

Setting Up MySQL Server on Ubuntu

March 12th, 2010

Pretty easy first:

Read more...

Web Development

Django On Mac OSx

March 8th, 2010

Originally battling with installing Django on OSx I decided to go with my host(dream host) then after battling with them and realizing that I did alot of my development on a train with out internet access that it would really benefit me to install it on my Mac OSx Laptop and to forgot the Apache Integration, I thought this would be a synch armed with my new book I leaped into the unknown.  The instructions were pretty easy to follow:

I installed a new version of MySQL, pretty easy find out what version of OSx you’re running and if you don’t know how many bytes your processor is go with 32.

Then using basic commands from the Django website.  (I’m a big fan of svn, as i use it at work, I also see it’s down sides though) I was able to install Django and begin with the “interesting chapters” of my book.

./django-admin.py startapp mysite
./manage.py startserver(You can verify this works here, but we’ll check later)

So I trucked onwards in my book with the next command that actually set the framework and got the ball rolling.

./manage startapp blog

Then I continued defined a Model and set my database information in the settings tab.  And that’s when I hit my first road bump, I’m a trained programming not really a systems guy.  Everything I learn about sysadmins is by total accident in an attempt to do something with a programming language.

The first of two problems was python could not find the mysql driver.  This isn’t a hard problem at all.

1. Download East Install(download the egg that is the same version as python you’re running)
2. run the command “sudo sh setuptools-0.6c9-py2.4.egg ” renaming 2.4.egg to the file you’ve downloaded
3.  Run this command “easy_install MySQL-python” (This will install the mysql patch)
3.5 (At this point feel free to try the “./manage syncdb” command again it should fail
4. Open ./bash_profile or ./profile in using vim ~/.bash_profile or vim ~/.profile
5. add the following line PATH=”${PATH}:/usr/local/mysql/bin” (and “EXPORT PATH” if needed, this will allow all binary files to be added to the global link, to test this run mysql_config from wherever you are)
6. At this point you should be able to run “./manage syncdb” with no problem

If you’re following the same book as me, Python Web Development with Django, it will have you setup the admin controller for the blog site.  Once you do this and visit your blogsite you will have some error saying that “NameError: name ‘admin’ is not defined”.  In the urls.py add the following line of code “from django.contrib import admin” and you should be golden

Web Development

Valid Credit Card Numbers for Paypal Sandbox

March 5th, 2010

When testing your paypal account in the sandbox you’ll sometime need a fake credit card, and the ones supplied by Paypal do not work.
The easiest way is to login/create an account in the sandbox. When you do that goto My Account > Profile > Credit/Debit Cards.
From here create a credit card, remember the information for this credit card, and yes you can leave the Card Verification Number as 000.
And there you go, a valid credit card number. Note if you save this credit card you will not be able to save it as it will be tied to a paypal account.

Web Development