Quantum Mechanic

Content tagged Uncategorized

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.

First wikipedia edit!

posted on 2016-01-03 17:45:00

I was working on my typing practice, today, learning the Colemak layout, and came across a small typo in the Wikipedia article on Morris Engines!

It was a simple typo (form -> from), but I decided that was a level I was comfortable contributing at. I didn't notice there was a checkbox for minor edits like typos on the submission page, so I fully expect someone to crawl out of the internet and point it out to me.

Using Emacs to Study Japanese

posted on 2015-12-06 03:02:00

Tonight, I took my first steps into the world of emacs lisp!

Last January, when I had more time and energy to devote to studying Japanese, I started wondering about using org mode to help me. I was reading articles from the NHK News Easy website and spending a lot of time going back and forth between that, jisho.org, and emacs (where I was keeping my notes).

If you haven't used it, already, jisho is a wonderful site that is the best of what you could hope for in an online dictionary. It's fast, clean, and usually returns the most helpful results without having to fight it too much. I've also spent a bunch of time using LEO and, while I appreciate it, it suffers a bit from over design that hurts usability.

Anyway.

I really wanted to find a way to work in emacs with org mode. Maybe just copy articles from the NHK into a study log and then look up words and insert them under the sentence they were from. Last January, I wrote to the makers of jisho and Kim Ahlstrom was nice enough to write back and let me poke around with an API he'd been working on. Today, I spent a few hours learning my first emacs lisp and making a few functions to query it and format some nice defintions for me!


jisho-mode.png

Figure 1: It doesn't get much more exciting than this!


Starting with a background in Common Lisp was probably pretty helpful, because I was ready to understand the plist's and the like that were involved. Some of the json handling was nicer than in Common Lisp, since emacs seems to let keywords be lowercase by default, as are most of the json key names that they're decoded from. In CL, you need to do a lot of :|property-name| because the reader upcases everything. I also learned that you can modify that behavior and that it is terrifying. I recently had an experience like this, trying to make json access easier for myself:

CL-USER> (readtable-case *readtable*)
:UPCASE
CL-USER> (setf (readtable-case *readtable*) :preserve)
:PRESERVE
CL-USER> :thing
:thing
CL-USER> (print "Hello, world!")
; Evaluation aborted on #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {1004729173}>.
CL-USER> (PRINT "Hello, world!")

"Hello, world!"
"Hello, world!"
;; ABORT! ABORT!
CL-USER> (SETF (READTABLE-CASE *READTABLE*) :UPCASE)
:UPCASE
CL-USER> (cl:print "Hello, world!")

"Hello, world!"
"Hello, world!"
CL-USER>


Hopefully, I'll be able to share this emacs-jsiho integration work, soon, because I think people would like it. I was asked not to make the API public, so I will wait until I have permission to share. I'm excited to have finally dipped a toe into elisp and, hopefully, I'll have time to refine my code and make it even more useful (like selecting from a list of possible results after searching!) in the meantime, anyway. I was pretty impressed with how easy it was to do API call, parse the JSON and then crawl through it. I have the impression that some parts of elisp are even moldier than CL, but maybe people are making a good effort to modernize it and lower bars.

Vegan ice cream sandwich!

posted on 2015-10-18 22:57:35

image

From Lucky's sweets in Saugerties, NY!

Playing with the MOP

posted on 2014-12-01 20:30:00

I was poking around at my project, Chirp, today and finally decided to deal with a strange bug I was having. When I sent JSON down to the AngularJS controller that renders the page, dates were always coming back as the time the request was made at. This was strange, since the database records of the chirps store when they were created, and the time should have been that. The one I was testing was over a week old.

Eventually, I realized that in the slot definition

(created-at :type clsql:wall-time
:initform (clsql:get-time))


the time stamp would always be the current if the time wasn't set on the instance when the database was read.

I'd recently started using clsql-helper to get instances of classes back from complicated SQL queries. By 'complicated' I mean 'contains a basic join.' Apparently, CLSQL doesn't feel it needs to do that. I wish I knew why.

In any event, when I used clsql-helper, the dates were wrong, when I used clsql's built-in #'select, the dates were correct. So it slowly dawned on me that clsql-helper was doing something wrong. Sure enough, it wasn't converting the string that the time stamp returned into the wall-time instance that clsql expected.

So I took the chance to play around with the MOP a bit and wrote code to convert the values to the right type, looking at their slot definitions in the class.

(defun get-slot-by-name (name class)
(find name (closer-mop:class-direct-slots (find-class class))
:key (lambda (slot)
(intern (symbol-name (closer-mop:slot-definition-name slot))
*package*))))

(defun coerce-value-to-column-type (class column value)
(let ((type (clsql-sys::specified-type (get-slot-by-name column class))))
(coerce-value-to-db-type value type)))


With that code, you just do something like

(coerce-value-to-column-type class coulmn data)


and things come out the right way.

Injera and Company

posted on 2014-07-22 00:46:00

Tonight is an exciting night. Tonight, I'm making Ethiopian food for the first time. During my time as a grad student, I barely cooked (or wrote) anything, let alone something new. So, I'm very excited to be doing something new tonight.

A few days ago, I started preparing the dough to make Injera, the national bread of Etiopia and, as far as I'm going to count, my first sourdough bread. The recipe is really simple, once you've found some teff flour. All you do is mix it with water and wait for it to start to go bad!

Aside from finding the teff flour, the other difficult part of this (and it gets much easier afterwards) is finding berbere spice mix. I have no idea where to do this in Kitchener, so I found this recipe that suggests how you can make your own. It doesn't contain ground lentils, which another site suggested was part of the mix, but I'm not one to work too hard at accuracy. I'll be using tomato sauce instead of tomato paste, as well, and grinding up my own chilis, probably with a blender (I did end up doing that, and only using half the suggested amount).

wpid-chilis-scaled.jpg

I found a helpful article on the Toronto Sun website that contains some vegetarian recipes for the various toppings that go on the Injera, so I'll use that!

After sitting out for a day, covered with a damp towel, the teff mixture smelled a bit odd, which seemed right for sourdough. I had tried to make the batter once before, and it had grown mold, being left alone for three days. That might just be our apartment in the summer, though. I wonder if the wintertime would require a longer fermentation time.

Ideally, the bread is made like a thick crepe, but it didn't run very quickly in my pan, so it ended up fairly thick and misshapen, but it did bubble in a way similar to the bread I've gotten at restaurants. Apparently, many Ethiopian places in North America cut their teff flour with wheat flour in order to make the flavor less intense, and I wonder how that affects the consistency of the dough itself. I might have to try, just to see if it makes it easier to cook.

finished ethiopian-scaled

Mining on Linux

posted on 2014-02-02 21:48:41

This weekend, I decided to look into crypto currencies again.  Three years ago, I poked around bitcoin and managed to find a site that would give you 1/1000th of a bitcoin for free, just to get people to use the currency.  Now, there are lots of new currencies online and who knows which will become as popular as Bitcoin, although I expect some of them will make it.  I, personally, like the vibe of Dogecoin, which has a level of seriousness I find appropriate for currencies anyway.

I set about trying to mine some on Fedora 20.  I am the sort of Linux user who tolerates very little non-free code on the machine and graphics-related topics especially give me pause.  It seemed worthwhile to me to figure out how to get a miner running on the open-source drivers, then.  I was happy to find that Tom Stellard, a mesa developer, posted on his blog about getting mining working with the open radeon drivers.

The trick, it turns out, was getting a new enough version of mesa, clang, and LLVM to get things working.  I ended up having to install fedora-release-rawhide and then running
sudo yum install mesa mesa-libOpenCL clang llvm --enablerepo=rawhide

to get the appropriate bits.

Now I'm chugging away at ~160Mhashes/s, which seems to be pretty slow by modern standards, but within a factor of 2 of what other people report for my card.  Not bad for new code.

If you find this useful, feel free to throw some of your shiny, new crypto-currency at me!  Maybe then I'll be able to get hardware I can actually play this strange lottery with!

BTC: 1QKPMpRNEbpwhzzP33HpiNSEfEgDdTYvd3

DOGE: D5A9ngH7mb3roJgpAGUjUPdAcbV3svvkvH

Getting to know Canada

posted on 2013-06-18 16:45:24

Today is the second day of our trip to Canada to look at apartments. So far, we've learned

* Your phone is not unlocked, even if the internet seems to say it should be. If it seems like Verizon did something kind, that information is wrong.
* Getting a cheap, prepaid Sim card with a phone is pretty easy. Tel us gives you $20 credit when you buy a phone.
* Canada looks a lot like the US but the store names are different.
* Finding apartments is horrible regardless of which country you're in.