Archive for the ‘Blog’ Category

Rounded corners in Internet Explorer

Wednesday, September 29th, 2010

There is a way for rounded corners on css-3 using border-radius . . . however, IE doesn’t support this function — older safari and mozilla browsers need the -webkit or -moz prefixes respectively.

So for everything to work together, we need to include an .htc file for rounded corners to behave properly in IE (Internet Explorer) – the htc file is made and being supported by Nick F. – and you may download it here.

After the download, all you need to make it work is to add these styles:


html,body { position:relative;} /* important if you have a background other than white */
.box1 { background-color:#000; border:1px solid #303030; border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px; behavior:url(border-radius.htc); } /* the last statement with behavior is where the magic lies */

Make sure that if you put the .htc file in a different folder, that you specify an absolute/relative path to it . . .

And there you go . . . rounded/curved corners in firefox, internet explorer, safari, chrome and what have you . . .

Insight . . .

Wednesday, September 22nd, 2010

I haven’t posted in a while . . . have been busy with work and a 4 month old at home.

I came across this video at TED that jolted me . . . I didn’t agree with everything she said but it suddenly made sense to me how Adam and Eve were before the fall . . . perhaps, their brains weren’t separated and that was why they could feel and see God . . . and perhaps that is why after eating of the forbidden fruit – they noticed they were naked . . . it must be because their focus shifted from outer to inner (to themselves) and that is how it’s been ever since . . . we are just so focused on ourselves – in feeding ourselves, clothing ourselves and spoiling ourselves . . . always looking out for no. 1 as they say . . . maybe, if we were to realize how meaningless this is and to realize how being part of something bigger than ourselves would actually make us feel happier . . . perhaps, the Garden of Eden is right in front of us, we just don’t see it . . . or choose not to see it.

here is the video:

Guide to writing HTML email

Monday, July 19th, 2010

I’m involved in a project that required me to construct html for email and I have got to say that it’s a different animal. When designing for the web – I have to worry about Internet Explorer (v.6 especially!), Chrome, Safari and Firefox. On designing HTML email, there is way more to worry about – First of all, you have to make sure you aren’t blacklisted or your email will never even reach an eyeball — it will just go straight to the junk folder and deleted. Secondly, you have to create 2 version – a plain text version for email clients that do not support HTML and the HTML version which contains the fancy stuff. To do this, your email has to have the correct document type as laid out here:


Content-Type: multipart/alternative;
boundary="----=_NextPart_000_008A_8001a"


------=_NextPart_000_008A_8001a
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Insert your plain text message here


------=_NextPart_000_008A_8001a
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Insert your html email message here

Insert the last boundary below to end the message.


------=_NextPart_000_008A_8001a--

In writing the html email itself – it is a completely different science, like what I mentioned earlier. Some things you should do or pay attention to are the ffg.:

  • Design in tables. Most of your CSS would NOT work.
  • Use inline styling. If you must use CSS, it should be inline.
  • Outlook doesn’t display background images.
  • When tiling images in a table – Gmail automatically adds a 1px margin. You need to put { display:block; } on the inline style for the image and a valign=”bottom” or { vertical-align:bottom; } on the cell.
  • Width should not be more than 620px.
  • Test, test and test — make sure your email isn’t ending up in the spam or junk folder.
  • Use this to check your spam score – http://www.contactology.com/check_mqs.php
  • Update: Don’t use h1,h2,h3 tags. As it inherits default styling in Hotmail and seems to disregard inline styling for color.

Want to be an Entrepreneur?

Monday, June 21st, 2010

This was done by Grasshopper.com and very inspiring.

Drupal Page Theme According to Content Type

Thursday, June 17th, 2010

I have used this a lot in the past for most of my Drupal projects – To theme a page in Drupal (v. 6) according to its content-type (ie page-news.tpl.php) . . . you will need this piece of code in template.php – it also makes a lot of other suggestions including getting the page url alias . . .


function themename_preprocess_page(&$variables) {
global $user;
if ($node = menu_get_object()) {
$variables['node'] = $node;
$suggestions = array();
$template_filename = 'page';
$template_filename = $template_filename . '-' . $variables['node']->type;
$suggestions[] = $template_filename;
$variables['template_files'] = $suggestions;
// Add a single suggestion.
if (module_invoke('throttle', 'status') && isset($user->roles[1])) {
$variables['template_file'] = 'page-busy';
}
// Add multiple suggestions.
if ($variables['node']->type == "page") {
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$variables['template_files'][] = $template_filename;
}
}
}
if (!empty($user->roles)) {
foreach ($user->roles as $role) {
$filter = '![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s';
$string_clean = preg_replace($filter, '-', drupal_strtolower($role));
$variables['template_files'][] = 'page-'. $string_clean;
}
if (drupal_is_front_page()) {
$variables['template_file'] = 'page-front';
}
}
}
}

Dynamic Font Replacement on the Web

Friday, June 11th, 2010
How Cufon works

How Cufon works

I’m currently reading about the Web Typography chapter in the Smashing Book and discovered a new font replacement technique . . . I’ve used most of them in one project or another but haven’t heard of Cufon. Cufon behaves similar to sIFR but instead of using Flash to generate the fonts, it uses a font generator and a renderer (javascript) – it works better than sIFR because it doesn’t use Flash at all and believe me, I’ve used sIFR before and have run into a lot of problems . . . it’s good for small projects but there are just a lot of restrictions and because Flash resizes the fonts accordingly, it’s unpredictable what sizes the replaced fonts will be on any given browser. I like Cufon for the simple fact that I do not have to deal with any of that. Cufon is also speedier than sIFR and is less of a hassle to set up. I’m cutting up a project now and will try it out. Will let you guys know how this one goes.

The other font generation techniques include static image replacement (via CSS) or dynamic image replacement using server based script. Both of these have accessibility issues and should be used with it’s limitations in mind. Another interesting technique is by using @font-face. This is probably the easiest and the only one that is a web standard. The reason why it isn’t widely used is because it’s a fairly new standard (CSS 3) and old browsers do not support it. But it’s probably the best one since the only rendering engine it relies on is the browser itself. Here is how it works:

In your CSS, you include


@font-face { font-family: NewHelvetica; src: url('fonts/NewHelvetica.otf') format("opentype"); } 

and to use it, just declare it in your styling – such as


h1 { font-family:NewHelvetica, Arial, Sans-serif;}

So there you go – Web typography still has a long way to go but it finally seems to be getting there.

[Added 11:41AM PST]
By the way, there is a talk about this on this year’s SXSW’s Interactive – a podcast of this talk is available now thru SXSW.com – Listen to it.
There are also other resources which I will include here:

[Added June 28, 2010 02:41PM PST]
I just also discovered that you can use Google Webfonts as an alternative as well . . . right now, they only have a few fonts that you can use but I’m guesssing that if they gain enough traction with this initiative, they will add more.

The Ketchup Conundrum

Friday, June 4th, 2010

As a guy who loves ketchup, this article I read recently through the book – What the Dog Saw by Malcolm Gladwell is a good read . . . It was first published in the New Yorker on Sept. 2004 – so it is a bit late that I just read about it now . . . to all ketchup lovers, who haven’t read it – you should. I will never look at ketchup the same way again . . . Read the Ketchup Conundrum article in PDF.

jcarousel external linking

Tuesday, April 27th, 2010

I have recently been working a lot with jquery and one of the plug-ins I’ve incorporated is jcarousel.  It’s a good plugin for a simple gallery of pictures or static content.

Unfortunately, there are a couple of flaws with external controls or linking to a specific frame. The website does have an example of a very crude gallery with external controls which is seen here below:

There are a couple of problems here – the plugin doesn’t have an option to specify/add an “active” class to the link, so there is no way of telling which frame you are actually looking at without clicking on something. Also, the links have to be numbers bec. the function is being called through initCallback – here is the default code below:


function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
return false;
});
jQuery('.jcarousel-scroll select').bind('change', function() {
carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
return false;
});

Now remember we are only modifying the external pager controls (not the next/previous links). Using the default code, you may only link to a particular slide by doing this:


<div class="jcarousel-control"><a href="#">3</a></div> <!-- this links to the 3rd slide -->

To modify the number link as well as add an active class to the active slide . .. here’s my modified code:


function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
var index = $(this).attr("id").split("_");
carousel.scroll(jQuery.jcarousel.intval(index[1]));
//carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
$(".jcarousel-control a").removeClass("active"); //Remove any "active" class
$(this).addClass("active");
return false;
});
jQuery('.jcarousel-scroll select').bind('change', function() {
carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
return false;
});

With my modified code, you may link to any slide through this code:

<span class="jcarousel-control"><a href="#" id="_3">This links to the 3rd slide</a></span> <!-- don't forget the underscore -->

Also, it will add “active” to the class of the active/clicked link.

<a href="#" id="_3" class="active">This links to the 3rd slide</a>
.

If you know just a little bit of javascript or jquery you would be able to do some more with this as my solution is a crude one due to time constraints.

11th year anniversary . . .

Monday, April 19th, 2010

Yesterday was our 11th yr. anniversary.  I unfortunately cannot afford to give my wife any material presents because we are both saving up for the upcoming addition to our family.

However, unlike in years past – I didn’t forget to greet her this year . . . I posted a song I’m dedicating to her in light of our present circumstance on my other blog which I’m posting here as well . . .

[audio:baby.mp3]

Facebook User Name and Facebook ID

Monday, April 19th, 2010

Currently,  I have been incorporating twitter and facebook follow links on my websites more and more – it all seems like a “fad” to me — much like the animated gifs, marquee ticker, apple aqua buttons and the flash splash pages that came before.  However, unlike the ones that came before which were merely “aesthetics” to make a page look good . . . the social media follow links actually serve a purpose.  It probably benefits the site owner more than the user but nevertheless, if people decide to follow you then you can send them regular updates without being classified as  “spam”.

So having a facebook/twitter account is absolutely beneficial if you know how to use it properly.  Just now, I’m amused that it takes quite a bit of “googling” to set up a custom id for your facebook page . . . and you need at least 25 fans to be able to set it up.  Just login to your facebook account, make a page for your business – add a profile and other relevant information. Then head on over to http://www.facebook.com/username – yes, it’s a separate url . . . you can’t change it from your settings page – I guess facebook doesn’t like you doing this so they are actually making it a bit more difficult than it has to be.