Font Scribes & Font Websites @davelab6 @googlefonts


We all have in both the octaverse and with droids and computers and devices here font scribes, someone that designs your font for you… if you didn’t know when you goto a font website what the font sites webmaster see’s as his range of fonts is largely different what you see, each font he loads on there is more like a meta or projection and the font you get from your scribe transposed over the top of that font is in your either personal or peer group.

Even business may have different fonts within them than in the same torrent or file you download for a font that you would or a 3rd party outside the business or peer group, as I am a master librarian in qualifications I do things on ‘for and behalf’ not as a standard librarian does ‘in the view of yourself’ so I have written a font api you can see running here https://api.fonts4web.org.uk that is available on our https://github.com/Chronolabs-Cooperative that is has a couple bugs in it still but is largely working that will top layer different groups of fonts in your peering.

Advertisements

Why REST API and what qualifies as a REST API (load balancing + whois)


Well as REST API (Application programmable interfaces) go they are one that are mainly URL or form method POST directive only, part of the reason they are like this for example say you have a whois intensive application and for some reason some of the domain nics are rejecting your IP cause of two main lookup what you do is for example you made http://whois.snails.email you would then make on independant IP addresses the following for example remember whois api is not a heavy load so it can sit on multiple of your IP addresses without a question what you do is have the following where each of these are in an independant IP address:

Where you then make whois.snails.email redirect to a selection based and shuffled on their query source referee URL IP Address or $_SERVER[‘REMOTE_ADDR’] which has a cache that redirect each to each one once dropping that from the list to do until the listing refreshes, to bounce the queries around coming from different IP addresses this would be done in the whois.snails.email with:

 <?php header('Location: http://1.whois.snails.email/v2/bluehost.com/json.api'); ?>

where cURL and the rest will redirect to this and get the query result.

Cronjobs Generating Emails a Useful Tip About Timing!


Most people fondly as developers don’t think about the psychological impacts in generating emails via cronjobs/scheduled tasks and should serious consider implementing this say you have a cron set up like so in you scheduler to periodically every 2 hours send a batch of emails ie:

* */2 * * * /usr/bin/php -q /path/to/crons/send-emails.php

there is a couple of things you need to do to change the psychology impact of this regular batch of emails firstly at the top of the php file you need to implement a random sleep like so for a period if it is firing every 2 hours up to 1.5 hours like so:

sleep(mt_rand(0, 3600 * 1.5));

This sits at the top of each of the crons, part of the reason you do this is so the times of the email changes when they arrive for a randomised workflow, this means the business or organisation shop floor, wont have stints of work and sometime they make and may have time to spend more on the last email depending on the delay.

The other thing to do is between sending email delay for a random upto 45 seconds like so at the bottom of each loop between caching and sending the mail, with sleep(); again like so:

sleep(mt_rand(0, 45));

Part of the reason this is done to load balance the mail transport layers as well as provide a completely different date of recieving the mail rather than the impact of recieving emails always on the hour, or on the every two hour with little or difference in the time displayed, so doing this will make the daily grind of working from schedule emails actually enjoyable as well as fun for the employee as they will not have any way of estimating when the next group of emails will arrive, making the shop floor dynamic again!

Of course the other way around with a shorter delay from the start of the php script to each loop generating the email as a longer delay is also a very good way of distributing emails over an employee shop floor where the grind is a gentle workflow where different people start at different times, also if you can randomise the sort of the email being sent this is also good.

You generally use sleep(); with load balancing cronjobs and scheduled tasks, so you where firing a cron every minute, then you would sleep(mt_rand(0, 90)); especially when you are running multiples of the same cronjob so it doesn’t fire on the 0 second of every minute over requesting the queing on your servers processor threading.

WhoIS Services API – Version 2.0.11


WHOIS Services API 2.0.11 — Chronolabs Cooperative

Author: Simon Antony Roberts wishcraft@users.sourceforge.net

This is an API Service for conducting a whois on both IPv4, IPv6 and domain names. It provides a range of document standards for you to access the API inclusing JSON, XML, Serialisation, HTML and RAW outputs.

You can access the API currently without a key or system it is an open api and was written in response to the many API Services that charge ridiculous amounts for querying such a simple base. The following instructions are how to access the api I hope you enjoy this api as I have writting it with the help of net registry.

Download:

  1. https://github.com/Chronolabs-Cooperative/WhoIS-API-PHP
  2. https://sourceforge.net/projects/chronolabsapis/files/Version%202.x/Whois-API-PHP/

Video:

GeoSpatial Places API Service – Version 2.3.2


Well I have just completed over the last couple of days the api: GeoSpatial Places API Service – Version 2.3.2! It is a complete system of places and data on locations for both working with Google Places and Google Address API as well as having a widening resources of locations on hand as well.

It comes complete with an installer it is just a case of unpacking the archive or pulling the git repository and then using with apache2, ngix or any of the other web hosting application running the installation and then it is done:-

Downloads:

Load balacing PHP Crons ~ Defcon Pixey/Pixel Sleep States – 


Too load balance PHP is much the same as any c it is with the function sleep(); unlike c which is in milliseconds PHP sleep runs in seconds. This is good for example up to three or four times in a loop in up to four defcons in any PHP Cron or schedule task it load balancers cpu: 

if( mt_rand(0, 3) == 1 )

         sleep(2, 11);

Okey so you have a at best a good quickly firing – 1m Cron you want to fire multiple of everything good except the Cron job or scheduling will fire them at the same 1m execution time on the CPU so you put at the top of the Cron the following depending on number being fired say 10 X 1m Cron job of the same then you would put:

sleep ( mt_rand(1, 158) );

$odds = $inner = array(); :: passing variables to a rest API!!


You do not pass $_REQUEST but what you do is the following of $_POST + $_GET and one other…

$odds = $inner = array();
foreach($_GET as $key => $values) {
    if (!isset($inner[$key])) {
        $inner[$key] = $values;
    } elseif (!in_array(!is_array($values)?$values:md5(json_encode($values, true)), array_keys($odds[$key]))) {
        if (is_array($values)) {
            $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
        } else {
            $odds[$key][$inner[$key] = $values] = "$values--$key";
        }
    }
 }
foreach($_POST as $key => $values) {
    if (!isset($inner[$key])) {
        $inner[$key] = $values;
    } elseif (!in_array(!is_array($values)?$values:md5(json_encode($values, true)), array_keys($odds[$key]))) {
        if (is_array($values)) {
            $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
        } else {
            $odds[$key][$inner[$key] = $values] = "$values--$key";
        }
    }
 }
 foreach(parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].(strpos($_SERVER['REQUEST_URI'], '?')?'&':'?').$_SERVER['QUERY_STRING'], PHP_URL_QUERY) as $key => $values) {
    if (!isset($inner[$key])) {
        $inner[$key] = $values;
    } elseif (!in_array(!is_array($values)?$values:md5(json_encode($values, true)), array_keys($odds[$key]))) {
        if (is_array($values)) {
            $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
        } else {
            $odds[$key][$inner[$key] = $values] = "$values--$key";
        }
    }
}