Slashdot Mirror


User: severoon

severoon's activity in the archive.

Stories
0
Comments
1,076
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 1,076

  1. That's Not Good Code on Are You Proud of Your Code? · · Score: 5, Interesting

    The biggest thing I see wrong with other people's code is not at the syntax level or to do with commenting. It's based on a misunderstanding of basic CS principles. An example is in order from last week...

    In the codebase I work on, there's a module that analyzes documents and tags them, assigning different weights to each tag based on relevance. (Think of the way google works--it reads a web page and tags it with terms, then if you type in one of those terms while doing a search that document comes up--yes I know this isn't the way google actually works, save it. :-p ) At one point we send a list of tagged documents from one system to another, and this area was the source of many, many bugs. The responsible developer spent the better part of last week slaving on this code and every change seemed to introduce more bugs than it removed. Finally, I got involved to see what the problem was.

    Here is one thing (out of many) that I found. After the docs arrive in the new system, each doc is supposed to be persisted along with the top 5 most relevant tags (the rest discarded). The code was written to create a Document, check a hash table that maps the doc to the number of tags it currently has, add a tag if that doc doesn't yet have five, then increment the value associated with that doc in the hash table. When I saw this, my head almost exploded. At some point, this developer thought it would be a good idea to create a hash table and keep this information, information which is available in the document itself (he could've just called doc.getTags().size() to see how many tags it currently had). Now he created this hash table and all his code was written to depend on it, so of course he had to write a lot of code to keep it in sync with the state of all these documents.

    This sounds like a simple enough thing, right? It's not necessary, and it's not the best thing, but it's a fairly simple mistake and one that couldn't impact code readability all that much, right? Maybe--but consider that this is one of about 10 simple mistakes I found, and you can imagine the explosion of interactions of all these simple mistakes...and that's why we burned a person-week on something that should've been trivial. When I pointed out to this developer that he could just get the number of tags directly from the doc itself, and doesn't need to keep this state in some other object too, he said something to the effect of, "That's a different approach, but whatever...one's not better than the other."

    But one is better. If this developer understood the difference between intrinsic and extrinsic, he never would've written that code in the first place much less defended it. To put a fine point on it: the number of tags associated with a document is intrinsic to the document itself, so that is where the information should live...not there as well as some hash table somewhere. The document is the authority and the final word on how many tags it has at any moment in time. (There's a principle in databases called the SUA Principle--it means one should keep data in a Single place, in an Unambiguous manner, and that should be the Authoritative source of that data and no other. It applies here too.) Putting this info into some other object, even if that object exists solely for the purpose of tracking that info, means you're creating an object that stores information that is extrinsic to it. Never a good idea...now you need a whole bunch of supporting code that keeps the extrinsic info in sync at all times.

    Let's say I'm designing a Ball class for use in a physics application that students learning physics can use. They can shoot the ball out of a cannon, put it under water, in deep space, on Jupiter, etc, and see how the simulation behaves. As the developer of this class, I decide to add a characteristic to the ball that keeps info about its "heaviness". What should I add, a getWeight() method or a getMass() method? The developer I was talking t

  2. Re:Release bombs at supersonic speeds? on USAF Launch Supersonic Bomb Firing Technology · · Score: 1

    A "low point"? If WWI was the beginning of air warfare, then WWII was the beginning of industrialized air warfare. It wasn't so much a "low point" as a "beginning point".

    The real point is, we're far more intolerant of collateral damage these days than previous generations. And some people think that the threat of collateral damage used to go a lot farther to temper the actions of governments (or the governments allowed by societies comprised of potential collateral damage). War used to be very, very bad...by those standards, today war is a fairly sterile affair. (For those who actually took the time to read and understand this point, prepare for the histrionics that will inevitably result from those who didn't...)

  3. How I Learned Philosophy on Paying People to Argue With You · · Score: 5, Insightful

    Actually, it's not the attempt to mathify that I find problematic—I find that encouraging. It is, though, the results.

    My (awesome) university philosophy professor had us do a very interesting exercise that was, though more logical than mathematical in nature, similar to what the author of TFA was going for. It goes like this...

    Write down a belief that you have. For people new to this process (the entire class), this should be a strongly held belief...doesn't matter how controversial. Let's say, for example: I think abortion should be a woman's choice. (For you controversy-hounds out there, please don't mistake this for my actual belief—I'm intentionally not going to define my actual belief on this topic here.) Don't worry about getting the wording just right—you're free to revisit your initial statement as many times as you like throughout and revise it to more concisely represent your intent.

    Now write down the set of "sub-beliefs" that you have which form the basis of your belief. For our example: 1. Life begins at conception. 2. Every life is equally valuable. 3. A life has no quantifiable value, but is inherently precious and ought to be protected if at all possible. Etc. Next we iterate, applying the same process to each belief listed. Obviously, you will very quickly diverge into an explosion of statements that resist corralling at every effort. Do not fret—I haven't told you about the thrust of the exercise yet.

    (I should mention here that we did an entire section on identifying context-free statements, and we were asked to make our best effort to ensure that each statement was context-free, or as free of context as possible. "Context-free" means that the statement is true of our beliefs regardless of the circumstances in which the statement is tested. If that's not possible—and it's not often possible—we'd go for "generally" true, where "common sense"—whatever that is—dictates obvious exceptions.)

    You will find it unnecessary to list each and every belief supporting your initial statement, which would quite likely fill several thick volumes if you did so exhaustively. Luckily, you don't have to do this to satisfy the point of the exercise, which is: where necessary, skip down to "lowest level" beliefs...that is, at some point you will mentally reach a point where you have identified a belief for which you have no further basis beliefs. When you reach this point, you have identified an axiomatic belief—that is, something you accept essentially on faith, on gut feeling, because you think it is correct. If possible, identify the key beliefs that go from your initial statement to the set of axiomatic beliefs identified.

    The next step is to look at your beliefs, both axiomatic and intermediate, for consistency. In every case in carrying out this exercise, one will invariably find a whole host of contradictory statements. Then we did an iteration that attempts to resolve these conflicts by tweaking our initial statement, etc...provided we were tuning up the language to indicate real intent and not moving the statements further away from our actual beliefs, great. The ultimate idea is to identify our beliefs in all their gory, inconsistent, warty detail.

    Then, we make up a list of so-called axiomatic beliefs and they are given to 5 random classmates (all double-blind, of course). You then are tasked with taking home those 5 lists of axiomatic beliefs and attempt to drill down further. If they are truly axiomatic, you won't be able to do this—the idea here is that you ultimately get back 5 people's analysis of your list and given another chance to continue the process—most of the time, it turns out you realize your axiomatic beliefs weren't axiomatic for you after all, and that you can actually drill down even more.

    Anyway, it goes on like this, the ultimate point being that you arrive at some network of beliefs which yo

  4. Re:Conclusions... on Patterns in Lottery Numbers · · Score: 1

    One of my favorite examples that point up this exact fact was presented by Richard Feynman to his Caltech class decades ago. He said, "A remarkable thing happened to me on the way to work this morning. I saw a car with license plate FCW138...and that's not all! It was from OUT OF STATE. Everyone, get out your calculators and calculate the chances that I would encounter that exact license plate this morning."

    If there was a student smart enough to reply: "1" I'm sure he got a gold star.

    The point is that once something happens, its chances of having occurred are 1. It's pointless to look into the past to calculate the probability of that particular event as a way of predicting the future. To take Feynman's example to a limit--imagine the number of possible particle arrangements making up the part of the universe that is visible to you right now. There are certainly hundreds or thousands of moles of particles participating in the universe you are experiencing at this very moment, each with its own little explosion of possible positions and momenta and spin, etc. Now think on how lucky you are that you happened to experience, out of the myriad possibilities of the last moment, the exact configuration you did...1 possible configuration out of an astronomically high number of possibilities.

    The fact is that whenever there is a range of choices available to the universe, things must go SOME way. One of those possible configurations must be chosen. Once it is, it's foolhardy to look back on it and regard it as near-impossible. Once it happens--it happened...in other words, the chances of it having happened are exactly 1.

  5. Re:Conclusions... on Patterns in Lottery Numbers · · Score: 1

    Actually, if you spin a roulette wheel enough times, it's virtually guaranteed that eventually a sequence of 13 blacks will occur. It's not remarkable that this happened at all. (Now if you were able to predict ahead of time *when* that sequence of 13 blacks would appear--that would be remarkable.)

  6. Re:Conclusions... on Patterns in Lottery Numbers · · Score: 4, Informative

    Can you win at roulette by betting there will be "only 8 reds in the next 13 spins"? No, you have to say *which* spins will be red of those 13. In other words, you're arguing here that order doesn't matter...but it clearly does.

  7. Re:RTFA on Man Arrested for Refusing to Show Drivers License · · Score: 1

    Does it really make it more difficult for a shoplifter to be caught if that shoplifter happens to know that he's well within his legal rights to sail right past the receipt checker and there's nothing they can do about it?

    I don't agree with the devil's advocate's assertion that the environment is detrimental to shoplifters, and even if it is, I assert that it is also detrimental to me, the paying customer. What if I bought something embarrassing that I don't particularly want the door clerk poking through? You may say, but the person working the register already saw the item! Actually, I was quite relieved when I saw stores put in self-checkouts for this exact kind of purchase. You may reply, don't buy things you're embarrassed about, then. Oh, so now I'm not allowed to buy items I'm a little shy about without having some guy going through my things? This devil's advocate seems to be willing to marginalize the group of people I'm describing here when, in principle, those people are really on more solid ground ethically, legally, everything-ally. No wonder this guy advocates for the devil.

  8. Hear, hear! on Man Arrested for Refusing to Show Drivers License · · Score: 1

    I think we have the definitive statement on the side of this argument against Mr. Righi. The thinking goes exactly as the parent post delineates it: you are assumed guilty until you provide enough evidence to prove you didn't do anything wrong. Now we know it's usually pretty tough to prove a negative, so it might require you really dig deep and lay your entire life out for us to examine, but look at it this way: it'll help us reduce shoplifting a bit, so in the end, we're really just doing you a big favor! You're welcome! Now drop those pants and grab those ankles...

  9. Re:I smell something... on Man Arrested for Refusing to Show Drivers License · · Score: 1

    Yea, one of the things my lawyer friend told me he learned on day one of contract law—you know those signs you see when you pull into a parking garage that says they're not responsible for anything that happens to your car or the stuff you leave in it? You know how they print a mile of legalese on the back of the claim ticket you get?

    This helps the parking garage owners in one way, and one way alone. It convinces ignorant people not to try and sue them if something does happen to their car or their property. If you ever do have occasion to challenge these signs, you'll find it's not much of a challenge after all—the law considers them meaningless.

    Some devout Muslims believe it is wrong to use recycled paper because it could contain bits of old discarded Qurans. Most receipts are printed on recycled paper. If a Muslim were to, therefore, immediately discard their receipt upon receiving it, should they not be allowed to leave a store? Can you imagine...a place where devout Muslims are detained, completely without due process of law just because there happened to be a sign omg IthinkIjustfiguredouthowGitmohappened!!!

  10. Re:I smell something... on Man Arrested for Refusing to Show Drivers License · · Score: 1

    Dredd13—my lawyer friend read the post you were responding to and milk shot out his nose. And he wasn't even drinking milk!

  11. Re:Hrm... on School Kids Get Virtual Web Lockers · · Score: 1

    What you say is too true and so like government. Hey kid, I see you have an 8GB iPhone there with full web and email capabilities. We're introducing this great new service at school you should get familiar with. It's a whole 100 megabytes of teacher-monitored space hosted on our own servers, admin'd by our resident IT and security expert—your very own computer teacher! Hey, where are you going?

    You gotta love it when the state gets involved in stuff like this. It's so adorable!

  12. Re:And if people are compelled to pay? on ISPs Dragged Into Swedish File Sharing Battle · · Score: 1

    Oh, hm. Well, whatever...long as I get to download all the free music I want. The rest of it sounds like SEP to me.

    (Of course, in case you missed it, I was being sarcastic in my original post above. Just for the record, I think it's a terrible idea to mandate the state require people support any particular business model just because it happens to be otherwise unsupported. I have lots of terrible business ideas too, but I don't see anyone rushing to my aid with a bailout.)

  13. Hrm... on School Kids Get Virtual Web Lockers · · Score: 1

    Problem: once they provide virtual lockers, they will likely remove access to USB ports to plug in thumb drives. Can't do that now because the kids actually need access to them. And even with access to a USB port, rebooting to peanut linux probably isn't a good solution either—talk about attracting attention. In my grade/jr high/high school, when we had access to a computer, rebooting was not allowed (nor was opening applications other than the one we were supposed to be using).

    I think the proper approach would be to teach kids about security and protecting themselves online. This would be a great way to teach kids to implement their own little security program to encrypt their data (Caesar cipher to start) and then move them up to real encryption.

  14. And if people are compelled to pay? on ISPs Dragged Into Swedish File Sharing Battle · · Score: 3, Interesting

    I think this is a fantastic idea. They should be very careful to spell out the terms, but provided that it's not an exhorbitant amount per person (say, 5 cents per month), think about the flip side of that deal: for say 5 cents per person per month (or whatever nominal fee they work out), copyright holders are paid. That means that all people are free to copy as much music as they want. No more need for sites like pirate bay to operate in the shadows.

    I mean, surely the copyright holders don't want to be paid and give nothing in return at all. Right? Guys? ...guys?

  15. Subversion on Laptop/Server Data Synchronization? · · Score: 1

    I agree—subversion isn't really the right tool for syncing data in two places. Having said that, if you want to keep revision history and sync it, then the latest subversion might be right up your alley. Included is a svnsync tool that is intended to sync a "live" repo (one that you use regularly for commits) with a backup repo (exists solely as a copy).

    As far as automating backup, assuming you're talking about linux, I would say that the best approach is to simply write a short script that pings for the presence of your server. If found, it mounts the remote drive, rsyncs, and unmounts. If the transfer is interrupted, no worries—it'll resume next time you connect. Assuming the rsync succeeds and exits normally, you can have a clean umount, otherwise you'll have to umount forcefully.

  16. Re:Buttons!? on Steve Jobs Hates Buttons · · Score: 1

    It's very popular to compare things to drunk drivers because everyone knows and has already accepted that all "drunk" drivers are evil people and should be thrown off from the surface of the Earth into space.

    Except...the data doesn't actually support the notion that someone is actually "drunk" at 0.08. If you can get your hands on raw data (and it's very difficult), you will find that, statistically, drivers found with 0.08 up to 0.xx (no one's sure of this number because no studies are allowed to be done to determine it) are no more likely to be in an accident than drivers between 0.00 and 0.08, and no more likely to have more costly accidents (in fact, for some reason, around 0.04-0.05, drivers seem to be statistically better than average drivers). What we do know is that cost and injuries to all parties involved does start increasing around by the 0.15 mark.

    Do I support raising the limit, then? Personally, no. I think we should discourage drinking and driving...I wouldn't even necessarily be against lowering it further. However, I think the punishment should fit the crime. If you're pulled over and incidentally found to have been drinking with a "low" (needs to be defined by science) amount of alcohol in your system, then you should probably get a ticket and a mandatory tow home. The hassle of having to pay a few hundred dollars in fines and tow fees and having a moving violation on your record will take care of the casual drink'n'drivers. No need to threaten basically good citizens with loss of Constitutional freedoms like voting.

    Once you get up into the range of drivers that are drunk enough that stats say they actually are dangerous, then lay the smack down. You put me and my family in danger capriciously? Then you get a felony, sir.

    Unfortunately, the system we have now was set into motion primarily by the histrionics of those who are understandably foggy with emotion, having lost one or more family members to a drunk. Politically, a crying mother trumps rationality (just look how far Cindy Sheehan took her absurdity). The result is that, even if you are below 0.08, if an officer finds you to be driving "erratically" and detects any amount of alcohol on your breath, you could be smacked with the full force of a felony. The outcome of your particular case mostly depends on your age, ethnic background, financial resources, etc...a whole host of things that have nothing to do with the severity of your slight against fellow humans. On the other hand, many who actually are over the legal limit get handled with kid gloves because everyone responsible for holding that person to account knows that drunk driving laws are overly harsh, and what we're dealing with here is a fine, upstanding member of society—we can't hit him with a felony!

    So drunk driving laws are now used as a legal catch-all in some parts. If you happen to be driving in an area defined by federal law, the limit could be as low as 0.02. This is something that is not advertised and most people don't know. But no worries—most people don't have cause to fear it...you only need be concerned if the authorities want to selectively prosecute you for something else that won't stand up. I'm pretty sure, judging from regimes like North Korea, Iran, etc, capricious prosecution is the opposite of freedom.

  17. Yea, We Need More Thinking Like This... on Steve Jobs Hates Buttons · · Score: 2, Funny

    I always also drive with the radio off because I find that distracting. I think others should also be compelled by law to drive without music.

    And kids.

  18. Hippies Don't Hate Smoking--They Hate Money on Nicotine Is the New Wonder Drug · · Score: 1

    Those "truth"-hippies aren't against smoking. They're against corporations. Especially successful corporations that have a big, soft, exposed underbelly. The biggest blow to the legalize marijuana cause would be legalizing it because the first companies to get involved in the distribution, sale, and profit would be...you guessed it, Philip Morris et al.

    So long as no one's profiting, marijuana is totally different, duuuuude!

  19. Re:Not Sure Why... on Nicotine Is the New Wonder Drug · · Score: 1

    Yea.....

    So are lots of pharmaceuticals that doctors prescribe every day. So I'm failing to find your point.

    I wasn't saying that nicotine wasn't non-toxic. My point was simply that millions upon millions of people smoke every day, and the vast -vast- VAST majority aren't dying of nicotine poisoning. Ergo, it's a relatively safe substance if used for good in controlled way compared to many other pharmaceuticals that we consider the benefits outweighing the risks.

    Your subsequent comments pointing up extremely infrequent cases of children suffering nicotine poisoning further point up my case. More information about other populations makes this drug as a potential pharmaceutical more useful, not less, because it would allow it to be controlled much more carefully.

    Come on, think about it...what other drugs currently under development enjoy such an embarrassment of riches when it comes to statistical data? The only real fear, I suspect, of many in the anti-smoking camp is that real research surrounding nicotine may just slaughter a sacred cow or two. I'm personally allergic to cigarette smoke and hated growing up in a household with a 3-pack-a-day dad, so I am totally against smoking (personally) and others who force me to breathe in their second-hand smoke. But for me its more an issue of courtesy and inconvenience (allergies). As against smoking as I am for this and other reasons, I'm for science, scientific research, and truth.

  20. Roaches! on High-Tech Squirrels Trained to Conduct Espionage · · Score: 1

    Think about the lowly cock roach—that's the perfect animal for this type of thing. Even if you could catch them to prevent your enemies from offloading the intel...ewww! Roaches!

  21. Not Sure Why... on Nicotine Is the New Wonder Drug · · Score: 4, Insightful

    I'm not sure why this is so hard for some people to swallow. Most drugs that have such an obvious and strong effect on people and have been tested on millions with few adverse effects (all the bad effects of smoking come mostly from the smoke + chronic use—the nicotine merely makes it addictive) usually yield other valuable research output.

    I don't see any reason to let emotional value judgments get in the way of potentially valuable medical applications. Let's turn that frown upside down and make a negative into a positive!

    Disclaimer: No I'm not a drug company representative nor a smoking advocate.

  22. BBC Panorama Logic on BBC Kicked out of School Over Wi-Fi Scaremongering · · Score: 1

    It's cheap, widely available, makes my life easier, is convenient, and, not to mention, pretty cool.

    It MUST be bad for me!

  23. Re:On the other hand, they also make great Bourbon on Creationism Museum Opening in Kentucky · · Score: 1

    I don't understand your issue here--every public school science curriculum I've ever observed does exactly everything you ask of it and more when it comes to evolution...indeed, ALL science. They begin teaching science to students by teaching them the scientific method, which encompasses the basic definitions of scientific terms like "hypothesis," "theory," "experiment," etc. So, by calling it "the Theory of Evolution," right off the bat everyone knows what that means. Any student who paid attention during that first week of jr. high science ought to also be able to tell you the difference between the fact of evolution and the theory (also more casually referred to as "Darwinism")...something which I fear you perhaps cannot? This covers the first paragraph or so you have written...of course your statement that schools shouldn't teach theory, only fact, is bogglingly flawed. Pretty much all of science is about theory. Facts form little more than an almanac. Without theories, which is nothing more than a fact-based model used to make predictions, we would not have science at all. Nor would we be able to make scientific predictions, as the ability to predict is what separates science from, well, just about everything else. Quick litmus test to tell if we're talking about science...ask yourself, does it make reliable predictions? Astrology? No, therefore not science. Astronomy? Yup, therefore science. Gravity? Yup, therefore science. Mythology? Entertaining and interesting, but no predictions result, so no, not science. "Intelligent" design? Hmmm...

  24. Re:On the other hand, they also make great Bourbon on Creationism Museum Opening in Kentucky · · Score: 1

    Well, yes...but only because I "believe" in science.

  25. Since This Thread is Light On It... on Creationism Museum Opening in Kentucky · · Score: 1

    ...and it's obligatory for a discussion of this nature, I will now purport to be offended by something totally irrelevant to the main line of debate in order to (1) score emotional points from lurking idiots, currency which I will presumably spend soon to reinforce my absurd point of view and (2) draw attention away from the spotlight you're attempting to shine on the more subtly positioned points in the arguments you're advocating.

    Here I go.

    "Fat Americans"??? How dare you!

    Note how I used quotes improperly to put words in your mouth--words you didn't actually type. I'm hoping to establish a precedent here of being able to use quotes that approximate what you have said. This way, in later replies when I completely go off the reservation, I can continue to "quote" you as if I know what you're really saying and reference to your actual words are all but irrelevant.

    (This post is a result of my attempt to see things from the Creationist point of view, to better understand where they're coming from. If you're a Creationist, how'm I doing so far?)