31 Aug 2010

Office Warfare

Author: Messy | Filed under: Life

My New Nerf Sniper Rifle

In the interest of self preservation in the workplace, I have recently invested in Armaments  for my office.  The bolt action sniper rifle appealed to me, but I think I’m going to have to go back and get a side arm.  I have to see them coming in time to get them at a distance.  Though it is an effective deterrent and people are now wary of interrupting my coding time.  The barrel does disconnect for a shorter weapon, but I haven’t really seen a reason, other than transport, where that would be a useful thing.  Who knows maybe I’ll figure it out eventually.

31 Aug 2010

Me being a dork…

Author: Messy | Filed under: Life

Me and the Cisco Sign at The Mandalay Bay

So we were in Las Vegas a little while back for my cousin’s wedding and Cisco was in town, so of course we couldn’t help ourselves when we saw the giant Cisco sign. Had to get a picture with it. Bryan got more adventurous than I did. But I like this one.  I added some other pictures to the Gallery too… not much though.  Have to get back out and take some.

24 Aug 2010

Rebooting a car

Author: Messy | Filed under: Life

What the hell.

We bought a Honda Insight this year for the long haul treks to work, what I didn’t expect was that the car would need to be rebooted. Seriously. I’m driving along and XM stops working. Normally I’m not really worried about it, but I was listening to something I really wanted to hear on NPR and then no audio. Nothing at all.

I wouldn’t usually turn the car off and back on to fix it, but well it is the Radio and it is electronics. When I was stopped at a light I dropped it in park, turned the car off and then back on. Radio worked again. I think I need to invest in an old car, because it worked and I don’t think I should have to use computer troubleshooting on a car. It’s a friggin’ car dammit!

BAH!

So I like making life easier and all that for myself when coding….  So I decided a while back to recreate some of the tags I used to have in happy ClodFusion land into PHP land.  Granted I’m sure they aren’t as pretty or nifty, but they work so I’m happy.  The first one I made was for a textbox type input.

// print a single-line text box
function input_text($element_name, $element_label, $values, $maxLen = ”, $maxSize = ”, $juju=”) {
print ‘<dt style=width:”‘.$juju.’ !important”>
<label for=”‘ . $element_name . ‘”>’ . $element_label . ‘</label>
</dt>
<dd>
<input type=”text” name=”‘ . $element_name .’” id=”‘ . $element_name .’” maxlength=”‘. $maxLen .’” size=”‘. $maxSize. ‘”  value=”‘;
if ($values == ‘$_POST’){
print htmlentities($values[$element_name]) . ‘” /></dd>’;
}else{
print htmlentities($values) . ‘” /></dd>’;
}
}

So once the code is included somewhere with your functions you can call it and it makes a pretty little textbox for you.  I have the following in the style sheet so that the text boxes will align and all that.

dt label{
clear: both;
position:relative;
float:left;
width: 10em;
padding: 0 0 .1em 0;
text-align: right;
}
dd input, dd select, dd textarea{
float: left;
position:relative;
width: 17em;
margin: .25em 0 .25em 0;
padding-left: .2em;
}

Usually to use it I will create a displayFom() function and stuff the form I want to use in it.

//example Form Funtion
function displayForm(){
print ‘<form method=”POST” action=”‘. $_SERVER['PHP_SELF']. ‘ “>’;
//This is the form’s main fieldset
print “<fieldset>
<legend title=\”\”>Blah Form</legend>”;
print “<fieldset>
<legend title=\”Blah Information\”>Blah Information:</legend>”;
input_text(‘firstName’, ‘*First Name: ‘, $_POST['firstName']);
input_text(‘lastName’, ‘*Last Name: ‘, $_POST['lastName']);
print “</fieldset>”;
print “</fieldset>”;
input_submit(‘submit’,'Add this Volunteer’);
</form>
}

At that point if I want a single stage form I’ll write an if statement wondering if the submit has been triggered yet and check to make sure that my required fields are filled in.


//Here it checks to see if the form was submitted
if (isset($_POST['submit'])){
//Then it gets ready to check the required fields
//initialize the errors array for validation
$errors =array();
//Create a database record ID if you need one
$ID = uniqid(“”,true);
//replicate the blow code chunk and enter your required fields to either validate them or trigger the error message
if (empty($_POST['firstName'])){
$errors[] = “You forgot to enter the Volunteer’s First Name…”;
} else {
$firstName = trim($_POST['firstName']);
}
if (empty($_POST['lastName'])){
$errors[] = “You forgot to enter the Volunteer’s Last Name…”;
} else {
$lastName = trim($_POST['lastName']);
}
//if there aren’t any errors
if (empty($errors)){
// then connect to the database
require_once(“theDatabaseConnection”);
//get ready to insert the record
$query = “INSERT INTO things(stuffID,
lastName,
firstName)
VALUES (‘$ID’,
‘$lastName’,
‘$firstName’)”;
//Insert insert insert!
$result = mysql_query($query);
// If all goes well you should hit here and go on
if ($result) {
//Yay the database insert worked!
echo “<h3> Thank you!</h3>”;
echo “<p>”. $firstName . ” has been added</p>
<p><a href=\”/\”>Go back to the  Website</a></p>”;
} else {
//booooo the database insert didn’t work, so now show me how I messed up…
echo “<h3>Uh… Oh</h3><p>I couldn’t process your server information… </p>”;
echo “<p>Please let the webmistress know the following has happened: <br />” . mysql_error();
echo $query;
exit();
}
} else {
//If there are errors in the required fields, this reports the errors
echo “<h3>The following error(s) occurred:</h3>”;
foreach($errors as $msg) {
//Prints each error
echo “- $msg <br /> \n”;
}
//and then redisplays the form to be finished in again with the previously entered information
displayForm();
}
//if the submit button hasn’t been pushed then it goes on to display the initial form
} else {
displayForm();
}

That’s pretty much it… This just uses the one form field type.

2 Aug 2010

Well I didn’t get anything for sysadmin day…

Author: Messy | Filed under: Work

Oh well… there is always next year…

30 Jul 2010

Happy SysAdmin Day 2010!

Author: Messy | Filed under: Miscellaneous

I hope everyone is enjoying this wonderful SysAdmin Day!

26 Jul 2010

Happy Marmot Day Owosso!

Author: Messy | Filed under: Miscellaneous

Marmot Day was begun in 2002 in Owosso, Michigan, as a day of celebration for this animal which is usually considered as a pest. A luncheon is traditional as part of the celebration, and marmot jokes are also shared, among other festivities typical of any party or celebration. At 12:30 P.M., a marmot is positioned outside its hole, and if it goes into its hole, legend has it that summer is over; if it does not go into its hole, there will be one more month of summer.

4 Jun 2010

Happy Donut Day!

Author: Messy | Filed under: Miscellaneous

Celebrate with Doughnuts and give to the Salvation Army.  2 great things, one great day to celebrate!

More about Donut Day

25 May 2010

Don’t forget to bring a towel!

Author: Messy | Filed under: Miscellaneous

Happy Towel Day all you Hitchhikers!

25 May 2010

Happy Geek Pride Day

Author: Messy | Filed under: Miscellaneous

From Wikipedia

A manifesto was created to celebrate the first Geek Pride Day which included the following list of basic rights and responsibilities of geeks.

Rights:

  1. The right to be even geekier.
  2. The right to not leave your house.
  3. The right to not have a significant other and to be a virgin.
  4. The right to not like football or any other sport.
  5. The right to associate with other nerds.
  6. The right to have few friends (or none at all).
  7. The right to have all the geeky friends that you want.
  8. The right to not be “in-style.”
  9. The right to be overweight and have poor eyesight.
  10. The right to show off your geekiness.
  11. The right to take over the world.

Responsibilities:

  1. Be a geek, no matter what.
  2. Try to be nerdier than anyone else.
  3. If there is a discussion about something geeky, you must give your opinion.
  4. Save any and all geeky things you have.
  5. Do everything you can to show off your geeky stuff as though it were a “museum of geekiness.”
  6. Don’t be a generalized geek. You must specialize in something.
  7. Attend every nerdy movie on opening night and buy every geeky book before anyone else.
  8. Wait in line on every opening night. If you can go in costume or at least with a related T-shirt, all the better.
  9. Don’t waste your time on anything not related to geekdom.
  10. Befriend any person or persons bearing any physical similarities to comic book or sci-fi figures.
  • Try to take over the world!