So having moved desk from one side of the room to another, I have lost my view of the sea. Oh well, this is where technology has come to the rescue and returned my calming view...

Note: I think this is running in British Summer Time (BST) rather than GMT or it's clock is seriously off. Otherwise it's a picture from the future (see photo timestamps).


What?
So this is an article to note an oddity when I was working with a Yootheme template called "yoo_sync". Some clever scripts (both mootools and jquery) using the equalize method to make div layers the same height, and in this case, the same width. It isn't so much a miscalculation of 100% divided by 3 that leaves 1 pixel left over, more the fact that the scripts use that 1 pixel (ceiling rather than floor?).

Why?
We have a row on a website of three boxes made of div layers. When viewed normally on a 15" Laptop, all was good using Chrome and tolerable using MS Internet Explorer. If we maximized the Google Chrome browser, the row would split and there would be 2 boxes on the top row and the third would pop under these. As for MSIE, that was ok when maximized.

How?
You could do loads of code hacks which is what I tested but all for nothing because you always end up needing to specify a third of the width.

What?
Just a quick note on how to format a given filesize and to reduce the display output to a small string, eg:
copyraw
196 bytes          : displays as => "196 bytes"
   12945 bytes        : displays as => "12 Kb"
   1478515 bytes      : displays as => "1 Mb"
   8798745455 bytes   : displays as => "8 Gb"
  1.  196 bytes          : displays as => "196 bytes" 
  2.     12945 bytes        : displays as => "12 Kb" 
  3.     1478515 bytes      : displays as => "1 Mb" 
  4.     8798745455 bytes   : displays as => "8 Gb" 

Category: Personal Home Page :: Article: 468

What?
This is a quick article on how to resolve the following issue:
  • Overall body background color is blue.
  • Background color of my contents is white.
  • When I visit a small page on the site, the contents background (white) shows.
  • When I visit a very long page on the site, the contents background disappears and reveals the overall background (blue) making the text very hard to read.

Why?
Took me a while to figure out what was the problem, I'd visit some pages and they'd be fine, but when visiting a long page, it would initially display properly but then the white background would disappear when the page finally loaded.

How?

Somewhat incomplete! Will post a final solution but here are the basics

What?
This article is a quick note to myself on the idea of a slideshow with the MooTools javascript framework. Basically, I want to create a div layer that I can see through (like a window with no glass) and for all the flashy stuff, to only appear within the boundary of the parent div layer.

Why?
I'm making a slideshow from scratch.

How?
The idea is:

What?
So I have an unordered list of values (*, 1, 2, 3...) and for styling reasons I want the asterisk to be the same size as the numbers but not overlap any list item beneath it. By increasing the size of the asterisk, this often increases the line-height and causes the overall line height to change for other objects in the same row. The problem afterwards was that the asterisk character would overlap the item beneath it (in this case #2) so when a user clicked on #2 they would in fact be clicking on the item containing the asterisk above it.

Objective
Box List Before:Box List After
  • *
  • 1
  • 2
  • 3
  • *
  • 1
  • 2
  • 3

How?

What?
This is to describe how to change the value of a field of a form from it's default when it is clicked on so that it auto-clears and changes to how it normally works.

Example?
Note the value in the below field. Now click on it and it disappears, allowing you to type normally. Clear whatever you type so the field is empty and click somewhere on the page (not on a link as this will take you to another page) and the field returns to displaying "Name:".

Why?
I've noticed a lot of solutions now use JQuery or Mootools but most of these will not work in Internet Explorer 7 which is unfortunately still in use. I needed a back-to-basics solution and this is the one I have used since my fad of JavaScript 1.2 in the 90s. For broader compatibility, this is my recommended solution.


Why?
This has taken me too long to figure out and I hope I don't lose this note again. The only website that was titled similarly kept slowing down my computer too much so I decided to work out my own. The complexity is due to content also being dynamically resized in height.

What?
Basically I have a menu in a sidebar, I don't want it to overlap the header nor the footer.I have a content page next to it which changes in height dynamically (a separate mootool function to this one).

How?

What?
This is intended for activity/session durations and although I usually get MySQL to do the date/time calculations, there are times when we have to do with PHP. This is the shortest way I know to properly convert seconds into total hours, minutes and seconds (taking into account regional settings and without using a date function).

How?
copyraw
$total_time =intval(intval($total_seconds)/ 3600).":";
$total_time.=str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":";
$total_time.=str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT);

// yields
// 82800  = 23:00:00
// 108000 = 30:00:00
  1.  $total_time =intval(intval($total_seconds)3600).":"
  2.  $total_time.=str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":"
  3.  $total_time.=str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT)
  4.   
  5.  // yields 
  6.  // 82800  = 23:00:00 
  7.  // 108000 = 30:00:00 
On one line:
copyraw
$total_time=intval(intval($total_seconds)/ 3600).":".str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":".str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT);
  1.  $total_time=intval(intval($total_seconds)3600).":".str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":".str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT)
Category: Personal Home Page :: Article: 413

So I know it's quite a long title but I'm not sure what I'll be searching next time. It has taken me a lot longer than I thought it would mostly out of frustration and the inability to know exactly what I'm looking for... always difficult. After a cup of tea the solution was glaringly obvious, just do a primary school mathematics table and it all makes sense (see my 10 mod table below).

This article is a quick note (so I never spend as long again) in PHP on how to determine when looping through a loop, which entry was first and which was last. This is incredibly useful for pagination.


Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

RSS Feed

Related Articles

Joes Revolver Map

Joes Word Cloud

data   windows   mysql   table   page   source   parameter   report   file   joomla   code   following   field   work   display   where   system   time   first   deluge   list   added   google   zoho   version   order   find   client   using   script   creator   form   database   error   website   case   create   value   note   used   would   function   files   date   need   name   user   license   uploaded   server   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.