mv_timeMenu
Mon, Feb 20 2012, 21:50 Lasso, programming PermalinkI just edited the tag mv_timeMenu on tagSwap. Because copy/paste on tagSwap does something with line endings that makes much code end up all being on one line, I post the routine here too. Simply copy & paste.
/*
Creates a list of time values inside a <select></select>. Example:
<select name="xyz" class="abc" id="def">
[mv_timeMenu(-fromHour=800, -toHour=2300, -minutes=25, -selected=$db_value]
</select>
*/
define_tag('mv_timeMenu', -optional='fromhour', -copy, -optional='tohour', -copy, -optional='minutes', -copy, -optional='selected', -copy, -optional='firstblank', -EncodeNone);
local('result' = '', 'p' = 0, 'z' = 0, 'h' = 0, 'm' = 0, 'y' = 0, 'f' = false);
if(! local_defined('firstblank'));
local('firstblank' = 0);
else(integer(#firstblank) <= 0);
#firstblank = 0;
/if;
#firstblank = integer(#firstblank);
if(! local_defined('fromhour'));
local('fromhour' = 0);
else(integer(#fromhour) <= 0);
#fromhour = 0;
/if;
#fromhour = integer(#fromhour);
if(! local_defined('tohour'));
local('tohour' = 2359);
else(integer(#tohour) <= 0 || integer(#tohour) >= 2400);
#tohour = 2359;
/if;
#tohour = integer(#tohour);
if(! local_defined('minutes'));
local('minutes' = 15);
else(integer(#minutes) <= 0);
#minutes = 15;
/if;
#minutes = integer(#minutes);
if(#firstblank);
#result = '<option value="" ';
if(local_defined('selected'));
if(#selected == '');
#result += ' selected="selected"';
/if;
/if;
#result += '></option>';
/if;
// Calculate correct starting point
#z = #fromhour;
#h = integer(#z / 100); // Take hours-part
#m = #z - (#h * 100); // Take minutes-part
#y = integer(#m / #minutes); // Calculate how many times the frequency fits
// Calculate new minutes-starting-point
if(#m == (#y * #minutes));
#m = #y * #minutes;
else;
#m = (#y + 1) * #minutes;
/if;
#y = integer(#m / 60); // Calculate how many hours minutes-starting-point contains
#h += #y; // Add those hours to the hours-part
#m -= (#y * 60); // Subtract the hours from minutes-starting-point
#z = (#h * 100) + #m; // Construct new time
#p = 0;
#f = false;
while(#z <= #tohour);
#result += '<option value="' + mv_fmtnum(#z, '####', 'R') + '" ';
if(local_defined('selected'));
if(!#f && #selected != '' && #selected >= #p && #selected <= #z);
#result += ' selected="selected"';
#f = true;
/if;
/if;
#result += '>' + mv_fmtnum(#z, '##:##', 'R') + '</option>';
#p = #z; // Save previous time
#h = integer(#z / 100); // Take hours-part
#m = #z - (#h * 100); // Take minutes-part
#m += #minutes; // Add interval to the minutes to get total-minutes
#y = integer(#m / 60); // Calculate how many hours total-minutes contains
#h += #y; // Add those hours to the hours-part
#m -= (#y * 60); // Subtract the hours from total-minutes
#z = (#h * 100) + #m; // Construct new time
/while;
return(#result);
/define_tag;
/*
Creates a list of time values inside a <select></select>. Example:
<select name="xyz" class="abc" id="def">
[mv_timeMenu(-fromHour=800, -toHour=2300, -minutes=25, -selected=$db_value]
</select>
*/
define_tag('mv_timeMenu', -optional='fromhour', -copy, -optional='tohour', -copy, -optional='minutes', -copy, -optional='selected', -copy, -optional='firstblank', -EncodeNone);
local('result' = '', 'p' = 0, 'z' = 0, 'h' = 0, 'm' = 0, 'y' = 0, 'f' = false);
if(! local_defined('firstblank'));
local('firstblank' = 0);
else(integer(#firstblank) <= 0);
#firstblank = 0;
/if;
#firstblank = integer(#firstblank);
if(! local_defined('fromhour'));
local('fromhour' = 0);
else(integer(#fromhour) <= 0);
#fromhour = 0;
/if;
#fromhour = integer(#fromhour);
if(! local_defined('tohour'));
local('tohour' = 2359);
else(integer(#tohour) <= 0 || integer(#tohour) >= 2400);
#tohour = 2359;
/if;
#tohour = integer(#tohour);
if(! local_defined('minutes'));
local('minutes' = 15);
else(integer(#minutes) <= 0);
#minutes = 15;
/if;
#minutes = integer(#minutes);
if(#firstblank);
#result = '<option value="" ';
if(local_defined('selected'));
if(#selected == '');
#result += ' selected="selected"';
/if;
/if;
#result += '></option>';
/if;
// Calculate correct starting point
#z = #fromhour;
#h = integer(#z / 100); // Take hours-part
#m = #z - (#h * 100); // Take minutes-part
#y = integer(#m / #minutes); // Calculate how many times the frequency fits
// Calculate new minutes-starting-point
if(#m == (#y * #minutes));
#m = #y * #minutes;
else;
#m = (#y + 1) * #minutes;
/if;
#y = integer(#m / 60); // Calculate how many hours minutes-starting-point contains
#h += #y; // Add those hours to the hours-part
#m -= (#y * 60); // Subtract the hours from minutes-starting-point
#z = (#h * 100) + #m; // Construct new time
#p = 0;
#f = false;
while(#z <= #tohour);
#result += '<option value="' + mv_fmtnum(#z, '####', 'R') + '" ';
if(local_defined('selected'));
if(!#f && #selected != '' && #selected >= #p && #selected <= #z);
#result += ' selected="selected"';
#f = true;
/if;
/if;
#result += '>' + mv_fmtnum(#z, '##:##', 'R') + '</option>';
#p = #z; // Save previous time
#h = integer(#z / 100); // Take hours-part
#m = #z - (#h * 100); // Take minutes-part
#m += #minutes; // Add interval to the minutes to get total-minutes
#y = integer(#m / 60); // Calculate how many hours total-minutes contains
#h += #y; // Add those hours to the hours-part
#m -= (#y * 60); // Subtract the hours from total-minutes
#z = (#h * 100) + #m; // Construct new time
/while;
return(#result);
/define_tag;
Comments
Foto: Glowing Cave
Thu, Feb 16 2012, 03:09 Art, iPhone, Photo Permalink
Glowing Cave
I created this poster on my iPhone 4 with the Phoster-app. The only post processing was to lighten it a bit, with Preview.
To view my original image used in the poster, click the poster.
'Transfer services from server to server' mind map
Tue, Feb 14 2012, 10:27 Mac OS X, Mindmaps, Projectmanagement, Webserver PermalinkUsing mind maps to follow your thoughts and track your findings is really a superb experience, every time again. And especially MindMeister, because it is 'in the cloud', i.e. web-based and can be accessed from anywhere and almost anything.
Every one of my personal projects goes into MindMeister if it involves more than just a few scribbles. In this mind map, I have noted all steps I must take, with all peculiarities that arise in the process, to transfer web sites and services from one server to another, in this case from a virtual CentOS server to a co-located MacMini Server from 2011. Mind you, the MacMini Server is no toy anymore - it is blazing fast!
I find this mind map quite interesting and since I am not the only one in the world doing stuff like this, I thought I'd share it so you, reader, might find the information in it somehow useful.

Every one of my personal projects goes into MindMeister if it involves more than just a few scribbles. In this mind map, I have noted all steps I must take, with all peculiarities that arise in the process, to transfer web sites and services from one server to another, in this case from a virtual CentOS server to a co-located MacMini Server from 2011. Mind you, the MacMini Server is no toy anymore - it is blazing fast!
I find this mind map quite interesting and since I am not the only one in the world doing stuff like this, I thought I'd share it so you, reader, might find the information in it somehow useful.

Slurp!
Fri, Feb 10 2012, 17:14 Drinks, Wine PermalinkBrowsing the wines in our supermarket, I stumbled across a wine that really stood out: Slurp! Since I am always in to try something new, especially bio-/eco-wines and their statement on the label, I went for it. Well, a super wine! I can really recommend this one! The label is transparent and I used a blue background while scanning, so the text would be pleasantly readable. | ![]() |
De Saint 0483 - De Saint trekt westwaarts
Wed, Feb 01 2012, 12:27 books PermalinkMonte Real Rioja Reserva
Tue, Jan 24 2012, 09:53 Drinks, Wine PermalinkMy son brought me a special wine from Spain as a present: a Monte Real Rioja Reserva from 2004! This one was 'all wood', qua taste. Rioja's in general are fine wines and I did not know that they can age that much. I can highly recommend this Rioja.
![]() | ![]() |
De Grote Dikke Beer en De Draaimolen
Wed, Jan 18 2012, 11:53 Film PermalinkNaar aanleiding van verzoeken op Recensiekoning.nl en KinderTV.net, hierbij de links naar de films De Grote Dikke Beer Vertelt en De Draaimolen, welke wij voor onze kinderen bewaard hebben door de van televisie opgenomen programma's op VHS-cassette naar DVD over te zetten en de DVDs dan weer op de computer te importeren.
DVD 1: De Grote Dikke Beer Vertelt
DVD 2: De Draaimolen
De films zijn in H264 (.m4v) formaat en kunnen dus:
Update 10-02-2012:
Helaas zijn de kosten voor het extra dataverkeer iets aan de hoge kant en dus bied ik de films alleen nog op DVD aan. Stuur me een mailtje via de 'Contact me'-link onderaan de pagina.
DVD 1: De Grote Dikke Beer Vertelt
DVD 2: De Draaimolen
De films zijn in H264 (.m4v) formaat en kunnen dus:
- zó in iTunes worden geïmporteerd en via Homesharing worden bekeken met de Apple TV 2, iPad, iPhone of iPod
- direct op je iPad, iPod, iPhone of Apple TV 1 worden gecopieerd en bekeken.
Update 10-02-2012:
Helaas zijn de kosten voor het extra dataverkeer iets aan de hoge kant en dus bied ik de films alleen nog op DVD aan. Stuur me een mailtje via de 'Contact me'-link onderaan de pagina.