| (no subject) |
[Nov. 18th, 2009|06:28 pm] |
Ever wondered what my user icons were about?
 | After playing and falling in love with Oni, and experiencing Berkeley for two years, I decided to dye my hair purple. Over time, purple faded to blue, and when I added green, you know what the result looked like: Awesome! |
 | The first and only time when I was singing "I'm singing in the rain" in the rain. Although the downpour was strong, the water was surprisingly warm--which is why I was soaking wet by the time I took this photo. |
 | Hooked by my feet in a park in San Diego, hanging upside-down on a sunny day, I asked my parents to take a picture of me. Here it is! |
 | boggyb tells I had this icon when I first joined LiveJournal. Even though I don't remember it, I was fond of the symbolism at the time (as I am still, actually), so there's emptiness. |
|
|
|
| Stories |
[Sep. 10th, 2009|12:02 pm] |
| [ | mood |
| | curious | ] |
| [ | music |
| | Corderoy - Sweetest Dreams | ] | Before I forget, here is what I defined yesterday:
A good fiction book advances through the plot via one of these three techniques: Mission, Mystery, or Maturation. (I decided to use the same first letter for them.) A hero may be guided through the plot by a higher mission (e.g. Frodo must destroy the ring); a hero may need to solve the mystery (e.g. Poirot discoveres who killed Ratchett onboard the Orient Express); or the hero may just be growing up (e.g. Harry Potter 1 & 5; two thirds of Ender's Game; Fahrenheit 451; American Gods). In fact, good stories combine these techniques, and often offer pieces of mysterious overarching plot, with the hero gradually maturing at the same time (e.g. Wizard's First Rule).
Question: am I right? Did I miss anything? Did anyone study this explicitly?
[EDIT] This link is good! http://en.wikipedia.org/wiki/Monomyth |
|
|
| (no subject) |
[Sep. 4th, 2009|01:15 pm] |
| [ | mood |
| | annoyed | ] |
| [ | music |
| | Black Sun (Ronski Speed Remix) | ] | What's with the fascination with insanity that prompts masses of people to identify with outspoken, mentally ill characters? Take Mr. Patrick Buchanan, and one of his articles that I found after following some hyperlinks. It's nonsensical. While the words are arranged into sentences with correctly-placed subjects and verbs (thought the same cannot be said about the punctuation), the sentences do not make any semantic sense:
"But why destroy Hitler? If to liberate Germans, [WW2] was not worth it."
This sufferer of logorrhoea seams to imply that these two sentences make sense when placed side by side, forming a Question-Answer form of rhetoric--unfortunately forgetting that the answer must always correlate with the original question. It's equivalent to the following sentence:
"But why read books? If you like Arthur Dent, then six times nine is not forty two."
This absurdism is beyond humorous; it's irritating. Here are the answers to Buchanan's questions: neither the US nor the UK destroyed Hitler, for he destroyed himself by simultaneously swallowing cyanide and shooting himself in the temple; no one had intended to liberate the Germans; and WW2 was horrid but unavoidable--seeing that no country was willing to acquiesce to Hitler's request to eradicate itself completely.
(That was my interpretation of the statement "it was not worth it". When attacked, it is not only natural but also right for the victim to defend. "Is it worth it" becomes synonymous with "is living worth it". However, seeing how Mr. Buchanan's essay is not an existentialist disquisition--I even doubt that he is capable of writing such--I must answer with a simple affirmation that living is a necessity for the living, by definition.)
Returning to my original question, I must ask: what made Mr. Buchanan so popular? He must have a following of people who can successfully read this entire essay and others like it, manage to extract a logical argument out of his ramblings, and even agree with them. But how can anyone agree with a random string of words? Maybe a large portion of the population is suffering from mental disorders? Is maybe his essays are not read by scanned, while the readers idly nod and conclude "This guy is a genius--he proved that World War Two was really bad! How come no one noticed that before?" Another possible interpretation is that Mr. Buchanan has recently descended into senility, and his editors allowed him to keep his day job out of kindness--and if that is the case, did the same happen to his readers? |
|
|
| Bed! |
[Jul. 29th, 2009|01:05 am] |
Suppose you have a queen mattress, but no box spring. Instead of buying a box spring, consider a simple Ikea bed, the Dalselv (which sounds like Dalek Server to me), with about $65 of modifications to make it awesome. If you do, here's what you'll need:- $100 - the actual frame
- $5 - a small can of wood stain. I recommend "Natural" colour.
- $5 - a small can of polyurethane. I recommend semi-gloss.
- $50 - 2 pieces of 0.75" plywood, 30 inches wide, 80 inches long, OR $40 - Ikea slats. This depends on your mattress: don't place a foam mattress on slats, for example.
- $5 - 2 foam brushes, 1 mini-tray, and sandpaper.
NB: assemble the bed in the intended room. It's bulky, and doesn't fit through most corridors. Sand and stain the wood. Let sit for 24 hours. Finish the wood with polyurethane. Let sit for another 24 hours. Assemble the bed. Place (sanded) plywood / slats on top of the bed. Voila! You can even keep modifying the bed: replace the metal pillars with wooden dowels, or change the height of the head board... All in all, definitely a great DIY project. :-)
I'll post pictures when it's all ready. |
|
|
| Unknown Inheritance |
[Jul. 7th, 2009|05:53 pm] |
1. Pointers-to-membersWhile a pointer to a member resemles a normal pointer, the two concepts are different enough to warrant a description. A traditional pointer to member points to a concrete object or a concrete function; dereferencing it will yield some data that you can use immediately. In contrast, a pointer-to-member is better thought of as an offset within a class. Here's an example to demonstrate it:
struct S { int m_data1; int m_data2; };
int g_data;
int main() { int * pData = &g_data; int S::* pData1 = &S::m_data1; }
So far, so good. pData points at the data, whereas pData1 points at... Well, this is where the analogy with an offset comes in handy. pData1 is an offset within a normal S object, that specifies which member to use; you still need an S object to use it:
S object; object.*pData1 = 0;
".*" is a special dereference operator, which is more of an "add offset" operator. This works on pointers as well, so if you had a pFoo, you'd say "pFoo->*pData1" to refer to the member you want to access.
2. InheritanceTechnically, there are only 3 inheritance patterns in C++: single, multiple, and virtual. Single - inherit from 1 parent. Multiple: inherit from many parents. Virtual: inherit from parents that probably have the same root parent, and avoid carrying duplicate definitions of the base parent.
Unknown inheritance is not actually an inheritance pattern, but it's still something that the compiler writers need to implement--when they examine pointers-to-members.
3. MemoryThose of us who'd grown up on x86 (which is all of you, actually) feel pretty good about the number 0. 0 is NULL, and that's all there is to it. A NULL pointer is always 0, and calling ZeroMemory on a struct is considered an okay way to initialize it.
But this is a dangerous notion to carry, for a couple of reasons: * First, code that doesn't run on x86 doesn't have to have its NULL pointers be 0 in memory. If you reinterpret_cast(pointer), you may discover some bits that are set to 1! * Second, this is exactly what happens with pointers-to-members! A pointer-to-member is an offset, so if it's pointing to the first data element, the value of the offset will be 0. But it itself is a pointer, and pointers can be set to NULL. See the problem?
int S::* p = &S::m_data1; int S::* q = NULL;
Since you can't reinterpret_cast from one to another, fire up your debuggers and examine the contents of p and q. P is 0, as promised; but q is the surprise: in Visual C++, it's 0xffffffff, which is a special value that the compiler uses to indicate a NULL pointer-to-member. See why you have to be careful about using ZeroMemory now?
4. Inheritance and sizeof()If you take the sizeof the pointers to members in the previous sections, they'll all be 4 (on x86), which is expected. You may even wonder why you can't reinterpret_cast that value to an int.
Here's why: the more complicated the structure gets, the more bytes you need to represent it. If you have a pointer to member data, it almost always stays at around 4 bytes. If you have a pointer to a member function, it's also 4 bytes, until you involve inheritance. If your struct inherits from multiple parents, you'll need 8 bytes. If your struct involves virtual inheritance, you'll need 12.
And in one special case, you may need all 16:
struct S;
int main() { cout << sizeof(int (S::*) ()) << endl; }
In this case, S is not defined; but the compiler nonetheless needs to represent an offset to a member function that takes no parameters and returns an int. Since the definition of S is not available, you don't know if you have single, multiple, or virtual inheritance; you know nothing about the struct; so you better pack as much info as you can. At least, that's what VC++ does. And this is what's called "Unknown Inheritance".
Now, you may have noticed an inconsistency: if you have a definition of S, then the pointer takes only 4 bytes. If you don't, then it takes 16. So if you pass a pointer to a member function from one file with the definition to another without a definition, what would happen? The answer is that most people don't use unknown inheritance, and the compiler optimizes for the majority case by using fewer bytes. However, if you need strict compliance, you need to pass in the special flag (/vmg for CL.exe, see http://msdn.microsoft.com/en-us/library/yad46a6z(VS.100).aspx) to make sure that ALL pointers are 16 bytes, and that you never have an inadvertent size mismatch between your pointers. |
|
|
| Separate Realities |
[May. 15th, 2009|11:47 pm] |
| [ | mood |
| | sleepy | ] |
| [ | music |
| | DI.fm - Trance Channel | ] | One interesting and difficult problem about constructing artificial intelligence is the fact that in reality, and in our heads, all information is tied to a specific domain. We, humans, are surprisingly good at discerning the topic being discussed: instead of storing all our memories sequentially, we categorize and tag them, and "write them out" into the appropriate database, a.k.a. domains. The complication comes from the fact that these databases themselves need to be categorized.
And different people have different ways of dealing with this task. Suppose you're reading Stephenie Meyer's latest noel, and you realise that instead of burning in the sunlight, the vampires simply shimmer. Being an avid vampirologist, you realise that it's bollocks, but you want to continue reading the novel nonetheless. While you have a couple of options, the route you'll take most likely will involve a construction of a separate reality. You'll say, "While usually the vampires burn, when I'm in the domain of Twilight, vampires shine." Upon closing the book, you'll tear down this new reality and return to the current one. And when someone asks you, "Why do vampires avoid the sunlight?", you will now first have to figure out which vampires the person is referring two, because there are otherwise two valid answers to the question.
The alternative, of course, is to deny the existence of multiple realities, and to choose only on truth to hang on to. It's much more succinct, requires less imagination, but can be limiting. If you can think of this as one extreme of the spectrum, then you'll be correct placing me onto the other.
I noticed this about myself a few months ago: almost every time I encounted some information that contradicts with what I accept as the truth, I split off a new thread of reality and incorporate the new factoid into it. I always try to minimise the imaginary reality, but I also try not to lose anything. More importantly, following the principle of lazy argument evaluation, I don't verify the validity of the statements in one reality against other realities: I can simultaneously be thinking two opposite forces, provided that they're contained in different worlds.
It's passive. It lets me play along and interact with people I wouldn't otherwise be interacting with. It allows me to build an adapter for others' thoughts, and communicate with them. Partially a defense mechanism, I communicate out of my world only with people I'm close to--since that would require me to reveal the truths that I hold dear. It does present philosophical dilemmas about truth and honesty, since those are no longer absolute. (Technically speaking, nothing has ever been absolute, but this is even less absolute.) At the same time, it helps resolve them.
A paradox? Not in the least. How many of you, Gentle Readers, have been frustrated and irritated in the past? Anger and willingness to break objects may seem like best responses at the time, but thinking back suggests that violence is not the best answer. Am I a different person when I'm annoyed? Am I unstable if my mood ever swings? No: I'm just subconsciously swapping one reality for the other... And so does everyone else... And since I can't be certain about what others believe, the only way I can understand them is by creating these realities.
Now, if only I didn't lose so much sleep to these musings... |
|
|
| Techy |
[Apr. 30th, 2009|02:14 am] |
| [ | mood |
| | sleepy | ] |
| [ | music |
| | DI.fm - Chillout Channel | ] | ( OMG, want! )
In other news, I've successfully installed a media player on my newly-acquired Magellan Maestro 3200. It's not as nifty as other Magellans (some even render buildings in 3D!), but after using it for a little while, I have great respect for the device. So far, there is only one feature that I don't like, and that is not being able to scroll the 3D map around while zoomed out--I need to switch it to 2D mode first. In all other aspects, it's great! And the Hacks made it even better: 10x the number of Points of Interest, a file manager, even an offroading GPS application. (Navigator.exe is just an app running on top of Windows CE Core 5.0 on an ARM920T processor.)
However, I took all of those off, and replaced everything, because they weren't rigorously tested by the hobbyists, and the unit kept rebooting (but not bluescreening!). Now, I have fewer POIs, but I can drive in peace. |
|
|
| Ill-Structured Problems |
[Mar. 15th, 2009|03:17 am] |
I have a particular dislike for Ill-Structured Problems. (And please pardon me for skewing the definition of the term for my own needs.) The most famous one, of course, is the Nine-Dots problem: without lifting the pencil from the paper, draw four straight lines, so that they go through all of the dots?
 But before discussing its solution, take a look at a different problem first.
The problem states that even a first-grader can solve it. It's not a fixed problem, and it goes something like that:
1017 = 1 2596 = 2 4153 = 0 6074 = 2 5153 = 0 0000 = 4 1111 = 0 2222 = 0 1259 = ? | I won't really torture you with this problem, because I don't think it's in any way remarkable. The solution is simple: count the number of little circles in the representation of each digit. 0, 6, and 9 are worth 1 point each, while 8 is worth 2 points. The answer is 1.
|
So why is this an ill-structured problem? Because when I see a math-related problem, I automatically assume that the it's related to, you know, math, and use Mastermind-like induction to solve it, without relying on looking at the shapes of the numbers. But that's not the actual reason for my disliking the stock solution. The actual reason is this: the solution is intrinsically tied with manipulating the assumptions. And what are these assumptions?
Maybe my brain is different from yours, but in addition to having a part dedicated to language, and a part dedicated to shapes, I have a part dedicated to numbers. Numbers and digits get put into their own category. Четырнадцать, fourteen, and 14 are three different entities, that are eventually tied into the same concept, but are processed separately. The numerical representation of 14 is devoid of words and shapes: it's concurrently 2*7, and 6+8, and 10+4. Since I grew up in base 10 (but of course, every base is base 10), I'm much slower doing calculations in other systems; but as long as there is a way to represent each digits from 0 to 9, I'm good to go.
So that means that if 2 were replaced with 'F', and 8 were replaced with 'Z', and I trained myself for a week to adapt to the new language, then I would transcribe the problem "1259 = ?" into "1F5Z = ?", and use the same logic to solve it. But those counting the circles would not, because they would be relying on this underlying assumption: "The problem is valid only when using Arabic Numerals."
The same discussion can be applied to the original 9-Dots problem. Here are two different solutions. I came up with a third when contemplating writing this entry: assume a non-Euclidean geometry: the nine dots are on a sphere, where the first three are on the 0° longitude, the last three are on the 90° longitude, and the middle three are, consequently, on the 45° longitude. The top and the bottom rows are on the +45° and -45° latitude, respectively, and the middle row is on the equator. Each of the three straight ("straight" as defined by the non-Euclidean geometry) lines goes from the north pole to the south pole; each of the three lines intersect at both end points, and cross all 9 dots. A fourth line isn't even needed.
Sure, I've just shown you many ways to hack the problem. But each of them requires removing some implicit assumption: either that the solution can extend past the square containing the nine dots, or that we're no longer planar. I'm pretty sure one can imagine a multiply-connected space, such that even 1 straight line would suffice. The real trick to arriving at a given solution is saying, "Okay, even though most puzzles require solution to fit inside the space provided, OR assume 0-dimensional points instead of 2-dimensional dots, OR assume Euclidean geometry, this one doesn't." So what's wrong with that?
What is wrong is that these puzzles are praised because they require "thinking outside the box", whereas in reality they are just eliminating an implicit assumption, and seeing whether the contestant is able to catch up. That's okay if it's disclosed beforehand, but since puzzles require highly-constrained hypothetical situations, clandestinely removing the constraints is just that: lying. Why such a strong disrespect?
Because most of those who use that phrase are usually looking for open-minded students or employees, and are usually unaware of the implications. While it's a given that talented people can come up with novel solutions, the converse--that novel solutions are created only by talented people--is just not true. A dramatization of this issues is in the famous setup of having two strings hanging from the ceiling about 10 feet apart, of the problem of having to tie them together, and of the solution of tying one of the strings around your shoe, swinging the shoe, and using the momentum to catch the first string and tie it to the second. Well, another solution is to pull on the first string, break it off, tie it to the second, and declare the problem solved. But is that what "talent" is about?
Actually, no. Talent requires grace, beauty. The best solution is usually the simplest one. In software engineering, it's also the one that runs the fastest, and is the easiest to maintain. A systematic approach will generate better solutions to 95% of all problems than hap-hazard "thinking outside the box". Hacking one thing here and one thing there, ignoring or bending the assumptions, can also lead to working code *now*, but if later someone tells you "non-Euclidean geometry prohibited", or better yet, "the digit 8 is replaced by Z", the methodical solution won't break down and give you a headache, stealing hours of your time. And the answer "given the constrains, there is no solution" is a lot more valid than "if we remove a constrain, then we can do it." Problems have constraints for a reason. If you want to see how well a person deals with removing the constraints, state so in advance; otherwise, the only people solving such puzzles won't be "open-minded" enough to solve anything requiring good old elbow grease.
P.S. This especially applies to all single-language, or "punny", problems. If the problem is valid only in English, then it doesn't belong outside a comedy club, where the rest of the puns live. |
|
|
| Infra-red |
[Mar. 9th, 2009|01:04 am] |
|
While the infrared bar that must be placed on top of the TV is invisivle to the human eye, a camera equipped with a night mode can detect them quite well. ( This is what they look like. ) |
|
|
| "Shortcut to" |
[Mar. 5th, 2009|07:00 pm] |
| [ | music |
| | Roger Shah presents Savannah - Body Lotion (Inspirations Mix) | ] | The easiest method to prevent Windows XP / 2003 from adding the text "Shortcut to XYZ" for new shortcuts is outlined here: http://support.microsoft.com/kb/253212 And it works! Well, worked--they removed the feature in Vista. *sigh* |
|
|
| Tech Support |
[Mar. 2nd, 2009|11:56 pm] |
All software engineers should watch Medieval Helpdesk. If you don't have the patience for the whole 3 minutes, at least watch the last 30 seconds. It illustrates the not-well-enough-known "grandparents" problem: how do you explain the computer to your grandparents?
Take a concept of a window. Sure, a window, in Win32, is represented by a handle HWND, and is created using CreateWindow with a class registered using the RegisterClass() API. Too technical? Okay, then a window is a rectangular picture that can be dragged around, minimized, or closed. (My grandparents like to use the word "frame", because it certainly does not look like a window to them.) And a menu is... Wait, what's a menu? You sometimes have to right-click, sometimes double-click, but sometimes only single-click?
On a more philosophical level, only in the last two centuries has technology really advanced far enough that there is a divide between knowing how to use something and knowing how it works. Take the abacus: you learn what it is by learning how to use it. Same with a hammer, or a matchbook, or a mirror, or a musket that you have to clean and reload after every shot. Once you introduce the telephone, the radio, or the television, you must create concepts to describe the things that most people will no longer observe: electromagnetic waves, the electron gun, amplitude modulation. Computers are a few steps above that, with objects that don't even exist. On a typewriter, if you press a key, the hammer strikes the paper, and you see a letter. On a computer, if the "window" doesn't have "focus", then your text disappears into the void. By now your concepts are so abstract, that none of the things you do are actually real. Your brain is forced to carve reality out of these digital concepts.
Which is easy when you're young; but if you spent 60 years of your life with typewriters, a pop-up dialog box is something you'll have a hard time visualizing. So make UI as intuitive as possible! |
|
|
| Acrobats |
[Mar. 2nd, 2009|11:37 pm] |
+1 to the monopolies: Adobe wins again. I've removed FoxIt and installed Acrobat.
Why would I do such a thing? Simple: FoxIt is written for viewing static documents, and does not handle filling out any forms. Unfortunately, I spend a lot of time on www.uscis.gov, and all the PDFs there happen to be interactive, with fillable text. FoxIt, even the most recent version, chokes on all of them. Be warned! |
|
|
| Translation |
[Feb. 20th, 2009|03:38 pm] |
I want to translate a book Metro 2033. Even though there are rumours of an actual translation, it won't be done by the end of the year, and if I can get some help, I can realistically translate it by summertime.
But I need help: (1) A Wiki site to post the translation I have a Wiki: http://metro2033.wikidot.com/start (2) Proofreaders, because my English is not perfect
What do you guys think? |
|
|
| Brilliant |
[Feb. 4th, 2009|01:05 pm] |
 This took me a second to get, but wow! :-) |
|
|
| π, e |
[Nov. 25th, 2008|01:43 pm] |
| [ | mood |
| | amused | ] | Reading Wikipedia has reminded me of a couple of things from my college years. I present them here with a form of a poll. If you could request a historical do-over:
(1) Would you change the value of π to be 6.28, i.e. double the current value of π? (2) Would you change e (the charge of an electron) to be +1.602 × 10-19, i.e. positive? |
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
| [ |
go |
| |
earlier |
] |
| |
|
|