2010-03-01

Sorry about Anonymous Commenting Being Turned Off

A loyal reader has informed me that anonymous commenting was turned off. My apologies, I've switched it back on.

2010-02-28

Trust in Giant Corporations


Nothing improves trust in a multi-national bank's online security quite as much as a directory listing for a home page.

2010-02-07

It's The Small Things

One reason I love VHDL is that the store operator isn't the equals sign:
IF (SHIFT = state_reg) THEN
read_value <= next_value + read_value;
END IF;
Here is some (nearly) equivalent code in C:
if (SHIFT == state_reg) {
read_value = next_value + read_value;
}

Both lines of code instruct that if state_reg is equal to SHIFT, read_value should be incremented by next_value.

In C the = sign doesn't actually mean equals - that is what the == symbol means. In C, as in most programming languages, the = symbol really means "store the right-hand value into the variable." This caused me no end of confusion when I started programming - if you subtracted read_value from both sides of "read_value = next_value + read_value" wouldn't you get "0 = next_value?" In reality the line instructs the computer to add next_value to the current value of read_value, and store this sum back into read_value.

In VHDL = means equals and <= means store. Unfortunately <= also means less than or equal to. I would have preferred VHDL to use the symbol <- for store. In the first programming language I ever learned, TI-86 BASIC, there was a single-character symbol for <-. I still find the first line below to be the most intuitive of the three:
sum <- element + sum
sum <= element + sum
sum = element + sum
I doubt programming languages will ever change from the equals sign to something else, but I would appreciate it. Every now and then my brain seems to go into math mode, and the = symbols still cause me confusion, but the <= is close enough to <- that I don't seem to notice. Oh well, maybe I'll never master C.

2010-02-03

PyCharm

I love PyCharm from JetBrains! I used Resharper when I was a C# monkey, and I am all ready much more productive with Python because of JetBrains. If you're a Python programmer you have to check out PyCharm as an IDE.

2010-01-26

Software Fail



My license is actually valid.

Just so you're aware, people use Xilinx FPGAs and the tool-chain for critical systems. I hope I'm not shaking your faith in that PET scanner, though. They're probably free from the issues associated with radiation therapy systems.

2010-01-19

The End of an Era

Tomorrow my @mit.edu account expires. It is about time, but I'll still miss it like crazy. The account was easily the best managed e-mail and file account I've ever had. I had over 12,000 messages in my inbox alone and nearly a gigabyte of files, capturing some of the best things I ever experienced, along with some of the most educational.

Farewell, account!

2010-01-07

Officially Old

With another birthday under my belt and the new year started, I am officially old. On the other hand, I've now been programming for more than 10 years! I dug up an old piece of my code, prime3b.java, which was last modified on July 14th, 1999. Technically, I've probably been programming for 12 or 13 years, but I don't think my self-taught, TI-86 programming should count as programming.

According to Wikipedia's Java Version Page, this program would have been created for Java 1.2. The program took a number, computed all the primes to that number, and could print out the calculated primes or number of primes.


import java.util.*;

public class prime3b
{
public static void main(String [] args)
{System.out.print("Would you like to print out all the primes?");
String cond = KeyBoard.readString();
boolean f = true;
boolean d = true;
if (cond == "no")
{f = !f;
}
System.out.print("Would you like to print out the number of primes?");
cond = KeyBoard.readString();
if (cond == "no")
{d = !d;
}
System.out.print("Enter a number:");
int x = KeyBoard.readInt();
int a = 0;
int b = 0;
int []m = new int [100000];
m[0] = 2;
int z = 0;
int e = 0;
int c = 3;
int y = 0;
long t1 = (new Date()).getTime();
for(; c <= x; c = c + 2)
{y = (int) Math.sqrt(c);
for(z = 0; m[z] <= y; z++)
{a = c % m[z];
if (a == 0)
{b = 1;
}
}
if (b == 0)
{e++;
m[e] = c;
}
else
{b = 0;
}
}
long t2 = (new Date()).getTime();
t2 = t2 - t1;
z = e;
if (f == true)
{for (; z != -1; z--)
{System.out.println(m[z]);
}
}
if (d == true)
{e++;
System.out.println("There were " + e + " primes at or below " + x);
}
System.out.println("Time is:" + t2);
}
}



PS In case you're wondering about my instructor's feedback, he said that one day I would be a superb programmer, after I had been crushed by the complexity of a few systems (I don't think he said "been crushed by", maybe "grappled with?"). This would teach me discipline, actions like encapsulating code into functions, thinking about testing, using standard formatting, using better variable naming, checking inputs, checking boundary conditions, and learning that code was also meant for people.

I'm still hoping his prediction comes true.

PPS I think most programmers fall into two categories: OCD programmers who need everything perfect, constantly re-visiting and re-working, or lazy efficient programmers who do the least amount of work even if it means more code. I think the above firmly puts a younger me into the efficient camp.

2009-12-16

Nature and Nuclear Reactions

I've blogged about toilets evolving in nature, but apparently nature also created self-sustaining nuclear reactions:
Perrin and the other French scientists concluded that the only other uranium samples with similar levels of the isotopes found at Oklo could be found in the used nuclear fuel produced by modern reactors. They found that the percentages of many isotopes at Oklo strongly resembled those in the spent fuel generated by nuclear power plants, and, therefore, reasoned that a similar natural process had occurred.
...
Scientists think these natural reactors could have functioned intermittently for a million years or more. Natural chain reactions stopped when the uranium isotopes became too sparse to keep the reactions going.
It is amazing to me that the random motion of matter can create a self-sustaining nuclear reaction with an average power output in the 100 kW range. This interesting anecdote of a complex system arising from random processes is evidence that long time periods and random processes can create surprising, complex systems. Maybe even life?

2009-12-11

Google Wave Invites

Even after sending many invites, I still have a few left over. Let me know if you want one.

2009-12-10

Auto-Pilot

I'm sorry I haven't posted. I've been so stressed out lately that it has taken everything I have to focus on getting an iota of work done every day. I tried writing a long, thoughtful post about what is happening, but it just sounded lame.

I'm not dead, I know I'll eventually have things to blog about, but those things just aren't going to happen any time soon, at least not until I'm back in the states for vacation. You can check out today's PhD strip for a decent run-down on the current events in my life...only imagine someone who is convinced that working now will lead to laziness later, but instead this working is leading to more trouble with working. Or some other non-sense like that.

2009-11-21

Rejection

Last week I went to an astronaut's speech on the future of commercial space flight. The astronaut, Steve Smith, worked on the Hubble Space Telescope while it was in orbit. I got to meet and talk with him personally for a few minutes, and loved every second of it.

He had a lot of interesting anecdotes, but the one that I'm still thinking about is this: the space program rejected him as an astronaut candidate four times before being accepting him. You can only apply once every two years, so he was living in a state of space-program rejection for eight years before being accepted. I wish I had had the foresight to ask him whether this was normal for astronaut candidates, or if he was an exception. Either way, the fact that he keep reaching for his dream, even after eight years of rejection, is amazing and inspiring to me.

2009-11-07

Chip



My 2.5 by 2 mm^2 integrated circuit design was finalized yesterday. Maybe now I can stop stressing out so much?

Probably not.

2009-11-02

Randomizing a Coin Toss

Way to report only the problem, Freakonomics blog:
But it may be that the the random coin toss isn’t so random. A 2007 study found that a vigorously flipped coin is likely to land on the same side it started on at least 51 percent of the time, possibly more depending on the person doing the flipping.
Say you have a coin with a bias that doesn't change from flip to flip. You can remove the bias by flipping the coin twice, and taking the first result if the second result differs from the first or repeating if it lands the same way both times.

Mathematically, if the probability of landing heads is P, then:

  • P^2 = Prob[HH]
  • P*(1-P) = Prob[HT]
  • (1-P)*P = Prob[TH]
  • (1-P)^2 = Prob[TT]


Since the probability of HT is the same as TH, taking the first element removes the bias.

Mad props to von Neumann for inventing this trick (publication was "Various techniques used in connection with random digits"), along with fundamental portions of the theory for quantum mechanics, cryptography, and game theory. They don't make mathematicians like they used to.

2009-10-14

Temper

I don't normally blog about personal things, because I think they're lame and I really hate putting personal information onto the interweb. But I figured I've got to try most things once and see how it turns out.

I lost my temper today. It was pretty bad. If you know me, I may not seem like the kind of person who loses it very easily, and in general I think I keep my cool pretty well. Today just wasn't my day.

Today at work, one of my officemates made a passing remark about gay people and how they were decreed to be killed in his home country. He was talking to another person at the time (not me), but I thought the way he phrased it was completely inappropriate. What I thought I heard was a statement supporting violence against people based on their sexual preference. What he probably said or intended to say was a factual statement about what happens in his home country because of the laws. In retrospect, as he isn't a native English speaker, the intention of the statement and what were said were probably different. I think the words "should," "could" and "would" are particularly difficult for non-native speakers to grasp. Even native speakers aren't clear with their intentions in everyday conversation.

Anyways, I then asked him if he would please keep the hate speech out of this country.

A large fight ensued where I lost my cool. He claimed the remark wasn't for public consumption, but at the same time I heard it and pointed out that other people use our room. When he makes remarks like the one he made, other people listen and he implicitly represents our group, and hence me in such remarks. We ended up taking the issue to our adviser, who as head of our group is mostly responsible for our group image.

My adviser agreed with me about our room and our remarks being public. My adviser warned my colleague to be more careful with his words in the future. My adviser told me I needed to be less strict in my interpretations of what people, especially non-native speakers, say, and that I shouldn't assume their intentions from their speech. He also said not to overreact so much. I think I agree with him on all statements. I lost my cool, and need to be more understanding of the slipperiness in communications.

I would be lying if I said there hasn't been a build-up to this, or to the other times I've lost my cool. The way my officemate structures his speech would be extremely rude in Iowa. I've tried explaining it, but so far without much success. Maybe the problem is with me? I don't know. Things aren't really great between us. He accused me of being a spy today (I don't think he knows what the word means), and I think I've burned too many bridges to try and explain to him how he is subtly insulting me. He probably wouldn't believe me anyways - I'm a spy, right?

I'm been having some problems with my temper lately (when I say lately, I mean over the past two years, since leaving university). At my last job, I had pretty big issues with how long it took to accomplish things. I'm a pretty lazyefficient person, and when I do work I want it to matter. I get angry when it doesn't, or if I did unnecessary work. Making sure I take the right approach to getting things working is very important to me, and I think it makes me a good engineer. I know I can focus my anger when things don't go well. I distinctly remember times in middle school when I did poorly on a test and studied non-stop because I was angry about it, and the next tests always came back with high marks. At the same time, it seems over the past few years my temper has starting to get in the way of getting things done in the most efficient manner. I should have asked my officemate to clarify his statement, not immediately assumed a bigoted intention. I should have known that getting things done quickly is different for a very constrained university assignment than for work in the corporate world.

I thought I'd share this moment of anger with you. While writing about it has been a bit cathartic, I'll still be fuming for the next few days.

2009-10-12

How are Our Children Going to Get Out of Bathrooms?

It was roughly 2 am on a standard night at MIT. Pacing the hallways with my trusty football, I asked a few people if they wanted to hit up a local shop for some late night chocolate milk and Italian subs. Receiving an affirmative, I told them I'd be back in a moment. I really had to go to the bathroom.

Having finished my business and washed my heads, I went to unlock the bathroom door. The knob turned, but the latch did not retract. I looked at my football. We were stuck in the bathroom.

After yelling and attracting the attention of some local residents, I asked if they had any bright ideas. One suggested re-locking and unlocking the door, which had allowed her to escape a similar situation several days ago. Alas, it did not work. I looked at my football again. Still stuck in the bathroom.

But wait! I had my trusty Gerber multi-tool with me! Holding my football a bit steadier, I whipped out the mini-screwdriver, took off the doorknob casing, had some friends help take apart the rest of the doorknob, pulled out the latch, and escaped the clutches of the bathroom (EDIT: this sentence was modified to properly attribute work to people missed on the initial post).

Today, the NYTimes ran an article on schools punishing children for carrying multi-tools. I want to know from these multi-tool nay-sayers: Who is going to get our children out of the bathrooms at 2 am? Because I don't think it is going to be you.

The Invention of Google Wave: A Play in One Act

Date: roughly one year ago. Two twenty-something google engineers (both decked out in blue google t-shirts and jeans) sit on their fitness balls. One sips some strange coffee-like concoction while the other downs an Odwalla drink. Engineer one checks his e-mail.

One: That jerk Larry from HR keeps top-replying to my emails. Seriously. Who the h#** uses top-reply these days?

Two: Everyone but nerds uses top-reply. Didn't you talk with new girl? She was an M$ intern last year, and apparently M$ mandates top-reply in their emails.

One: And what if you want to respond to multiple points in the e-mail?

Two: I think Outlook would have crashed by then.

One: Seriously, this is non-sense. We need to get some giant conspiracy going to make bottom-reply the default.

Two: I have an idea. How about we claim we're merging IM functionality with e-mail. But in reality we'll just be forcing people to use the indent-reply conventions nerds have been using for the past 40 years, and give people too stupid to setup IM notifications of email events the chance to get e-mail instantly.

One: That sounds awesome. We'll dress it up to look fancy, so people aren't so intimidated by the less than signs that would normally occupy the start of the line.

Two: I know. Heaven forbid people learn how to use conventions, or look at plain text.

One: Oh, and we can put in annoying features that geeks would hate! Maybe we can have it immediately show the person's reply, while they're typing! Heaven forbid people think before they respond, like us introverted nerds do with emails, so the hundreds of people getting our emails don't have to sit through our mistakes. We can cut out the subject line, too - it isn't like people use that to its potential.

Two: Those sound like exactly the sorts of nerd-hating features that'll launch this project into the big time! Let's get coding.

Curtains close as furious keyboard pounding commences.

2009-10-11

Tape-Out

If you've talked with me lately, I've probably told you how stressed out I am about something called a "tape-out." The phrase refers to production of an integrated circuit. According to my adviser, 20 or 30 years ago, before the internet was around, circuit designers would send physical tapes to the chip manufacturers. Hence the term tape-out. Thus when an electrical engineer is creating an integrated circuit, (s)he uses the term tape-out to describe the process.

Today I thought I'd share a little bit of the designer process, so you can understand what I'm talking about when I say I've been staring at colored polygons all day. Circuits perform a lot of tasks, from the main processing in our computers, to capturing images in some of our cameras, or detecting events in the world around us.

To create circuits to do all these things, engineers start simple and build up. The basic unit in an integrated circuit is the transistor, which acts as a switch in digital logic. The switch is on or off depending on the electrical signals we send to the transistor. I've taken public domain pictures from Wikipedia that shows the behavior when the transistor is off (first picture) or on (second picture).




The basis for transistor construction is the placement of materials with different characteristics. The "n" and "p" labels above are on materials with different elements. Placing these materials at proper distances from one another is critical to proper operation of the switches.

When electrical engineers create circuits, we need ways to control where the materials go, and then we can control the behavior of the circuit. Thus when I talk about colored polygons, I am talking about visualizing the locations of different types of material that determine a circuit's operation. I've labeled the drawings above with the colors of the layers, and including a screenshot of what I look at when I am using software to "create" a transistor. The wikipedia images are from the side, whereas engineers view things from the top.




The red polygon, representing the gate, interfaces with the control signal for the transistor. The green layer represents the 'n' implant into the 'p' type silicon. The blue layer is a metal routing layer on top - there are other metal layers for routing, along with via layers such as the teal layer above that connect metal layers to other layers.

You'll notice I don't specify all the layers. The silicon dioxide layer, dashed in the figure, doesn't have a corresponding polygon. Some layers are auto-generated from other layers; this can create problems when you want to do something fancy.

Starting from these simple layers, we can quickly build up complicated devices. I didn't mention this before, but there are actually two types of complementary transistors on most integrated circuits. This is the basis for the term CMOS, or complementary metal oxide semiconductor. The next picture shows both types of transistors. You can check out the CMOS Wikipedia page if you're interested in the two types.



The structure you're looking at is an inverter, as it outputs the opposite of the input signal after some time. If you're confused by the layers, follow the red polygon (the gate) to the green areas - the overlap area would be the two transistors. The yellow and white dotted layers help describe which type of transistor is to be created. The big orange box around the top portion would change the material in a large area, and is required for one of the two transistor types. The teal / cyan squares are vias that connect the metal to other material. Though vias only connect to the green layers in the transistor I showed above, they can also connect to other layers.

There are additional metal routing layers than the metal one I've shown so far. The next picture shows a custom structure I have made. This structure includes yellow and white polygons, which represent metals at different heights than the metal in the previous images.



The purple and orange squares represent vias between the various metal layers. The structure that you're looking at is a variable-delay buffer. It takes a control signal and an input signal, and outputs the input signal after a delay which is set by the control signal.

I've included measurements on the side of the structure in microns, or one-thousandth of a millimeter. A micron is also one-millionth of a meter. When you hear people talk about different integrated circuits production processes, they'll usually use the minimum accuracy of the gate size as a first-order statement of how advanced the process is. This is a 0.35 micron process, meaning that the minimum gate size is 0.35 microns, or 350 nanometers. The current processor in your computer is probably a 45, 90 or 130 nanometer process.

You might ask why people care about the construction of the circuit - don't we really just care about the behavior? Digital engineers do tend to care more about the behavior than the construction itself, and they usually don't lay out circuits by hand. They usually specify the behavior using some type of code, and run this code through a bunch of fancy tools to get the material locations.

However, if you work with sensors, it is often more difficult to specify the exact characteristics of the structures than simply laying out the structures by hand. This is the case for most of the work my group does.

There is the additional problem that messing up means the entire circuit might not work. This is why I'm constantly stressed out - while one mistake can cost a software person months of their life, simple things are enough to easily prevent this. This often isn't the case in hardware, as creating the circuit takes months, and you're stuck with the circuit.

Well, I hope you enjoyed my post on tape-outs. I cannot post pictures of my more complex structures, as a lot of the cells I work with are proprietary, and the man would come after me. I'm finished with this tape-out in early November, and then it will be a few months before I know whether it was a waste of time. I'll probably be drinking a lot of egg nog at xmas time.

2009-10-10

Worst People



I'm beginning to think Google is out to get me.

2009-10-05

Architecture around TU Delft

The weather was nice a few weekends ago, so I went out and snapped a few photos. Enjoy!


This is a picture from the window of my new apartment. I now have a view of the canal. Sorry for the tilt, my head isn't on straight so it looks normal to me.





TNO is a large defense contractor in Delft.




A south view from my building.




A west view from my building, towards the part of town with the high-rise apartment buildings.
I've circled a bunch of the high rise buildings. As I've previously described, most of the development in Delft occurs on the outskirts of town. This preserves the town center as is.



You can see that along the canal there are a lot of industrial type buildings. A lot of heavy freight is shipped along the canals instead of roads, which means that the roads require less maintainence.



Some apartments near the university. You can see part of my building in the background.


Some apartments near the university. They stand over a pond.


Due to all of the bicycle traffic, it can be difficult to know whether a bicycle is supposed to go on a path or not. The people who designed the park in the middle of campus included environmental cues to help. First, the rocks are close enough together that a bicycle would have trouble going between them. Next, the gray sections of the path are rough; riding over the alternating path sections feels unnatural on a bicycle. The path goes down a few steps out of sight, so it is important that bicyclists don't go on this path. People don't seem to like signs here, Delft has a lot of these environmental cues around the city to help bicyclists with whether or not they belong in certain places.


The main bicycle path next to the mechanical engineering building. Exposed stairwells are very common here, I think architects like them.


My building.


The civil engineering building, which also contains administrative offices. Another building with exposed stairwells.


A set of dorm rooms are by my building.


Two Hogeschools (or vocational schools) have opened up next to TUDelft. When they were building this school, they had water in the lot that is now under construction. This building looked like one of those beach buildings on stilts. The empty lot will soon contain housing.



Another vocational school. This one is interesting because it contains a parking lot on the roof!