Home

Advertisement

Customize

Previous 10

Nov. 24th, 2009

condylarth

FLPGotD

Consider an idealized Newtonian universe with a uniform gravitational field. Roll a ball up one side of a radially symmetric hill, so that its velocity is zero at the top. Reverse time; the ball now appears to break symmetry spontaneously. Is this a paradox? Why or why not?

Nov. 6th, 2009

mew

a thought

I guess everyone has their own completely unrealistic ideas of other people.

Sep. 28th, 2009

perl

FLMPotD

Find a property characterizing a subset W of a vector space V, such that W is obviously closed but nonobviously empty.

Sep. 24th, 2009

pitstop

on polls

Suppose you want to give a choice to many people, in an attempt to simulate a random variable. For example, you may ask each person to say "Yes" or "No". However, they may then infer that you are using the result to decide whether to do something, and their response may be biased. You then desire choices with as little connotative difference as possible.

I currently have "Pick an element of {-1, 0, 1}". Any ideas for simple ways of improving this (using only text)?

(You can also vote here if you want, and haven't on chat.)

Sep. 1st, 2009

perl

Six Degrees of Wikipedia

So it turns out most of Wikipedia (decently-sized, decently-written pages) has a diameter of three or four links, with occasional pairs requiring more. I've only tried five pairs; feel free to play around.

(Requires Algorithm::SixDegrees. May do unexpected things if page titles have weird characters or pages have lots of links.)

Jun. 14th, 2009

condylarth

Collaborative Writing (Part 2)

(Part 1)

Part 2 )

(Part 3)

May. 29th, 2009

condylarth

cesium presents: ranks

Confused by the abundance of fictional militaries that adapt existing rank systems into mutual inconsistency? Here at last is a single definitive standard.

AdmiralAckbar
CaptainMarko Ramius
CommanderJames Bond
EnsignWesley Crusher
GeneralJack O'Neill
LieutenantLouis Hoshi
MajorMajor Major Major
MarshalÉomer
Petty OfficerMaster Chief
SergeantSchlock


For example, if you can't remember which of Commander and Ensign is higher, just decide whether Wesley Crusher could command James Bond. Simple!

May. 27th, 2009

condylarth

a minor joke

Q: Why does it take longer to write code in Z[√-5]?
A: You have to refactor.

May. 11th, 2009

ufo

Monty Hall

I've always felt that the simplest explanation goes as follows:

The initial chance of being correct is 1/3. There is always a goat behind one of the other doors, so opening that one gives you no extra information. Therefore, the probability remains the same.

Unfortunately, it hasn't proven very successful at convincing people.

May. 4th, 2009

condylarth

why Java forbids multiple inheritance

Oh man... Mega-Japan is back. I'm curious whether any of my LJ friends know him firsthand? Or at least have heard of him (her?). Anyway, back to our main attraction.


Besides all the namespace and super ambiguities, there's a fundamental reason.

Suppose we have a class A with two ints and a char.
+-----+-----+---+
| int | int |chr|
+-----+-----+---+
^

A pointer to an object of this class will point to the start of the data, at the caret (modulo some stuff).

Now we create class B extending A, and add a long.
+-----+-----+---+-----------+
| int | int |chr|    lng    |
+-----+-----+---+-----------+
^

The data is stored in order of the type hierarchy. The pointer still points at the beginning of the data, which is the stuff from class A. If you want the long from B, since you know exactly what data A has, you skip that many bytes (in this case, 8).

Here's the thing -- if a reference to B is interpreted as a reference to A, you can still access the A data, because it's still int-int-char after the pointer. This means that Java doesn't even have to explicitly implement polymorphism, except in the type-safety checks. Every subclass is guaranteed to have the same data in the same order as the superclass, so you can just look at offsets from the pointer and everything works.

If you have multiple inheritance, now you have to combine the data of two object hierarchies, and there's no way to tell for certain where a given piece of data is. Languages like Python get around this with maps of names to locations, which are recalculated whenever you inherit. This is much less efficient, but lets you do fun stuff like dynamic attribute and class creation, or hacky manipulation of what people see when they access something.

Anyway, yeah.

Previous 10

Advertisement

Customize