better than your blog.
Header image

For those of you who like to see things visually, the newest release of MySQL workbench enables you to connect to your existing MySQL database and reverse engineer it so that you can see the full ERR (Entity Relationship R_____) Diagram in all its glory. For me this is helpful to see when I’m taking over a project I know nothing about. As long as the foreign keys are set up correctly, the tool should be able to do all the work for you. You can also make changes to the Diagram and then have it synchronize with your development/production database. This feature used to be some sort of premium feature that you had to upgrade and pay for, but I just discovered that it’s all included in the free download. I like free stuff.
http://dev.mysql.com/downloads/workbench

Screenshot:
MySQL Workbench Screeshot
After reverse-engineering the existing MySQL database, you can get an ERR diagram that looks like this. Now your job is to nicely organize the tables.

Finally updated this thing to 2.8.6… Hopefully this will get rid of the spam that was plaguing my site…

The fact that you don’t have to initialize your variables in PHP makes me a very lazy programmer.  With a large scale project that I’ve been working on for the past 6 months, I’ve really paid the penalty for dumb mistakes like not initializing and resetting my variables.  So just because PHP doesn’t make you do that stuff, it’s always best practice to do so.

I’m not sure if this is totally correct and I have no fixed way of measuring this (other than that I don’t get any timeout errors anymore) but I’ve noticed a significant difference when choosing between two different methods of string concatenation:

Slow way:

foreach($oranges as $orange){
$orange_str = $orange_str . $orange;
}

Better way:

foreach($oranges as $orange){
$orange_str .= $orange;
}

This is obviously simplified for example’s sake, but I had a situation where I was concatenating several hundred (maybe a thousand) elements to a string and I was receiving a “Fatal error: Maximum execution time of 30 seconds exceeded…”.  My best guess is that with the first method, an actual copy of that string is being made in memory so you’re probably taking up twice the amount of memory than you should be.  That’s just my guess.

more to come later…

Probably the best example of form validation comes from Jeremy Keith’s DOM Scripting, which is probably the best book I’ve ever picked up.  Ever since I read it a little over two years ago, it definitely got me into the loop as far as modern-day javascript is concerned…  But anyway, he shows you how to create an unobtrusive way of doing form validation.

Basically all you gotta do is give the field you want to be required a class of “required”.  Then in your javascript, you iterate through all the inputs and search for anything with a class of “required”.  If the contents of that field are empty, then you put up an alert and stop the form from being submitted.  I put my own little twist on it by coloring the border of the field red and alerting the user of how many fields need to be filled in.  Since I’ve been a big fan of jQuery lately, i’ve re-done the function in jQuery…

Javascript:

$('form').submit(
function(){
$(this).find('.required').each(
function(){
if($(this).val().length < 1){
$(this).css('borderColor','#ff0000'); counter++;
} else {
$(this).css('borderColor','#ffffff'); } } ); if(counter > 0){ alert("There are "+counter+" fields that need to be completed."); return false; } } );

HTML:

Name*:
Email*: 

Sorry the formatting sucks, but I haven’t figured out how to make things look nicely with this WordPress Code Plugin.  In any case, you can totally copy this exact function and use it for your purposes.

So this is pretty straightforward, but the only reason this function has come to my attention lately is because if you’re working on a webpage with oh…. 200+ input fields (i’ve got a page that looks like a spreadsheet), this function is RIDICULOUSLY slow in Internet Explorer 6 and 7.  In fact, IE tells me “Are you sure you want to keep running this script?”.  The reason it takes so long is that i’m using the class selector $(‘.required’) which actually goes through every single input and checks for the class “required”.  It’s nowhere as fast as using the ID selector (an alias of document.getElementByID).  So i dunno, I haven’t yet figured out a solution to this.  I could definitely narrow down the fields that I’m going through but that seems kind of a hack.  I want to be able to say “required” on any field I want to.

Without saying…  it’s pretty clear how much faster my page with 200+ input fields performs on Firefox or Chrome…  IE sucks.  I should re-title my blog to the IE Sucks blog.

I’m handing over an application with zero documentation.

I’m currently using jQuery 1.3.1 and Internet Explorer throws an error when I try to clone() an element whom itself is a clone.
clone1.gif

So if I were to hit “Duplicate” on row 15 in the diagram above, a copy of that row would show up at the end of the table.  The error occurs when I try to Duplicate that row that was just created. The issue has been reported here http://dev.jquery.com/ticket/3500.  I tried using the latest build last night, but still no luck.

I ended up doing a small work around where I copy the first row, then copy the values of the row that is intended to be duplicated into the new row.  Crappy workaround, but whatever.

I have like 3 or 4 side projects that I want to get rolling on…  but I feel like there’s little time to work on those kinda things.  Kristine and I went to Mozart’s this past Saturday so I could work on something I’d been putting off since September and it actually felt really good.  Now that college football season is over, my Saturdays have to be devoted to something, right?

But in order to get these things done, I have to spend way more time than the weekends to do these things.  When I get home from work (where I do web development), sometimes I don’t feel like doing more web work.  I’ve obviously gotta have some sort of balance in my life.  Things like going to the gym, watching my Netflix movies, keeping up with TV shows, PS3, cooking, and just time with Kristine all supercede the time for side projects.  Most likely, i’ll have to give up the Netflix, fall behind on TV shows, or something…  Or maybe I can organize myself enough to actually get all this stuff done!  Maybe.

By the way, hello Facebook…  I was kinda iffy about importing http://frankmaulit.com into Facebook notes, since I think I’ve already got enough exposure on Facebook, but whatever.

I’ve also added a bunch of blogs/websites on my blogroll on http://frankmaulit.com.. If you want me to add your blog or website, let me know.

The thing I like about Javascript frameworks so far is that I don’t seem to be having the same kind of browser compatibility issues I used to have when I used to write most of my Javascript from scratch.  All of the browser incompatibilities have been abstracted to me so I don’t have to worry about whether or not things work in IE6, IE7, Firefox..etc FOR THE MOST PART.

1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|134|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210| buy pills risperdal buy atarax tablets buy risperdal without a prescription cheapest order inderal zofran buy no prescription order no prescription lasix actonel no prescription needed purchase albuterol over counter order valtrex online birth control no prescriptionAccutane Online Doxycycline online Buy Cheap Lexapro Online No Prescription Prednisone Online Buy Accutane No Prescription