February 29
I really wanted to make sure I post today because.. today is the most ‘different’ day of the year. Well at least it doesn’t show up until after 4 years.
My workaround-of-the-day is commonly known as clearfix.
I heard it from someone that we should avoid using HTML tables, or at least use them wisely. So, I checked out a few css files (and learned of floats), and read of ‘clearfix’. When I was working with facebook apps, adding ‘clearfix’ when I had floats, sure worked wonders.
A float works most with columns, take for example, this blog’s theme. The posts are written on a floating(left) div while the sidebars are floated right. The problem comes in, when we need another div as a footer. You see, a float takes the div out of the normal flow (thus the name ‘float’). So, the parent div of the divs will not ‘contain’ the float normally (OR it means, that the parent div will not get the height of the floated divs) .
What we’d use here is: clear:both; (for the footer).
Also, you might wanna make sure that if you have floats, and have more than one column, and they are kind of width-dependent, your floats will not expand. Because sometimes, when our floats gets added content, the widths expand, and this could cause our divs to run down. [And totally break your design..
]. I usually solve this problem using ‘overflow:hidden;’ ![]()
PHP’s Now I know #1
I was already in my 3rd year in College when I first heard of PHP. Notice the word “heard” (hehe
). We were actually taught PHP (as it was part of the curriculum). I guess I wasn’t just listening that much.
Unfortunately, we had a big project whose credit was as big as the Final Exam. I think what made it really “big” was that I had to use sessions. Sessions are PHP’s simple way of knowing if you’re logged in or not. (You can also use cookies if you want.)
Anyway, as I was saying, my first encounter on sessions was terrible. I had to face a lot of errors, most were “headers already sent” ones. Our instructor suggested we use ob_start. And just like yesterday’s post, the “workaround” really didn’t get me. I just used it and didn’t bother learning more about it.
Yesterday, I was working on a PHP script that had to use sessions. Sure enough, the years-ago error showed up once again :(. Then I remembered ob_start (start output buffering). You see, I think we get “headers already sent” errors, because, before the sessions, output had already been sent to the browser.. thus when we used sessions, it sends another set of headers, which triggers these errors. What you could do here is (1) check for something else before the opening <?php and closing ?> tag. (2)If this fails, you can use ob_start to start output buffering.
According to php.net (referring to ob_start):
This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.
The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.
..and then release the contents of the internal buffer using ob_end_flush.
On a side note, ob_start and ob_get_contents would be very useful if you need to return output from a function.
Centering blocks
When I first started learning HTML a few years ago, centering blocks used to be very easy with the <center> tags. But with my first web-based UI task last year, everything looked different. And the <center> tags didn’t center my divs
. I copied a few CSS declarations and it worked.. must be something about the CSS. I dismissed the solution after I got it right a couple of times.
Last week, I again faced the same problem at centering blocks, but this time.. I forgot the solution. I checked a few sites that I have frequently visited and checked their css.
Margin:0px auto;
If you want a block centered, you can set the block’s right and left margin widths to “auto”. You can check this site if you wanna know more.
Yeyyyy meeeh!!
I am just sooo proud and happy.. (that I really wanna blog about it). I finally got my very own favicon.
According to Wikipedia:
A favicon (short for ‘favorites icon’), also known as a website icon, page icon or urlicon, is an icon associated with a particular website or webpage.
It’s the blue heart you see beside my blog’s url: blog.3rdbee.com. I created it. Well.. not really, I put it up on Photoshop using a brush from Seishido.biz Brushes. So technically, I stamped the brush on a 16×16 #333 box.
I hope you like it, because I love it sooooooo much.
I just turned One
My blog just turned 1 (month).
hihi.. I published my very first post “Our Song” (of Taylor Swift) last Jan23. I still love “Our Song”.. I play it when zzzzzzzzzziness gets me.
Today, I was my sister’s lady in waiting.
We are six years apart but people kept thinking we’re twins. She’s attending her first JS Prom. I think she’s scared and excited at the same time. (She either needed moral support or someone to bring her things home.. huhu).
Her classmates are superrrrrr excited.. they reserved for ‘hair and makeup’ at 12 when the program doesn’t start until 6. Hihi.. ![]()