More Dr. Meter fun

Finger

Arm

Hair

Salt

Nutella (gross)

Peanut

Serrated knife blade

Ballpoint pen

Printed beer logo

Cloth

Melting snow

[flv:http://ben.akrin.com/wp-content/uploads/2013/02/temp.flv http://ben.akrin.com/wp-content/uploads/2013/02/Screen-Shot-2013-02-24-at-11.53.58-PM.png 640 426]

Google drive API file upload script

If you want to upload file to Google Drive, you will naturally gravitate towards the Google Drive API. While reading about the APIs that Google publishes for almost anything, you will learn about their SDK. The SDK provides you with easy functions for interfacing with the API for various programming languages.

The problem is that the more I used the SDK the more confused I was. The documentation is often unclear, not all bindings are implemented across all languages. But above all, the thing that made me dislike the SDK is the fact that uploading a file to Google Drive took 5 times the amount of memory than the file itself. Meaning that the datastructure they use and how they pass it around is SUPER LAME. Not a huge deal if you’re uploading a few doc files but definitely crappy for GB range files. It’s just not right and completes the pattern of “meh” surrounding the SDK.

What is clear & consistently documented is every single API call you can make. It was time to go straight to the API. Sure there is still quite a bit of poking involved in getting something working exactly right but my experience with the API has been a lot better. It has also helped me understand the mindset & design so figuring out new things is much faster.

How?

HTTP, every API call uses it. You can use any technology that you are familiar with to do your HTTP call but I have a penchant for PHP + cURL.

The script

It will read a file in chunks and upload them consecutively. Do to so it uses the API’s resumable uploads. As such it will never consume more RAM that the configurable chunk size.

download

It still needs a few improvements at the moment but it’s functional.

What it solves

  • authentication: getting a new access token from a refresh token as needed
  • curl custom HTTP requests with custom headers
  • file chunking
  • Google Drive API resumable upload
  • passing JSON encoded requests in body
  • exponential backoff

Doesn’t sound like much but it took a while to piece it all together.

Dr. Meter B003+ 300X USB digital endoscope/miscroscope camera

TLDR: an awesome cheap device wrapped in Chinese funkiness.

The details

It is hard, very hard to not pay attention to all the funny details that go around the device. But it’s a solid device that performs great for a good price. As far as I can tell, it does not do zooming per se, it is only able to get very close to a subject and thus when the resulting picture is displayed on a bigger screen, small details are visible. As such, what you see is strictly dependent on how close you stick the camera to your subject. In fact the camera has a focus length of a few millimeters to infinity, which means you ca use it a a regular camera but you’ll have to turn the focus knob quite a bit for that.

First, some pics of what it’s capable of

They are seriously lacking online

The device itself

 On its little tripod

The lens

Everything else

The device has multiple attachments referred to as “beauty inspection tools” which are meant to stick the camera in various orifices of one’s body. They are nicely sealed in sterilized bags (but not the anal one).

Some of the various “beauty inspection tools”…

The unboxing feels like opening a Chinese treasure chest, the mechanism, the texture, the looks; this product is made in China and not pretending otherwise. What else feels Chinese is pretty much anything written in English. It’s super funny to read it all.

Technically

The device is recognized as a standard camera in Windows, MacOS & Linux! No extra drivers necessary. This is what I love about buying products from smaller companies, they go after existing standards. As such you can open it with any webcam software, I took my test shots with photobooth. They provide some software for filming & measuring among other things but I care not about this functionality so I won’t spend the time loading it.

I’ll take it to the beehive this week-end and we’ll see how it does there.