Tag Archives: featured

Rapid Prototyping and Cosplay: lie ren / jade dragons on the lasercutter


things happened over the last month. i guess that’s the way of life. can’t stay constant.

i’ll start with rapid prototyping and cosplay. sadly, no 6-axis knitting robot arms were involved in this, nor lasercut lace.

first time (probably last time) cosplaying: cosplay, costume play. there is no competition and no acting required.


for me, it was also my first real adventures into sewing, minus my rather sad attempts at vermiculture bags. sorry long dead worms 🙁

sewing is hard. i guess most first things are hard. but that’s a tale for another, longer post.

so three weeks or so before anime boston, brian chan convened a meeting on latches in cosplay. he had also kindly invited a few of us to invade his annual rapid prototyping and cosplay panel. i thought, since i’m probably not going to be in town next anime boston, i may as well do a cosplay. cynthia (man i’m just surrounded by awesome people, do read their blogs) suggested lie ren, a character in rwby. several of my friends were going as characters in rwby.

i… i still have yet to watch any episode containing him that i remember. i barely know anything about rwby. oh well. for me, the primary interest is in making things.

anyway, he has these gun/blade hybrid things. they’re supposed to fold up in his sleeves and emit green dust or something.

i pushed off the rapid prototyping / weapons part to the last-minute, since i was pretty confident i could come up with a solution that would work in time. especially since there’s been prior art on the internet: $100+ ones you can buy that model the art pretty closely, and then ones that looked like water guns with cloth wrapped around it. the sewing i gave myself all three weeks to work on, since i knew i would consistently underestimate how much time it took no matter what.

so the week before or so, i bought some water guns, you know, just in case the sewing took so long i wouldn’t be able to rapid-proto some (non-function, mock, cosplay) guns and only had time to work on the blades.

cost: I think $16.

uhm the friday of the con i decided i should probably start on the weapons, since i was supposed to help out with a panel on saturday. putting the rapid back in rapid prototyping…

1) bandsaw, ‘cos i need to attach extended magazines or some non-sense

2) ponder how to create “sanded edges” to thin it down more towards a point at the end. opt in the end to skip it entirely and just do the easiest thing possible

lasercut three identical layers out of mdf and glue it together and call it a day

some blatant tracing from some screenshot i found later, plus scaling based on getting the magazine to roughly fit into the existing grip, and exporting to pdf because stupid coreldraw hates inkscape SVG files and almost everything inkscape exports for whatever reason. ugh coreldraw. i should sink some time into switching over to inkscape on the lasercutter.

one layers takes 1.5 minutes. good.

some of them are flipped. this is because the mdf is rough on one side and shiny on the other, and i want both outsides be shiny.

at this point it’s 9 AM, so then I lasercut some stencils out of cardboard (next post) and head off to work.

at 10 pm i come back to working on this, even though i want to continue sewing, mostly because i’ve learned that actually spraypaint takes 24 hours to dry, not the one hour i was imagining. which means i better finish this part, paint it, and set it drying ASAP.

3) now how to attach my lasercut pieces to the off-the-shelf pieces.

After some pondering i settle on 5-minute epoxy.


and some “press-fits” or close-fits, just to give it lots of area to adhere to.

a few iterations later i was satisfied.

the blades were tricky to epoxy because they were heavy and long and not possible to clamp down. i was actually worried about weight and carrying it all day, but it turned out to not too heavy at all.

but mostly, it just required patience. which i had a lot of by that time because i was pretty sleep-deprived and mellow. here they are, propped up on some power supplies to keep blade from falling over.

i epoxied them two or three times: once to tack them down, wait fifteen minutes, then gingerly all around them and set it back on the power supply to cure, and then a third time to fill in any gaps i missed.

the epoxy has got a pretty noticeably different finish than the wood, which i worry about a bit. but turns out it all doesn’t matter, no one notices the fine details when you are cosplaying, because you are a large human and a vague resemblance is fine.

two layers of spraypaint (one to cover most of it, and then the second to cover the back, which i picked last because the paint would still be tacky and would come off on my hand during the con, but it’d be facing me and no one would notice) and i’m done. actually, one thing i learned: spraypaint doesn’t like to stick to plastic, so you should rough up the plastic beforehand.

i didn’t do that, or any of the hand-paint detailing, or anything at all. but it was still fine and great.

and i am never ever doing that much sewing again.

Biking to the Arboreturm, Walden Pond from Somerville, MA

There were two days of 40s-50s temperatures a few weekends ago, so I decided to bike to the Arboretum and then the following day to Walden Pond.

Arnold Arboretum (near Forest Hills T stop)

I left around 11:30 am and arrived at 12:45 am at the Arboretum, with earphones in one ear trailing to my cellphone GPS (kind of dangerous, but effective). Here is a mural I saw along the way which I’d never seen before.

rough bike directions

 We went into Jamaica Plains for lunch. Along the way, we saw a take it – leave it – street library, which I found pretty cool.


Walden Pond (around 2-3 miles away from some commuter rail station)

The next day I woke up at 2 pm and felt like going somewhere, since I didn’t have anything to do until 6 pm. After a bit of googling I settled on biking to Walden Pond. It felt ambitious but doable, but I would have to leave almost immediately to get there before sunset.

rough biking directions

After biking on some highway for a bit, I reached the start of the MinuteMan bike bath. This path (pictured above) was very nice and flat but wet / slushy / icy in many parts despite a day and a half of nice weather. Good thing someone told me to wear rain boots, to bring extra socks, and not to expect to go fast!

I left at 3pm, bought some snacks and gatorade, and headed out by myself. Too impromptu to find anyone to go with me. There was a large section after the bike path just on the side of the road, which actually meant on the road because

if you biked on the side of the road you ended up in the mud / giant puddles. Good thing I was wearing rain boots!

5:12 After walking up 3 or 4 hills and then biking some more, I arrive at the Walden Pond State Reservation, which isn’t actually where Walden Pond is.

Walden Pond is across the street.

The pond was frozen over and still covered and snow, while the sun was setting by this point. Only two other people were there. It was really nice and tranquil, disturbed only by the sound of me noisily munching on food rawr delicious fluids and trail bars.

Well, after a few minutes, I headed back out, since it was getting dark. I failed at getting directions to the closest commuter rail (commuter rail, because biking back in dark icy conditions on the side of roads without bike lanes sounded like a terrible idea) beforehand, figuring I’d rely on GPS and that I should get on the road ASAP to get there before dark. Lo and behold, when I tried to go back, not enough 4G signal for usable GPS. fail. And then I on top of that I got a flat (and I definitely did not have a spare tire or pump). Luckily some really nice strangers who came out of the state reservation wearing snowshoes had a car nearby which could haul me and my bike to the commuter rail station.

$8.00 for a ticket back, and $6 (I think?) for a replacement inner tube. Ah well. So it goes. I also had issues on my bike with the shifter chain falling out (I have an three speed internal gear hub) when I replaced the inner tube, but that’s a tale for another time.

I didn’t even feel too tired at the end of my 15 mile trip. Bikes are great!

Ubuntu Hardware Course Screencasting: Screenpainting + live webcam feed (12.10, wacom CTL-480, zoom h1, Ardesia, gtk-recordmydesktop, OpenShot, cheese, key-mon, Arduino)

Hello dear friends!
Today I’m here to talk about screencasting a hardware course in Ubuntu using tools that are free (no-cost) to use. I had some issues that were cinnamon-on-ubuntu specific, and others I’m still not sure the cause of, but overall I’m pretty pleased with how things turned out.

Left: Cheese; Right: Arduino, Ardesia; Bottom: gtk-recordmydesktop; Overlaid Writing/Drawing: Ardeisa

Hardware setup:

  1. USB webcam on a tiny tripod
  2. wacom tablet (CTL-480) — to get this tablet working in Ubuntu, see step 1, step 2
  3. Zoom H1 recorder with v2.0 firmware (for USB mic support in linux) — to see which firmware version you have, simply turn on the recorder and at the top it will say “2/00” if you have version 2 (shown without USB cable)
  4. and then I had the iteaduino (arduino clone) and 
  5. my laptop
  6. secondary laptop for displaying the script

Lower Screen Resolution

My default resolution is 1600×900. First step, Lower the screen resolution to 1280×720 to make text readable at lower dpi and file sizes smaller (and thereby make your lower-bandwidth internet users happier!)

1) Install gnome-session-fallback.
sudo apt-get install gnome-session-fallback
This is because I’m running cinnamon and can’t get the display to change resolutions unless I log in as gnome-classic instead. You need gnome classic WITH effects for Ardesia to work, by the way.

2) Open a terminal (alt-f2, gnome-terminal). Run gnome-control-center. Click on “Displays”. Lower the resolution to 1280×720, which is standard HD resolution (youtube uses 16:9).

Get Alt-Tab Working Again

Okay, now we’re running Ubuntu 12.10 with gnome classic fallback, and ugh Alt-Tab doesn’t work wtf. To get it working:

sudo apt-get install compizconfig-settings-manager
sudo apt-get install compiz-plugins

Then go to Window Management > Application Switcher > Enable. Okay now I also have ultra-fancy alt-tab swoosh effects too, but at least I have alt-tab.

Drawing on the Screen:

sudo apt-get install ardesia

Ardesia is great! It’s very easy to use, is in the ubuntu repositories, and provides multiple options for drawing on the screen. See first picture at the very top (where I show how it can toggle between wiggly, smoothed wiggly, and squareish lines, as well as draw arrows), as well as this one:

However, when I try to screencast in Ardesia, the audio (whether I use the internal mic, or the zoom H1 as a USB mic) is unusably choppy.

Thus, we use yet-another-application for the actual screencasting!

For screencasting (recording the screen)

I used gtk-recordmydesktop.
sudo apt-get install recordmydesktop.

This had a bit of a learning curve for me. There is a tray icon that shows or hides the main window, and when you hit “Record” the main window goes away automatically. It doesn’t save the file as anything usable at first, when you stop recording it begins encoding and then saves as an OGV file in the directory where you selected in the “Save As” dialog in the main window. Also, since we have a stereo mic with the Zoom H1, I went to advanced settings (upped the frame rate to 25 fps as well) and increased it to 2 audio channels. I don’t know if this actually affected the output, but presumably it does.

Officially youtube doesn’t support ogv, but I haven’t had issues with uploading the OGV files this application created.

For a live view of the hardware

I used a webcam connected to Cheese and then resized cheese until the lower toolbar disappeared.
sudo apt-get install cheese

I had a laptop camera as well. To choose the external webcam instead I simply went to Cheese > Preferences > Device  and chose “USB2.0 Camera /dev/video0” instead of “1.3M HD Webcam /dev/video1”.

For USB Mic

For a comparison of the audio quality using my internal mic versus using the Zoom H1, see:

With laptop mic
 With Zoom H1 as USB mic

Connect the Zoom H1 to the computer. On the screen it will blink between “USB Card and USB Audio. Hit the red record button when it says “Audio”, then hit the red button again to accept the audio settings. Now go to
gnome-control-center > Sound (or “Sound Settings…” under the volume tray icon in the gnome panel). Under “Hardware” you should see “H4 Digital Recorder”.

I set it to “Input” only (instead of duplex) to be safe. Then, under “Input”, you should see “H4 Digital Recorder Analog Stereo.” If you don’t see it in “Input”, but it shows up in “Hardware”, try rebooting your computer — that did the trick for me.

For displaying which keys are pressed

I used key-mon.
sudo apt-get install python-pip
sudo pip install key-mon

For syncing audio and video, or video editing

Say like me you initially didn’t figure on using yet another application to get non-choppy audio simultaneously recorded with the video screencast, and instead have a .wav file from your zoom recorder and a .ogv file from your screencasting tool. How do you sync up the audio and video files appropriately?

PiTiVi was sad for me. I liked pitivi, because it displays the audio waveform, which is useful. However, the video preview was really choppy (unusable for syncing purposes) even when I selected “video thumbnail 1/100 sec” and the export didn’t work.

Use OpenShot.
sudo apt-get install openshot

The export settings are pretty self-explanatory. For now, I’ve settled on using “Device> AppleTV” as the settings I use. “Web >Youtube-HD” probably also works. When I tried manually selecting “H264” and “AAC” audio like youtube recommends, though, OpenShot gave me a .h264 file that youtube grudgingly accepted and converted for me (but I couldn’t open in VLC or anything locally). So… just stick with the “simple” export settings and everything is great.

By the way, OpenShot 1.4.3 doesn’t like to import OGV files on my computer (pops up an error, “ogv not supported). Therefore:

Convert OGV to AVI or MP4

Use ffmpeg or avconv to convert the OGV file into AVI or mp4 and then import into OpenShot.
ffmpeg -sameq -i ardesia_project_2014-19-2_18:11:24.ogv output.avi
avconv -i ardesia_project_2014-19-2_18:11:24.ogv output.mp4

Then open the AVI file into OpenShot, along with the WAV audio file, drag-and-drop to sync the files, and then hit export.


You have a video 🙂
For an example of the output, see http://www.youtube.com/watch?v=8ZgO082rD2g. It’s a bit fuzzy, probably in part because I recorded it in 4:3 (1024×768) instead of 16:9 which it was converted to (1280×720). But the text is mostly legible.

Second Winter School Hike: Warm toes while skating and griliing on Lonesome Lake!

(for why I’ve suddenly become more interested in exerting physical effort despite my long-standing belief that I’m not interested in sports, exercise, or outdoors things, see previous post)

We hiked ~1.2 miles up ~1000 ft to Lonesome Lake carrying grills, charcoal, skates, group emergency gear (foam sleeping pads and tarp if we got stuck on the mountain), and food and drinks.
Or rather everyone else did except me, since I had a dinky little book bag that made everyone pass over me in letting me take group gear.

I’ve learned gradually that people hike for different reasons. Four years ago I did not understand the point whatsoever. I grew up flying and driving to cities and walking around cultural landmarks, not really nature. But now through talking to people I realize that some people do it to enjoy nature, some for the exercise, some for the community / social aspects, some for the challenge and summits, etc.

Each trip has taught me more about my physical fitness level and what equipment I need to be comfortable. ahhh I was so tired the next day (today), I slept for 15 hours and still feel tired (and now I feel sore all over). But the day of, the hike was pretty easy for me.

trip start! (actually our first stop was dunkin’ donuts, but w/e)
Grilling supplies and ice skates! Not pictured: the half gallon of milk and half gallon of cider we also brought up.
this was roughly the angle of elevation all the way up. steep but we managed without using microspikes at all since there were only a few by-passable patches of ice.
We all slipped and slid a decent amount, but for the most part the hike was pretty easy. Especially for me, since I was carrying almost nothing.
one of our trip leaders and another group member carrying the shovels for clearing the lake, the grill parts, and skates.
We reach the top around noon after two hours. We went really slowly.
frozen lonesome lake covered in snow!
we had a trap and put all our gear on it
then brought out the liquid (?) stoves which will work in the cold. they require priming to heat up the pipes before they will work.
hot cider on the lake with ice skating in the background!
shoveling to widen the ice skating rink path. you can see the grill to the left.
the Appalachian Trail crosses here!
and there’s an Appalachian Mountain Club “hut” complete with wood stove, solar panels, and a bathroom with composting toilets and even toilet paper
view from the hut was gorgeous
swag for sale inside the hut
grilling those kebabs wait what is that
shrimp and steak kebabs? talk about gourmet trail food 🙂
foooooddd chowing down
skating on the lake
walking on the short trail around the lake.
it was really pretty.
snow fight!
sledding down the hill.
I was introduced to butt-sledding as well. Since it was often steep enough and we had waterproof snow pants, we could sit on our butts and slide down the trail. It was a LOT more fun going down the trail than up the trail!
near the end of the trip. it started snowing toward the end and the pretty views from earlier were gone. missing two members: me and the trip leader who made all the kebabs

More pictures here.

Gear-wise, I didn’t need my big poofy jacket at all. I learned that if at the beginning of the hike up hill you are warm already, definitely delayer. I learned to wear gloves when sledding.

Holy hexapods, my extremities were sometimes the warmest parts of me! The uphill hike really helped, and I opened toe warmers but ended up using them to warm my fingers. The MITOC rental boots are amazingly warm compared to rain boots, which is what I wore last time. Below is a picture of 90% of the items I brought or wore on the hike.

cover your eyes if this is TMI. all non-cotton
Feet: liner socks, thick wool blend socks, sorel winter hiking boots
Hands: sometimes thin liner gloves (not pictured), sometimes thinsulate 40g gloves (not pictured), sometimes the black polyester ones pictured here although not really the last one
Lower body: non-cotton underwear, fleece leggings, base layer, I added snow pants (not pictured) for skating / standing around / downhill
Upper body: Base layer, patagonia alpine jacket I got for free with awesome zipper jackets, windbreaker
Head: cotton-filled knit hat thing, some polyester cloth I’m using to tie around my lower face when my nose and chin get cold
Essentials: Toilet paper, pads, fire starter, compass, headlamp, whistle, trail snacks, some bandages and gauze
Water: 2 liters of water. I used 1.25 liters from 10 am to 6pm.

I was pretty frickin’ happy the entire trip because my hands and feet were so happy.

Also, in terms of waterproof shell layer which I still don’t have, currently investigating making them from tyvek or other waterproof materials (e.g. kite material).

All-in-all a great trip. All the other hikers at the top marvelled at us deciding to bring an entire grill and charcoal and shovels and skates, reminding us that our trip was a little atypical.

Winter school has ended now, and time to plan some backpacking / 20 mile trips, in between fixing boats (future post, maybe in a few months).

AT week-long hike planning (PONIES!) || MIT Outdoors Club, Winter School: Easy Hike

Grayson Highlands State Park, aka PONIES

Out of the blue one day a few weeks ago, my friend Judy asked me if I wanted to backpack a week-long section of the Appalachian Trail with her in late May.

I didn’t grow up doing sports, exercise, or any sort of physical activity, let alone outdoors activities. Only with a more varied social circle in college (and in particular with more time and money post-undergrad) have I started to take more interest in outdoors activities or physical exercise at all.

Our current preferred choice is to hike SOBO (southbound) from Atkins to Damascus at a leisurely place, taking time to enjoy the PONIES. 😀


We hiked Southbound from Atkins to Damsacus (75 Miles) and it seemed to have some level and gradual climbing. We did it in 5 days but you could make it six days the Grayson Highlands are great.

One piece of advice is as you approach Grayson Highlands Park and the area around Mt. Rogers, I’d pack an extra day’s worth of food, as this is a place you’ll won’t want to hurry thru, and may well want to slow down, and maybe even take a full day off. “Zero” days on the Trail can be better than days off in town, but very few folks ever do this, partly because they haven’t brought along enough provisions.

I learned from experience that it’s far preferable to shuttle to your starting point and get back when you get back, than to hike to a prearranged shuttle at a set time and have to worry about making it on time for your whole hike.

We are worried about how we will get there and back. It would suck to rent a car for a week and just have it sit at the trailhead burning rental money. We’ll see. Hiking the AT in NY would be much easier, since we can reach the trail by public transit, but if we’re committing a week’s worth of time on the trail and far more preparing for the hike, we will probably prefer to hike a prettier section of the trail.

In any case, we are starting several months ahead of time because of our lack of experience with backpacking. Areas of preparation include food, gear, physical fitness, and backpacking experience.

My initial plan was to climb the porter square T stop stairs (before the pay entrance) every day, since it only takes around 45 minutes including walking there and back from my house (because I can only climb 15 minutes of stairs).

picture proof I sent to Judy, who lives in NY

The stairs are really narrow so it’s a good thing I’m the only one doing this. However, this plan fell through, as most of my plans tend to do, in part because I have been feeling crunched for time between NarwhalEdu‘s contract work and our kickstarter work. The new plan is to resume when we finish our MIT Office of Digital Learning contract work, probably in mid-February. It’s interesting. I never found much point in exercising even though it’s definitively good for you, but I find the idea of exercise a lot less tedious and more interesting when there’s a goal I am seriously interested in in mind (spending time on an adventure with a great friend).

In the meantime, on the weekends, to help convince myself to exercise, I have been participating in MIT Outdoors Club (MITOC) winter school (open MIT students, affiliates, alums, and the general community). “Participating,” since for various reasons this past weekend was my first winter hike to Noanet Woods in Dover, MA (about 40 minutes drive from MIT).

Note: In case they send out the email with links four hours after sign-ups open again next year and screw over newcomers on the first weekend trips, go to http://web.mit.edu/mitoc/www/#join_trip to sign up for a trip. Trips fill up fast so be sure to sign up exactly Wednesday at noon. Getting off the waitlist is possible if  you’re high up, so you can try showing up to the pre-trip meeting even if you are waitlisted.

we are super over-prepared, since it is a learning exercise for winter school beginners and due to winter school safety guidelines

I chose the easiest hike possible, since I know I’m not really in shape despite biking on average 30 minutes a day (I bike slowly), and I don’t have experience hiking, so I don’t know if 7 miles is too much for me or not. I don’t want to drag my group down.

I still prepared for this hike quite a bit, which helped make it a mostly comfortable and enjoyable experience instead of one where I was freezing my extremities off. Biking in sub-zero weather forced me realize I need to invest in proper winter clothing too.

Over the last few weeks,

  1. I bought Neff Women’s Digger Gloves (black) off of SteepandCheap, since I thought they were skiing gloves that they would be fine. They were such fail I returned them. Maybe they require liners underneath for people with cold hands like me :/
  2. I went to Harbor Freight in Medford, MA and discovered Ocean State Job Lot next to it, where I bought lots of non-cotton items: liner socks for $2.50, wool blend tall socks and boot padding socks for $3 to $5 each, a pair of thinsulate 40g gloves for $5, and fleece leggings for $5
  3. I went to Target in Somerville, MA and discovered CWPrice, where I bought a base layer (pants+shirt) for $10
  4. I dug out my orange sweater and grandma’s windbreaker (:/ she passed away a few years ago)
  5. I learned from Cappie to tie cloth or a scarf around my nose and mouth to keep my face warm. This tactic does tend to fog up my glasses. I need to remember to wear contacts, although I’ve gotten better about breathing with my mouth in overbite formation so that the hot air is redirected through the bottom
  6. Jordan from MITERS lent me a pair of thick Bonfire gloves that seem to be on par or slightly warmer than my thinsulate gloves. He found them lying around for months so he gave them to me for free.
  7. Bought a magnesium fire starter at harbor freight, and a compass and whistle from MITOC

Now, my everyday wear is:

  • 3 leg layers, 3 top layers, 2 layers of socks, a hat, a scarf, and the thinsulate gloves

On the hike in around 20F I wore

  • 3 leg layers (leggings, base layer, and jeans, because I didn’t have thick / wind or water-proof non-cotton shell layer. I notified my trip leaders and they brought polyester hiking pants, but I stuck with the jeans because it wasn’t precipitating and my legs felt warm just standing outside)
  • 3 body layers (base layer, my awesomely warm patagonia jacket, and a windbreaker) — no poofy layer was needed
  • Two socks
  • Rain boots with liners (winter hiking boots would have been better, but it is such as hassle to leave a deposit and check in and out equipment, even if the monetary cost is already much better)

My toes were painfully cold for 1/3 of the hike and then suddenly warmed up in such a way that at first I was afraid they’d gone numb. Then they were nice and warm. Perhaps this phenomena was due to cold-induce vasodilation. I wish I didn’t have to deal with painfully cold toes at all though, and I asked some of the other hikers and their toes were warm throughout! I’ve always had problems with cold toes though.

frozen lake
Noanet Peak gave a view of the Boston skyline

It was an interesting experience, hiking on snowy trails. A lot of normal people passed us, running with their dogs or walking on skis.


It was a fun group. We joked about “traversing noanet” and “bagging noanet peak” (387 ft) 🙂

I look forward to the next hike. I learned that MITOC Winter School doesn’t teach you first aid, and some of these were covered in lectures that I missed, but I things I want to learn / hands-on:

  • use a compass (oops I missed this lecture, ssshhh I am supposed to know it before going on a hike)
  • emergency signals
  • start a fire in wet conditions
  • wilderness first aid
  • use a stove
  • other TMI things (there was such a great TMI lecture during the second set of mandatory lectures, covering all the female-specific issues) (many things are different in winter — you can’t dig a hole for your poop, for instance, because the ground is frozen)

I want to go on an overnight winter trip too, but they all tend to be for intermediate hikes and up. I suppose there’s next year, and I can first practice with easier spring weekend trips.

WTFisThisRegister, Beginner’s Flask App: Dictionary based on Flaskr (uses sqlite3) and deployed to Heroku

Over the course of a night and morning I built a small flask app (Flask is a micro web framework for Python. Django is similar but more heavy-duty). It is essentially a dictionary. You can search for an entry by its keyword, or view the helptexts for all the entries, or (if you are logged in) add and remove entries. It is a straightforward derivative of excellent the Flaskr tutorial.

For me, I am really proud of this app even though it is dirt simple and not much to look at because this is the first time I really interacted with a database in a programming language.

The intent was to make a database of documentation for the AVR Atmega328P microcontroller. However, since then I have decided to move to using a mediawiki (sample page).

The app may be seen live at salty-retreat-5363.herokuapp.com. The username is “admin” and the password is “default”. The database gets wiped at least once every 24 hours.

If you’d like to run the app locally and play around with source code, please see https://github.com/nouyang/WTFisThisRegister for detailed instructions. That page also details how to deploy this app (or similar ones, such as Flaskr) to Heroku. I used http://dillinger.io/ to play around with markdown online and learn it and actually document this project with a proper README.

Things Learned

Here are some things I learned in the course of making this:

  1. Gitignore files need to be created before you run “git add .” — in general, the line telling it to ignore a file needs to exist before you added it to the version control, git won’t automagically remove it for you.
  2. Heroku DOES play with sqlite3 but not happily, for instance the database will be wiped at least once every 24 hours. See https://devcenter.heroku.com/articles/sqlite3.
  3. Virtualenv does NOT like spaces in your directory path! This was tricky to debug as even in -v verbose mode the full path for my virtualenv packages was shortened and so I couldn’t even notice that my path had spaces in it.
  4. Databases use cursors.

The Process

Here are some images from the process. Click on them to view them in full resolution.

1. First I started out just using a dictionary (no database involved) and a single hello.py file.

2. I then followed the Flaskr tutorial. After doing so I wanted to modify it so that the text was monospaced and preserved whitespaces, because it doesn’t by default.

I used the “pre” tag at first.

but soon switched to using CSS.

This actually caused me a lot of headache later troubleshooting why there was random whitespace in my design, because I didn’t restrict where the CSS was applied enough. So much whitespace:

 In the end I had this file: https://github.com/nouyang/WTFisThisRegister/blob/master/static/style.css

.helptext { preserve whitespace with wrapping CSS }

and the corresponding code in the html file was

 <div class="helptext"%gt;
{{ entry.helptext|safe }}</div>

3. I wanted to be able to delete entries, so I added a delete button.

In show_entries.htmloops can’t show it because blogger can’t escape this HTML properly :/ In the main python file:

@app.route('/delete', methods='POST'])                                                                                         
def delete_entry():
if not session.get('logged_in'):
g.db.execute('delete from entries where keyword = ?', [request.form['entry_to_delete']])
flash('Entry was successfully removed')
return redirect(url_for('show_entries'))

The “?” is a safe why for sqlite3 to accept text (in this case, whatever was entered in the form with the name entry_to_delete).

4. I learned to play around with the database to test my SQL commands in the terminal:

 $ sqlite3 /tmp/flaskr.db
sqlite> select helptext from entries where helptext='PCMSK0'

5. Finally I added a search functionality to the site:

@app.route('/search', methods=['POST'])                                        
def search_entries():
keyword = request.form['searchterm']
cur = g.db.execute('select helptext from entries where keyword = ?',
result = [dict(keyword=keyword, helptext=row[0]) for row in cur.fetchall()]
return render_template('search.html', result=result)

And set the homepage to be the search page:

def show_search():
return render_template('search.html')

6. I learned about initializing databases, namely by dumbly thinking I needed to include the flaskr.db file and no schema.sql file in the repository to allow other people to get it working on their systems. Actually, I was just missing a line, “init_db()”, before “app_run()”. In the end I am still keeping it without that line so that I have persistence in the database (I can stop the server and restart it and the database entries will still be there).

All in all I learned a lot! Do browse through the source code and play it with yourself if you’d like.


Liveblog Notes (kept here for reference)



(did not use: http://www.realpython.com/blog/python/python-web-applications-with-flask-part-ii-app-creation/)

http://flask.pocoo.org/docs/tutorial/introduction/ Ah! Here’s the hands-on quickstart.

Hmm, well now the newlines show up but long lines aren’t wrapped.
To fix:

.page { width: 70%;

Modifying the database name: How are you supposed to properly do this? I just deleted /tmp/flaskr.db and then ran in the shell:
sqlite3 /tmp/flaskr.db < schema.sql

and things seemed to work again.
Include a delete button in the future:
If you don’t want your data wiped clean, DO NOT do 
$ python
>>> from flaskr import init_db
>>> init_db()
Instead, to play with sqlite3 commands,
sqlite3 /tmp/flaskr.db
And then use the same commands as in flask, but with semicolons.
So to lookup something we need the WHERE command:
e.g. for me it is:
select helptext from entries where keyword=”PCMSK0″;
Uhm, okay, now how to display it in my flask app?
ahh what are database i am so confused

Let’s install the AVR eclipse plugin
http://www.instructables.com/id/How-to-get-started-with-Eclipse-and-AVR/step13/Quick-Tour-Of-Cool-Features/ (windows)

sudo apt-get install eclipse (270+ MB! sigh)

sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude


Heroku deploy

  1. Install heroku toolchain
  2. Login to heroku
  3. Install and activate virtual environment
  4. Install dependencies (why do I need gunicorn? not sure) 
  5. Make a Procfile
  6. Run foreman and check in browser that app is up on localhost
  7. Download the python .gitignore and add the “venv” line to the top
  8. my own step: add to github, git remote add origin https://github.com/nouyang/WTFisThisRegister.git

OH. The .gitignore file does NOT go in the root directory directly. No wonder everything failed and I just had to delete my github repo and also the .git folder in my root directory.


For example, you might create the file at ~/.gitignore_global and add some rules to it. To add this file to your cross-repository configuration, run git config --global core.excludesfile ~/.gitignore_global. Local per-repository rules can be added to the .git/info/exclude file in your repository. This method can be used for locally-generated files that you don’t expect other users to generate.

Wait, but what if there’s one file, e.g. a passwords for the database file, that I don’t want to commit? Maybe it’s just messed up because I did the git init and then added the gitignore file or something funky, I don’t remember. http://stackoverflow.com/questions/1139762/gitignore-file-not-ignoring

Okay, so now I want to pull the config parameters (passwords, admin usernames, secretkeys) out into a separate file that is gitignored.
Done. Created a file called databaseconfig.py, added the line “from databaseconfig import secretkey, username, password” to the main python file.

Oh I should generate a real secret key
>>> import os, binascii
>>> binascii.hexlify(os.urandom(24))

Whoa they actually mean create the file ~/.gitignore_global, not create ~/.gitignore_global/.gitignore

Also, vim and gedit create swap files not covered by github’s gitignores, so add




to ~/.gitignore_global

Yes! Succesfully used .gitignore for once.

(venv)nrw@nrw-PC:~/projects/WTFisThisRegister$ git commit -m “init”
[master (root-commit) 35b1400] init
 10 files changed, 228 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Procfile
 create mode 100644 README.md
 create mode 100644 WTFisThisRegister.py
 create mode 100644 requirements.txt
 create mode 100644 static/style.css
 create mode 100644 templates/layout.html
 create mode 100644 templates/login.html
 create mode 100644 templates/search.html
 create mode 100644 templates/show_entries.html

Now add it to github.
git remote add origin https://github.com/nouyang/WTFisThisRegister.git
git push -u origin master
Okay, now to finish the heroku deploy.
heroku create 
git push heroku master

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Whoops I need to add this computer to heroku.
$ ssh-keygen -t rsa
/home/nrw/.ssh/id_rsa already exists.

Whoops, let’s not overwrite that, maybe it will break github. 
cat ~/.ssh/id_rsa.pub
and copy that into heroku under Account (https://dashboard.heroku.com/account).
Alright, let’s try pushing to heroku again.

—–> Launching… done, v3
       http://salty-retreat-5363.herokuapp.com deployed to Heroku

Oh noes. It doesn’t work on heroku… Is that because I gitignored the databaseconfig.py file and so it doesn’t exist on heroku?
Guhuhuh I guess I should learn to use github branches.
Okay nevermind, I found a better answer than having two branches to maintain and update if I ever change anything (bletch).
This gives a clear explanation and example: https://devcenter.heroku.com/articles/config-vars
So in the main python file I put
and then in the terminal I type
heroku config:set SECRETKEY=blahblah.
Then, git add, git commit, and then git push heroku master.
NOPE that didn’t fix it ;____; wahh I am sad.
Let’s research….

WHOA good point I forgot to turn debug off! Whaaaa. Okay that is terrible of me.
# configuration
DEBUG = False
WAH. still sad.
Let’s try to fix foreman by adding the var to .env… Does that work?
.env does not like spaces around the equal sign assignment operator!
S3_KEY = mykey
Oh! Make sure to add “import os” to the main python file if we are using os.environ. DUH.

Note: Only today I realized that in pasting URLs from the location bar in chromium-browser (ubuntu 12.10) into blogger, the URLs are automatically turned into hyperlinks, but they remain plain old text and I have to manually turn them into hyperlinks when I copy them from firefox, my main browser 🙁 Such a weird specific bug.

Ah? It still doesn’t work?? Why? It works locally on foreman, but not remote on heroku.

Okay, let’s look at the heroku logs.
ImportError: No module named databaseconfig

Whoops. So a gitignore issue.
UGH. Everything becomes 10x more complicated when working in a virtual environment. Fine. I’ll take the hit and jump full out into non-localhost environment, where I can’t just run “python blah.py” I have to run “foreman start” and other issues. Because foreman looks for a “.env” file. But python does not. (http://stackoverflow.com/questions/12335488/cannot-use-environment-variables-for-settings-in-django)

The solution is to use os.environ.get() instead.

Okay, so I’ll just write a short if statement checking if os.environ.get() is None. 

SECRET_KEY = os.environ.get(‘SECRETKEY’) #for heroku deploys.                
if SECRET_KEY == None:                                                      
    SECRET_KEY = secretkey    

Great, now my config works in with both “foreman start” and “python WTFisThisRegister.py”.

Now to get databaseconfig to show up in heroku. Do I want to?
No. A cleaner solution instead of all this is to use try, importerrors. Since the present of databaseconfig.py can be used to indicate that we are running it locally.

ahhhh now the /entries works locally but there is an internal server error remotely. WHY.

Instead of foreman start, just use foreman run python app.py if you want to debug your application in development.

 Maybe it’s an issue with gunicorn or procfile or whatever that stuff is?
 web: gunicorn WTFisThisRegister:app        
changed to
web: python WTFisThisRegister.py

Okay, still works locally but not remotely. Maybe it is a port issue. Sucks that these tiny changes debugging production (heroku environment) take forever to try (30 seconds for each time I git push heroku master)

2014-01-12T05:58:48.956357+00:00 heroku[web.1]: State changed from crashed to starting

Yay! Fixed ports issue.

AGH. Still internal server error. WTF.
So sqlite3 could NOT be used on the previous version of heroku. However, I think it should be able to now?
CANNOT. Ugh. So this is all pointless. Time to migrate to postgreSQL or something that supports sqlite3.

Sigh. I guess I’ll just submit a documentation issue about this whole fiasco.

Okay, looking into how other people deployed their flaskr projects.
This person has a LOT of documentation and talks about jquery / AJAX. Todo for the future!

WAIT. WTF. It looks like you can use sqlite3, I’m just dumb and you have to include the databse in your root directly, not off in /tmp/ somewhere.

So, looks like DATABASE = ‘flaskr.db’

sqlite3 ./flaskr.db < schema.sql

Note that the way I have it set up — foreman locally will run with Debug = False, heroku will run with Debug = false, and python locally will run with Debug = True. A rather peculiar state of affairs, but fine for me.

Let’s debug the download-from-github install for the Readme.
$ virtualenv –distribute –no-site-packages venv
The –no-site-packages flag is deprecated; it is now the default behavior.
New python executable in env/bin/python
Installing distribute………………………………………………………………………………………………………………………………………………………………………done.
Installing pip…
  Error [Errno 2] No such file or directory while executing command /home/nrw/projects/t…env/bin/easy_install /usr/share/python-vi…p-1.1.debian1.tar.gz
…Installing pip…done.

Installing existing pip-1.1.debian1.tar.gz distribution: /usr/share/python-virtualenv/pip-1.1.debian1.tar.gz
Nope, I’m using –distribute and it fails.

sudo apt-get remove python-virtualenv
sudo pip install virtualenv

bash: /usr/bin/virtualenv: No such file or directory

sudo pip uninstall virtualenv
sudo apt-get install python-virtualenv
NOPE still get the error.
UGH. It’s because my path had spaces.

Gender Gap in Engineering: My Take (stop looking solely within the U.S. and do more active experiments instead of surveys)

Continuing the spate of blog posts, I’d like to write down my take on feminism, engineering, and the gender gap.

My overall thesis is that we should 1) stop looking solely within the U.S. and 2) do more active experiments instead of passive surveys to improve the current state of affairs, because rapid change is possible.

Countries with a Majority of Female Science Degrees and Other Surprising Statistics

Let’s start out with some surprising statistics from “What Gender is Science” (as a nicely laid-out pdf here) (I highly recommend read the entire article if any of the following statistics intrigue you):

in Indonesia, where 48 percent of engineering graduates are female (compared to a 49 percent share of all Indonesian college and university graduates). …
While American computer scientists are depicted as male hackers and geeks, computer science in Malaysia is deemed well-suited for women because it’s seen as theoretical (not physical) and it takes place almost exclusively in offices (thought to be woman-friendly spaces).

Of particular note, in several countries women earn the majority of science degrees! Tell that to anyone that tells you that the low percentage of STEM women in the U.S. indicates women are inferior at STEM.


One theory is that in developing countries, income matters more and there are fewer career choices, therefore women are drawn to engineering.

Next, note these historical graphs of women in computer science. Here’s one about the dismal state of affairs in CS:


Note in particular that in the 1970s in a single year there was a 4% increase in percentage of CS degrees awarded to women — rapid change is possible. But in CS in particular, the percentage of women in CS has steadily declined for the last three decades

source: page 33, Ch. 2, Gender Codes (here in PDF format if you have MIT certs) [1]

If you want to be enraged (or if you care about these issues at all), please listen to this riveting and passionate 8 minute talk which features the fact that in 1987 42% of programmers were women  [1] (or see first graph in picture above) and also features a bunch of really NOT classy ads.

Phoenix Perry – “Embodied play design and building a female developer community” – Open Hardware Summit 2013 from OSHWA on Vimeo.

Fun note, that is actually a page from the Cosompolitan Magazine! Oh how times have changed.


That article is recommended reading too. 

Computer science has always been a male-dominated field, right? 


My main takeaway:
(A) Rapid change is possible.

(B) We should pay more attention to cross-cultural studies to understand what other countries / cultures have that the U.S. does not and attempt to replicate it in the U.S.). Many studies are focused solely on the U.S. or other developed countries (at least the ones covered in the SWE literature review I’ll talk about in a second), which seems shortsighted to me, although I can understand the reasoning (scientific rigor). Caveat: We have to be very careful that we don’t just draw broad conclusions (e.g. “Muslim culture encourages gender equality in math/science scores,” an analysis against here).

(C) It’s a shame that facts like the existence of countries with some measures of gender parity are not covered in engineering school — they’ll be covered in NarwhalEdu‘s intro to engineering course for sure. I’m going to make my own happy bubble on the internet free of some of the indignant ignorance you can find online.

SWE Lit Review

My reading of the Society for Women in Engineering’s Annual Literature Reviews 2011 and 2012 went along the lines of “look at all these contradictory studies we’re not really sure about anything.” I still highly recommend reading them, though, for upbeat attitudes like this:

These women (33 female Greek engineer-managers) also talked about their efforts to find ways to show why it’s actually _good_ to be a female engineer, how being female makes you a better engineer.

The lit reviews also force you to not just read studies that reinforce your existing theories. They’re available in some weird and annoying webapp here: 2011 and 2012, or as PDFs I uploaded to google docs here: 2011 and 2012.

I highly recommend reading them.

My complaint with all this studying is that much of it is so passive. Let’s send out these surveys and try to interpret the results. Oh oops guess what it’s really hard to interpret these results and these other people in this other part of the country get contradictory results. Maybe we should split the results by sex orientation or race or different categories of engineering or, wait everything is more complicated than we think.

Time’s a-wasting, friends. ^^ Let’s go out and try things in the world, and reserve analysis for plotting how we can radically change the status of affairs. That’s the plan, see you folks in two decades.

What follows is a small selection of the articles I have been reading as well as the sole footnote.


For those craving some wikipedia, here are relevant articles (I have not read them all yet):

Feminine Engineer?

If you search from “feminine engineer”, the following blog posts pop up. I have excerpted a paragraph from each to entice you to click through and actually read them.

The Triplet State: Feminine, Female, and an Engineer

It’s almost as if society views being feminine, female, and an engineer as a forbidden quantum triplet state.  Even though quantum mechanics claims that a triplet state is impossible, it occurs.  In life there are always people to prove our preconceived notions wrong.  So maybe I am some sort of living dichotomy, a natural Frankenstein, of abstract-minded romantic and a systematic logician.  I am a Barbie-blonde cookie-cutter creation of femininity and a rebel fighting to fit in a male-dominant world.  So if I could chose two words to stereotype myself, I would chose female engineer.

Must a woman tone down her feminine side?

My 16 year old daughter adores math and engineering, and wants to be either a nuclear engineer, or a civil engineer. However, she is also a very, very girly girl who loves high heels, glitter, wearing pink, party dresses, and, well, just think Engineer Barbie, or Legally Blonde. She has been told that she will need to tone it down (a lot) if she plans to be taken seriously in engineering.

Female Engineering Student Stereotypes
An interview with MITERS‘s own Star Simpson!

On the subject of femininity, Star and I somehow got on the subject of shaving. As it turns out, neither of us shaves albeit for different reasons. To paraphrase Star, “it seems like a waste of time. Instead of shaving, I could be doing engineering – that’s what all of the guys are doing” 

… “A focus group of male engineering students told us that women in engineering were ‘nerdettes’ who are plain or ugly, despite visual evidence to the contrary [my emphasis]. Senior women engineers increasingly tried to look inconspicuous in order to avoid hostile or situationally-inappropriate attention from faculty and peers, or to avoid common accusations from faculty that they were flirting.  (National Academy of Engineering, 2006). 

… Or is the influx of women engineers changing engineering? It seems like everything is pointing towards women being changed by engineering but I so badly want it to be the other way around.

Why Being a Female Engineer is Awesome (Part 1)
(There is no part 2).

It’s actually kind of uncomfortable sometimes how much people love that I’m an engineer. One woman I met monolouged for a good 10 minutes about how she admired me for breaking down boundaries and making a difference. 

… Even less drunk people have the same reaction. I met a well respected author at a swanky awards ceremony once, and when she heard what my job was she said that engineering was “basically magic”  to her. Unfortunately it wasn’t J. K. Rowling,  because that quote would have been extra awesome. But as it stands, I’m pretty sure only engineers and magicians can claim that people think they have some super human powers. I mean,  just look at Iron Man.

True Child | Femininity & Science, Technology, Engineering, Math
A collection of some interesting research papers on this topic (complete with abstracts).

Dr. Maria Klawe is the lady who has achieved near-gender parity in Harvey Mudd’s CS program since becoming president in 2006 (less than a decade ago!).

Why female H.S. not study engineering
1) it’s boring
2) won’t be good at it
3) wouldn’t want to hang out with dorks and nerd


[1] 42% number is from the book Gender Codes, page 32:

In 1987, computer systems analysts comprised 34% women, while computer software developers (e.g., programmers) comprised 42% women. Incidentally, computer systems analysts have also been better paid on average than computer software developers on average, between 1971 and 2006.

If you want to dig deeper and get the raw data, I was able to find the data for the bottom graph, % women with CS majors, in publicly available NSF data. The Gender Codes book looks at data from 1966-2006, the latest data is here (1966-2010). I believe the author used #33 “computer sciences” under “Field of Degree.” (PDF, XCL, image preview:

or in percentage form here).

I could not, however, find the relevant Bureau of Labor Statistics for the graph from which the 42% statistic is drawn. The citation in Gender Codes is a terse “13. Bureau of Labor Statistics Database, accessed May 2008, courtesy of Peter Meyer.” and I was not able to navigate the BLS site sufficiently well to find this data. BLS does have a nice beta dataviewer in-browser tool, but it only had 2010-2012 data.


….well, so much for building robots today.

To be feminine or not to be (as an engineer)

This is an email I sent out to poll my friends, but as it also serves as a useful summary of my recent readings, I will post it here in all its messed-up footnotes glory:
How much should i emphasize that I am female in my life if the goal is to have the most impact on female representation in STEM I can as one person?

But actually i would really appreciate thoughts or research or statistics on this.

If we accept the premise that stereotypes play a role in all this, [6]
in my mind there are two approaches to being a female entrepreneur:
1) be a diva (combat “1337 male hacker” with “1337 female hacker”)
2) be an everyday person (“all types can be female programmer”)
For 1), I look up to people like ladyada (on the cover of WIRED) and debbie sterling (goldieblox). When I talked to ladayada / ptorrone they said they explicitly grew the company so that ladyada (a) gets to do as much technical work as possible and (b) remains as the publicly visible front of the company. And it’s sort of nice in an aggressive way to be in-your-face feminine and competent, to try to break the link between feminine and competency. Also people have told me that female role models are very important.

For 2), there’s a reactionary sentiment against over-sensationalizing that you’re female [3] and  instead emphasizing being a human being [7], but I don’t know if this is just “be humble” “be quiet and skinny and take up less space.”  [5] In this case, I’ll should just be my normal not particularly feminine self.
In particular, I would appreciate help finding science about either of these approaches instead of just gut instincts / blog posts. I can’t seem to word my question appropriately for google scholar though.

To some extent it doesn’t matter immediately since i know which approach i prefer (#2) and it’s better to act than philosophize all the time, but I am struggling to find research that isn’t just a bunch of academics being confused as to why progress is stalled [1] [2] (maybe it is a reflection of conditions 10 years ago?). But in media production for the course, I can easily play up being feminine (nail polish, makeup, clothing) or not. I wouldn’t mind this at all, and it sort of plays out haphazardly right now depending on how I feel.

[1] ” Moreover, as we will elaborate further, we have noticed a sense of alarm concerning trend in science, technology, engineering, and mathematics (STEM) disciplines in general, and engineering in particular. It was possible in the recent past to point to gradual increases in the numbers of women in engineering and to define those increases as positive indicators. Any confidence that it was just a matter of time before gender equality in engineering would be achieved has, instead, been undermined by the reality that those increases have either slowed or stopped altogether.”
http://www.nxtbook.com/nxtbooks/swe/litreview2012/#/226 SWE 2012 compendium. I uploaded the relevant portion as a PDF here.

[2] “Women Gain in Some STEM Fields, but Not Computer Science”
“Computer science actually is more male-dominated today than it was two decades ago: Women received 29.6 percent of computer science B.A.’s in 1991, compared with 18.2 percent in 2010.” http://economix.blogs.nytimes.com/2013/11/15/women-gain-in-some-stem-fields-but-not-computer-science/

[3] ” I don’t see any solution other than time and perseverance.  Meanwhile I’m sick of writing about it; I’m bored silly with it.  So I’m going to cut to the chase, close my eyes, and pretend the problem is solved; we’ve made a great cultural leap forward and the whole issue is over with. And I’m going to write the profile of an impressive astronomer and not once mention that she’s a woman.”

[4] http://miters.mit.edu/blog/2012/11/02/what-is-a-miters-2/ or for more commentary, skim through http://orangenarwhals.blogspot.com/2013/12/my-reply-to-charless-on-200gokart-us.html
In response to whether people were intimidated by MITERS’s reputation or not sent to all MIT undergraduate dorms via email:

[5] I also remember reading somewhere how this one programmer felt strongly that she was a “normal female” who left work at 5 and went out to shop for shoes and didn’t do hackathons during the weekends, and so she doesn’t really have role models she relates to. I also feel this way strongly due to my experience with MITERS where both M and F were “intimidated” by the hacker stereotype (although F more so statistically [4]).

[6] “But even when fields are defined more precisely, countries differ in some unexpected ways. A case in point is computer science in Malaysia and the U.S. While American computer scientists are depicted as male hackers and geeks, computer science in Malaysia is deemed well-suited for women because it’s seen as theoretical (not physical) and it takes place almost exclusively in offices (thought to be woman-friendly spaces). About half of Malaysian computer science degrees go to women.” http://contexts.org/articles/spring-2011/what-gender-is-science/

Look at all these countries with >50% of science degrees going to females! (it sounds like the post-graduation opportunities are still lacking though)

[7] http://en.wikipedia.org/wiki/Finkbeiner_test

. To pass the test, an article about a female scientist must not mention:

  • The fact that she’s a woman
  • Her husband’s job