Do you Want to Move or Copy?

I got an interesting message from Windows when I was going to copy some files from a file server mount to a drive on a Windows server and got the following dialog:

Do you want to move or copy files from this zone? (Yes)(No)

I want to copy. So yes or no? Turns out the dialog was asking if I wanted to perform the action of move or copy (whichever action I envoked). It was not asking for me to choose from either move or copy.

Interesting few Weeks

Art of the Start signed by Guy KawasakiIt has been a wile since I have posted about what I'm up to. Work has actually been busy and productive. A couple weeks ago, I was tasked to develop a multidimensional form in under 5 days and demo it. This is where all my recent posts have been coming out of. Friday, a week ago, I demoed my multidimensional form to some key stakeholder in the project, and got to go ahead to continue working on it, which is good. That afternoon, I went home sick and stayed sick over the VEISHEA weekend. AmesMUG didn't have a tent this year, so I guess I didn't miss anything that needed to be done. Gaila was gone for the weekend at the estate auction in Ottumwa, so I was sick all by myself :(.

On the good side, it got me around to finally hooking up my Wii. I have already gotten about half way through Paper Mario and Gaila has taking a liking to playing Zelda.

Last week Gaila was sick all week, same thing I had, but during the week. Because she was sick all week, she has been working pretty much the entire weekend, catching up on what she missed.

This week was the Emerging Technologies Conference on campus. I went to see a couple of presentations. The most notable presentation I went to was Guy Kawasaki. He talked on the "Art of the Start", what to do and not do when trying to start a business that will change the world, in a very humorous manner. I bought his book the "Art of the Start" which he signed after the presentation. I also learned that he has Meniere's Disease (same thing my mom has) and discussed some of the treatments he has done. He doesn't have it as bad as my mom does, but it was interesting talking about.

The IgniteIT event was lots of fun. Free beer, free food, and free fun. Some great short presentations, and the end was a series of Power Point Karaoke.

Now it is time to do a little something about cleaning this apartment, as it has fallen apart from us being sick all the time.

Multiple Buttons in IE

When working with the multidimensional forms, I found I wanted to perform some actions to some elements in the form. For example, deleting a sub element using a button. I found the nice <button> tag which allows you to have a separate submit value from the label of the button. I later found that it doesn't work right in Internet Explorer. Poking around for a solution, most were solved using JavaScript. But I didn't want to bring JavaScript into the game because people may not have it enabled and the level of complexity goes up. So, I sort of came up with my own solution to fix it entirely with PHP.

Instead of using <button> I went back to the input method, but to be able to get the value and the label to be different, I had to do something a little different. I ended up putting the name and the value into the name attribute. For example:

<input type="submit" name="btnDeleteRow=<?php echo $rowNumber; ?>" value="Delete" />

In order to be able to work with with it, I created a function to take care of parsing out the key value pairs and throwing it back in to the $_POST array:

function fixIEButtons($arr)
{	
	foreach($arr as $key => $value)
	{
		if(substr($key, 0, 3) == "btn" && strrpos($key, "="))
		{
			// this is a button that needs to be evaluated
			$button = explode("=", $key);
			$arr[$button[0]] = $button[1];
		}
	}
	return $arr;
}

Attached is a text file with PHP code that demonstrates what IE does in the different ways of doing things.

Multidimensional Forms in PHP

At work, I was tasked to create a multidimensional form. For example. The user was going to define X number of animals, and each animal was to have X number of syndromes, and each syndrome for each animal could have X number of lesions.

So in programming you can set this up as a multidimensional array. Say you were interested in the name of the 2nd lesion of the 1st syndrome of the 23rd animal, $animal[22][syndrome][0][lesion][1][name]. Pretty simple. But, how the hell do we implement that into an HTML form (without JavaScript)?

I learned that since PHP 4, there is now support for multidimensional forms. Like so:

<pre>
<?php

print_r($_POST);

?>
</pre>
<form method="post" name="main" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="field[0][name]" value="zero" />
<blockquote>
	<input type="text" name="field[0][sub][0]" value="zeroSub0" />
	<input type="text" name="field[0][sub][1]" value="zeroSub1" />
</blockquote>
<br />
<input type="text" name="field[1][name]" value="one" />
<blockquote>
	<input type="text" name="field[1][sub][0]" value="oneSub0" />
	<input type="text" name="field[1][sub][1]" value="oneSub1" />
</blockquote>
<br />
<input type="submit" name="submit" value="submit" />
</form>

To extend this further, you can just code inside a loop as follows:

<input type="text" name="field[<?php echo $fieldID; ?>][sub][<php echo $subID; ?>] />

when posted this can be accessed as an array in the $_POST array:

$_POST['field'][$fieldID]['sub'][$subID]

or

$_POST['field'][22]['sub'][0]

No string parsing or explode()ing necessary.

Bought the Wii

WiiSo, awhile ago I learned about Wii Tracker that will watch for Wiis gong on sale on the Internet. I finally bought one when Wal-Mart offered the Customer Choice bundle, which comes with a Wii, 6 games, an accessory, and a 3-year warranty. I got the following games:

  • Super Paper Mario
  • Trauma Center: Second Opinion
  • Cars (Pixar)
  • Legend of Zelda: Twilight Princess
  • GT Pro Series
  • Super Swing Golf

The way the deal is set up, I will end up getting a whole bunch of different packages at different times. I should have it all by the end of the month. Since I didn't want to be getting a ton of personal packages at work and risk having one opened and / or lost in the sea of the hundreds of packages that show up every day, I'm having them shipped to my apartment. Unfortunately, this means I will probably be running around to FedEx, UPS and other facilities when my packages start arriving.

Simple Barcode Generation in PHP

a barcodeIf you ever need to generate barcodes in PHP, I have modified a simple library I found to work with register globals off and stripped the debugging code. It doesn't work all the time and input validation could be better, but it seems to work well for the purposes I have used it for. Check out the tgz file attached.

The library requires GD, which I found is NOT included in RHEL 4's copy of PHP 4 or PHP 5 from the default RHN channel. Usually PHP 4 and 5 have GD built in.

Where Have I Been?

So, a few interesting things have happened in the past week or so, but I haven't taken the time to post :-/

LANFEST happened last weekend. Colin has a few pics of it on his Fickr. Unfortunately, I didn't play very many computer games, but I ended up play Wii mostly, and Gaila enjoyed a good portion as well. Colin and Nick showed up and mostly played WoW. The venue changed form the pavilion to the atrium in Howe Hall, and we stayed until around 5am by the time we were all packed up. Pretty soon, I will not be able to do the whole night anymore.

This weekend, Colin, Brett and I will be going down to Des Moines to see Lewis Black at the Civic Center. Gaila is gone for the weekend at conclave, so I have the apartment to myself until Sunday afternoon.

I learned that Guy Kawaskai will be coming to town April 26, 17th for the Emerging Technology Conference. He'll also be going to the IgniteIT event the evening of the 26th. I'm going to have to get a copy of "The Macintosh Way" and/or "The Art of the Start" to have him sign. Definitely going to be a really good week.

At work, I have figured out how to work with the MSSQL database with PHP and extract form data from PDFs as well as touched up an open source library for generating barcode images using GD. Perhaps I will post about the barcode library soon.

How About an Update?

So, I have been working at my new job for just over 3 weeks now. In that time I set up a subversion server for source control, LAP (LAMP minus the MySQL) server for creating proofs of concepts for the work I will be doing, learned how to parse form data from PDF forms in two different ways, learned how to dynamically populate PDF forms and not allow changes to be saved using Adobe Reader, started setting up a TRAC server and started working with MSSQL in my PHP. Oh and I managed to get a Mac on order so I will not be left in the Windows world during the day. Also, today my name has been stuck to the outside of my office door.

Last Friday, Gaila and I went to see the Soweto Gospel Choir(warning, embedded music) at Stephen's. I scored 2 free tickets during my employee orientation. While there we ran into Pastor Fritz. He invited us to participate in an interview Monday night at church for the national organization to evaluate funding. Gaila didn't make it, but I went and learned that Pastor Fritz has officially put in his resignation to end his term this coming summer. He is going to stay around the Ames area, however.

LANFEST is coming up really quick. It will be on Friday, April 6th at 7:00 in the Howe Hall atrium. We'll have a Wii or two as well has loaner iMacs from Apple in case you don't have a beefy enough machine. The event is free for everyone as it is an official "This is Your April" event. It seems this semester is coming to an end very quickly, after LANFEST it is another week until VEISHEA and then the week after that is dead week and the week after that is finals. At least I am no longer a student and don't have to worry about finals anymore, but I will still play a role in organizing LANFEST and VEISHEA.

Today, I bought tickets to go to see Lewis Black at the Civic Center in Des Moines for April 14th. A little bit on the pricey side, but probably worth it. I'll be going with Colin and Brett. Unfortunately, Gaila will be at Conclave.

Cool New Stuff

So, I have been busy getting settled in my new job. I am finally starting to get work done instead of just getting acclimated and set up. I set up my own Red Hat server for Subversion and PHP development. I have also figured out how to parse out form data from PDFs and will be working on integrating that into our web site. I am also learning Java and JSP to be able to work with our existing web system. I have just finished connecting PHP with our MS-SQL server so I can start getting some real work done. I am lobbying my boss for a Mac to work with.

Speaking of getting a Mac, I used my Student Developer Discount I had left to buy a MacBook Pro. I'm typing on it right now and installing the updates. I ordered a custom machine from the online store on Wednesday afternoon, and it showed up this morning. I'm glad I sprung the extra $15 to get it shipped 2-Day from China. Now I get to play around with it over the weekend.

I hope everyone's spring breaks are going well.

Starting Monday

I have signed the letter of intent and I will be starting work on Monday at the College of Veterinary Medicine as Systems Analyst I. I was hired into a newly created position starting on a brand new project for the department. I will be starting on a large project right from the beginning, which is exciting. The only down side to the job is that it is primarily a Windows environment, which means I will have to get used to being productive on Windows, but that just means I get to play with shaim all the time. I'm sure I will pick things up pretty well.

In the mean time, I have Thursday and Friday off to relax during the snow storm we are going to be getting.

Syndicate content