Wikipedia:Reference desk/Archives/Computing/2010 September 3

From Wikipedia, the free encyclopedia
Computing desk
< September 2 << Aug | September | Oct >> September 4 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 3[edit]

Idiotic and Useless Emails[edit]

Why I keep on getting more and more foolish messages like proposals to get quick money (100000 $) ! etc. from a bank etc. who account holder is dead or other bullshit like that. Who is behind all this and what they gain by wasting people's time ?  Jon Ascton  (talk) 01:11, 3 September 2010 (UTC)[reply]

Have you ever heard of a phishing trip? (Now that I read that joke a couple times, it sounds really corny...) Essentially, some slob sitting in a smelly apartment somewhere is hoping you're dumb enough to hand over your most sensitive financial information. Then, they can then use it to ring up something expensive and/or illegal, or sell it to someone else who will end up doing that anyway for thousands of dollars. Of course you wouldn't hand over your credit card number for no good reason, so they cook up all sorts of crazy schemes to dupe you. Most often I hear about the Nigerian prince scam that asks you to wire money to a sketchy Nigerian "prince" so he can send you a ridiculous amount of money in return. Other suspicious e-mails include: you have won a lottery you never entered, and the company needs your bank details so they can send you the winnings; the legitimate-looking e-mail from your bank telling you that you have to change your bank website password for some reason; or there is some rich foreigner who died in a plane crash with no will or family, and you have been chosen to receive his fortune. Ignore them. It's a huge business, and many people are suckered in. You can protect yourself by just deleting them, and remembering that there is no such thing as free money. Xenon54 (talk) 02:14, 3 September 2010 (UTC)[reply]
Or set up a filter that puts mail with words like 'free money' into junk.Sir Stupidity (talk) 03:22, 3 September 2010 (UTC)[reply]
There are several of these scams out there and people fall for them every day. I read an article a couple years ago about a woman who kept giving more and more money away to someone on the net in the hopes of an eventual pay off. If I remember correctly, she gave the scammer something like US$14,000. Dismas|(talk) 04:38, 3 September 2010 (UTC)[reply]
There was an elaborate scam attempt on me the other day. I offered a cellphone for sale online in South Africa, and this person claiming to be on holiday in London wanted me to post the cellphone to his son working in an oilfield in Nigeria. Just the mention of Nigeria set off an alarm bell and I refused to give him my banking details... he even offered way more money than I was asking. Obviously this sounded too good to be true so I told him to transfer into my paypal account. Soon after I got a very authentic looking email from "paypal" but first of all, my paypal status wasn't updated and after looking at the email more carefully, I noticed the odd spelling mistake and the wrong email account being used. It was also sent by someone@gmail on behalf of services@paypal. I reported it to paypal who said they would investigate. I can imagine some derelict warehouse in Nigeria receiving thousands of free items a day and the police there just turning a blind eye. Just be careful people... even worse than material theft is identity theft... it can wreck your life. Sandman30s (talk) 06:00, 3 September 2010 (UTC)[reply]
The basics of the scam have already been clearly outlined. The scammers work on a model that expects a tiny fraction of people that fall for it - The vast majority of people will simply delete the email. However, as in the case mentioned by Dismas - when the phishers do get a 'bite' they can be in for a significant prize. If it really does annoy you, there are a number of sites set-up that give advice to people about trolling the scammers, and they also publish transcripts of the trolling communications (some can be quite funny). If you do go down that route though, be careful not to give the scammers any personal information that could be used to steal your ID Darigan (talk) 11:23, 3 September 2010 (UTC)[reply]
So why do you keep getting these foolish emails, while I haven't received any spam in months? Because I don't go spreading the email addresses I really care about all over the internet. I tell friends and relatives my real email address, I use several webmail accounts for signing up to site memberships and shopping (places that might sell my address onto a third party), and I use other webmail accounts for very occasional 'dodgy' dealings with places that will definitely sell my address onto a third party. Also, I never reply to any spam, even to request they 'unsubscribe' me. The net result is that the spam ends up in an account I only visit once or twice in 6 months, and my real address gets no spam. Astronaut (talk) 11:39, 3 September 2010 (UTC)[reply]
It's really important never, ever, to reply to spam. There is a possibility that a spammer receiving any sort of reply could make him notice that the e-mail address is live, which encourages him to send even more spam to it. Because of a similar reason, the e-mail client I use (Evolution) by default does not automatically download images in HTML e-mails. If it did, the spammer's HTTP server would register a connection from my IP address, confirming that the spam was received by a live person. So Evolution is clever enough to prevent that. JIP | Talk 19:16, 3 September 2010 (UTC)[reply]
I know the 'never respond' advice is often given. but has this ever been confirmed to (still) be true? If you have a botnet capable of sending mail to a 100 million email addresses, is a spammer actually bothering to send his second spam run to only a fraction of those? Unilynx (talk) 10:03, 4 September 2010 (UTC)[reply]

I find I receive junk e-mails with nonsensical contents and subject lines, with an attached image. I've never opened one of the images, but I wonder what this is about. --rossb (talk) 19:32, 4 September 2010 (UTC)[reply]

Is the image attached, or just embedded? If it's just linked to you can be sure that they're doing it to test for valid email addresses. (As soon as your mail client sends a request to the server the image is on, they know the email went through.)
If it's actually attached, it may not be an image. Sometimes you see files named things like
"NakedGirls.jpg                                                            .exe"
If it's attached, and if it's legitimately an image file, then I'm mystified. I don't think I've ever gotten one of those. APL (talk) 00:06, 5 September 2010 (UTC)[reply]
It may well be an attempt to get around Bayesian spam filters. The image can contain a picture of the word "Viagra" (as well as the name of their website) without tripping any filter conditions. Marnanel (talk) 15:18, 5 September 2010 (UTC)[reply]

One time I was in a mood to click a link that promised free iPhone. iPhone was indeed free, but to qualify for it web site required to sign up for number of "promotions", like half a dozen out of forty available, and each of them was non free, requiring products purchase or payments for services. Since I obviously did not trusted the site, I haven't purchase anything, but I clicked couple links that I found interesting (one was Disneyland something, important for later developments). And at the beginning I filled the form with my real address in it(but phone number thanx god was fake, duh! should have gave them local police station number!). Next thing a couple months or so later I received backpack full of toys, addressed - opps had to go, finish later. 70.52.186.74 (talk) 00:06, 5 September 2010 (UTC)[reply]

Addressed "TO: Mynamehere's child" A small backpack itself and toys looked very cheap, but were delivered to my address. Then a letters start coming into my mail, with requirements to pay for it. Sum was not big, less then $50, forty something. And letters looked scary - basically they were saying, you owe us for service/goods provided, please make a payment or call number to pay with credit card etc. And I got something from them! And it was smart on their side, backpack arrived long time I visited a site, and how many people would remember what they were doing online and exact wording of what they signed up for couple month ago while they were browsing online bored? I was even considered myself to make a payment (now it sound silly, but then, when I was reading letters - it just looked like it is better to pay rather then get into some kind of trouble). Anyway I did not paid a cent and, afraid, backpack ended up in the garbage bin, since I had no use for it. What amazes me, is that those truly random website phishers did invested some real money into products (cheap one, but anyway), and bothered themselves with not only electronic phishing. And I bet, if I would provide them with my real phone number, I would have get some automatic system calling my cellphone every other day to remind about payment and such. And in case I have paid them, they could have sent me another gift "worth" $200+. Hope you like this story. 70.52.186.74 (talk) 02:18, 5 September 2010 (UTC)[reply]

data corruption[edit]

Resolved

Is there a way to simulate data corruption on a file? Like a special program that can corrupt a file to varying levels so you can test how much the data is retrievable? 82.44.55.25 (talk) 09:47, 3 September 2010 (UTC)[reply]

A hex editor may be the simplest to use for your basic tests. If you want to be systematic, a simple program should be easy to write; you just have to define "corruption". For example, consider three different kinds of failures:
  • "zero out 1 byte at 1024 uniformly-distributed random locations in the file"
  • "zero out 1024 bytes, starting at file-offset 100,000."
  • "zero out every 8th byte, starting at file-offset 0, and ending at file-offset 8192"
  • "xor 1024 bytes in the file using the same bitmask."
These all corrupt the same number of bytes in file, but each simulate a different kind of failure-mode. Unless you know how your files might get corrupted, it's difficult to simulate (or to design a good strategy for recovery). Consider reading our error detection and correction article. Nimur (talk) 18:06, 3 September 2010 (UTC)[reply]

Thanks! 82.44.55.25 (talk) 18:35, 3 September 2010 (UTC)[reply]

Parchive[edit]

I've read the Parchive article but I don't understand how it works. It makes indexes of file hashes which can be used to repair files? How exactly is that done? What level of damage can the file be before the Parchive can't fix it? 82.44.55.25 (talk) 09:56, 3 September 2010 (UTC)[reply]

It uses a parity bit system. Parity relies on xor which is a bit operation. Just like addition is 1+1=2 and represented by a +, xor is a bit operator and is often represented with a , or a ^ in some programming languages. Xor is "one or the other but not both." So 0⊕0=0, 1⊕0=1, 0⊕1=1, 1⊕1=0.
If you're storing something, let's say a string of 1's and 0's (1100 0010). You can split it up into two blocks, then compute a third block, a parity block. So you then store 1100, 0010, and 1110 (the last one is your parity block). Now if any one block gets clobbered somehow, you can figure out what it was using the remaining blocks. If two or more get clobbered, you're out of luck.
This is the general idea. It can be expanded, applied to millions of strings like that, etc. That's how parity systems work. You might find RAID-5 interesting, it works on the same principal. Shadowjams (talk) 23:20, 3 September 2010 (UTC)[reply]
I want to point out that my explanation isn't exactly how parchive works either. It uses Reed Solomon codes which entail more detail. [1] That is the original paper that the theory's based on. But the general idea is still the same. Shadowjams (talk) 23:36, 3 September 2010 (UTC)[reply]
The general concept is called an erasure code. 67.122.211.178 (talk) 01:01, 6 September 2010 (UTC)[reply]

Webpage to PDF[edit]

Is there anything that can easily turn a webpage into a PDF? I have seen the the Firefox add-on 'PDF Download' but it is tagged as Adware, does the conversion online, and has had bad recent reviews. Thanks 92.15.11.118 (talk) 10:17, 3 September 2010 (UTC)[reply]

My Firefox allows me to print (File -> Print) to a file, and I can select PDF as the output file. Does this suit you? --Ouro (blah blah) 11:13, 3 September 2010 (UTC)[reply]
My computer (WinXP) does not offer that unfortunately. 92.15.11.197 (talk) 14:04, 3 September 2010 (UTC)[reply]
If you want something that can do it in batch (for example to snapshot a website regularly) wkhtmltopdf works well.-- Q Chris (talk) 11:23, 3 September 2010 (UTC)[reply]
That looks interesting but as Windows has deskilled me so that I only understand clicking something, I do not know how to set it up or run it. 92.15.11.197 (talk) 14:08, 3 September 2010 (UTC)[reply]
For this purpose, I installed CutePDF Writer, which does the same thing that Ouro above describes on my Windows XP system. Comet Tuttle (talk) 14:56, 3 September 2010 (UTC)[reply]
In an unexpected turn of events, I cannot check how it works, no Linux version. Sidenote, I wonder why FF for Win does not give the option to print to a PDF file. Hope Comet's solution works out for you. --Ouro (blah blah) 16:23, 3 September 2010 (UTC)[reply]
"print to file" is part of the standard desktop printing architecture in many desktop Linux distributions. It works just the same as the pseudo-printer that CutePDF installs. It's available to any desktop program that's aware of printing (strictly I think there's one plugin for Gnome and a different one for KDE, but they work much the same); they're mostly a layer built on Ghostscript. Non-gui programs have to call Ghostscript themselves to do the same job. -- Finlay McWalterTalk 16:33, 3 September 2010 (UTC)[reply]
Could be. Has to be out of the box, this install is fresh (done last week) and almost nothing had been modified because I didn't have the time to do it. On Ghostscript, I remember yeaaaaaars ago (in the days of W98SE) I had to install Ghostscript to do... a lot, print to files too I think... Thanks. --Ouro (blah blah) 16:39, 3 September 2010 (UTC)[reply]
I use PDFmyURL. It does exactly what it says on the tin - type your URL into the box and it provides a PDF to download. It does add a logo to the PDFs though. Equisetum (talk | email | contributions) 17:15, 3 September 2010 (UTC)[reply]
Quite a silly thing to do. If you merely want to archive a web page into a single file, use Mozilla Archive format (for Firefox, Internet Explorer has its own built-in which does the same thing). ¦ Reisio (talk) 02:09, 5 September 2010 (UTC)[reply]
Your assumption is wrong. Thanks for the gratuitous put-down. In any case I tried that in the past, then uninstalled it because it wasnt very good. 92.15.30.74 (talk) 12:56, 5 September 2010 (UTC)[reply]
It was a charity — any other thing you might be wanting to do other than merely archiving a web page to a single file... would be even sillier (using PDF). ¦ Reisio (talk) 19:09, 6 September 2010 (UTC)[reply]
If you're running OS X, the Print function (File --> Print) has a feature that does exactly this - in the Print window of Safari (or Firefox) there will be a 'PDF' button in the lower-right. Select it, and then "Save as PDF". Rishi.bedi (talk) 18:02, 8 September 2010 (UTC)[reply]

a/b drives[edit]

why do my computer does'nt have a, b drives —Preceding unsigned comment added by Shantanuca (talkcontribs) 10:43, 3 September 2010 (UTC)[reply]

These are usually assigned to floppy drives. If your computer doesn't have a floppy drive, then those drive letters won't be shown 82.44.55.25 (talk) 10:57, 3 September 2010 (UTC)[reply]
See Drive letter assignment. It's sad that people are already forgetting floppy disks; it makes me feel old. In any case, what happens if you have more drives than letters to assign? Do you start getting drives AA, AB, etc., or does the computer just not let you do it. Buddy431 (talk) 13:28, 3 September 2010 (UTC)[reply]
I asked a question about that a while ago, Wikipedia:Reference_desk/Archives/Computing/2010_May_2#Drive_letters 82.44.55.25 (talk) 13:42, 3 September 2010 (UTC)[reply]
That's interesting, thanks. Buddy431 (talk) 01:17, 4 September 2010 (UTC)[reply]
FWIW, MS-DOS v2 (released in 1983, and I now feel old) certainly used to let you go on beyond Z, so the next drive would be [:, and so on through the ASCII set. I don't know when this was removed. Marnanel (talk) 14:58, 5 September 2010 (UTC)[reply]

Javascript time[edit]

I want to write a greasemonkey script that will popup an alert box at a certain time, say 6pm. Sort of like an alarm clock. In javascript, is there a way to make a function execute at a set time? 82.44.55.25 (talk) 11:08, 3 September 2010 (UTC)[reply]

The window.setTimeout function will launch a function after a specified number of milliseconds. Calculate the number of milliseconds between now and 6pm. Then, use that number of milliseconds as the offset for setTimeout. -- kainaw 12:43, 3 September 2010 (UTC)[reply]

Cell Phone and Lap top[edit]

I am thinking about purchasing a cell phone and contract that will allow me about 800 anytime minutes free on weekends and evenings. (perhaps a variation, free incoming) I also want to be able to retrieve email and brouse Web. I can get such a plan for about 60.00 a month. I would then like to cancel my home internet and home phone. I only want to do this if I can plug in the new phone to my lap top and be able to read my email on the lap top and to hopefully write emails on the lap top that will be sent back through my cell phone. DOES ANYONE KNOW IF THIS IS POSSIBLE. ANY ADVICE IS APPRECIATED. I AM GOING OUT TO DO SOME HANDS ON TESTING BUT HAVE NO IDEA WHAT WOULD BE THE BEST PLAN OR PHONE. I DO SEEM TO FAVOUR THE SLIDE KEY BOARD FOR TYPING TEXTS. A bigger phone screen would also be helpful for reading texts etc. —Preceding unsigned comment added by 99.199.47.107 (talk) 17:06, 3 September 2010 (UTC)[reply]

Where are you? Your IP address suggests you're in Canada. -- Finlay McWalterTalk 17:21, 3 September 2010 (UTC)[reply]
What you're wanting to do is called tethering. Most smart phones can do it in some way or another. You will want to check with your mobile provider to see what options they offer for mobile broadband tethering. Most mobile broadband plans are designed with the idea that access is solely through your phone. Thus, most providers charge extra for this service. Also, keep in mind that mobile broadband plans are usually more restrictive in terms of bandwidth and data caps. If you're just utilizing the Internet for email, you shouldn't have a problem. However, if you're wanting bandwidth intensive applications (video, gaming, etc.) you are going to see poor performance compared with wired Internet access. --—Mitaphane Contribs | Talk 18:31, 3 September 2010 (UTC)[reply]

Methods for multiple classes[edit]

I'm trying to write a math thing in Java where there is a fraction class, a radical class, a polynomial class, and so on. When defining multiplication for fractions, I would multiply the numerator and the denominator, but there could be many things in the numerator, like an polynomial or a radical or something. First, how would i declare the class of the numerator, and second, could i write something saying "call the multiply method of whichever class this belongs to"? KyuubiSeal (talk) 21:44, 3 September 2010 (UTC)[reply]

There are several ways you can do this. Off the top of my head:
  1. You just have each type of math thingy implement multiply functions for all the things it's meaningful to multiply it by. Java's polymorphism mechanism will call the right one. So your Complex class might have a multiplyBy(Integer) method, a multiplyBy(Complex) method and so forth. This is the straightforward way to go - a (probably minor) downside is that if you add a new kind of math thingy you need to alter all the things it can multiply by so that they know about it, and you have to do that at compile time.
  2. If you needed extensibility beyond that, you can dispatch calls through a dynamic registry you maintain. That way you can add (even at runtime) new math thingies, but the code gets rather complex. Have all these math thingies be concrete implementations of an abstract base class (lets say MathThingy). MathThingy has a multiply(MathThingy A, MathThingy B) method. This is final. When this is called, it uses getClass on its arguments, looks them up in a little registry, and calls specific methods in the concrete subclasses. The registry is filled by the class constructors of each MathThingy as they're classloaded - so the Complex class registers handler methods that say they can handle intXcomplex, complexXint and complexXcomplex. This is very flexible - you can even add new operators (at a logical level; java doesn't allow you to overload or define actual java syntax operators). But a major downside (aside from the complexity) is that type errors become runtime errors rather than compile time ones (so you don't get a problem saying you can't raise a complex number to the power of a matrix until you run the program).
-- Finlay McWalterTalk 22:08, 3 September 2010 (UTC)[reply]

I get the first part about the polymorphism already, but I suppose I should rephrase my question. If I have a Fraction class, it would have an attribute numerator, right? How could I make the numerator an instance of the Polynomial or Radical or BigInteger class? And when it is, is there a way I could say numerator.multiply(5), and have it call the correct class's multiply(int)? Also, how is there no operator overloading, but "a"+"b" will give "ab"? Is that just a special case? KyuubiSeal (talk) 23:07, 3 September 2010 (UTC)[reply]

In your example, you need "Polynomial or Radical or BigInteger" or "..." to satisfy either option:
  • implements a common interface, like "Multipliable", or
  • extends a common parent class, like "MathematicalExpression"
The first way uses a Java interface, and you can follow this tutorial to learn how to use it. The second method uses inheritance - follow this tutorial to learn how to use it. The two methods are subtly different. Now, you can specify your numerator to be a "Multipliable" or a "MathematicalExpression" - and any class that either implements that interface (or extends that parent-class) is acceptable to use as a Numerator. Then, when you call a multiply() method, it will use the implementation of that method for the actual runtime type of the object. Nimur (talk) 23:33, 3 September 2010 (UTC)[reply]
Lastly, your question about Strings: these are "special things" in Java. Consider them a "special case" - they are true objects, but they are the only objects in Java that permit Operator Overloading (and this is the cause of much debate and brouhaha - but was part of the language design). Note that the language explicitly specifies this syntax - and it is not actually "operator overloading," it is special shorthand Java syntax for a new String constructor. This is to make the language "easy to use" for text processing, while staying true to certain "Java commandments" about object-oriented design. (And, take it from a seasoned programmer: you do not want operator overloading. You think you want operator overloading, but that is because you don't have it and haven't seen how horrible it is). Nimur (talk) 23:40, 3 September 2010 (UTC)[reply]
(we're rat-holing here, so I won't belabour this too much) when people say they "do not want operator overloading" I've found they mostly mean the brain-damaged operator overloading that C++ inflicts on innocent minds. Haskell's operator definition (I won't insult it by calling it overloading) lets you define type, arity, priority, and fixity (and actually deigns to let me define any operator I want, like foo or ⊕ or !!!) and combined with Haskell's non-shit type system makes for operator definition to work the way you'd sanely want it to. Sorry for the digression, as KyuubiSeal is working in an environment without such luxuries. -- Finlay McWalterTalk 01:12, 4 September 2010 (UTC)[reply]
So if I have a variable of class A (or interface B), any subclass of A (or something implementing B) can be assigned to it? This means anything can be assigned to an Object, right? And would there be any casting involved? (That's probably not too difficult to handle though) KyuubiSeal (talk) 23:55, 3 September 2010 (UTC)[reply]
Yes, you can assign an object of a subclass to a reference of any of its superclasses. And the system remembers what type it really is - so if you later upcast it (Java will make you handle a ClassCastException in this case) it's still of the same type you defined it as. The java instanceof is your friend here - you can say "is X an instance of A, or is it an instance of B, or not", and act accordingly. -- Finlay McWalterTalk 00:57, 4 September 2010 (UTC)[reply]

Okay, it's working now. Thank you so much! KyuubiSeal (talk) 01:09, 4 September 2010 (UTC)[reply]

Terminal window of safari[edit]

Where can I find the terminal window of Safari 5.0.1? I want to do some tweaking.Thanks--180.234.39.169 (talk) 23:22, 3 September 2010 (UTC)[reply]

Safari does not have a terminal; are you sure you don't mean either the operating system's terminal or the Safari Snippet Editor or Error Console ? Nimur (talk) 23:26, 3 September 2010 (UTC)[reply]
If you mean your operating system's "terminal" window, try to navigate to /Applications/Utilities and double-click on Terminal. If you still can't find it, see this.--Mithrandir (Talk!) (Opus Operis) 07:31, 4 September 2010 (UTC)[reply]