Wikipedia:Reference desk/Archives/Computing/2017 August 9
Computing desk | ||
---|---|---|
< August 8 | << Jul | August | Sep >> | Current desk > |
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. |
August 9
[edit]I need help asking about 2 these websites
[edit]1. On this website http://www.aronscottphotography.com/contact/ The purchasing of photos doesn't work well and the email address doesn't work. How can I purchase from this person? 2. Is there a contact email for the person operating this website here or a phone number: http://reneeoconnorfan.pixel51.com/ 3. What is the fastest computer that is on the market as of today? 64.114.70.78 (talk) 02:33, 9 August 2017 (UTC)
PHP maths
[edit]I want to input simple maths equations into PHP via the Windows command line and have it calculate the result. For example, "5*5" should return "25". I have the following code;
php.exe -r "$handle = fopen ('php://stdin','r'); $line = fgets($handle); echo ($line);"
However it just returns "5*5" not "25". I have tried;
echo $line; echo ($line); echo '' . $line . ''; echo '' . ($line) . '';
I also tried;
$maths = ($line); echo $maths;
But that did not work either. Can someone help me? Thanks for your time. — Preceding unsigned comment added by 165.138.225.250 (talk) 07:30, 9 August 2017 (UTC)
- The methods you have been trying so far treat the string "5*5" as a string of characters and then display that string. What you actually want to see is the value of "5*5" when it is interpreted as an expression by the PHP compiler. PHP has an eval function that might help you - see here. Note that this function comes with warnings. It is not selective about which code expressions it evaluates, so it is potentially dangerous because it allows the program user to insert their own code into your program.
- Alternatively, you could write your own parser that dissects a simple arithmetical expression, evaluates it and displays the result. That would be more instructive and safer than using the built in eval function but would not fit into a one-line program. Gandalf61 (talk) 07:53, 9 August 2017 (UTC)
- Thank you for the response. I tried
eval('echo $line;');"
- But it still returns "5*5". I tried adding and removing quotes but I just get "Parse error: syntax error, unexpected T_ECHO in Command line code on line 1". 165.138.225.250 (talk) 08:24, 9 August 2017 (UTC)
- eval('echo $line;') evaluates the expression 'echo $line;' which, as you already know, gives the result "5*5". You want to evaluate the variable $line itself. Try eval($line). You may find you need to append ";" to the end of $line first. Gandalf61 (talk) 10:21, 9 August 2017 (UTC)
- eval($line) returns the value of $line, in this case "25". To print the result, you want echo(eval($line)). However as noted, this is quite dangerous. For example, if the user types in "unlink('somefile')", calling eval on that string will delete the file. CodeTalker (talk) 16:00, 9 August 2017 (UTC)
- The real question here is "Why are you trying to do this?" PHP is not a language designed to be used to execute code snippets from the command line. It's designed for Web programming. If you're trying to teach yourself how to program in PHP, there are much better things to do. Also, something that takes external input, like a calculator, is surprisingly complex if you want to do it "right" for untrusted input, as others have brought up. Incidentally, if you're a new programmer, I strongly recommend not trying PHP as your first language, because it has a lot of sharp edges and pitfalls for unwary newbies. Python seems to be the trendy "teaching language" these days, though everyone has their own favorite language. --47.138.161.183 (talk) 00:06, 10 August 2017 (UTC)
Question duplicated on the Science Desk, where it has already been hatted |
---|
The following discussion has been closed. Please do not modify it. |
What does Vitamin C help?[edit]1. Prevent cell damage from free radicals 2. Boost iron absorption 3. Enhance immune function, which increases resistance to disease 4. Promote healthy gums and wound healing 5. Resolve bruising and recurrent infections 6. The sources of vitamin C are tomatoes, green leafy vegetables, parsley, cabbage, asparagus, and avocados. — Preceding unsigned comment added by Shangeethaaigs (talk • contribs) 08:29, 9 August 2017 (UTC) |
E-mail deluge
[edit]Nowadays, many people complain about the e-mail deluge they're exposed to. A case in point is the current question at WP:RD/S#Blindness to important information because of deluge of irrelevant emails, to which this post originally was a reply. But I would like to ask it as a question by its own right: Why did nobody succeed in putting Bill Gates' idea into practice?
21 years ago, Bill Gates wrote in The Road Ahead:
A decade from now you may shake your head when you remember that there was ever a time when any stranger or a wrong number could interrupt you at home with a phone call. [In the future, software] will help by prescreening all incoming communications [...] If someone not on any of your lists wants to reach you, he'll have to have someone who is on one of your lists forward the message [or use] one of those paid messages I talked about in chapter 8 if he wants your attention.
— Chapter 10, "Plugged in at home", p. 245
One way for the advertiser to capture your attention will be to offer you a small amount of money–a nickel or a dollar, say–if you'll look at their ad. [...] Network mailings offering this sort of paying advertisement could be extremely effective because they could be carefully targeted. [...] Advertisements and messages from people and organizations you don't know could be sorted by how much money was attached to them. [...] You won't have to take the money someone bids, of course. [...] The bid is really just an amount the sender puts at risk to get your attention. [...] If a man sent you a $100 message saying he thinks he's your long/lost brother, you might forgive him the money if, in fact, he turned out to be your brother. On the other hand, if he was just somebody trying to get your attention to sell you something, you'd probably keep the money, thank you very much.
— Chapter 8, "Friction-Free Capitalism", p. 297
If I think about the Billions of Dollars lost to humankind in the 21 years since, due to information overload and all its consequences, I am more than just shaking my head. If Bill Gates was right in analyzing the huge potential of his solution, why can nobody make profit from implementing it? — Sebastian 12:50, 9 August 2017 (UTC)
- Junk email works just fine as it is. Those sending the emails turn a profit. They have no reason to change their business model. Those who receive the emails and don't want them aren't paying into the system. So, they don't get a say in the business model. The companies that deliver the emails are the ones who pay into the system. It is obviously not a problem for them, so they let it pass - to a point. Google mail is heavily filtered. So, they are removing a lot of email from the system. 209.149.113.5 (talk) 13:18, 9 August 2017 (UTC)
- "Junk email works just fine as it is" - now it does but if everyone else started using some whitelist process then they would have to conform or their message simply won't be read and if you wanted to advertise to the demographic behind that system you'd have to use that system. --129.215.47.59 (talk) 15:15, 9 August 2017 (UTC)
- I see a couple problems with your proposed fix:
- 1) They aren't likely to be willing to pay a significant amount to get people to read their ads. Probably only a fraction of a cent per person, if that's what they pay for sending email SPAM now. Since this is too little for people to be willing to read them, this business model won't work.
- 2) We do sometimes need to accept unsolicited emails or phone calls. For example, say the Internal Revenue Service or equivalent calls to say that somebody has apparently filed a tax return in your name to claim your refund.
- However, I do agree with the concept of a white list of callers who can make the phone ring, say using a secret code they enter, in case they call from a different phone, with the rest just being able to leave a message. StuRat (talk) 14:53, 9 August 2017 (UTC)
- That's a neat idea about the secret code; only of course it doesn't solve the e-mail deluge. — Sebastian 20:43, 9 August 2017 (UTC)
- White lists already exist in multiple ways. In the simplest form, I can tell my email program to ONLY show me emails from people I've added to my address book. In a more complicated form, there are systems that block emails and send an auto-response to the sender asking the sender to get their email address whitelisted. I don't like those because most junk email doesn't come from the person sending the junk email. It comes from a random email address. I personally get thousands of "could not send" replies every day where my email address is used in the 'from' field of junk emails. 209.149.113.5 (talk) 18:19, 9 August 2017 (UTC)
- Thank you, 209.149.113.5, I find your reply especially helpful. What systems are there that offer the block+autoreply? Maybe I should switch to one of those. I only don't understand why the function of a whitelist would be significantly impaired by spammers using random addresses. Since they're random, it should be extremely unlikely that they by chance hit an address on your whitelist, so practically all of them should be blocked anyway. Or am I misunderstanding something? — Sebastian 20:43, 9 August 2017 (UTC)
- White lists already exist in multiple ways. In the simplest form, I can tell my email program to ONLY show me emails from people I've added to my address book. In a more complicated form, there are systems that block emails and send an auto-response to the sender asking the sender to get their email address whitelisted. I don't like those because most junk email doesn't come from the person sending the junk email. It comes from a random email address. I personally get thousands of "could not send" replies every day where my email address is used in the 'from' field of junk emails. 209.149.113.5 (talk) 18:19, 9 August 2017 (UTC)
I solved my email spam problem years ago, and haven't had a problem since.
Here is the basic problem: If you use an email address spammers get it. As time goes on you get more and more spam, especially if someone tries to harass you by signing you up to mailing lists, replying to spam using your email address, etc. And it gets a lot worse if you use that email address on Usenet or social media.
After ten years with the same email address I was getting between 10,000 and 50,000 emails per day, with only a handful being things I wanted to read.
Whitelisting means that people who have never emailed you before cannot reach you.
Automatic spam-filtering always stops a few good emails and lets through a few bad.
Manual spam-filtering also stops a few good emails and lets through a few bad. A human being cannot go through 10,000 emails, separating spam from good emails, without making a few errors.
So, what is the answer?
First, get a domain name that you own. For this purpose a .biz or .us is better than a .com, because some spammers just blast away at random .com, .org or .net email addresses hoping for a hit. Lets pretend you picked jeyhokdux.biz (I got that from my random text generator; it took six tries to get something pronounceable).
Get an account with Tuffmail. For one low price you can create as many @jeyhokdux.biz email addresses as you want.
When you sign up with, say, Amazon, give them the email address amazon49287@jeyhokdux.biz (the numbers are so that someone who knows your scheme has trouble guessing the email address).
Then you tell facebook that your email address is facebook71256@jeyhokdux.biz, and you tell that dodgy Chinese site you ordered a hello-kitty-themed chainsaw from that your email address is chainsawcentral93678@jeyhokdux.biz. Go ahead and tell Tuffmail to apply no spam filtering at all. It has spam filetering, whitllisting, blacklisting, etc. but you will not need it.
So, let's say you start getting spam addressed to chainsawcentral93678@jeyhokdux.biz. Just tell Tuffmail to silently delete anything sent to that email address. Meanwhile your Amazon email address and any other email address that has not spammed you still works fine. Getting spam to the amazon email address? Change it to amazon712240@jeyhokdux.biz, block amazon49287@jeyhokdux.biz, and tell amazon that your email address has changed.
They cannot spam you if they cannot figure out what email address to send the spam to. Plus, you will know who sells your email address and who keeps it private. For example, in 11 years, Wikipedia has never leaked my email address to anyone. --Guy Macon (talk) 21:28, 9 August 2017 (UTC)
- @Guy Macon: If you don't care about privacy (and helping our robot overlords conquer even more of this planet) it is also possible to get a gmail address (for example: "example@gmail.com") and sign up for amazon with "example+amazon@gmail.com" (or, if you prefer, example+amazon49287@gmail.com). You won't need to pay a domain registrar or Tuffmail, and you basically have the same thing except the privacy. (((The Quixotic Potato))) (talk) 21:57, 9 August 2017 (UTC)
- I tried that before coming up with my present method, and it worked fairly well. Unfortunately, I found that roughly 25% of websites refuse to allow you to enter an email address with a "+" in it when you register. This violates Internet standards: RFC 2822 (which replaces section 6 of RFC 822) says that "+" is legal when used on the left side of the "@" character in email addresses. See sections 3.4.1 and 3.2.5 at http://www.ietf.org/rfc/rfc2822.txt or http://www.faqs.org/rfcs/rfc2822.html for details.
- http://www.remote.org/jochen/mail/info/chars.html has more details on what is and is not allowed in an email address. --Guy Macon (talk) 23:48, 9 August 2017 (UTC)
- I've almost never encountered a situation where a plus sign in an email address is not allowed, but when I do I can simply use (for example) e.x.a.m.p.le@gmail.com and set up a filter to always mark emails delivered there as spam. https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html (((The Quixotic Potato))) (talk) 06:27, 10 August 2017 (UTC)
- I've had problems with the plus before, but not that often. But worse is when the plus is accepted but the system doesn't handle it properly. (I seem to recall something which didn't like multiple dots. Or maybe it was just multiple consecutive dots which isn't technically allowed so isn't so surprising.) Note that doing these either requires you always use an email with plus or dots for accepted addresses or that not enough people do it. (I.E. This is a particular possible annoyance for personal email addresses which people may still on occasion give out by voice, or may be typed manually.) Since if you still use your email without dots and pluses as an ordinary email rather than an all spam one, any sufficiently advanced system will probably add that to their spam list as well if enough people are doing it that they bother. Nil Einne (talk) 18:29, 12 August 2017 (UTC)
- I've almost never encountered a situation where a plus sign in an email address is not allowed, but when I do I can simply use (for example) e.x.a.m.p.le@gmail.com and set up a filter to always mark emails delivered there as spam. https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html (((The Quixotic Potato))) (talk) 06:27, 10 August 2017 (UTC)
- Sebastian, I think you're missing the IP's point. Since many spammers use random, often valid, from addresses, any system which sends autoreplies to rejected emails is going to send a lot of unwanted junk emails to people who just had the misfortunate that the spammers used their address. Sure you the sender may not be affected by this (especially since if you are doing the whitelist thing, you also won't see the junk can't delivery emails others who do the same thing send you for emails you never actually sent). But as a good netizen, you probably shouldn't be sending out such junk. And actually it could affect you if enough people complain to your email provider and they consider it a TOS violation for you to send out automated replies to spammers and their fake from addresses. Nil Einne (talk) 18:38, 12 August 2017 (UTC)
I use gmail, and I've never had a problem with Spam: it just goes into the Spam folder. I check it periodically to make sure nothing important is there, but I've never found anything. You can also use Mailinator for a one-time, disposable e-mail address: I do this when I need to ask a question on a forum that I'm never going back to, or when I buy a one-time product from a merchant that insists I make a login before they will let me check out (last year I bought a colored light bulb for a project, and I didn't want to make an account because I will never need one of those again).OldTimeNESter (talk) 23:47, 12 August 2017 (UTC)
Is my car radio broken ?
[edit]It used to display the names of the station, song, and artist, maybe half the time or more, but now it never does. What's the name of that service, and did they stop broadcasting that info in Detroit, or is my radio broken ? StuRat (talk) 15:22, 9 August 2017 (UTC)
- Radio Data System. It's very likely that, in some fumbling with eyes on the road, you've accidentally turned it off. -- Finlay McWalter··–·Talk 15:46, 9 August 2017 (UTC)
- In my experience relatively few stations bother to use Radio Data maybe 1/2 of them, though the percentage will of course vary by market. Which is shame, because it's pretty cool and useful. But it has nothing to do with broadcast area, and everything to do with what a particular station cares to put money/time into doing. If you can rule out settings on your radio, you might call a particular station that you used to receive the data from, and ask if they turned it off. SemanticMantis (talk) 18:34, 9 August 2017 (UTC)
Thanks so far. Is there a way to get a list of who broadcasts it in my area ? (If I check all the stations in my area and none of them show up, then it must be my radio or it's settings.) StuRat (talk) 21:05, 9 August 2017 (UTC)
- http://www.beaglebass.com/dx/dx_rds.htm#Detroit -- Finlay McWalter··–·Talk 21:10, 9 August 2017 (UTC)
- Thanks ! StuRat (talk) 01:45, 10 August 2017 (UTC)