object { outline:none; }
Tuesday, October 21, 2008
Firefox 3 Dotted Gray border arounf Flash SWFs
If that gray border around your flash movies is showing up in firefox 3, you can get rid of it by putting this into your stylesheet:
Monday, August 6, 2007
PHP: count($var) in loops
I can remember -- when I was in college -- someone mentioning that
However, in a site I recently built, the menu was database driven and it seemed to be taking forever to load. I was going thru the code trying to optimize it and found some places in the PHP where I was using count($array) in loops. So, just for the fun of it, I changed my code to
for(i=0;i<array.length;i++)was a bad idea, because you were calling the length function every time through the loop. The better way was to set a variable to the length and use that. I never saw any speed difference tho, so I just kinda skipped that step every time.
However, in a site I recently built, the menu was database driven and it seemed to be taking forever to load. I was going thru the code trying to optimize it and found some places in the PHP where I was using count($array) in loops. So, just for the fun of it, I changed my code to
for($i=0, $num=count($array);$i<$num;$i++)and it fixed all the issues. Granted, I was probably looping between 3-400 times, but the change probably saved 3-4 seconds of render time. Pretty cool. So anyway, keep in mind that those little optimizing hints actually do work.
Wednesday, April 25, 2007
PHP: mysql_fetch_row vs mysql_fetch_object
This is probably another one that everybody and their brother knew except me. I've always used mysql_fetch_row() to parse thru SQL results in PHP, but recently discovered mysql_fetch_object().
With mysql_fetch_row, you get an array of the items in the row... meaning if you queried the database with 'SELECT id, name, date FROM table', and call $row = mysql_fetch_row($query), then $row[0] is the id, $row[1] is the name, and $row[2] is the date. Seems pretty easy, until i found mysql_fetch_object.
Using that command, those same array vals are now object vals, so you can reference $row->id, $row->name, and $row->date. A little more typing, a lot easier to read. I think I'll stick with it.
With mysql_fetch_row, you get an array of the items in the row... meaning if you queried the database with 'SELECT id, name, date FROM table', and call $row = mysql_fetch_row($query), then $row[0] is the id, $row[1] is the name, and $row[2] is the date. Seems pretty easy, until i found mysql_fetch_object.
Using that command, those same array vals are now object vals, so you can reference $row->id, $row->name, and $row->date. A little more typing, a lot easier to read. I think I'll stick with it.
Friday, April 13, 2007
CSS min-height and IE6
Today (for the last month, but i just attacked it today) I was trying to get someone else's CSS design from a template to a fully database driven page. I had it working in Firefox and IE7, but I don't have IE6 on my machine so I hadn't really tested it much on that. I had heard there were problems, but wasn't worried about them until today. So today, I discovered a couple fun problems with IE6. One is that min-height doesn't work very well on things that aren't tables. (I thought the whole point, or a big point, of CSS was to get rid of tables.) So in order to make my min-heights work in IE6 without breaking anything else, I used a little trick i found at a blog by Dustin Diaz (which is appropriately ranked #1 on Google for 'min-height IE6' searches). Apparently this problem has been around a while, I've just been busy using Flash. Good deal for me, it's already fixed.
Add this to your classes that have min-height in them:
Worked like a charm. For me and about 500 other people who commented about it on his blog.
Add this to your classes that have min-height in them:
class {
min-height:500px;
height:auto !important;
height:500px;
}
Worked like a charm. For me and about 500 other people who commented about it on his blog.
Thursday, April 5, 2007
Gimme back my cursor
Here's something I read this morning that reminded me of something I hate. Normally when you open a web browser, by default, your cursor is in the address bar. But some sites steal your cursor and move it where they want it. For example, Yahoo! moves it to the search bar of their homepage. That makes it hard to type a new address into the address bar and move on when you don't want to be on Yahoo!'s page. I thought maybe I was the only person bothered by this, since there is no sign of it changing, but thankfully I'm not.
Subscribe to:
Posts (Atom)