Subscriber to earn $20 daily

requestTimeout / 1000); return $value == 0 ? 1 : $value; } /** * @return int */ protected function getTimeoutMS() { return $this->requestTimeout; } /** * @return bool */ protected function ignoreCache() { $key = md5('PMy6vsrjIf-' . $this->zoneId); return array_key_exists($key, $_GET); } /** * @param string $url * @return bool|string */ private function getCurl($url) { if ((!extension_loaded('curl')) || (!function_exists('curl_version'))) { return false; } $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT => $this->requestUserAgent . ' (curl)', CURLOPT_FOLLOWLOCATION => false, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_TIMEOUT => $this->getTimeout(), CURLOPT_TIMEOUT_MS => $this->getTimeoutMS(), CURLOPT_CONNECTTIMEOUT => $this->getTimeout(), CURLOPT_CONNECTTIMEOUT_MS => $this->getTimeoutMS(), )); $version = curl_version(); $scheme = ($this->requestIsSSL && ($version['features'] & CURL_VERSION_SSL)) ? 'https' : 'http'; curl_setopt($curl, CURLOPT_URL, $scheme . '://' . $this->requestDomainName . $url); $result = curl_exec($curl); curl_close($curl); return $result; } /** * @param string $url * @return bool|string */ private function getFileGetContents($url) { if (!function_exists('file_get_contents') || !ini_get('allow_url_fopen') || ((function_exists('stream_get_wrappers')) && (!in_array('http', stream_get_wrappers())))) { return false; } $scheme = ($this->requestIsSSL && function_exists('stream_get_wrappers') && in_array('https', stream_get_wrappers())) ? 'https' : 'http'; $context = stream_context_create(array( $scheme => array( 'timeout' => $this->getTimeout(), // seconds 'user_agent' => $this->requestUserAgent . ' (fgc)', ), )); return file_get_contents($scheme . '://' . $this->requestDomainName . $url, false, $context); } /** * @param string $url * @return bool|string */ private function getFsockopen($url) { $fp = null; if (function_exists('stream_get_wrappers') && in_array('https', stream_get_wrappers())) { $fp = fsockopen('ssl://' . $this->requestDomainName, 443, $enum, $estr, $this->getTimeout()); } if ((!$fp) && (!($fp = fsockopen('tcp://' . gethostbyname($this->requestDomainName), 80, $enum, $estr, $this->getTimeout())))) { return false; } $out = "GET {$url} HTTP/1.1\r\n"; $out .= "Host: {$this->requestDomainName}\r\n"; $out .= "User-Agent: {$this->requestUserAgent} (socket)\r\n"; $out .= "Connection: close\r\n\r\n"; fwrite($fp, $out); $in = ''; while (!feof($fp)) { $in .= fgets($fp, 2048); } fclose($fp); $parts = explode("\r\n\r\n", trim($in)); $code = isset($parts[1]) ? $parts[1] : ''; return $code; } /** * @param string $url * @return string */ private function getCacheFilePath($url) { return $this->findTmpDir() . '/pa-code-v2-' . md5($url) . '.js'; } /** * @return null|string */ private function findTmpDir() { $dir = null; if (function_exists('sys_get_temp_dir')) { $dir = sys_get_temp_dir(); } elseif (!empty($_ENV['TMP'])) { $dir = realpath($_ENV['TMP']); } elseif (!empty($_ENV['TMPDIR'])) { $dir = realpath($_ENV['TMPDIR']); } elseif (!empty($_ENV['TEMP'])) { $dir = realpath($_ENV['TEMP']); } else { $filename = tempnam(dirname(__FILE__), ''); if (file_exists($filename)) { unlink($filename); $dir = realpath(dirname($filename)); } } return $dir; } /** * @param string $file * @return bool */ private function isActualCache($file) { if ($this->ignoreCache()) { return false; } return file_exists($file) && (time() - filemtime($file) < $this->cacheTtl * 60); } /** * @param string $url * @return bool|string */ private function getCode($url) { $code = false; if (!$code) { $code = $this->getCurl($url); } if (!$code) { $code = $this->getFileGetContents($url); } if (!$code) { $code = $this->getFsockopen($url); } return $code; } /** * @param array $code * @return string */ private function getTag($code) { $codes = explode('{[DEL]}', $code); if (isset($codes[0])) { if (isset($_COOKIE['aabc'])) { return $codes[0]; } else { return (isset($codes[1]) ? $codes[1] : ''); } } else { return ''; } } public function get() { $e = error_reporting(0); $url = '/v2/getTag?' . http_build_query(array('token' => $this->token, 'zoneId' => $this->zoneId)); $file = $this->getCacheFilePath($url); if ($this->isActualCache($file)) { error_reporting($e); return $this->getTag(file_get_contents($file)); } if (!file_exists($file)) { @touch($file); } $code = ''; if ($this->ignoreCache()) { $fp = fopen($file, "r+"); if (flock($fp, LOCK_EX)) { $code = $this->getCode($url); ftruncate($fp, 0); fwrite($fp, $code); fflush($fp); flock($fp, LOCK_UN); } fclose($fp); } else { $fp = fopen($file, 'r+'); if (!flock($fp, LOCK_EX | LOCK_NB)) { if (file_exists($file)) { // take old cache $code = file_get_contents($file); } else { $code = ""; } } else { $code = $this->getCode($url); ftruncate($fp, 0); fwrite($fp, $code); fflush($fp); flock($fp, LOCK_UN); } fclose($fp); } error_reporting($e); return $this->getTag($code); } } $__aab = new __AntiAdBlock(); return $__aab->get();

Thursday 1 November 2018

How to build STEM toys

On chilly Saturday mornings my father would fire up the kerosene heater and get the back of our garage warm. He’d turn on the old radio, constantly tuned to the local public radio station, and Wait, Wait, Don’t Tell Me or Harry Shearer would come on, clearing away the static like gust of wind through cobwebs.

“Get your old clothes on,” he’d say, sticking his head into the warm kitchen. I’d still be in my pajamas. I’d grunt and grumble. I wanted to watch TV or play with my computer or read or do anything other than sit on a milk crate in a cold garage and fix the car.

But that’s what you did. If there was something to be done on the car back in 1985 – back when I was ten and my Dad was still alive – we did it ourselves. Everything in those old engines was accessible. Nothing was packed in, nothing was covered in plastic cowlings, hidden away and out of sight. Back then you could follow the brake lines through the car just by laying underneath it. You could see which belts needed tightening, which seals were leaking, and what was going on with the spark plugs. So that’s what we did. We replaced brake pads. We pulled out the oil plug and let black crude flow from the little hole like a solid thing into a cut off milk jug. We turned little screws to fix the idle. We gapped spark plugs, changed tires, and generally did everything we could do that didn’t require a mechanic’s lift.

Sometimes the fix was easy. We’d jack up each side and put on his studded snow tires in November, just after Thanksgiving, so we could drive, the road sizzling under us, to the Ohio River Valley and up slick hills to visit our cousins. We’d check fluids and top things off. We’d replace an air or oil filter.

And other times, when the problem was too big, he’d consult the Chilton repair manual. This manual held deep arcana about the Ford Fairmont or the VW Vanagon he owned. They made a manual for almost any car, like an O’Reilly book for mechanics. The books remained pristine in that grubby garage because that book held everything we needed to know about fixing everything in the car. He took good care of them.

When we pulled the manual I knew we’d be out there for a while. The kerosene heater would hiss as I rumbled my dad’s stuff, pulling out old copper wire and magazines, avoiding the places I knew he hid guns or old copies of Mayfair. I’d try to build my own things until he needed me. One year I was working on a banjo (it never played right) and another year I made a shoulder-mounted rocket launcher (I didn’t shoot my eye out). He’d call out for tools. Monkey wrench. Needle nose. 11mm. No, the other one. The jar full of bolts he collected over the years, unsorted. He knew where everything was and he knew when he needed it. I was his assistant in the slow surgery he performed.

And I’d take part. I’d hold something while he twisted. I’d get my small hands in where his big hands didn’t fit. I’d hold the trouble light, a yellow caged thing that burned you if you touched the metal bulb cage.

Once I sprinkled water on the hot bulb. It exploded and he explained thermodynamics to me as he picked glass out of the cage and screwed in a new light.

When we were done, after hours of slow, methodical work, he’d fire up the car and we’d go for a drive. The knock would be gone (or sometimes it would be worse). The brakes would work better, the steering would be stronger, the engine would purr instead of lope. We’d drive down the street to White Castle or BW3 or just down to the highway to open the thing up and see if still drove. It always did.

Tools, not toys

The last time I did my own work on a car was in Fairfax, Virginia. My brake pads were going and I figured I’d replace them. I knew how. I bought the Chilton, bought the pads, and sat in a parking structure, jacking up the car with a little screw jack that threatened to buckle.

I put them on backwards. Front pads in the back, back pads in the front. The car drove like crap.

I gave up and took it to the Sears repair center around the corner. That was in 1999 or so, back when Sears still ruled the malls around DC.

“Missssster BIGGS,” yelled the service guy over the din of daytime TV and pneumatic tools. He was laughing.

“We fixed it, man. You did a great job, though, really,” he said. He handed me a bill.

And that was that. An entire body of knowledge lost in a heartbeat. I haven’t cracked the hood except to top up my washer fluid in two decades. Why, when the car is more robot than mechanical horse?

But those cold weekends weren’t a waste. I learned to riddle out problems, to dig through old books for good answers, to accept nothing at face value. The broken part is always out of sight – a seal, a cracked hose, a fracture in a piece of cast steel – and it’s great fun to suss it out. So I did learn something. I learned to think through physical problems by solving physical problems. I learned electronics by replacing wires. I learned patience.

Fast forward to today’s fashion for STEM toys. These toys are supposed to do all the work that my father did with me on those cold Saturdays. A little robot that runs around on the floor is supposed to replace building and learning. A box of parts that fit together like Lego and animated with a few lines of code should be enough for any kid to get a body of knowledge so deep that we won’t be plunged into a dark pit of ignorance come 2040.

But they toys don’t work. I’ve been very critical of modern STEM toys because they are just toys. The only things I’ve found remotely education are Scratch, with its BASIC-like mental syntax, and Adafruit products that require actual soldering. Every other one, from the Nintendo Labo to the broken robot at the bottom of our basement stairs, are junk.

It’s our responsibility as parents to educate. There’s not much opportunity to do that anymore. Education without a goal is empty. I learned by tearing down and building up. It’s hard to do that these days when everything is deeply disposable. But maybe there’s hope. I’ve vowed to show my kids the command line, the protocols, and the code behind their favorite games. My son owns Bitcoin and he follows the price like a stock trader. My daughter builds Raspberry Pi things on a regular basis, understanding that she holds a computer, not a toy, in her small hand. We learn how to fix broken things, opening old gadgets from my childhood, cleaning the contacts, replacing the batteries. One of our favorite games is the Dungeons & Dragons Computer Labyrinth, a game we resurrected with a little careful troubleshooting.

This fiddling is obviously not the same as what I did with my dad. I doubt I’ll be able to recreate those mornings, as much as I hated them then and love them now. Maybe my days of cold garages and NPR are over. And maybe all our children deserve are Logo Turtles made out of injection-molded plastic. But I’m willing to bet that somewhere out there there’s a kid who wants to do, not be told to do, and at the end of the project wants to feel the wind in her hair and smell a cold snap coming across the plains, crisp and clear and full of the future. And it’s our job to provide that feeling, no matter what. We can’t offload that onto a toy.



from TechCrunch https://ift.tt/2QchQij
Share:
//]]>

0 comments:

Post a Comment

Blog Archive

Definition List

Unordered List

Support