New gadget – Dynam USB RC

Arrived yesterday after a three weeks trip from Hong Kong.

20160112_142340_b

Nothing fancy, but works great with Freerider FPV on Linux — trims neutral, Mix off, Gear/Pit neutral, plug in before launching Freerider, calibrate in game before starting the sim. All the channels should be aligned at the start in the game’s calibration screen, if they aren’t check the switches and restart Freerider.

Compared with flying my Hubsan X4 (expert mode off) the response of the sim copter is less rubbery (maybe latency is not modeled?). Unlike on Hubsan’s RC, throttle control (up-down on left lever) is stepped. I still have to fly the Hubsan with proper trimming — which I’m learning to do quickly with the sim — and expert mode on.

Enter future here

Q. Do you ever end up reading/thinking about stuff like the heat death of the universe or Earth
being destroyed by red giant Sun and causing you to have an existential crisis? I somehow manage to do this to myself a few times a year.

Fran Ontanaya: No. Hypothesis about the future five billion years into the future are still just speculation. You
couldn’t pick something more uncertain to be existential about. Some people get existential about that thinking
humanity would still be sitting on their asses on Earth to watch the Sun inflate.

Entropy describes the universe as a dumb, inanimate system. To put it in an extreme, imagine each photon was sentient, and could decide upon spawning to fly towards the center of the universe. Someone would observe it and say, everything tends to revert to the Big Bang. That universe would be anti-entropic — it would return always to a higher order state. Now, there’s no sentience in photons that we know of, but since we are here, we do know our universe doesn’t completely lack sentience. So the future is unclear.

I’ve even seen people be existential about the notion of becoming immortal — as in, existing too much. That’s when I get really Spock-faced. Existentialism is the failure of imagination.

List of transhumanist websites

Taken from here with CC By-SA license:

Transhumanism Websites

  1. ACN Newswire (en.acnnewswire.com)
  2. Adam Ford (youtube.com/user/TheRationalFuture)
  3. ASU Transhumanism (transhumanism.asu.edu)
  4. Ben Goertzel (wp.goertzel.org)
  5. Big Think (bigthink.com)
  6. BlogKinnetic (blogkinnetic.blogspot.com.tr)
  7. CARTA (carta.anthropogeny.org)
  8. Diginomics (diginomics.com)
  9. Do The Math (physics.ucsd.edu/do-the-math)
  10. Eliezer S. Yudkowsky (yudkowsky.net)
  11. Extropy Institute (extropy.org)
  12. Fernando Pizarro (fernandopizarro.com)
  13. Fusion (fusion.net)
  14. The Future Of Human Evolution (futurehumanevolution.com)
  15. Futureseek Link Digest (futureseek.wordpress.com)
  16. H+ Magainze (hplusmagazine.com)
  17. The Hedonistic Imperative (hedweb.com)
  18. Humanity+ (humanityplus.org)
  19. Institute For Ethics And Emerging Technologies (ieet.org)
  20. Institute For Social Futurism (socialfuturism.net)
  21. Io9 (io9.com)
  22. Jason Silva (thisisjasonsilva.com)
  23. Joao Pedro De Magalhaes (jp.senescence.info)
  24. Juice Rap News (thejuicemedia.com)
  25. Journal Of Evolution And Technology (jetpress.org)
  26. Kurzweil (kurzweilai.net)
  27. LessWrong (lesswrong.com)
  28. Metanexus (metanexus.net)
  29. MIT News (news.mit.edu)
  30. The National Bureau Of Economic Research (nber.org)
  31. Nautilus (nautil.us)
  32. Nick Bostrom (nickbostrom.com)
  33. Orion’s Arm Universe Project (orionsarm.com)
  34. Science, Technology And The Future (scifuture.org)
  35. Singularity Hub (singularityhub.com)
  36. The Singularity Is Near (singularity.com)
  37. Singularity Symposium (singularitysymposium.com)
  38. Singularity University (singularityu.org)
  39. Singularity Weblog (singularityweblog.com)
  40. Technological Singularity Subreddit (reddit.com/r/singularity)
  41. TED (ted.com)
  42. Transhumanism.tv
  43. Transhumanism And Transhumanist Art (transhumanist.biz)
  44. Transhumanism Meetups (transhumanism.meetup.com)
  45. Transhumanism Subreddit (reddit.com/r/transhumanism)
  46. The Transhumanist Party (transhumanistparty.org)
  47. Transhumanist Party Australia (transhumanism.com.au)
  48. Transhumanist Party Blog (transhumanistparty.wordpress.com)
  49. What Is Transhumanism? (whatistranshumanism.org)
  50. Wired (wired.com)
  51. World Transhumanist Association (transhumanism.org/index.php/WTA/hvcs)
  52. Zoltan Istvan (transhumanistwager.com)

Posting multipart content with PHP and cURL

Recently we had a situation in which a user needed by the end of the day to have their PHP platform submit files directly to a form with login tokens, so I supplied him with a snippet to do so.

The backend (Django) is developed by our engineers and I had no prior knowledge of this piece of UI, so the first part took some source inspection and checking the POST request log on Firebug, to find out if it needed any extra fields or headers.

Next thing was to write a simple cURL function for the user (reusability/tests etc. weren’t the concern here, just keeping it down to the minimum). In our case the data passed in the cookies was enough and it didn’t require to add any extra headers.

function curlPost($url, $authcookie, Array $data) {
    $cr = curl_init();
    curl_setopt($cr, CURLOPT_COOKIE, $authcookie);
    curl_setopt($cr, CURLOPT_URL, $url);
    curl_setopt($cr, CURLOPT_POST, 1);
    curl_setopt($cr, CURLOPT_POSTFIELDS, $data);
    curl_setopt($cr, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($cr);
    curl_close($cr);
    return $result;
}

The user already had a solution for getting the credentials and the only thing needed was passing them:

$id = somenumber;
$token = 'sometoken';
$uuid = 'someuuid';
$sid = 'somesessionid';

$url = "http://ourserver.org/postthingshere/{$id}/submit/";
$authcookie = "uuid={$uuid}; sessionid={$sid}; token={$token}";

The form sends both a file and the token in the same POST request. To make it simpler we used a PHP 5.5+ object called CurlFile:

$data = array(
        'token' => $token,
        'thing' => new CurlFile('/path/to/my/thing.ie')
    );

$result = curlPost(
        $url,
        $authcookie,
        $data
    );

The content type is automatically set to multipart/form-data and CurlFille fills in the rest of the headers for the file submission, including the file size.

Finally I posted to a file on the local server containing:

print_r($_REQUEST);
print_r($_POST);
print_r($_FILES);

to check that all the request contents were there.

Broken mysql server: Can’t open and lock privilege tables

After a series of bad hard reboots mysql stopped working on my Ubuntu 15.04 install, with this showing up on /var/log/mysql/error.log:

[ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'

Trying to purge and reinstall mysql server packages didn’t work, and the reinstall would hang up when trying to restart the service. The blocking error is not in the packages, configurations, folder permissions or apparmor settings — it’s actually the folder that contains the data /var/lib/mysql being corrupted and hanging up everything else.

Before going on a “forum fixes” wild ride, back up /var/lib/mysql, nuke it, purge mysql-server and mysql-server-5.6, reinstall mysql-server and mysql-server-5.6 and run sudo service mysql start.

After that it’s all about restoring the databases and skipping whatever is broken.

Makes you wonder why couldn’t it be handled more gracefully — last thing you want on Linux is a hung up apt-get process.