technonaturalist

image link to hive image link to ko-fi

css notes: fixed middle fluid outer column

Friday, 6 April 2012 @ 1:53pm

Also known as: I’m a blithering idiot.

I spent way too long overthinking this problem and only finding solutions with floats (I have very specific cases where I’ll use floats for layout, also I could have missed anything that didn’t use floats for layout as I was stupidly staying up way too late when working on this). The way to do it is actually embarrassingly easy. I’ll be using it for the header and footer (after I’ve installed Sassy, prepro and phpsass.

Malay, lojban, and pocket money for bookwork

Sunday, 1 April 2012 @ 1:37pm
F=Faham

F=Faham (Photo credit: :Salihan)

Not “versus” because it’s not a contest. Not really.

I’m about to give up on my Malay Anki deck, mostly because it’s not ordered in a way that makes logical sense to me. I grew up hearing a lot of Malay, sadly I didn’t learn it formally because I couldn’t be bothered going to Malay school on Saturday mornings (I already went to school five days a week, why in the hell would I want to go on a sixth?) and I didn’t pick up nearly enough in daily life (partially because I think my parents were more concerned about me speaking and writing decent English while going through school, partially because I had for a very long time this idiotic notion that if I couldn’t grasp something the very second it was presented then I was obviously too stupid to live, and mostly because I was probably too damn lazy to pay proper attention). I figured that I should just be able to pick it back up, and I did to a degree. I’m not sure how the deck was structured, perhaps relevance to something that wasn’t relevant to me. There were many instances where I wondered why the root word hadn’t been introduced before a word that built off it.

theAbysmal Calendar Drupal module

Sunday, 25 March 2012 @ 9:52pm

I think it’s done now.

  • fixed an issue where the years weren’t being calculated properly (?!)
  • I may be slightly out of sync with the official documentation, at least according to the tests I’ve done on my local so far. This year should match up, and so will key dates (New Year Day and Leap Day). I’ve shifted leap years to fall on multiples of 4 so calculating would be a simple case of if mod 4 is 0, it’s a leap year, if mod 128 is 0, it’s not a leap year, so some of my years will be a day or two out

theabysmal_calendar.info

name = theAbysmal Calendar 
description = Converts Gregorian date to theAbysmal date 
core = 7.x 
package = Date/Time

theabysmal_calendar.module

<?php
/**
* @file
* Converts date from Gregorian to theAbysmal Calendar
* 
* theAbysmal Calendar in depth: http://theabysmal.wordpress.com/theabysmal-calendar/
* Currently uses months from the Tranquility Calendar 
* (http://www.mithrandir.com/tranquility/tranquility.html) and days in
* highly informal/bastardised lojban as that's how I use it.
* 
* @author ryivhnn
*/

/**
* Implements hook_help.
*
* Displays help and module information.
*
* @param path
*   Which path of the site we're using to display help
* @param arg
*   Array that holds the current path as returned from arg() function
*/

function theabysmal_calendar_help($path, $arg) {
switch ($path) {
    case "admin/help#theabysmal_calendar" :
    return '<p>' . t("Converts date to theAbysmal Calendar") . '</p><p>&nbsp;</p><p>';
    break; 
    } 
} 

function node_created_date() { 
    // grab node create date 
    $query = db_select('node', 'n') -> fields('n', array('nid', 'created')) -> condition('nid', arg(1)) -> condition('status', 1) -> execute() -> fetchAssoc(); 
    $date = $query['created']; 
    return $date; 
} 

function today() { 
    // grab today's date 
    $date = time(); 
    return $date; 
} 

function date_converter($date_ce) { 
/** 
    * doing the calendar converty magic 
    * owe the algorithm to the software engineer husband 
    */
    
// set the zero date and time for theAbysmal Calendar 
$zero_date = mktime(0, 0, 0, 12, 21, 2012); 

// this is New Year Day on theAbysmal Calendar 
$zero_day = date('z', mktime(0, 0, 0, 12, 22, 2012)); 

// this is first day which is counted from 0 
// calculate theAbysmal year 
if ((date('m', $date_ce) == 12) && (date('d', $date_ce) > 20)) { 
    $year = date('Y', $date_ce) - date('Y', $zero_date); 
} 
else { 
    $year = (date('Y', $date_ce) - date('Y', $zero_date)) - 1; 
} 

/** 
    * I think theAbysmal Calendar may be following Gregorian leap years to a degree. 
    * I couldn't find anything explicit in the documentation on the website. 
    * Because it counts from 0 every 4th number ends up being slightly weird (3, 7, 11, 15). 
    * I've decided to modify slightly to make leap years occur on multiples of 4 like they do 
    * on the Gregorian which then makes the not observing the leap year every 128 years 
    * slightly easy to remember, and also takes an operator out of the maths. 
    * Yes I can write an entire rationale in the comments but cbf putting in one extra operator. 
    */ 

if ($year % 4 == 0) { 
    $ly = 1; 
    
    if ($year % 128 == 0) 
    { $ly = 0; 
    } 
} 
else { 
    $ly = 0; 
} 

// because the leap years are different, we need to do maths with Gregorian 
$gly = date('L', $date_ce); 

// "buffers" for the leap year calculations 
if ($ly == 0 && $gly == 0) { 
    /** 
        * the way the $year_length calculation works, years where it's not a Gregorian 
        * or theAbysmal leap year come up a bit short, so this pads it out 
        */ 
        
    $leap_buffer = 1; 
}
elseif ($ly == 1 &amp;&amp; $gly == 1) { 
    /** 
        * conversely if the leap years coincide it makes the $year_length a bit longer 
        * than it should be, so this adjusts 
        */ 
        
    $leap_buffer = -1; 
} 
else { 
    $leap_buffer = 0; 
} 

/** 
    * working out how long the year is 
    * need to +1 to make it an absolute value 
    * add theAbysmal leap year and subtract the Gregorian leap year as required 
    */ 
    
$year_length = date('z', mktime(0, 0, 0, 12, 31, $year_ce)) + $ly - $gly + $leap_buffer + 1; 

// what day number are we up to in the Gregorian, + theAbysmal leap year + the leap buffer 
$gregorian_day_of_year = date('z', $date_ce) + $ly + $leap_buffer; 

// how many days have passed since theAbysmal start date, plus tA leap year day, less Gregorian leap year day 
$days_from_start = ($gregorian_day_of_year - $zero_day + $year_length) % $year_length; 

// theAbysmal month converted to an integer 
$month_number = intval($days_from_start / 28); 

// what day in the month it is 
$mday = $days_from_start % 28; 

// lojban day names assigned to month names 
$days = array( 
    'xundei' => array('0', '7', '14', '21'), 
    'najdei' => array('1', '8', '15', '22'), 
    'peldei' => array('2', '9', '16', '23'), 
    'ri\'ordei' => array('3', '10', '17', '24'), 
    'cicnydei' => array('4', '11', '18', '25'), 
    'bladei' => array('5', '12', '19', '26'), 
    'zirdei' => array('6', '13', '20', '27'), 
); 

foreach($days as $key =&gt; $value) {
    if (in_array($mday, $value)) { 
        $weekday = $key; 
    } 
} 

// Tranquility calendar month names 
// the 14th "month" is a 2 day intercalary period for New Year Day and Leap Year Day 
$months = array( 
    '0' => 'Archimedes',
    '1' => 'Brahe',
    '2' => 'Copernicus', 
    '3' => 'Darwin',
    '4' => 'Einstein', 
    '5' => 'Faraday',
    '6' => 'Galileo', 
    '7' => 'Hippocrates',
    '8' => 'Imhotep', 
    '9' => 'Jung', 
    '10' => 'Kepler', 
    '11' => 'Lavoisier', 
    '12' => 'Mendel', 
    '13' => '', 
); 

foreach ($months as $key =&gt; $value) { 
    if ($key == $month_number) { 
        $month = $value; 
    } 
} 

/* 
    * intercalary days 
    * 
    * check to see if it's December Solstice (Dec 21) 
    * if it is, it's New Year Day 
    * if not, it's a weekday 
    * 
    * if it's a leap year, Dec 20 is Leap Year Day 
    */
    
if ($month == '') { 
    $weekday = ''; 
    
    if (date('d', $date_ce) == 21 && date('m', $date_ce) == 12) { 
        $mday = "New Year Day"; 
    } 
    
    if ($ly == 1 && date('d', $date_ce) == 20 && date('m', $date_ce) == 12) { 
        $mday = "Leap Day"; 
    } 
} 

// leading zero silliness 
$yrabs = abs($year); 
$yrlen = strlen($yrabs); 

if ($date_ce < $zero_date) { 
    $era = 'btAT'; 
} 
elseif ($year == '0000') { 
    $era = 'tAT'; 
} 
else { 
    $era = 'tAT'; 
} 

if ($yrlen == 1) { 
    $year = '000' . $yrabs; 
} 
elseif ($yrlen == 2) { 
    $year = '00' . $yrabs; 
} 
elseif ($yrlen == 3) { 
    $year = '0' . $yrabs; 
} 

$daylen = strlen($mday); 

    if ($daylen == 1) { 
        $mday = '0' . $mday; 
    } 

    return $year . $era . ' ' . $month . ' ' . $mday . ' ' . $weekday; 
}

function date_shorten($date) { 
    /** 
     * can't help but feel this may be unnecessarily long winded :) 
     * 
     * Months and days are put into an array 
     * the first letter in each is grabbed 
     * the $date string is searched and the full name replaced with the letter 
     * then spaces are stripped 
     * 
     * I also continued with negative years in the array even though Not Jack 
     * isn't a huge fan og negative years as the $era was making my short dates 
     * longer :) 
     */
     
    if ($era = 'btAT') { 
        $neg = '-'; 
    } 
    
    $month = array( 
        'Archimedes', 
        'Brahe', 
        'Copernicus', 
        'Darwin', 
        'Einstein', 
        'Faraday', 
        'Galileo', 
        'Hippocrates', 
        'Imhotep', 
        'Jung', 
        'Kepler', 
        'Lavoisier', 
        'Mendel', 
    ); 
    
    foreach ($month as $value) { 
        $m = $value[0]; 
        $date = str_replace($value, $m, $date); 
    } 
    
    $wday = array( 
        'xundei', 
        'najdei', 
        'peldei', 
        'ri\'ordei', 
        'cicnydei', 
        'bladei', 
        'zirdei', 
    ); 
    
    foreach ($wday as $value) { 
        $wd = $value[0]; 
        $date = str_replace($value, $wd, $date); 
    } 
    
    $date = str_replace(' ', '', $date); 
    $date = str_replace('btAT', '', $date); 
    
    return $neg . $date; 
}

/** 
 * implements hook_block_info() 
 */
 
 function theabysmal_calendar_block_info() { 
    $blocks['today'] = array( 
        'info' => t('Today\'s theAbysmal date'), 
        'cache' => DRUPAL_NO_CACHE, 
    ); 
    
    $blocks['posted'] = array( 
        'info' => t('Converted post date'), 
    ); 
    
    return $blocks;
}

/** 
 * implements hook_block_view() 
 */ 
 
 function theabysmal_calendar_block_view($delta = '') { 
    $block = array(); 
    
    switch ($delta) { 
        case 'today': $block['subject'] = t('Today\'s theAbysmal date'); 
            if (user_access('access content')) { 
                $date_ce = today(); 
                $block['content'] = date_converter($date_ce); 
            } 
        break; 
        case 'posted': $block['subject'] = t('Converted post date'); 
            if (user_access('access content')) { 
                $date_ce = node_created_date(); 
                $date = date_converter($date_ce); 
                $block['content'] = date_shorten($date); 
            } 
        break; 
    } 
    
    return $block; 
}
?>

Usage instructions

  • create a folder called theabysmal_calendar in sites/all/modules
  • copy theabysmal_calendar.info and theabysmal_calendar.module to files of the same name and save them into the folder you created. Dicth the closing php tags in the module file
  • if you don’t like the month and week days I’m using, change them to whatever you like in the days and month arrays (two of each, just be aware that the date shortening as it is may look odd with week day and month names that start with the same letter, the date formats can be changed easily enough)
  • go to the modules page (I think it’s Admin >> Modules, I use the admin toolbar and it’s just there), scroll down to Date/Time and check theAbysmal Calendar on
  • go to Admin >> Structure >> Blocks and activate and position the blocks you want. There are two provided, one converts today’s date and the other converts and shortens a post date. I’m using <?php echo render[$block['content']; ?> to spit the shortened date into the top of the blog posts

If anyone knows how to write Wordpress plugins and feels like converting it, go nuts.  Then tell Not Jack so theAbysmal Calendar blog can have an Abysmal Calendar :)

Simplistic musings on cats and dogs, or ramblings about why pet shops shouldn't sell them

Saturday, 24 March 2012 @ 10:15am

[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]

I have this bias towards cats and dogs in this piece, because I’ve only ever shared a house with cats and dogs.

Staffy X rotti and staffy X mastiff squished up in the same dog bed

Fenrir and Taliesin bunking in

My random thought that triggered the blat was that JJ is not going to let me have any more cats.

Musings on The Cloud

Sunday, 18 March 2012 @ 10:25pm

[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]

clouds

clouds (Photo credit: Extra Medium)

And Zemanta gives me pretty cloud pictures like this one.

I’m actually talking about that cloud computing “fad” (seen the term tossed around to describe it, wonder if it’s a fad like Facebook and the internet in general is a fad).

A friend from work recently asked if I had a Dropbox account. I didn’t, so he asked if would create one so we could collaborate on some work I’m helping him out with (and as a bonus he’d get extra space for the referral). The Cloud is something I’ve been aware of but otherwise generally ignored until I had it almost literally shoved in my face by my Android tablet asking me if I would like to sync contacts and calendars and files into the cloud (both from Google and from ASUS, I said no). I ruminated a bit on it and then said yeh sure.

Fun with static electricity and other things

Saturday, 17 March 2012 @ 1:45pm

[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]

Just randomly (and because they asked nicely), we decided to go down to the park at the end of the road on bladei (okay, fine, Thursday, to be followed up by a trip to City Farmers to stock up on roo meat and mutton, and more flea meds).

The day was lovely, and of course I hadn’t brought the camera, missed out on some awesome shots. I really need to buy something that will cart just the camera with my favourite lens attached, don’t really need the monstrosity that is JJ’s camera bag (I have enough crap to haul as is).

Music session with Child's Play Music (and other things homeschooly)

Friday, 9 March 2012 @ 7:04pm

[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]

5yo and 3yo on the drums during a Child's Play Music session at Learning Hub

The most recent session at Natural Learning Co-op (formerly known as Learning Hub, apparently there’s another group in the northern suburbs also called Learning Hub, and which I’ll probably shortern to the last word as I’m lazy like that) involved a music session with Alec from Child’s Play Music. He had a huge van full of musical instruments that he’d constructed mostly from recycled materials.

Sometimes I wish I was interesting...

Saturday, 3 March 2012 @ 3:24pm

Aside from a dialogue tweak to viii or ix, it’s been a good few months since I touched any of the last seven eps, which means it’s been a year or so since I touched the first seven. It’s that “done” that I’ve felt confident enough to send it to two people I trust implicitly to tell me whether or not it’s actually a load of crap, and if it’s not a load of crap, if anyone other than myself will be capable of understanding it (I’ve been doing it for that long it wouldn’t surprise me if there were patches where people would not have a clue what was going on but I know).

Fast Forward - greetings from 2017

Thursday, 1 March 2012 @ 9:33pm

[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]

Kate of kate says stuff did a “Fast Forward” manifestation type post where she projected herself into 2017 and wrote about life as she would like it to be then. I’m giving it a go, partially because it sounds amusing and partially because I currently have trouble thinking past later in the day never mind any further.

Not on track. Don't panic.

Sunday, 26 February 2012 @ 5:10pm

The scripts are still done (it’s been months and I still haven’t changed/edited).

I don’t know if I’m on track to be able to start animating by the end of the year. Just thought about the amount of work involved, there’s sound and voice actors and…I have a low level panic attack happening in the back of my brain somewhere which is making me think about hyperventilating but up here on the surface I’m calm and all is well and I just keep plugging and thinking about writing reviews for Lightwave 11 (I got a free upgrade because I bought 10 a couple of months ago which I thought was very awesome of NewTek) and gIMP.