## Wednesday, December 4, 2013

### Using Arduino with Janus Vim (conclusion, who knows how janus/pathogen work, just follow two-year old instructions)

Some time ago I set up my vim config. This is usually a full-day ordeal for some reason I don't remember. I don't recall exactly what I did, but everything works now, and I am very happy with how it functions. My previous experiences have left me very wary of "fixing anything that's not broken" in vim... but enh I want Arduino syntax highlighting in Vim now that there's the sweeeeet
File > Preferences > Use External Editor
option in Arduino.

I think for the most part I just installed Janus:
https://github.com/carlhuda/janus

and it has really great autosuggest that makes typing repetitive Arduino code 10x faster.

 Lower left window: Autosuggest! So great~
Okay, so how to install Arduino syntax highlighting in Vim Janus setup?
There's this way that is pretty straightforward:
https://github.com/vim-scripts/Arduino-syntax-file

Just download file into a directory (in my case, ~/.vim/bundle) and add a line or two to .bashrc

nrw@nrw-PC:$cd ~/.vim/bundle nrw@nrw-PC:~/.vim/bundle$ git clone https://github.com/vim-scripts/Arduino-syntax-file.git

Edit ~/.vimrc and append two lines:

#### Voila! Done.

===
Below is a recounting of going down the rabbit-hole, if you ever wonder how I can spend a day on my vim config...
===
However, I feel like this isn't the cleanest way. So how does Vim/Janus handle syntax highlighting?

I feel like somewhere there is a folder of syntaxes that it handles.
Ah! using "locate .vim" I see that the folder is:
/usr/share/vim/vim73/syntax/

Should I just copy it there? Seems incorrect, I think I have to tell Janus somewhere to look for *.pde files.

Based on the pathogen documentation
https://github.com/tpope/vim-pathogen

It appears that I should git clone my .vim file to
~/.vim/bundle

cd ~/.vim/bundle
git clone https://github.com/vim-scripts/Arduino-syntax-file.git

Nope! I don't have syntax highlighting after restarting vim (I double-checked with :scriptnames) . Perhaps install in .janus folder instead?
cp ~/.vim/bundle/Arduino-syntax-file/ ~/.janus -r

Nerp still no syntax highlighting ;__; where do I tell it to look for both .ino and .pde files?

Hmm, it also appears that my Janus distribution is out-of-date based on the documentation (there is no NERDCommenter in my Janus as far as I can tell). But if I try to update
~/.vim\$rake /usr/local/bin/rake:9:in `require': no such file to load -- rubygems (LoadError) from /usr/local/bin/rake:9 Uh oh. I can feel the rabbit hole widening. http://stackoverflow.com/questions/2896485/no-such-file-to-load-rubygems-loaderror nrw@nrw-PC:~/.vim\$ which -a ruby
/usr/bin/ruby
/home/nrw/.rvm/bin/ruby

nrw@nrw-PC:~/.vim$sudo update-alternatives --config ruby There are 2 choices for the alternative ruby (providing /usr/bin/ruby). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/ruby1.9.1 51 auto mode 1 /usr/bin/ruby1.8 50 manual mode 2 /usr/bin/ruby1.9.1 51 manual mode Yep. Okay, so I need to nuke one of my versions. sudo apt-get remove ruby which -a ruby /usr/bin/ruby /home/nrw/.rvm/bin/ruby http://learnvimscriptthehardway.stevelosh.com/chapters/43.html Hmm, still two versions. Well. *shrug* Let's just kill one version. Ugh. I bet this is leftovers from all the EdX stuff I did that never worked and I didn't really document because I was so frustrated. AHHHH this is why I sometimes just NUCLEAR and reinstall my OS. Eheh. ^^; Nooo nooo bad brain nooo it is 10 pm on a Wednesday night. It is NOT time to reinstall my OS. Okay. Screw not messing up my system, it's already screwed up. 1) Add execute pathogen#infect() to my .vimrc NOPE Error detected while processing /home/nrw/.vimrc: line 134: E117: Unknown function: pathogen#infect E15: Invalid expression: pathogen#infect() Okay... Maybe I'll just follow directions. install details Just put the file in your vimfiles/syntax folder. To automatically use it on PDE files, add the following line to your vimrc file (or e.g filetype.vim to install it for all users) : autocmd! BufNewFile,BufRead *.pde setlocal ft=arduino Okay.... I don't have a /syntax folder. What is going on? Uhh. Well, I just put it into ~/.vim/bundle. And it works. ~__~ ah well. I guess I just have to follow instructions... === Colorize bash prompt https://help.ubuntu.com/community/CustomizingBashPrompt so now my ~/.bashrc just contains: color_prompt=yes if [ "\$color_prompt" = yes ]; then
PS1='\${debian_chroot:+(\$debian_chroot)}$\033[01;32m$\u@\h$\033[00m$:\[\>
else
PS1='\${debian_chroot:+(\$debian_chroot)}\u@\h:\w\\$ '
fi

===
Also, vim things I always forget:
To toggle whitespace,
:set list
:set nolist

To toggle linenumbers,
:set nu
:set nonu

To toggle paste-mode,
:set paste
:set nopaste

So ",n" will open NerdTree.

## Monday, November 18, 2013

### 6 AM rant about arduino

Hello friends,

I would like to convene an FTIAAP, aka Fix Things I Hate About Arduino Party.

Mostly, I think a lot of people use AnalogRead() and would like the Arduino IDE to just graph the variable already. It's a value from 0 to 1023. I want to monitor it while it scrolls by at lightning speed. No, I don't want to fire up Mathematica/MATLAB/Processing/Matplotlib (no not even python sorry) and write 10 lines of janky serial processing code. Arduino already has a serial monitor! I want it to be like

┌───────┐

│SWEET  │

│GRAPH  │

│THING  │

┌───────┐
│ Serial│

│Monitor│

└───────┘

*not to scale

Yea. Like that. I'll take just having updating boxes for each AnalogRead value, even, no graphs needed.

┌─────────┐

│Val1:1   │

│Val2: 123│

│Val3: 11 │

┌───
──────┐
│ Serial  │

│ Monitor │

─────────┘

I imagine that jankily it will start out like

Serial.graphsandponies(X);

Serial.graphsandponies(Y);

// Do not run graphsandponies() at faster than 1/10ms or everyone will hate you, including yourself if you are using windows

No more of this crap:

Serial.print("x1 "); Serial.print(loX); Serial.print(" x2 "); Serial.print(hiX); Serial.print(", y "); Serial.println(constY);

Like wtf no.

Barebones, finish in it a night code improvements. That's what I want to happen.

Oh, okay, so now I got started on things that bug me about the Arduino IDE.

On Linux, want to comment things out? Ctrl-/! Oh wait, all that does is f* up your code. But if you Ctrl-Z twice it will do what you wanted! WTF?

[begin]

pinMode(ELPin3, OUTPUT);

pinMode(ELPin4, OUTPUT);

[after Ctrl-/]

/

[crap Ctrl-Z]

[agh where did my code go? Ctrl-Z]

//        pinMode(ELPin3, OUTPUT);

//        pinMode(ELPin4, OUTPUT);

WTF?

Okay, and then let's say you, like a true Arduino user, are copy-pastaing off the internet.

Serial.print("Hello!");           //print out hello string

Heck yes. Who wants to actually type out code? Copy pasta!

Serial.print("Hello!");
Ah, I think I need another one.

Serial.print("Hello!");

Serial.print("Hello!");

Another one!

Serial.print("Hello!");

Serial.print("Hello!");

Serial.print("Hello!");

Why? Also seen in the classic "let me triple-click the line to copy it all"

LED_ON = true;
"hit enter and paste it"

LED_ON = true;

LED_ON = true;

Why? Also seen in the "let's copy more than one line"

LED_ON = true;
Okay! Hit enter and paste!

LED_ON = true;

pinMode(ELPin3, OUTPUT);

pinMode(ELPin4, OUTPUT);

LED_ON = true;

I hate everything.

If enough people are seriously interested I will try to bribe some real Arduino developer to come babysit us through getting familiarized with the codebase.

https://github.com/arduino/Arduino/tree/ide-1.5.x
todo post to: https://github.com/arduino/Arduino/issues?labels=Improvements&page=1&state=closed

~~
I'm going to email this out to friends when I figure out scheduling details and how motivated I am.

Mostly posting this because really what if my last post is making people uncomfortable? Can't let that happen. Better bump it off into oblivion...

## Tuesday, November 12, 2013

### why so slow? because my brain is overanalyzing everything in gender terms. thanks brain.

Whoa after a few weeks of discovering reddit i think i am ready to read actual books again

I am finally getting around to reading Why So Slow (), which I picked up from an MIT Press loading dock sale a while back (happens once a term). It's from 1999 and consists mostly of studies.

Semi-relatedly, something that has been bothering me: Over-analysis of everything in gender terms, where I see things that probably don't even exist.

Everything:
==

1) I wore a skirt and pantyhose recently. biking home alone around 3 or 4 am a car drives by and the some guy inside yells out "will you marry me?" ...It doesn't distress me, but I think I’m lucky I prefer neutral clothing. (although, even in neutral clothing, a seller at swapfest kept making a lame joke about marriage too. That’s how people make idle chit-chat, right?). I guess I just rate the likelihood of physical harm, conclude it nil, and then mark it down as another datapoint to reinforce my existing perceptions of the world (and future blog-post fodder of course).

2) Robot conferences: I look at a conference like NERC

and my first thought is “oh great, more old white guys.” I asked my friend and she said her first thought was “Cool! Robot conference! I want to go!”

It is a real issue, though. For an alternative approach, see how IGEM has organized their conferences. http://blogs.scientificamerican.com/oscillator/2013/11/04/gender-and-synthetic-biology-interview-with-an-igem-student/
We knew when we started working on this subject, that many fields in science suffer from gender bias, but because synthetic biology is a new field we expected that historical biases would not apply and that we would not observe an important gender bias. However what we found out is that the bias we observe in synthetic biology is very representative of the bias in other fields of science.

3) For background, see http://microaggressions.tumblr.com

My friends sometimes tend not to discuss technical things with me, and I'm uncertain if that is because I am female, or because I have been too tired to care about technical things lately and my friends are picking up on that, or just that I need to initiate more technical discussions and people will be associate me with being interested in these topics. People (I guess mostly I am thinking of MITERS, where I spend the most social time) will discover interesting things or make exclamations and walk right past me to talk to someone else. (Or maybe my brain is making things up as usual). (To any suddenly self-conscious friends: don’t worry, if I really cared and wasn’t just tired all the time I would interject myself into the conversation too).

4) I made a gif for our NarwhalEdu kickstarter. Here in media production land I actually think it’s very important to be “affirmative action.”

See:

But my brain takes it too far. My brain thinks: good, feminine handwriting. Okay, let’s write “fun” in a different color, maybe our logo color. But now it’s all guy colors. Well let’s add orange! I like orange. Enh I want to add a third word, let’s choose green, I like plants.

Then the feedback I get back is that it’s not professional looking and we should stick to two colors. But--but--shut up, head. It doesn't matter. (not fixed yet because I tried it and it looks aesthetically ugly).

5) I think it is important to over-represent minority populations in media whenever possible, since usually they don’t exist in media. But then how do I feel when I get pulled for a representational picture of MITERS on the MIT student groups listing?

(brought to MITERS' attention because we have way more than 7 members, by the way).

I am amused, because it looks like I’m working on the bike trailer that is not my project. I am amused, because it’s not actually really representative of the way MITERS is at all (it’s still 90% male), despite my best efforts/experiments.

Of course, this is probably ALL IN MY HEAD. They probably just scrolled down until they found a decent image and used that. Heck, I look like a guy in the picture. I wouldn’t even be thinking about this if it weren’t for browsing through How to Be Black which was on Steve’s desk the other day (I have not actually read it all yet, though) and the author talked about always being at company representation events. I would just feel my usual conflicting attitudes toward publicity.

==

As I said, this blog post is part of my solution to over-thinking: write these things down

(but the list always just gets so long once I get started. I cut it off. For the future: my hall female mailing list on grad school and sexism),

then get so busy that I don't have time to wonder about these things. I mean, seeing these all the time doesn't make me any happier or more productive. It doesn’t solve anything, it doesn’t excuse my own failures. Perhaps it makes me more empathetic, but I’m still going to keep on perpetuating everything society has taught me to perpetuate. I will still screw up.

The only solution is to keep living.

Or to go live out in the middle of nowhere with some other female engineers and have a rocking time by ourselves. Maybe then life wouldn’t be so tiring all the time.

==
Disclaimer: I am using anecdotes here to make a point, which isn’t actually what you should do. You should read and summarize studies and then use anecdotes to prove a point. But this blog post as always remains about my life and the issues on my mind.