“Forgive your enemies, but never forget their names.”
– JFK

Archive for the ‘me stuff’ Category


09
Feb

This was sent to me over IM :D

03
Feb

This product page inspired me to write this post. It was launched around February last year (uh oh time flies!) and the first successful order was made around that time too. By then, there were only about 20 products or less, and really short attributes i.e. volumes in 8, 12 or 16 oz. strength like mild, regular, etc. Last monday, new products came in for addition to the site and they have quite longer attributes. It could have had a liquid width on the attribute and cart buttons but they had a really good design advisers and wanted to follow the design to the pixel.

Initially, this html code composes the product attribute and cart button, notice that <span class="c">Cherry</span> is a one word attribute for scent

<div class="cartbutton" style="background-image: url(images/button-long-add-to-bag.gif);">
  <span class="c">Cherry</span>
  <span class="c">8 oz.</span>
  <span class="c">$5.99</span>
  <span class="d">
    <a class="e" href="cart.php?product=5|33404&amp;as=5">Add to bag</a>
  </span>
  <span class="e">» ITEM: 33404</span>
</div>

And the new ones came with the colors “Casino Red”, “Golden Chestnut” and “Orchid Black” – long attributes, and two others “Copper” and “Spice” – short and manageable, as the column width will fit the entire word.

I was really planning to rewrite the whole attribute and cart button section, but I didn’t had much time. I figured I can make the font smaller and paddings or margins can go smaller than the regular so that two lines would fit in the box if the attribute value is a word longer. But I cannot be in PHP, its not really the way to go. So, if I can add another class that would override existing font-size and parent margin/padding, that would work. Here, I thought, word count doesn’t really need be in the PHP side and since I’m using Smarty, I found in it a variable modifier that can print the number of words in a variable, and that’s it. I can add another class in the column span like words-10 or countwords-3 in my template by the number of words that is present in the variable. Below is the generated code

<div class="cartbutton" style="background-image: url('images/button-long-add-to-bag.gif');">
  <span class="c col-color words-2">Casino Red</span>  	  	  	  	  	  	
  <span class="c col-volume">8 oz.</span>  	  	
  <span class="c">$11.39</span>
  <span class="d">
    <a href="cart.php?product=28|33825&amp;as=14" class="e">Add to bag</a>
  </span>
  <span class="e">&raquo; ITEM: 33825</span>
</div>

CSS rules

/* default rules */
.cartbutton { height: 23px; background: url('/images/button-add-to-bag.gif') no-repeat left center; color: #333; }
.cartbutton span { display: block; text-align: center; float: left; font-weight: bold; font-size: 10px; padding-top: 5px; }
.cartbutton span.c { width: 45px;  }
.cartbutton span.d { width: 80px;}
.cartbutton span.d a { color: #fff; text-decoration: none; }
.cartbutton span.e { margin-left: 10px; width: 100px; }
/* special rule for two word attribute */
span.words-2 { padding-top: 3px; line-height: 98%; font-size: 9px; }

And this is how it is setup in the template.

<div class="cartbutton" style="background-image: url('images/button-long-add-to-bag.gif');">
{if $attr[at].color}
  <span class="c col-color words-{$attr[at].color|count_words}">{$attr[at].color}</span>
{/if}
{if $attr[at].strength}
  <span class="c col-strength words-{$attr[at].strength|count_words}">{$attr[at].strength}</span>
{/if}
{if $attr[at].scent}
  <span class="c col-scent">{$attr[at].scent}</span>
{/if}
{if $attr[at].volume}
  <span class="c col-volume">{$attr[at].volume}</span>
{/if}
<span class="c">
  $ {if !$attr[at].amount} {$results[r].amount} {else} {math equation="x" x=$attr[at].amount format="%.2f"} {/if}
</span>
<span class="d">
  <a href="cart.php?product={$results[r].id}|{if $results[r].sku && !$attr[at].sku}{$results[r].sku}{elseif $attr[at].sku}{$attr[at].sku}{/if}&amp;as={$attr[at].pas_id}" class="e">Add to bag</a>
</span>
<span class="e">&raquo; ITEM: {if $results[r].sku && !$attr[at].sku}{$results[r].sku}{elseif $attr[at].sku}{$attr[at].sku}{/if}</span>
</div>

Those extra class names like col-volume, col-scent and col-strength are only for future use, who knows what other formatting and adjustments on the data and theme will happen. Its really fun working with MVC model. Hope it helps :)

Happy coding!

23
Jan

Free accommodation gift certificate

18
Jan

I noticed this when I uploaded an entire project files from dev server to production server. Using Web Developer plugin for Firefox, I had a clue to compare the Content-Type from the response header and the one I have in <meta> tags in my HTML.

1
2
3
4
5
6
7
8
9
10
11
12
Date: Wed, 25 Nov 2009 01:32:28 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch
X-Powered-By: PHP/5.2.4-2ubuntu5.7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 6572
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
 
200 OK

And it was really it! Though they both have text/html, they had different character set values. Server responses with ISO-8859-1, but the <meta> instructs the browser to use utf-8, as it is declared in the document.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

And so the second load of page occurs, its sort of trying to correct page encoding on the client-side. In the script I was working, I needed to pass some session values to the next page and clear it on page load, but when it reloads the second time, the session value had been emptied.

Hope it helps.

30
Dec

It’s always great to visit EK, but on a holiday season, you might spend hours waiting in-line for each ride as there are lots of people during holiday. It’s alright anyway, kids had fun.

Out passed 1 a.m. from EK, heavy meals in a fast food along SLEX by 2 a.m. and home by 4 a.m.

25
Dec

Salamuch (sala-much)
Salamat in Filipino is the way of saying “thank you”, and I mixed it up with “thank you so much”, so it goes …

For those who greet thru IM, wall posts, SMS and email, family and friends, thank you! And those who personally did, thanks again! For my baby, I love you so much, and so grateful spending it with you this year and the pasts, thank you so much!

Uh-oh, another year in the 30′s! Merry Christmas everyone!

Christmas is, of course, the time to be home – in heart as well as body
~ Garry Moore

17
Dec

I’ve been looking on how to start a torrent session on another machine lately (on *nix flavor), and I thought there’s probably a command-line for it, and I was right. Since I can SSH thru in my Ubuntu machine at home, this sounds like a fit option.

The need arises when I’m in the office, working of course, and a movie title suddenly pops in my head and I get eager watching it. So I’d search for torrent for that movie with good remarks, at least watchable quality. Download it then SCP that to my machine at home and start session torrent on CLI. Takes at least a minute of my time to fire it up, but most importantly, it’s finished downloading when I get home. And watch on dinner I guess.

So, if you’re using Ubuntu, transmission is commonly installed there. But we need the transmission-cli package installed, which includes transmission-daemon and transmission-remote for starting CLI torrent session. First fire up the daemon, then use remote to add torrent file, like this one below

marvin@localhost:~/Desktop$ transmission-daemon
marvin@localhost:~/Desktop$ transmission-remote -a Avatar-2009-TELESYNC-XviD-ORC.torrent

If it says The program 'transmission-daemon' is currently not installed, just type the suggested install command. It should be like this

marvin@localhost:~$ sudo apt-get install transmission-cli

Now, if you want to find out download stats just add the -l or --list like the one below, will list all torrents and status.

marvin@localhost:~/Desktop$ transmission-remote -l

Use transmission-remote --help for other options. You can set upload and download limits too.

Here are useful links:

17
Dec

And so I did.

If you received one of these scam messages, just call your network provider. I found out they already warned the user, now his line is for disconnection.

06
Dec

Stuff you might want to know.

  • Entrance fee: PhP60.00
  • Dino world: PhP100.00
  • Snow world: PhP100.00
  • Ride-all-you-can with Snow world and Dino world: PhP365.00

In case you’re up to real ride adventure, get the ride-all-you-can PhP250.00, add PhP115.00 to get unlimited entries to Dino and Snow world. Will surely save you a lot of money.

l_640_480_4EF69CAA-3E68-46C3-9C64-10BAD8F32980.jpeg
l_640_480_7597BA36-67C6-4F3F-BE2A-2BF8A1FE9BEC.jpeg
l_640_480_BE22597D-9FCF-4FF5-AE57-6099EF056FC0.jpeg
l_640_480_39C8D1F4-8064-4B40-91B0-FDBBC05C5AEF.jpeg

(more…)

02
Dec

At last, host is back! Stats tells me how long it’s been unavailable. Zero traffic at all. So this one maybe an entire day, as I have been sending support ticket to hosting since last night.