Friday, June 29, 2007

Newsletter creation tool

Almost time to go and present the wonderful newsletter tool I wrote and posted about earlier.

It's been finished for more than a week, just took some time to setup the meeting and what not. Lets hope it all goes well and I don't have to re-code too much of it.

Sadly Vancouver trip is shelved :( Prices kept going up and up, and wasn't loving the choices for flight times. Perhaps we'll find something else to do, or I can spend some quality time watching more Stargate SG-1 (still not caught up to current season.. not by FAR!)

BFN

Thursday, June 28, 2007

Vacation: Vancouver?

Considering Vancouver as next week's destination instead.. I've been there before, beautiful city! Not sure how much we can amuse ourselves for 3 days?

BFN

Deluxe Field trip

Yesterday afternoon we went on a team field trip to Deluxe facilities in Burbank. It was educational.
Deluxe does the encoding for our trailers, and VOD stuff for iTunes, Amazon, Walmart etc. During our tour we visited the 'vault' where they keep all the media. I found on a shelf near the door the Stargate Atlantis episode "McKay And Mrs. Miller" on tape.. sadly I was being watched at the time (probably cos I oooooh'd too loudly) otherwise I would have snagged it (maybe not.. but I would have liked to!).

Considering going to London next week with my friend Deb, it's only $1500/person flight + hotel.
BFN

Tuesday, June 26, 2007

Off-Topic, Dr McKay phone message

http://jeninason.com/JenniferMessage.wav

Best Practices for content to go live

Over the time i've worked at MGM, we've been having some problems with how things go live after they are entered to the content management system.

The idea of "stage" and "production" seems to be confusing to the users. Since I made it on mgm.com a two stage click ("Click here to submit to stage", then "Click here to submit to production") the users simply click through both pages, and consider it an inconvenience (can you please remove the two pages and do both at once?).

To this end I think I will implement a "two user" policy for content to go live. The person who enters the content can submit the content for review, and the other person tests the content, then has the ability to send live. Of course I'll put in an extra user (me) who can do both ;)

Why don't users test the content? This is the question that has bugged me the most. Every single week I find someone live that wasn't tested (I can usually tell because the page is broken :S ). Constantly we reiterate how important it is to just go "look" at the page once you send the content live and see if it's even there!!

Users...

BFN

Wednesday, June 20, 2007

Bad code day

Ever have those days when you just didn't enjoy your code? You get a project with no spec, a very basic design which doesn't describe what half the stuff is supposed to do, an html version of that with no working links, so no clue where they all supposed to go, and a really really short deadline (do it today!).

UGH

BFN

Changing file extensions

When we moved the main site from JSP to PHP, we wanted to make sure that if people had old links, they would still work.
To this end, most of the pages ended up with the same filenames, the only change was the extension. Initially there was a mod_rewrite rule created that would push all people going to *.do to *.php. For some reason it stopped working. No clue why?

My experience with mod rewrite is extremely limited. I'm happy to say I'm somewhat baffled by regular expressions. It takes me an inordinate amount of time to write them.

As an interim solution, I updated the conf so that *.do would be executed as *.php. Almost all of the requests for .do pages were for one particular page, so now we have two copies of the same page. Not an ideal solution by far, but at least they aren't getting 404's anymore.

In my efforts to try and fix this problem, we decided to make some changes to our 404. Previously it simply redirected to the homepage, as we didn't have time to work out what we really wanted it to do. I updated so the 404 is a php page, and I check the URI and redirect the user to the search page, with what they request as a search query. It's quite slick, and handles proper movie names.

For a sneak peek (not live yet) try one of our movie or tv show names after the following url: http://vendor.mgm.com/movie name Unfortunately it doesn't handle the "lack" of spaces yet. That's going to be handled once my new DB design is implemented.

http://vendor.mgm.com/rescue dawn or http://vendor.mgm.com/stargate atlantis

BFN

Tuesday, June 19, 2007

25 Web Sites to Watch

A mate sent me a link yesterday which I found particularly interesting.

It's a list of 25 Web Sites to Watch.

There are some links on the list that i've never heard of, but also some that I just LOVE! OpenDNS for example, where I created for myself a bunch of shortcuts for sites I go to a lot. This site for example is "blog" in my address field. Time savers like that seem frivilous, but I love them!

I also have come to love Squidoo, Meebo and Yodio amongst others. Anyhow, it's a great list to see just what's going on out there, and things to watch out for!

BFN

Friday, June 15, 2007

EnginSite and Rapid PHP 2007 are tied

After a couple more days using the new editors, EnginSite is no longer in the lead. It is now tied with Rapid PHP.

I am liking the interface with Rapid PHP, with only one misgiving so far. I don't like it when I move my cursor to the end of the line, it doesn't wrap at the EOL. It just keeps moving to the right! I know this is a small thing, but I'm used to it wrapping, so it's disconcerting, and I keep typing on the wrong line!

Perhaps I should read the documentation for EnginSite, because I can't seem to find the File Explorer. Well.. I found one, (File Manager) but it's not showing for me anything on our network drive, which is where I do all my work. It only lets me browse through files on my C drive.

I've decided to give them both another week, alternating days of using them.

BFN

Thursday, June 14, 2007

Email validation review

A few days ago I posted a super simple function to validate email. Upon review, i realised that it didn't take into account .info or if they have @ipaddress.
Both of these are quite valid, but would be denied by that function.
Here is what I use instead:
function is_email_valid($email) {
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
return false;
}
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false;
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}

Sorry about the formatting for the longer lines doing the regular expressions, but you get the drift?

BFN

Comic-Con!

Registered for Comic-Con today! Just going for one day, but looking forward!

Wednesday, June 13, 2007

Nothing.. no code

Sadly I have nothing to add today. This morning we discovered that the connection to both Oracle and MySQL wasn't working. I called our managed services support. All the sites that were database driven were down for (we think) about 4 hours!!! It turned out one of the power cables on something got loose.. seriously.. a power cable.. loose.. thousands of dollars for a loose power cable.

SHEESH!

BFN

Tuesday, June 12, 2007

EnginSite is winning

So far.. EnginSite is winning. I like the interface, and the feel. Lets see how it performs for a whole week (and possibly on my new machine once I get it).

Ate too much fresh spinach at lunch *gag*

BFN

PHP Editors, random snippet

I've been searching high and low for reviews and trials of as many applications there are out there for writing PHP. I found some promising ones, but nothing has leapt out at me yet.
Currently I use HomeSite. More simply because it's what I used 10 years ago, than any other reason. Now I think I'd like to try an IDE.

Here are the apps I'm reviewing:
  1. Programmers Notepad 2
  2. Zend Studio
  3. EnginSite
  4. PHP Coder
I'll post my reviews once they are completed.

Code snippet for email address validation:
function is_email_valid($email) {
if(eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$",
$email)) return TRUE;
else return FALSE;
}
BFN!

New mini CM

I have been tasked to create a mini CM. Basically it's just to add new pieces to create a monthly email. I'm creating the tables in DB Designer 4 (even though I have Visio Professional now.. I can't seem to stop using the freeware one). The design is very simple, text fields, char fields, is_active, order for the pieces. A master table which has each month and it's pieces in it.

The moderately interesting thing about this task is that I need to generate two versions. One which will be emailed to a subscriber list, and another to remain on the site with forms to request more info and links to trailers which actually work. The links to trailers on the email only link back to the links from the one on the site. Does that make sense? Oh well.. babbling again!

Another task I'm currently working on is sweepstakes code. I'm not going to cover that here, simply because I'm just going to reuse code I've written for use on the Stargate site.

On my slate for this week:
  • Setting up http cache for a new site under Akamai
  • Blue Hornet API syncronization
  • Updates for the tools for all sites
  • Adserver config (openads is VERY cool!)
  • Redesign of the main database for MGM.com
Hopefully I'll get to cover the code I use for most of this (excluding Akamai and Blue Hornet.. since I doubt that's relevant to anyone else).

BFN

Monday, June 11, 2007

Nothing yet.. but

Well it's a bit early today for me to have anything to post. I checked on Friday night, and the date code I'd written Friday worked like a charm!
Everything appeared on schedule, and it still there (as it should be until Thursday, when I make sure it actually disappears).

I've been trying out google's adsense. I added it to my rather empty, and quite useless personal site. I think my site only exists just to try out technologies for the web that I actually implement properly on the sites for work. My site (in case you didn't actually just come from there) is jeninason.com

I added the google adsense "search" option to my page. Having a weird CSS error, where the outline for the text field is missing. I was going to ask Steger to give me a hand, but unfortunately he's feeling under the weather today, so won't be here!

Will post later again once I've actually done some real work :P

BFN

Friday, June 8, 2007

What I hope to do here

I thought it would be good to start with what I plan to do on this blog exactly.

Every day I work on web sites, whether I'm making little fixes to bugs, or writing entire applications. Here is where I plan to document my progress.

I'm pretty much self taught with web development, I've been writing the back-end of websites for 10 years now! When I discover new things, or simply want to be able to lookup for myself where I've done something in the past, this is the place I'll come.

Each week day I plan to write a short description on what code I wrote (if any) and what it did, and perhaps filename(s) for my own reference.. at least code snippets for others.

Often I find small niggling errors that I can't find the answer to. I'm positive that someone else must have seen it before, but get frustrated trying to find the solution. I google for the answer, and all I get is uber geeks belittling people like me asking questions on forums. Here I hope to write up solutions to these simple things, and hope that people offer me feedback.. especially when I ask questions!

The question now is.. what did I do today?
1. I updated my personal website with some text. Basically it's been horribly neglected, and it's only real purpose is to post my photo's for family and friends.

2. Wrote some code and fixed a SQL select statement for picking live content (checking to see if it's active, and if the start date is passed, and the end date has not passed) from a small content manager I wrote (in a hurry).
I had to do a sort of work around. You see the users who enter the content into the CMS enter the date/time as local pacific time. This creates a problem, since the servers are set to GMT. The problem isn't quite solved yet, but this is what I have now:

putenv("TZ=US/Pacific");
$now_time=date("Y-m-d H:i:s");
$query="SELECT id FROM tablename WHERE is_active=1 AND (datetime_start < '".$now_time."' and datetime_end > '".$now_time."')";

I know putenv isn't the best way to do this, but I am working in PHP4, so the new timezone functions in PHP5 aren't available to me.

Well that's it for today, and it's Friday, so no more posting til Monday!

BFN