Wikipedia:Reference desk/Archives/Computing/2017 August 5
Computing desk | ||
---|---|---|
< August 4 | << Jul | August | Sep >> | August 6 > |
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 5
[edit]PHP greater than alternative
[edit]In PHP is there any way to specify "greater than" without using the ">" sign? For example;
if (5 > 1){echo 'five is greater than one';}
Instead of the above I need to specify "greater than" without using the ">" sign. I need something like;
if (5 GTR 1){echo 'five is greater than one';}
I looked at the manual page but it doesn't seem to offer any solutions. Thanks for your help. — Preceding unsigned comment added by 2A00:6D40:60:9D81:0:0:0:1 (talk) 09:52, 5 August 2017 (UTC)
- The question is, why would you need that? The obvious solution is to use a negative < comparison. Or you could use
max()
, e.g.echo max(1,5) == 5 && 1 != 5 ? "5 gt 1" : "no";
Similarly you can also compare the sorted values, roughly:$a = array(1, 5); rsort($a); echo $a[0] == 5 && $a[0] != $a[1] ? "5 gt 1" : "no";
. Check the docs for both these functions as they can be a bit quirky. -- zzuuzz (talk) 10:45, 5 August 2017 (UTC)- I'm invoking PHP from the Windows command line using the "-r" switch. Windows CMD treats ">" as a redirection to file so I'm ending up with a file called "1){echo 'five is greater than one';}" being generated instead of the actual command being processed by PHP. Using "^" to escape the ">" causes an error with PHP. 2A00:6D40:60:9D81:0:0:0:1 (talk) 13:16, 5 August 2017 (UTC)
- You can surround the string in double quotes to protect metacharacters from the Windows shell:
perl -e "if (5 > 1){ print 'five is greater than one'; }"
- If you need to use a double quote within the perl code you can escape it with a backslash:
perl -e "if (5 > 1){ print \"five is greater than one\"; }"
- CodeTalker (talk) 15:14, 5 August 2017 (UTC)
- It's in PHP ;) but the same applies. The -r switch is "Run PHP [code] without using script tags <?..?>". I've never had a problem like this with metacharacters and CMD when using double quotes, but even if it happened there is almost always some way to escape things properly. -- zzuuzz (talk) 15:25, 5 August 2017 (UTC)
- While I appreciate the help troubleshooting escaped characters and providing alternative functions that achieve the same outcome, could the original question be addressed? Is there a way to tell PHP "greater than" without using ">"? Ideally a simple substitution of ">" with a string like "GRT" or whatever. Thanks for your time and help. 2A00:6D40:60:9D81:0:0:0:1 (talk) 19:13, 5 August 2017 (UTC)
- I believe you're discussing an XY Problem and looking for a construct which doesn't exist. You will have to use some workaround, like those mentioned above. There are a number of other alternatives, for example, using the shell or encoding and eval(), which is often described as a function that indicates that something has gone terribly wrong. -- zzuuzz (talk) 06:46, 6 August 2017 (UTC)
- While I appreciate the help troubleshooting escaped characters and providing alternative functions that achieve the same outcome, could the original question be addressed? Is there a way to tell PHP "greater than" without using ">"? Ideally a simple substitution of ">" with a string like "GRT" or whatever. Thanks for your time and help. 2A00:6D40:60:9D81:0:0:0:1 (talk) 19:13, 5 August 2017 (UTC)
- It's in PHP ;) but the same applies. The -r switch is "Run PHP [code] without using script tags <?..?>". I've never had a problem like this with metacharacters and CMD when using double quotes, but even if it happened there is almost always some way to escape things properly. -- zzuuzz (talk) 15:25, 5 August 2017 (UTC)
- CodeTalker (talk) 15:14, 5 August 2017 (UTC)
Finding the email address of a 'Twitter'ist
[edit]Is there a way to find the email address of someone holding a 'Twitter' account (which is inactive in this period of time, otherwise it would'nt much of a problem) ? It might not seem relevant to the question in principle, but it's precious & important to me (motivation). בנצי (talk) 13:04, 5 August 2017 (UTC)
- Which one? (((The Quixotic Potato))) (talk) 00:36, 6 August 2017 (UTC)
- What do you mean ? - his @namename (username ?) ? Any idea in mind ? It'll be kind to know more before exposing. Thank you. בנצי (talk) 05:36, 6 August 2017 (UTC)
- You can send a message via Twitter, asking what their emailaddress is (even if they're not posting tweets they may still get an email from Twitter telling them you've sent them a message) or you can google their username to see if they've used the same username elsewhere on the internet. (((The Quixotic Potato))) (talk) 16:53, 6 August 2017 (UTC)
- a. this option is obvious and known to the average 'Twitter' user. The point is that you can't send a message unless the addressee follows you (or permits sending him massages). That's not the case, and is the reason I raised the question.
- b. I did that, too, fruitlessly. בנצי (talk) 18:01, 6 August 2017 (UTC)
- Well, we cannot hack Twitter's user database for you. (((The Quixotic Potato))) (talk) 18:13, 6 August 2017 (UTC)
- A question is just a question, and as such, each applicant is entitled to a decent & fair answer. Hacking isn't in my glossary. If you can't help, at least say so and avoid attribution of intentions & sarcasm. Otherwise, it's insulting & offending, which's not what we're supposed to do here. I expect an applogy. בנצי (talk) 19:24, 6 August 2017 (UTC)
- I refer you to the reply given in the case of Arkell v. Pressdram. (((The Quixotic Potato))) (talk) 20:08, 6 August 2017 (UTC)
- A question is just a question, and as such, each applicant is entitled to a decent & fair answer. Hacking isn't in my glossary. If you can't help, at least say so and avoid attribution of intentions & sarcasm. Otherwise, it's insulting & offending, which's not what we're supposed to do here. I expect an applogy. בנצי (talk) 19:24, 6 August 2017 (UTC)
- Well no one said anything about a DM. You can send a public tweet to the user asking them. Tweeting people to talk to them is after all one of the ideas of Twitter, hence why such tweets while public, didn't used to show up on your Tweet feed [1] and people like some presidents added dots to ensure they did [2]. Most likely they won't want to provide it publicly, so I suggest you follow them or just enable all DMs so they can provide it privately, before Tweeting. Nil Einne (talk) 16:57, 7 August 2017 (UTC)
- P.S. I find it a little weird you're acting like you're an expert on DMs and Twitter when it was only about 1 month ago you had to ask about the very thing despite the fact a simple 5 second search found out about them Wikipedia:Reference desk/Archives/Computing/2017 July 1#a few questions regarding using Twitter. I mean it's great that you learnt since some users despite asking don't seem to. But if it's something so new to you too, maybe tone it down a bit. Especially since as I said, in this case while messaging was mentioned, DM (or private messaging) wasn't. And while most people call them tweets, a tweet is basically a public message sent via twitter. And when it mentions someone, it's a is a public message directed at another user sent via Twitter. So whatever TQP meant, they weren't actually wrong in saying you could message the user concerned to ask them. Well unless the user concerned already blocked you, but if that's the case you shouldn't bother asking here. Nil Einne (talk) 17:09, 7 August 2017 (UTC)
- Well, we cannot hack Twitter's user database for you. (((The Quixotic Potato))) (talk) 18:13, 6 August 2017 (UTC)
- You can send a message via Twitter, asking what their emailaddress is (even if they're not posting tweets they may still get an email from Twitter telling them you've sent them a message) or you can google their username to see if they've used the same username elsewhere on the internet. (((The Quixotic Potato))) (talk) 16:53, 6 August 2017 (UTC)
- What do you mean ? - his @namename (username ?) ? Any idea in mind ? It'll be kind to know more before exposing. Thank you. בנצי (talk) 05:36, 6 August 2017 (UTC)
where is our "flame graph" article?
[edit]Hi, I put "wikipedia flame graph" into Google and did not see wikipedia links in the results. I then searched Wikipedia for it via google's (put in "wikipedia" as a google search and it gives you a search field you can use) and Wikipedia's search (on the site) - my link to that is
though it appears to have a token so I am not sure if you can just click.
- Where is our flame graph article please?
I can't think of any other name for this type of graph. As you can see there are a lot of articles on the web and it's a well-known concept:
http://google.com/search?q=flame+graph
I am sure we have an article but perhaps there is another name for it.
Thank you. — Preceding unsigned comment added by 193.224.49.51 (talk) 13:11, 5 August 2017 (UTC)
- There isn't an article; no-one has written one. Is it really a "a well-known concept", though? A bunch of google hits doesn't necessarily mean that there's enough for a solid article. I'm seeing some presentations given by its inventor, Brendan Gregg, and some reports about those presentations. Some people have implemented the idea in a few packages on GitHub etc., and a few people have used them in their own presentations. But is it (the type of graph itself) covered, at length, in academic papers or books about statistics or displaying visual information? Are there articles about this specific kind of graph (not just articles using it)? The general standard of notability ask for "significant coverage in reliable sources that are independent of the subject". Without that, all there should probably be is a paragraph in the Brendan Gregg article. If you've found more stuff than I have, about flame graphs, then you can write an article yourself - see Wikipedia:Your first article. -- Finlay McWalter··–·Talk 15:37, 5 August 2017 (UTC)
hi, OP here. Thanks. I wouldn't write the article since I wanted to learn more about it. There were parts I didn't get and I thought a clear explanation the way most computer science articles give would be in the wikipedia. it's pretty surprisig no one has written this by 2017. May I ask, can I request articles somewhere on wikipedia? I am sure many people would be thrilled to write an article on something that has references but isnt in wikipedia. if I can request it somewhere let me know - otherwise thanks for your help. — Preceding unsigned comment added by 193.224.49.51 (talk) 17:13, 5 August 2017 (UTC)
- thanks, I've added the request there. yes it's really well-known. It's not obscure, and people show flame graphs without explaining it, assuming the readers know what it is. — Preceding unsigned comment added by 193.224.49.51 (talk) 21:11, 5 August 2017 (UTC)