A couple of development tricks

Recently a member of my team encountered 2 development problems that in my opinion are not really complicated but it seems people get stuck in such small stuff all the time so I decided to add the solution here maybe someone else might find it useful:

Trick #1. Getting several columns to adjust their height together according to the one with most content:

here we want to make the red DIV extend to the bottom of the container when the blue DIV has extra content, the simple solution to this is to structure them as follows:

<div id="container" style="background:url(X) repeat-y;">
    <div id="redDIV" style="float:left;"> your content here </div>
    <div id="blueDIV" style="float:left;"> your other content here </div>
    <div style="clear:both;"></div>
</div>

the trick is to insert a background image in place of the big red “X”  in the code that displays the background for both the red and the blue DIV, that way any content that expand either will extend the container to fit because you have a clear:both DIV after the two floating red and blue DIVs and it works all the time on every modern browser.

Trick #2.  A YouTube content widget imports video who’s titles are either in English or in Arabic, the problem here is that the font does not display nicely in both cases, if you adjust for English the Arabic looks terrible, if you adjust for Arabic the Englsh looks huge, and there is no direct or simple way to know in what language the content is in… or is there?
well actually there is, English content will be coded in ASCII codes below 128 and Arabic will be coded in higher values so the trick is to get any non-numeric random sample character from the content stream and check the ASCII code for it, if higher than 128 the it’s Arabic and you can instruct your code to inject a suitable CSS class to match the case and vice-versa for English.
For a listing of the lower ascii codes check http://www.klcconsulting.net/images/ascii-full.gif

let me know if you have similar cases and if my solutions worked for you (or not).

Advertisements

3 thoughts on “A couple of development tricks

  1. Aw, this was an exceptionally good post. Finding the time and actual effort to make a top notch article… but what
    can I say… I put things off a lot and never seem to get nearly anything
    done.

  2. I’m not that much of a online reader to be honest
    but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back in the future. Cheers

  3. First of all I want to say great blog! I had a quick question that I’d like to ask if you don’t mind.

    I was interested to know how you center yourself and
    clear your head prior to writing. I’ve had a difficult time clearing my thoughts in getting my ideas out. I do take pleasure in writing but it just seems like the first 10 to 15 minutes are usually lost simply just trying to figure out how to begin. Any recommendations or tips? Kudos!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s