Jun 19 2008

Remember TRBL

Tag: YadaDustin @ 10:34 am

This post (like many I write) is mainly for myself.

When using CSS padding or margin, I generally will write margin-top, margin-bottom, margin-left, etc. I know there is easier syntax where I can specify all for with one line such as

margin: 0 10px 88px 10px;

The problem is, I can never remember which one is where. Know I’m not going to forget. It’s simply top, right, bottom, left… TRBL, TRouBLe, trouble. Who can forget trouble?

Sometime I want the top and bottom the same and the left and right the same. It is also a one liner:

margin: 10px 20px; /* top-bottom, right-left */

No, I’m not going to remember TBRL, that would be stupid. I’ll just remember to start at Top. See, no TRouBLe at all!


Nov 12 2007

PHP to Excel

Tag: YadaDustin @ 5:12 pm

I was tasked with exporting report to Microsoft Excel files. There are a number of ways to do this. One of the easiest I have found it to create a tab delimited file and give it an .xls extension. You can also create a table using html and give it an .xls extension for similar results. The main issue with doing this is that it is not really an excel file so you may get an error like this: excel-error.gif

So, not wanted to re-invent the wheel, I went searching for a good php class I could use. I ended up selected this one. What I liked most about it was that I could just pass in a multi-dimensional array (which my data was already in) and it would create a Excel file from that.

Well, soon I got complaints that number fields were being stored as strings so it was back to the drawing board. I then came across this port of a popular Perl package. It had a lot more features I could use and it wrote numbers as numbers. I wrote a simple function that converted an array to an Excel file. I’ll post it here for your enjoyment.

$test = array(
array (
'Text' => 'abc',
'Number' => 123,
'Date' => '28345.345'
),
array (
'Text' => 'def',
'Number' => 456,
'Date' => '8/8/1977 7:00 AM'
),
array (
'Text' => 'ghi',
'Number' => 789,
'Date' => '1/1/2007'
)
);
echo '

'; print_r($test);
Array2Xls($test, 'test.xls', 'Report');

function Array2Xls($array, $filename, $worksheetname = 'Sheet1') {
	require_once "php_writeexcel-0.3.0/class.writeexcel_workbook.inc.php";
	require_once "php_writeexcel-0.3.0/class.writeexcel_worksheet.inc.php";

	$workbook = &new writeexcel_workbook($filename);
	$worksheet =& $workbook->addworksheet($worksheetname);
	$heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1, 'bg_color' => 'black', 'color' => 'white'));
	$date_format =& $workbook->addformat(array(num_format => 'mm/dd/yyyy hh:mm:ss AM/PM'));

	$worksheet->set_column(0, 3, 15);

	// heading
	$i = 0;
	$h = array();
	foreach(array_keys($array[0]) as $val) {
		$worksheet->write(0, $i++, $val, $heading);
		array_push($h, $val);
	}

	// values
	for ($i=0; $iwrite($i+1, $j, $array[$i][$h[$j]], $date_format);
			}
			else {
				$worksheet->write($i+1, $j, $array[$i][$h[$j]]);
			}
		}
	}

	$workbook->close();
}

There is still one issue I have yet to resolve and that is concerning dates. I’ve been searching for a PHP script that can convert Unix timestamps or date strings to Excel date numbers. I gave up on it figured I will implement it when or if the request comes in to do so ;)


Jun 26 2007

Blog Publishing In Word?!

Tag: YadaDustin @ 7:21 am

So I just upgraded to Microsoft Office 2007. I saw this feature to publish a document to a blog. You know me, I just had to try…

So let’s see how well it performs:

Lists

  1. One
  2. Two
  3. Three
  • Bullet 1
  • Bullet 2
  • Bullet 3

Big
Colorful
Text

And an image:


May 30 2007

Syncing Google Calendar with Outlook/PDA

Tag: YadaDustin @ 6:01 am

I always thought it would be nice to sync Outlook with the Google Calendar. I found out today that it is now possible thanks to OGG Sync.

Check it out and give it a try. There is not very much documentation, but be sure to read what documentation they do have on installing it so you can figure out how to use it after installing.

I should also mention that the freeware is limited to syncing the 3 days only - so it is not a time trial, but a free version with limitations.

[nms:pocket pc,5,1]


Jan 29 2007

Getting Things Done

Tag: YadaDustin @ 8:29 am

Getting Things DoneI finally finished reading Getting Things Done. Well, to be honest I can’t say I finished “reading” it. I read about 2/3 of the book then listened to the rest of it on an audio book :D

I would give the book 4 out of 5 stars. It seems to be written mainly for business people - especially the management types. Anyone can benefit from reading it though. Since reading the book, I cleaned out my Gmail inbox containing over 300 messages. I set up a new filing system at home (which works MUCH better). I bought a few extra baskets and changed the way I used my “in basket.” I even bought a nice labeler!

The problem is that if you don’t follow the whole system you can easily get back in a frustrated rut. I’m still figured out how I want to do things. My biggest problem is that I work from two computers and two locations. I have my work office and my home office with a computer for each.

There are resolutions for this type of thing, I just need to fully implement them. I would really recommend this book to anyone who feels they don’t have enough time to get everything done that they want or need to.


Jan 26 2007

Breaking the Law… Parking?

Tag: Humor, YadaDustin @ 4:45 am

parking ticketI’ve been highly entertained by Connor’s parking woes. It brings back semi-sweet memories of my time at Salt Lake Community College (SLCC).

Throughout my long career at SLCC I tried to get away with buying a parking pass as much as possible. My first two years I succeeded without getting a ticket. I think this was mainly because my classes where at the South City campus and they were always late at night. Once I started taking all my classes at the Redwood Campus those parking patrol guys got good.

The first time I got a ticket I went the same day and bought a parking pass. I didn’t pay my ticket though. I figured they’d just forget about it. Little did I know that they knew my license plate number. They put a hold on my account and I couldn’t get my grades that year until I paid my ticket.

Well, one year I seemed to be particularly busy with things and I couldn’t seem to make the time to go buy the yearly pass. My mom had just given me her old car. The beauty of this was that the school - or anyone really - didn’t have the license plate under my name.

It only took a few days of parking before I got my first ticket. The next day I had a class on the other side of campus. I still hadn’t had time to go buy a [stupid] parking permit. So as I left my car, I put the ticket back under my windshield wiper hoping that some silly little parking officer boy would see it and say “oh, this car already has a ticket.”

Well, they saw it, but that silly little officer boy was the same one that patrolled the other side of campus just the day before. He left me another ticket and added a comment at the bottom that said, “NICE TRY!”

Well, that just made me laugh. Jokes on you sucka! (That’s Ebonics for “I’m not going to pay my ticket because I can get away with it.”) I accumulated a few more tickets that month. Then I finally registered the car and got some new license plates and a parking permit to go with my new plates.

I never did pay all those tickets. I suppose with a little investigative work they could have tracked me down eventually, but for the amount of money they could have squeezed out of me I doubt it would even be worth it. I’m just a parking fugitive now.

Technorati Tags: , ,


Jan 25 2007

Boise Idaho

Tag: Napoleon Dynamite, YadaDustin @ 5:22 am

BoiseGrowing up, I often heard my mom talk about Boise Idaho. I know that she lived there for some period of here life, but I’m not exactly sure when. I’ve actually been there once, briefly. My friend got married there and I was his best man. I really didn’t see much of the city. I was in the Boise Temple most of the time there. We did see the inside of a mall and a Golden Coral or something afterwards.

It seems to be growing in popularity though. Can you believe their football team this year? That game against Oklahoma should have a movie made about it! :D Between that game and Napoleon Dynamite, people might start finding Idaho on a map ;)

My brother is currently doing his residency to become a doctor. Yeah, he’s a scrub. He’s here in Utah at the moment, but he and his wife have often talked about moving to Idaho once he is done. From what I here it’s a great place to live and lots of people are moving there.

Well, if it’s growing anything like the Salt Lake Vally, better jump into a home there while the housing is still affordable! Check out some Boise real estate.

(This was a sponsored post.)


Jan 25 2007

Collecting Old Wooden Bats!

Tag: YadaDustin @ 4:53 am

I’m trying to collect lots and lots of old wooden bats to decorate my sons room. This is just a shout out to please let me know if you have any old wooden bats sitting in your garage that you are willing to donate. I can pay for shipping them. Thank you much!

This is my inspiration: Baseball Bat Room


Jan 22 2007

Free Business Cards

Tag: YadaDustin @ 3:09 pm

Have you ever been out to lunch and saw the little canister full of business cards where they draw out a card and give the customer a free lunch?

Have you ever run across and old friend and tried to exchange contact information in a busy location - or with your kids pulling on your legs and whining?

Well these things never happen to me either. Seriously though, these are the occasions that I tell myself I need to get some business cards. But then I think, why would I want to buy business cards for these odd occasions. I’d certainly take free business cards.

Well my friend, you’re link luck. You can get free business cards on the internet. I found some and I only had to pay the cost to ship them. What did you expect? Free shipping too?

Now, if I could just find more places to use them! :D

(This was a sponsored post)


Jan 17 2007

Auto Sales Site

Tag: YadaDustin @ 1:33 pm

I’m glad to see more auto classifieds sites popping up - especially free ones. I remember back in the day shelling out $40 for a basic crappy listing at autotrader.com. Things continue to improve. I liked uCoast.com for a while, but I think they died a slow death.

I will only buy Used Cars. New cars are just plain too expensive. So unless I ever become a millionaire I will be browsing used car sites. The sites that like to list new cars are not for me. Now I just need to keep an eye out for a good deal on a used Toyota Tundra!

This is a sponsored post. Now that you’ve landed here, feel free to check out .


Next Page »


Clicky Web Analytics