Quantum Mechanic

Recent Content

The Esperantist

posted on 2016-12-05 19:31:00

Mi ĵus trovis la gazeton "The Esperantist" sur Project Gutenberg, kiu estis en Londonon eldonita Gazeto el la lasta jarcento. Kelkaj monatoj auntaŭe, mi trovis la Esperanto kurson sur Duolingo, kaj mi havis interson ekde mi eklernis pri E-on kiam mi en gimnazio estis. Tiam, trovis mi profesoron el Brazilo en Babilejo kaj mi ĝojis kunparoli iun malkun anglan lingvon. Nun, mi retrovas la ĝojon por legi E-on kaj partopreni internacian komunumon.

La paĝo de la redaktulo de la unua aldono ekiĝas kun promeso ke la gazeto ne intencas esti politika. Mi interesiĝis kiam mi tion legis, ĉar E-o ankoraŭ ŝajnas por multaj homoj minaci siajn hejmlingvojn kaj kulturojn. Multoj vidas E-on kiel komunista konspiro (aŭ, alternative juda konspiro).

Ĉiukaze, mi ne kredeble legos tre multe, sed la gazeto estas aĵo el pli frua tempo, kaj interesigas min pri kiel E-on vidis gehomoj en la estinteco.

An afternoon hack

posted on 2016-12-05 14:42:00

A few months ago, I decided that lucerne had enough things missing that I was rewriting for different projects, that I would bite the bullet and try writing my own framework. I'm generally a fan of Fernando Borretti's work, and I definitely suggest looking at the different libraries he's created for common lisp webapps, but these days he's been more of an inspiration for writing my own versions than anything else.

So, I've been writing nest for a while, now, which doesn't have much documentation and very spotty test coverage, at the moment, because it is still very much in the process of spilling out of my forehead, like some halting Athena, and I wouldn't want to break anyone else's webapps while I work on it. (I am trying to version and tag it, though, so at least you'll get the same sort of broken if you stick to a tag.)

I was looking through fossdroid.com, yesterday, and noticed the shopping list app, which boasted an open source php and mysql backend. It comes with some script to set it up under apache, but the list of technologies I wasn't very familiar with was too long, so I decided to test out my framework to get it running under lisp (and whatever database you want that's supported by cl-dbi).

Happily, I didn't bite off more than I could chew on this one, and I had it all working by midnight so I could sleep, too!

I found the api very strange, because it's all implemented at one endpoint. The android app also adds a trailing slash to whatever you configure as the host, which was odd, because I would get requests to /api.php/ or // depending on how I configured it. The app sends what function it wants to run as a post parameter, and then, hopefully, all the parameters appropriate for that function are along for the ride, too. It was a good excuse to pull out my validation library for a ride, which I generally use with a macro like

(defmacro validated (&body body)
  "Handle validation errors (`v:<validation-error>`) and respond with an error for the client."

  `(handler-case
       (progn ,@body)
     (v:<validation-error> (e)
       (declare (ignore e))
       (api-response :type +api-error-unknown+
                     :content "Invalid parameter"))))

I've also started using validate in Podcastinet, with a similar macro that sends back a 400 error in the event validation fails. Right now, there isn't a good way to collect failed validations for a meaningful error for the API consumer, but I suppose that will come in time.

In any event, it was a fun project and made me feel pretty good about nest, since I was able to use it to build an app in an afternoon. Now I need to make a docker image so I can throw it up on a server and keep track of my groceries! Check out the project here and let me know what you think. I'd also really appreciate feedback on validate. Maybe I'll post it to the lisp subreddit, soon, for some of that.

Fixing our Monoprice Mini Select

posted on 2016-11-26 01:36

A couple months ago, I ordered a Monoprice Mini Select 3D printer. I'd been hearing the buzz for years and at around $200, it seemed like it was finally an offering with good reception that I could feel fairly safe dropping the money on. We printed Millenilm Falcons and a test elephant model that came with it, but then it got relegated to a shelf next to our bed for the last few months while things were stressful and creativity was wanting.

This weekend, we broke it out so we could try to do something fun with it again. We'd never been able to get it to read an SD card, so we controlled it with a laptop that has since retired and it took me two hours of poking at linux serial point things to realize that I'd just updated my kernel and it seemed like something was having trouble mounting serial devices because of it. A reboot later, we were in business.

Unfortunately, that wasn't the end of that, because our printer started behaving strangely; taking lots of pauses for seconds at a time. It was causing beading in the plastic where it stopped, and was seriously lowering the quality of the builds. I'd long known there were firmware updates to be had at the Google Drive for the printer, but without a working SD card, I couldn't do the updates and we were seriously considering having to call customer support.

Thankfully, digging through random boxes bore fruit and I was able to located two more micro SD cards, one of which pleased the printer. Finally, I was able to update it.

Before we updated the firmware, the printer got into a strange state and ran itself to the extremes of the X and Y axes and then tried to go further. When that happened, something happened and the extruder temperature started showing as 0.

monoprice-broken-thermometer-screen-thumb.jpg

0 Celsius is pretty unusual for indoors, even in late Fall in New York, so I figured something was wrong with that sensor. Sure enough, the little wire connected to the thermometer had snapped. Probably, while it wires were stretched to the edge of the print volume.

monoprice-broken-wire-thumb.jpg

Luckily, with a quick run for overpriced solder at Radio Shack, I was able to patch it back up and get back to printing.

Getting my Nexus 10 to charge again

posted on 2016-10-26 17:33:48

Sarah started a masters in TESOL, recently, and we wanted to give her something to use in class that she could carry around easily that would take some basic notes and be useful for readings.  We'd had a Nexus 10 sitting around that I'd meant to use for my aborted grad school experience and it seemed like the best solution for this situation, too.

Recently, though, it stopped turning on and would only ever show us the charging symbol for a short time.  Today, I sat down and finally did some research into it and the simplest/likeliest cause seemed to be that the battery had just discharged beyond the point that the battery controller would even allow it to be charged.  I found some help in this blog post, which suggested disconnecting the battery from its controller for a short time to reset it.

I had a little trouble pulling the frame off the screen/device assembly, so the tip I would add is that the seam you're looking for is the one between the screen and its plastic bevel, not anything along the side of the device.  I spent a while looking for that.  It was pretty tough to remove it, and I think I shot myself in the foot by trying on two different sides and getting it part-way off, which probably meant I was pulling against myself on each side.  Maybe going from one side and working my way around the device would be better.

I just checked back in and I turned it on for the first time in a month or so!  Hooray!

Nexus 10 boots up again, after a long slumber
The little guy comes back to life!

Our Bodies, Our Hearts, Our Software

posted on 2016-08-23 22:10:04

I don't really keep up with the various Linux conferences that happen now and then, but I certainly follow various free software planets, which generally filter the good stuff out for me anyway.  Something that slowly made it through my filters recently was Karen Sandler's keynote address at the Australian Linux Conference, where she, unsurprisingly, talked about the importance of FOSS software.  The part that was surprising, though, and really hit home for me, was when she started talking about her internal defibrillator.

Apparently, Karen has an abnormally large heart, in the physical sense.  She is at risk of suffering what her doctors called "sudden death," which means she could simply die with no warning.  Luckily for her, there is a great treatment in the form of the internal defibrillator - a small device that can be wired directly into her heart that will issue a shock to restart her it if she suddenly, well, dies.

I'm going to take this moment to urge you to go watch the video, it's a bit long, but listening to her talk about her own heart is going to do more for you than I can manage.

For those of you not watching the video, there are two scary parts.  First - when she talks about being at risk of sudden death.  The second is the sequence building from her cardiologist not knowing much about the device he was offering to implant to the point where he hangs up on her in frustration.  His frustration came from her desire to see the code running on the device he wanted to put in her, the company's unwillingness to show her the code, and his lack of understanding about why that's important.  If you're wondering why this sort of thing is important at all, it's because this machine is wired to her heart.

What we put into our bodies...

When we go out to dinner somewhere, we expect to be told what's in our food if we ask, we expect to know what's in the drugs we take, so why shouldn't we expect access to what's in the devices implanted in our bodies?

Let me phrase it another way.  A company makes an electric heart that you need because yours was stabbed like Jean-Luc Picard was in Star Trek.  You get it and want to know what makes you tick, and they tell you that your heart is their intellectual property and you're not allowed to know how it works. Furthermore, you're not allowed to modify it, open it up, or see its source code.  There's a well-known bug in it?  There's a firmware update?  You might not get it if it doesn't make money for the company.  You want to install it yourself?  That might be illegal depending on the time of year and what phase the moon is in.

When Karen told her story, her concerns were that she couldn't check the logic of her device, herself, nor could she have a friend or consumer-advocacy group do it.  Four years ago, when I started writing this, that was where the story ended.

Things that come out of our bodies

A few weeks ago, I came across this article, which I thought might be a bout Karen, again.  I opened it, hoping to read more about her and, hopefully, what progress she had made.  Instead, I learned about a brave, new person taking up this baton, because the same problems were still around.  It turned out that, on top of Karen's original concerns, people were now taking data from Marie Moe's device and refusing to give her access to it.

At first, as I read that they were collecting the data, I hoped it was available to her.  Wouldn't that be cool?  I could make graphs of my heart rate, if I had that data.  But they seemed to think that the data was theirs.  Her doctor seemed to be too busy to help her get at it either, which isn't surprising.  To me, this feels like going into the doctor to get the results of your blood work and being told, "I can't show you the numbers, but your cholesterol is fine.  The company owns your iron levels, but you aren't anemic."

There's an old maxim that is often forgotten or ignored that you don't own anything you can't take apart.  Warranties are nice, but when farmers can't repair their own tractors you start to see why user serviceable parts, even skilled- or trained-user serviceable parts are important.  In a world where any data that's collected is often sold and firmware updates come twice a year and stop as soon as the new model comes out.  People with implants are at an ever greater risk of losing control of their body parts RoboCop-style.  Malfunctions happen, and a thriving, open community is a great way of keeping the process more transparent and hopeful for everyone.  I would hate to have a malfunctioning defibrilator in my chest and have nowhere to turn, once the company tells me it's outside warranty or the like.

Link Dump Week of August 22

posted on 2016-08-22 22:05:00


Page Dewarping

Overview of algorithms for converting a warped image of text (e.g. from a photo of a printed page of a book) to a clean, black and white version. Wish I'd known more about this in school, though I probably wouldn't have had the time to make anything with it. Looks like a fun weekend project.

Writing Less Damn Code

Just a bit of a (justified) rant on the complexity of some solutions to web problems. Mostly here to remind me that I really want to take some time to learn about flex box. Well… really want to know about flex box with as little effort as possible.

Writing a JPEG decoder in Rust

Part 1 and Part 2. Good idea for an appropriate project to make something with Rust. Maybe I can do a tga one to see how I can improve cl-tga. Maybe I'll finally do RLE encoding.

Cool futuristic Art

posted on 2016-08-01 13:15:00

>Sarah showed me the Work of Simon Stalenhag, who seems to do work of a futuristic/crumbling relics of consumerism/world-controlling technology nature. I'd suggest taking a look! It reminds me of the War of the Worlds movie around the middle of the page.

Finally fixed my phone

posted on 2016-05-15 14:32:00

I like to tinker with things, I own. An important part of deciding to buy any given device is that I can tinker with it, take it apart, install whatever hobby OS on it I like, &c. I'v generally been delighted by my Nexus 4 phone, which I've had for perhaps two and a half years and is my favorite smartphone so far!

Recently, though, Google stopped providing android updates for it (well, I think they'll still security patch Lollipop for a while) when Marshmallow, the sixth food-version, came out. I always like to poke at the new things in life, so I started looking around at my options and saw that there was a Cyanogenmod 13 image for my phone. CM goes by their own numbering system, and 13 corresponds to 6 in the official android versions, which is the latest. I had played with Cyanogenmod a few times over the last few years and so I felt pretty comfortable trusting them with my phone.

On top of trying the new version of android, which seems fine, but hasn't really blown me away with anything new, I also tried unlocking my phone's LTE modem. It seems the n4 shipped with an LTE modem which isn't turned on by default because maybe Google never got it properly tested. Some people got it turned on, though, so it's possible to upgrade your data connection considerably! It was like getting a new phone!

Unfortunately, I also had to seek out and install some Google apps. I'm finding Google increasingly irritating, recently, both in their apps and that they called me for an interview, screwed up the scheduling, then the programming language they were interviewing me about, then let me try again in the right language, and finished up by never responding. Mostly, I would seriously suggest the F-Driod repository of FOSS apps, but I need to install the Google Play Store for my banking app, many things I need for work, and I also make heavy use of the Maps app. So, I bit the bullet and installed Google Play using the Open Gapps project.

For a couple weeks, I tolerated the nightmare of continual modal popups from Google Play Services that informed me that it had stopped. Over and over again, it stopped. In the middle of typing words, it stopped and interrupted me. While trying to get directions, it stopped and never figured out where I was. While trying to find emails, it stopped and got confused. It was really annoying, but it tended to happen in terrible, agonizing bursts, so I could still function. I was busy adopting a dog and being an adult human, so I tolerated it.

BUT THAT ENDED TODAY

I finally sat down and got it fixed.

I tried a billion forum posts that suggested combinations of wiping partitions and dances around blood-spattered stone circles, but that wasn't really useful. I know that most of those things are essentially Skinner boxes, and so I try to avoid them, but desperation makes fools of us all.

I had avoided hitting the 'Report' button on the error dialog, because, on the stock android version, this brings up a wall of legal text about how Google is going to pack up as much data as it wants and ship it off to their servers when you submit the bug report (disclaimer: I never read that and have no idea what it really says, I'm just tired of accepting legal agreements). On cyanogenmod, though, the data will be shipped off to a bunch of friendly hackers (in the best sense of the word) who I don't know, but trust to care more about my privacy than Google, for some reason. I didn't submit the report, but being made by hacker-friendly people, the CM report dialog shows the Java backtrace of the problem. This was the most helpful information I'd gotten so far, and it informed me that the problem was
com.google.android.gms missing android.permission.ACCESS_FINE_LOCATION
But I had given Google Play services that permission!

Eventually, I found an issue that seemed to address it on the Open GApps issue tracker, that contained these commands:

pm grant com.google.android.gms android.permission.ACCESS_FINE_LOCATION
pm grant com.google.android.gms android.permission.ACCESS_COARSE_LOCATION

and that was it. No problems, yet.

I hope that this saves someone all the hours it cost me!

Clack Static Asset Middleware

posted on 2016-05-12 02:01:00

As part of my glacial march to get Knttl running the way I'd like, I wrote a middleware for the clack web framework to help me out!

When you're serving javascript and css files for a website, you want to inform the browser to keep a local copy as long as possible, because then it won't bother your webserver to download it again and the page will render faster for your users, too. There's a popular quote about programming

There are only two hard things in Computer Science: cache invalidation and naming things.
It seems this was said by a Phil Karlton.

So, like many things related to the it-was-never-meant-to-be-used-this-way world of web technology, there are some interesting best practices that evolved around this idea that, ideally, only one copy of a static file should ever need to be sent to a user, if their browser works well.

There are ways to tell a browser how long to hold onto a file before checking if there's a new version of it, but that only gets you so far. Presumably, your javascript is going to change, some day, and then you'll feel silly when all of your users are still running a three week old version of it that's still cached by their browsers.

The next bit is the hack that makes it all shine.

"Why not just change the filename when the file's contents change?" asked some bright engineer, somewhere. So, we do. We just attach a hash of the file to the filename and serve that. When the file changes, the filename we show the web browser changes, and we can tell the browser to just cache the file forever, or as close to forever as we can!

It's kind of a pain to generate a copy of all of your files with hashes attached, so what clack-static-asset-middleware does is store calculate some hashes of your files and just pretends those files exist and serves up whatever you tell it about.

I also wrote some helpers you can load to use this stuff easily with Djula, like so:

<a href="/" class="logo u-pull-left" title="Home">
<img src="{% asset-path "small-logo.png" %}"
width="54" height="60"
alt="Knttl" />
</a>
So, to summarize:
  1. Have style.css
  2. Template asks for hashed filename, gets something like style_2867f3f83a6a91ad4a19a6cd45536152.css
  3. Browser asks for style_2867f3f83a6a91ad4a19a6cd45536152.css
  4. Server says "Aha! I have fooled you! Here's style.css! Keep it as long as you like!"
  5. Browser says "Golly gee! I will, mister Server! I'll never ask for style_2867f3f83a6a91ad4a19a6cd45536152.css again!"
  6. Hooray!
So check out clack-static-asset-middleware, which will hopefully be in quicklisp soon!

We Can Has Doggle

posted on 2016-05-10 01:41:00

I have been a bad blogger lately, as always, but there's something worth throwing a few words onto the internet about.

We've adopted a dog! A little over a week ago, we took a trip out to the North Shore Animal League America and adopted a very mixed breed dog who we've named Wedge after the legendary starfighter pilot from the Battle of Yavin (and the X-Wing series of books that I loved in my teens). It only took us eight hours after the staff lost our application for a while and left us sitting in the dog meeting area hungry and uncertain.

IMG_20160501_015518.jpg

Wedge came from a pupply mill, which means he was probably brought up in a situation where he was kept in a cage all the time and probably wasn't treated like he was a sentient being all that often. If you look around online, you'll find that adopting a mill dog can mean signing yourself up for a fair bit of doggy rehab (figuratively speaking).

For the first week we had him, Wedge was afraid of just about anything at just about any time. You couldn't even give him a treat, half the time! He would walk up to take it and then it was as if the realization of how close he'd come to me hit him about two feet out from my hand. Then he'd turn so fast that his butt and head were going different directions for a moment. It was cute and sad all at the same time!

I'd never really expected to get a dog - the one we had growing up didn't like to do much but steal food and be ornery - so I wasn't really looking for another dog experience. After our trip to Portland, OR, though (which I'm now realizing I didn't write about here! More soon!), we were left with feelings about things that were missing from our lives. Things like really good coffee, vegan donuts, and maybe having a cute dog to stop us from being all depressive a lot of the time (therapist recommended!). Naturally we picked a dog with it's own emotional problem.

Now, Wedge is calming down and doesn't run away from me when I move around the rooms of our tiny apartment anymore. I haven't really had to train a dog before, though I grew up with one, so this is a bit of a challenge. Hopefully, he'll come out of his shell in the next few months and we can take him camping over the summer.