Slashdot Mirror


User: pruss

pruss's activity in the archive.

Stories
0
Comments
359
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 359

  1. Re:Faster loops on The Most Expensive One-Byte Mistake · · Score: 1

    I think the two pieces of code would be something like:

    NUL-terminated:

        MOV SI, [pointer] ; load pointer
        CLD ; clear direction flag for traversing
    loop_top:
        LODSB ; get byte pointed to by SI, increase SI
        OR AL,AL
        JZ done ... do whatever you need to do with AL, restoring it if necessary
        JMP loop_top
    done:

    length-prefixed:
        MOV SI, [pointer] ; load pointer
        CLD ; clear direction flag for traversing
        LODSW ; get length (N.B. expensive if not word aligned), increase SI by 2
        MOV CX,AX ; copy length to BX
        OR CX,CX ; check to see if length is zero
        JZ done ; get out if it is
    loop_top:
        LODSB ; get byte pointed to by SI, increase SI ... do whatever you need to with AL
        LOOP loop_top ; decrement CX and jump if non-zero
    done:

    The length-prefixed code has more setup code. Notice the kludgy separate case check for zero-length. Moreover, the length-prefixed code uses an extra 16-bit register (CX) for the countdown. On the other hand, the length-prefixed code has a lot less work within the loop. The looping structure is all handled by the LOOP opcode, while the NUL-terminated needs three instructions to control the looping.

    The LOOP opcode is 16 cycles when the jump happens, while the OR is 3, the JZ is 4 when the jump doesn't happen and the JMP is 11 if the loop isn't too large. So, the length-based loop uses 16 cycles for loop control, while the NUL-based loop uses 18. Two cycles isn't a big difference, and will be made up for if the NUL-based loop does something useful with the extra 16-bit register.

    However, some simpler operations would be faster on a length-prefixed arrangement. For instance, for a string comparison one could use the cool REPNZ CMPSB, and for string copying one could use REPNZ MOVSB. Both of these require knowing the length ahead of time. The NUL-terminated equivalents would require a conventional loop.

    That said, I like the NUL-terminated strings simply on aesthetic grounds: there is no need for a string type in the language. It's all just a matter of the library, and if you don't like the standard string library, you can write your own, for instance storing strings as struct {unsigned length; char* string;}. (Maybe better would be struct {unsigned length; char string[0];}, but such extendable-length structs weren't quite standard.)

  2. Re:This isn't an ethical issue ... on Slate: Amazon's Tax Stance Unfair and Unethical · · Score: 2

    Talking of convenience, it's also not convenient for individual buyers to have to keep track of their purchases for use tax purposes. One could argue that it's not nice for Amazon to off-load the record-keeping burden onto their purchasers. All other things being equal, I'd prefer to buy from an online retailer that charges tax: I wouldn't have to log the purchase in our use tax notebook and eventually add them all up, and month-to-month family budgeting would be a bit more accurate.

  3. Taxing the honest and cooperating with tax-cheats on Slate: Amazon's Tax Stance Unfair and Unethical · · Score: 1

    There is a kind of unfairness in the system in most states where use tax is submitted individually with little or no enforcement: the unfairness is that only the honest end up paying. So I think it would be good to reform the status quo in most states.

    Anyway, here's my opinion on the Amazon issue as an ethicist, for what it's worth. The opinion needs to be taken with a grain of salt, since I am not a lawyer, nor do I know the details of the California situation.

    There are three main kinds of reasons I can see Amazon as possibly having for not wanting to collect use tax from California residents.
    1. The technical difficulties of computing use tax on a large body of goods for residents of different localities with different tax rates.
    2. Constitutional principles about interstate trade and the federal system.
    3. The loss of a competitive advantage over California-based retailers.

    I think #1 would be a pretty serious issue for a small Internet-based business (say, a person or small company selling apps on Android Market, where developers are responsible for collecting and remitting sales taxes--a nuisance!). In fact, for a small enough Internet-based retailer, it could make the cost of doing business prohibitive. But #1 does not apply very well to an operation with as many resources as Amazon, and the CA law isn't aimed at very small businesses since they usually don't have affiliates of the relevant sort. Getting local tax rates isn't that hard. Figuring out which goods are taxable may be some work, but does not seem overly onerous.

    I can see how #2 could be a real consideration. However, I doubt that dropping California affiliates would have been the right response if #2 is the consideration. On the other hand, the referendum support is.

    On the other hand, #3 is not something a company has any right to take into account. The competitive advantage is primarily due to those California residents who fail to pay use tax when they buy from Amazon. If Amazon refrains from collecting the use tax in order to gain this competitive advantage, it appears that they are cooperating with people who are cheating on their taxes (California personal income tax forms have a section for use tax and are signed under penalty of perjury, so people who knowingly give incorrect numbers for the use tax appear to be committing perjury). And that does not seem to be ethically justified.

    So, in summary, it doesn't seem unethical for Amazon to oppose the collection of CA taxes if their reasons for doing it are #1 and #2. But if their reasons include #3, this is ethically problematic. What their exact actual reasons are is not something I know.

  4. Re:Amazing!!!! on Silver Pen Allows For Hand-Written Circuits · · Score: 1

    But the mgchemicals ones look felt tip, while these folks have a rollerball one. It looks like that may present particular difficulties. From the Advanced Materials article: "Central to the PoP approach is the design of a silver ink that readily flows through the rollerball pen tip during writing, does not leak from, dry out, or coagulate within the pen, and is conductive upon printing under ambient conditions. To create an ink with these attributes, we synthesized silver particles in an aqueous solution by reducing silver nitrate in the presence of a surface capping agent, poly(acrylic acid) (PAA) and diethanolamine.22–26 Using a multistep procedure, we first mixed these components to create a population of silver nanoparticles (5 nm in diameter). This particle population is then ripened by heating the solution to 65 C for 1.5 h to yield a mean diameter of 400 ± 120 nm, as shown in Figure2a. Ethanol, a poor solvent for the PAA-coated particles, is added to induce rapid coagulation and then the precipitate is centrifuged to achieve high solids loading. The silver particles are redispersed in water to remove the PAA capping agent, which is initially present at 10% by weight of silver, and again concentrated by centrifugation. This process is repeated three times, resulting in complete removal of PAA (see Supporting Information, Figure S1). Finally, hydroxyethyl cellulose (HEC), a viscosifier, is added to tailor the ink rheology." So, probably a more accurate way of describing what was invented is that they made a better silver ink, and then measured its properties as relevant to circuits on flexible substrates.

  5. Nostalgia for Palm UI guidelines on How Today's Tech Alienates the Elderly · · Score: 1

    This makes me nostalgic for classic Palm UI style: avoid icon buttons, use oblongs with text inside instead, because that will make it easier for the novice user to know what button does what. (Though there were a lot of third-party Palm apps that broke these rules by having confusing icons.)

  6. Can take a lot of work on If You're Going To Kill It, Open Source It · · Score: 3, Informative

    Unfortunately, it can take a fair amount of work to properly open source a large commercial project. The commercial project may well have bits of code and other assets from various sources under various restrictive licenses and either permission would need to be obtained (which makes work for the legal department) or documentation for the restricted code would need to be written so that somebody in the company or a volunteer could do a clean-room rewrite. And even if there is in fact no such code or asset in the project, I assume due diligence would require someone at the company to go through the project carefully to make sure that they have the right to release all of it. Plus, even after all that was done, there may be issues with required proprietary build tools--though that issue could be left for the community to work around (one can release a tarball that doesn't compile and let someone try to figure it out)--and, as many people mentioned, there may be issues with patents. Last year, I tracked down and persuaded the author of the now defunct but excellent PalmOS astronomy app 2sky to release it under the GPL. But open sourcing it wasn't easy, even though this was a much smaller project than some of the ones mentioned. There were a large number of chunks of code to be rewritten because the author had obtained them under a GPL-incompatible license. And for me to be able to generate binaries and debug, I had to switch it to an open source toolchain from Codewarrior. And finally I had to reverse-engineer some of the author's database formats because he couldn't track down the documentation for them and the data needed to be updated (new daylight-savings rules, new comet data). It all works now (open2sky.sf.net), but it was more work than I expected. The point is that to open source a large project is more work than inserting GPL notices and tarring. A company needs to make sure that everything they can't open source has been removed, and they may feel reasonably hesitant about releasing an obsolete project that doesn't successfully build. I still wish they would release. :-)

  7. Re:Better to scan to PDF on Google Docs' OCR Quality Tested · · Score: 1

    Searchable pdfs are not dead. For instance, jstor.org's large repository of scholarly journals is searchable pdfs. jstor is very heavily used in my field. Not perfect, but pretty good.

  8. Often can put on own website on Copyright Law Is Killing Science · · Score: 1

    Most of the publisher agreements I've been asked to sign (granted, in philosophy, not in science; I vaguely recall that the same was basically true in mathematics when I was publishing more regularly there) allow researchers to put a preprint up on their own website. Then the paper is available to anybody who wants it just by Googling for the title.

  9. Re:"Sony tried to point out that" on Sony Should Pay For OtherOS Removal, Says Finnish Board · · Score: 1

    IANAL, but it seems to me that even if you do allow contracts to do undo some consumer protections, nonetheless there is a false advertising problem. Namely, if Sony was advertising features and requiring contracts that allow Sony to remove the features, then correct advertising would have been: "You can run other operating systems like Linux, unless we choose to remove them." Moreover, it is my understanding that even in the U.S., unfair contractual provisions that a reasonable person would expect not to be there are not valid. If that's right, then a clause in a software EULA that says that if you run the program more than three times all your real property belongs to the software provider would be invalid. And a reasonable person would not expect contractual provisions allowing the removal of advertised features. That said, there would be nothing wrong with a car manufacturer that had you sign a contract clearly requiring you to give back the car's air conditioning system as soon as they request you to do so (since that's a clause you wouldn't expect, imagine that the clause is clearly highlighted and requires a separate signature), as long as they clearly stated in their advertising that they have the right to take the air conditioning back. In that case, the market should reduce the price of the car by approximately the cost of installing a new air conditioning system multiplied by an estimate of the probability of such take-back, and a consumer would have nothing to complain about, having paid a lower price in exchange for accepting this risk.

  10. Re:It needs to be a simple tax. on Senator Wants to Tax Internet Shopping · · Score: 1

    $500 a year would kill some really small hobby-type businesses whose revenues around in the $500 range.

  11. Re:Backyard collection... on Ask Slashdot: What Gadgets Would You Use For Hunting Meteorites? · · Score: 1

    I wrapped a fridge magnet earlier today in plastic wrap and ran it through the dirt near a downspout. Got one promising piece: shiny with rounded edges and the sort of texture one associates with a micrometeorite. Size: a little thicker than a hair, and about four times as long as wide.

  12. Re:It's still different on If App Store's Trademark Is Generic, So Is Windows' · · Score: 1

    IANAL, but I do sometimes work in philosophy of language. I would think that capitalization can a bit of a difference in print. "I bought the hot dog from the shack down the street" is different from "I bought the capacitors from The Shack." It doesn't seem particularly problematic to me to open a store called "The Shoe Store" or "Shoe Store" and have a trademark on it. But I am inclined to think that if I do trademark "The Shoe Store", I should consistently capitalize "The", and if I trademark "Shoe Store", I should consistently use it without an article, since if I use it with an article--"Buy your shoes at the Shoe Store"--it sounds generic. Interestingly, I notice that Apple doesn't do either one. The App Store website says: "Browse the App Store to find hundreds of thousands more..." There is an article "the", and it's not capitalized. That sounds completely generic. There is the capitalization of "App Store", but in speech it sounds generic.

  13. Re:Accidental? on Laser Incidents With Aircraft On the Rise · · Score: 1

    Normal stargazing procedure is to turn off green lasers when there are planes visible, and not to use them when one is near an airport. In any case, mistaking a plane for a meteor is rather unlikely unless one has never before seen a meteor, and the amateur astronomers with green lasers tend to be at least somewhat experienced--that's why they're the ones showing things to others. A somewhat more likely confusion is between a plane and a satellite, which is why it's a good idea, just in case, not to point the laser right at the satellite, but to sweep it in a decently sized circle around it.

  14. Re:Come on Sony! on Sony Files Lawsuit Against PS3 Hacker GeoHot · · Score: 1

    I've wondered about this argument, but I am not sure. The code signing restriction could count as a way of controlling an application's use of copyrighted BIOS code (which presumably would be used by any signed application) or at least of copyrighted processor microcode, and if so, it might count as an access restriction in the sense of the DMCA. So maybe Sony can argue that it's not an issue of copyrighted games, but an issue of a copyrighted BIOS and microcode. That's a perverse way of using the DMCA, since they're not really trying to protect the BIOS and microcode, but the games, but maybe it works (given the screwed up law). IANAL, though.

  15. Re:Market; try before buy on When Should I Buy an Android Tablet? · · Score: 1

    Downloading the floating .apk for the Market is a violation of Google's copyright, so that's not an option for me...

  16. Better than Spectrum? on Greed, Zealotry, and the Commodore 64 · · Score: 1

    I am not sure that the C64 was a significantly better unit than a Spectrum 128, and I doubt it was better than the American version I had, the Timex Sinclair 2068. The Spectrums had a Z80 processor with a 3.5X higher clock rate than the 6510 of the C64, but the 6510 could do things in about 1/3 of the clock cycles, leaving the Spectrum with only a slight speed advantage. The 2068 had a polyphonic sound chip that I really liked, and the 128 apparently had a polyphonic one, too. As a kid with poor typing skills, I really liked the pre-tokenized BASIC of the ZX/TS units--you press a shifted character, and get a whole keyword, which is stored and edited as a single token (if you backspace after that, you delete the whole keyword). My feeling as a kid with a TS 2068 was that there were way more cool C64 games, but mostly I programmed things myself, so that wasn't a big deal.

  17. Re:So, what if I have a car with bluetooth receive on US May Disable All Car Phones, Says Trans. Secretary · · Score: 1, Insightful

    Actually, there is some research suggesting that there is a difference between a hands-free phone conversation and a conversation with someone in the car. The difference is that passengers can often see what sort of a situation one is in, and they often pause conversing when they notice that the situation is tricky. It is also less awkward for the driver to pause talking with passengers in the car than over the phone. Moreover, passengers can convey additional information to the driver.

  18. Android Market on Hands-On Test With the Dirt-Cheap CherryPad Tablet · · Score: 1

    The article says that it comes with Android Market. But I thought that Google didn't license Android Market except for phones. So is it pirated?

  19. Re:Judges are alowed to order strange things on Bicycle Thief Barred From Using Encryption · · Score: 1

    But isn't this kind of punishment preferable to jail time, at least from the point of view of the criminal? Certainly, if I were the criminal, I'd choose no-use-of-computers-at-all over jail time in a heartbeat. I'd choose that even if "computers" included DVD players, engine computers in cars, digital cameras, cell phones, etc. It's still better than going to jail, and it doesn't seem unreasonable to send a receiver of stolen property to jail, assuming he knew what he was doing.

  20. Re:scumbag on How to Heartlessly Arbitrage Used Books With a PDA · · Score: 1

    I think library sales are different from thrift stores. The main point of thrift stores is to sell low-cost goods for the needy. Buying stuff there for resale does indeed harm the needy. The main point of library sales is not to provide low-cost books for the needy but to provide funds to support the library's operations, including the library's free book rental program which is traditionally its core.

  21. Javascript "Copyright Protect" doesn't do much on Woman Trademarks Name and Threatens Sites Using It · · Score: 2, Funny

    I just typed ctrl-a, ctrl-c, and, poof!, all of the text of the page was in my clipboard. :-)

  22. Re:Feetch! on Court OKs Covert iPhone Audio Recording · · Score: 2, Interesting

    You don't want to disable phones based on GPS location instead of confiscating. For what would you do when there is no GPS signal, e.g., indoors? (If you allow the cell-phone use, then the bad guys can use cell phones on a military base after removing the GPS antenna. If you don't allow the cell-phone use, then lots of good guys suffer because they can't make calls indoors.)

    This doesn't affect the recording feature suggestion, as that could be done via cell-tower ID.

  23. Re:Sneaky, yes. Lies, not quite. on ISPs Lie About Broadband "Up To" Speeds · · Score: 1

    Suppose you play one of those fast-food restaurant scratch-off games, and you're told that every ticket is a winner, with the smallest prize being a coupon, and that you can win up to $100,000. I don't see any innate deception here. Yes, you can win up to $100,000, but every sensible person knows that only a very small minority of the players will do that. Likewise, I don't see anything all that wrong in principle with a grocer having some weird promotion like: "For $3, I'll sell you a random bag of nuts. You'll get up to five pounds." If you get five pounds, you're lucky and you've won the nut lottery. But you should expect to get less. There really isn't any innate deception. There may be some non-innate deception, though, in both cases due to the fact that people don't deal with probabilities very well.

  24. Re:It's not a lie on ISPs Lie About Broadband "Up To" Speeds · · Score: 1

    "Up to" does not mean "less than or equal to". Then they could truthfully advertise that they go up to a googolplex bytes per second. To my ear, "up to x" means something like "less than or equal to x, and sometimes reaching x (or at least arbitrarily close to x)". That's still compatible with the average speed being about half of x, as long as on rare occasions one hits x. And it's not even all that misleading, I think. Maybe if the average speed was about a tenth of x it would be misleading.

  25. Re:BMWs, Minis on Cambered Tires Can Improve Fuel Economy · · Score: 1

    How does the unidirectional grip work when backing up on a slippery surface?