Jump to content

Wikipedia:Reference desk/Computing: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Line 154: Line 154:
::::<small><small>I thought this was about truth values. Nevermind, I re-read your paragraph and see what you mean - there's only one bit pattern for "false" but many for "true" (which I'd say is not a problem either, at least not in C, where the idiomatic way of checking two variables for truthiness is to write a && b, which checks them for nonzero rather than equality to "true.") As to good programmers, I imagine they don't compare floats to any constant, but constant±epsilon [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 12:51, 25 May 2017 (UTC)</small></small>
::::<small><small>I thought this was about truth values. Nevermind, I re-read your paragraph and see what you mean - there's only one bit pattern for "false" but many for "true" (which I'd say is not a problem either, at least not in C, where the idiomatic way of checking two variables for truthiness is to write a && b, which checks them for nonzero rather than equality to "true.") As to good programmers, I imagine they don't compare floats to any constant, but constant±epsilon [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 12:51, 25 May 2017 (UTC)</small></small>
:::::Good programmers [http://www.lsi.upc.edu/~robert/teaching/master/material/p5-goldberg.pdf know] that blindly replacing "unreliable floating point comparison" (which is a myth: <code>0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1!=1</code>, but that's because of rounding in the ''addition'', not because of anything to do with the ''comparison'') with toleranced comparison produces a non-transitive "equality" which, not being an [[equivalence relation]], invalidates many sensible uses of equality (''e.g.'', in conjunction with [[hash table|hashing]]). Which form of comparison to use thus depends on understanding the problem, not on knowing a "good programmer" rule. --[[User:Tardis|Tardis]] ([[User talk:Tardis|talk]]) 13:48, 26 May 2017 (UTC)
:::::Good programmers [http://www.lsi.upc.edu/~robert/teaching/master/material/p5-goldberg.pdf know] that blindly replacing "unreliable floating point comparison" (which is a myth: <code>0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1!=1</code>, but that's because of rounding in the ''addition'', not because of anything to do with the ''comparison'') with toleranced comparison produces a non-transitive "equality" which, not being an [[equivalence relation]], invalidates many sensible uses of equality (''e.g.'', in conjunction with [[hash table|hashing]]). Which form of comparison to use thus depends on understanding the problem, not on knowing a "good programmer" rule. --[[User:Tardis|Tardis]] ([[User talk:Tardis|talk]]) 13:48, 26 May 2017 (UTC)
::::::<small>those are ''very'' good programmers [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 21:39, 26 May 2017 (UTC)</small>
::::::<small>those are ''very'' good programmers. [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 21:39, 26 May 2017 (UTC)</small>
Oh boy - this is the second time this week I've had to deal with somebody storing booleans in floating-point data types...
Oh boy - this is the second time this week I've had to deal with somebody storing booleans in floating-point data types...
For better or for worse, programmers of most computer software can interpret bit patterns in ''any way they like.'' Most of the time, they choose to use standard bit representations, ''because it's easier and more consistent'' and it's harder to mess up. But - if you needed some kind of extra special tagging system for a particular application - beyond the mathematical conventions used in standard representations like IEEE-754, then could pack additional status into a [[Record (computer science)|compound data type]] (a "struct," in many languages). To do so in a way that is simultaneously ''useful,'' ''mathematically rigorous,'' and extensible - [[WLOG]], as the mathematicians say - would be very difficult. But you could! Consider:
For better or for worse, programmers of most computer software can interpret bit patterns in ''any way they like.'' Most of the time, they choose to use standard bit representations, ''because it's easier and more consistent'' and it's harder to mess up. But - if you needed some kind of extra special tagging system for a particular application - beyond the mathematical conventions used in standard representations like IEEE-754, then could pack additional status into a [[Record (computer science)|compound data type]] (a "struct," in many languages). To do so in a way that is simultaneously ''useful,'' ''mathematically rigorous,'' and extensible - [[WLOG]], as the mathematicians say - would be very difficult. But you could! Consider:

Revision as of 21:44, 26 May 2017

Welcome to the computing section
of the Wikipedia reference desk.
Select a section:
Want a faster answer?

Main page: Help searching Wikipedia

   

How can I get my question answered?

  • Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
  • Post your question to only one section, providing a short header that gives the topic of your question.
  • Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
  • Don't post personal contact information – it will be removed. Any answers will be provided here.
  • Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
  • Note:
    • We don't answer (and may remove) questions that require medical diagnosis or legal advice.
    • We don't answer requests for opinions, predictions or debate.
    • We don't do your homework for you, though we'll help you past the stuck point.
    • We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.



How do I answer a question?

Main page: Wikipedia:Reference desk/Guidelines

  • The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
See also:


May 21

What is jsfiddle?

Please reply at Wikipedia talk:WikiProject JavaScript#What is jsfiddle?. The Transhumanist 20:47, 21 May 2017 (UTC)[reply]

Making money through ads and blocking ads

There are people who want to make money through online ads. Advertisers put ads on a website and pay money to the website for hosting ads. If the ad is clicked, then advertisers pay the webmaster money. Then, there are people who block ads. If the website needs to make money from the ads, and many visitors block the ads, then how can the website make any money? Will the website be forced to go out of business or try to look for something to sell? 50.4.236.254 (talk) 23:46, 21 May 2017 (UTC) and also we earn money by <ref><google adsense and through Digital Marketing.[reply]

1) They are always finding ways to get around ad blockers.
2) They can simply make it mandatory to view the ad. If it's blocked, they don't display the content you are after. Of course, there may also be software developed to fool them into thinking you viewed their ad, when you did not.
3) There are other revenue models, such as a subscriptions or freemium pricing. StuRat (talk) 00:29, 22 May 2017 (UTC)[reply]

May 22

Natural monopolies

I'm looking for sources about natural monopolies in relation to the recent Net Neutrality debate. Benjamin (talk) 09:47, 22 May 2017 (UTC)[reply]

How does Gmail only have a Alexa rank of 11,361

When Gmail has one billion active users worldwide how can it have such a low Alexa rank Flow 234 (Nina) talk 23:56, 22 May 2017 (UTC)[reply]

I assume most of the activity is on google.com and not gmail.com. PrimeHunter (talk) 00:05, 23 May 2017 (UTC)[reply]
It's also possible their traffic is heavily diluted by people using apps instead to access their mail and Gmail users sometimes having multiple accounts (including business and work accounts) to account for the billion active users. Thanks Jenova20 (email) 10:09, 23 May 2017 (UTC)[reply]
In fact, according to Techcrunch there's been 1 billion downloads of the Gmail app and additionally 75% of people read their Gmail email on their mobile. A large portion of that is likely to be through app. Source. Thanks Jenova20 (email) 10:15, 23 May 2017 (UTC)[reply]

May 23

Thinking about hardware firewall

This latest talk about the ransom ware scared me to death. I am thinking about purchasing a hardware firewall. I checked Amazon.com and found that there are varieties. Some of them got bad reviews, like no tech support, upgrades only by subscription with additional fees, etc. I can afford a piece of electronics up to about a grand and a half but I definitely want to study the issue in depth before I committed even a couple of hundred dollars. I wonder if anybody could comment on the issue and recommend a model? Additional description as to how the model works would be appreciated as well. Thanks, - --AboutFace 22 (talk) 00:57, 23 May 2017 (UTC)[reply]

Sounds to me like you are over-reacting. Worst-case scenario, you need to wipe your hard disk and reinstall. Just make sure you have a backup of everything, stored elsewhere. Also, I recommend you have an offline computer, you use for things like balancing your bank statement, that has no connection with the outside world. An old, obsolete PC is a good choice for this. StuRat (talk) 01:00, 23 May 2017 (UTC)[reply]
  • Firewalls need to be managed, as an on-going investment in IT infrastructure. They can have vulnerabilities themselves. They can require new facilities provided in the future. This might be as simple as some new must-have app, like a 3D Skype version with added smell, that used a new series of TCP ports and so required them to be opened up. For any "fit and forget" box, I would be wary of trusting it long term.
Most such boxes are internally just simply computers (often fairly vanilla Linux) with multiple network ports. To provide the hardware for such, you can buy "a box" or you can use an existing PC running a suitable unix distro. The important need is to have it configured correctly, then managed in a small, but on-going, fashion by a competent network admin. Although there are businesses managing such boxes remotely (so that the "packaged box" solution can have a secure long-term future), I don't see the packaged box as having too much of an advantage over a PC that is more obviously a PC.
You can also do much of this through a good broadband router, without needing a second box of different type. There is a large jump in performance and features from the £50 domestic routers to the £200 small office routers. You can also use such a router (they're available cheaply S/H as people upgrade their outermost DSL modem to support the new vDSL protocol and allow a FTTC fibre broadband connection) as a pure router (not using its DSL modem) within your network.
There are many hardware options. But look at the human aspects of having it correctly managed first - who's going to do that, and what do they recommend? Andy Dingley (talk) 07:43, 23 May 2017 (UTC)[reply]
  • I am not sure a "hardware firewall" is what you expect it to be. In the context of computers, a firewall is a "something" that blocks network connections depending on a certain set of rules. Unless those rules are extremely simple (a gap of air will refuse all connections, after all), you cannot have a hardware-level, no-software firewall.
Andy described above what is sold as "hardware firewall": basically a stripped-down computer that takes care only of the network rules. It should be less vulnerable to exploits because of the reduced attack surface, but that is it. It would have offered little protection against the recent ransomware episode, which did not exploit (as far as we know) any vulnerability in the firewall itself.
The only very small advantage I can see (in that context) is if you have particularly stringent firewall rules in place e.g. to deny any connection to non-authorized websites, but that is probably not the case (for instance, this prevents casual web surfing; if your browser can use port 80 to visit any URL, in particular it can visit evilmalware.com, and so can the malware - the computer firewall even has an edge here, because it can know which program attempted the connection). If your computer gets infected by a malware installer which tries to reset firewall rules to download the payload, the malware will have a harder time with an external firewall. But I am not sure this scenario ever happened. TigraanClick here to contact me 08:55, 23 May 2017 (UTC)[reply]
  • You're better off dealing with the problem at your computer end. Have a means of backup that is disconnected or not visible between backups, that'll protect your data from being destroyed. If you are responsible for a lot of money have a separate computer dedicated to that job and do not use it for any email at all or for any website except those necessary for the purpose. And don't use any passwords from it on your general use PC. With something like that you will be by far the weakest link not the software, so if a friend sounds odd or sends you something strange or that requires you to click 'accept' or 'ok' ask yourself if it really is them or do you really want to accept a potential virus. And in the case you're worried about they didn't do the basics of keeping the OS up to date and having an antivrus. Dmcq (talk) 09:14, 23 May 2017 (UTC)[reply]

Thank you very much. A lot of important information that I really need. Yes, at this point all I do is backups and probably should continue to do them. Thank you. - --AboutFace 22 (talk) 13:40, 23 May 2017 (UTC)[reply]

  • I know I'm late to the party, but I agree with all of the advice given here. A firewall box really isn't going to increase your security that much, and it requires a much larger investment of time and effort. Unless you're running a server room that looks like a goldmine to hackers and virus makers, you're not going to see any real benefit from it. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:08, 23 May 2017 (UTC)[reply]
    Well, a thousand low-computing power units with ridiculously low security can be a more attractive target than a super-secure "goldmine" server room, see Mirai (malware).The Mirai botnet was used for its DDoS capabilities, not its computing power, but the point still stands. So while the particular value of cracking the OP's devices is too low to justify the effort, if an exploit against it can be scaled up to many more targets, it could very well happen. But it is by no means obvious that the home router is more vulnerable to any attack than the firewall box, so the gain in that particular scenario is dubious. TigraanClick here to contact me 16:01, 23 May 2017 (UTC)[reply]
Good point. Replace "a server room" with "something" and my point still stands.
But it is by no means obvious that the home router is more vulnerable to any attack than the firewall box, so the gain in that particular scenario is dubious. If he's running something that looks like a goldmine to hackers, I would absolutely recommend a dedicated firewall box. Of course, I'd also recommend a lot of other things (like a well paid, full-time security professional to manage the box and other security infrastructure), without which the firewall box is almost completely pointless. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 16:14, 23 May 2017 (UTC)[reply]

Largely because people occasionally hire me to secure their networks, I make it a point to make my own computers secure. (I have systems running Windows, Android, BSS, Linux, and macOS and randomly switch from one to the other, because I don't know what a future customer might be running.) In the past, I connected everything directly to the Internet, using firewall software that ran on the systems themselves. I was always able to honestly say that I have never, every detected any malware or visus on my systems (and I have used every popular antivirus tool, again because I don't know what a future customer might be running.)

Then came the fateful day that I discovered that it was impossible to install Windows 2000 and apply the security updates available only on the Microsoft website without the PC becoming infected before I could finish installing the updates. At that time I added what is commonly called a "hardware firewall" but is actually a separate computer wthe two Ethernet connections running dedicated firewall software. Now I could complete the install and apply the security updates without becoming infected.

Thankfully, Microsoft fixed that particular problem, but I still recommend a separate firewall for any business running more than a handful of PCs.

Here is an onlline utility that tests your firewall to see how well it is protecting you: [ https://www.grc.com/x/ne.dll?bh0bkyd2 ] --Guy Macon (talk) 17:59, 23 May 2017 (UTC)[reply]

Thank you all again for your insights. In a bizarre twist I started thinking about writing my own stateful firewall. You see I already picked up some strange terms for the start. I can write C,C++,C#, FORTRAN codes. I am very proficient in all those languages, however I don't understand how such a firewall should work. All descriptions I've read so far are too vague. Is it doable? Thank you all again. --AboutFace 22 (talk) 19:43, 23 May 2017 (UTC)[reply]

That is a really, really bad idea. Anyone can write a security system that they themselves cannot defeat. Just get an old PC and run Smoothwall on it. --Guy Macon (talk) 03:05, 24 May 2017 (UTC)[reply]

@Guy Maçon, thank you but you should indent your paragraphs. It is a rule in here. --AboutFace 22 (talk) 19:45, 23 May 2017 (UTC)[reply]

No it isn't. Indentation signifies a reply to another comment. My comment was a standalone comment about the topic in the section heading. --Guy Macon (talk) 03:05, 24 May 2017 (UTC)[reply]
I once wrote a program that used a series of one time pads to encrypt and decrypt data, thinking that since OTP's are theoretically unbreakable, that would make the ensuing ciphertext unbreakable. Makes sense, right? And they were: I submitted them to a cryptography forum and asked people to decrypt them, and they couldn't. Since my pads were random, each byte in the cyphertext was stochastic, with a stochastic relationship to every other byte. But every single person who tried knew I used OTPs to encrypt the data, and they all asked me about my method. So I described my method without giving away any of my pads, and uploaded a copy of the executable so they could see it in action.
Ten minutes later somebody posted the plaintext of the cypher I had submitted. Because all he had to do was run the program and watch memory for strings (the pads), then try each pad until it worked. My 'uncrackable' encryption turned out to be only 30 seconds of work for a competent attacker, because -being an amateur- it didn't occur to me that there were angles of attack other than pure cryptography.
So lets say you build a firewall to use on a server on a VPN. You want to be ultra-strict with it, so what you do is configure it only to let devices with a MAC address that appears on a list connect. It's awesome! It's impervious to attack, because no-one but the specified computers can connect! Then you're editing WP one day and come across MAC spoofing. Oops. So you do some research, and decide to add IP filtering to that. It works great! Now no-one can spoof their way on. Then a few hours later, one of the remote computers can't connect. Why? Well, because they have a Dynamic IP address, which has just changed.
So you permit IP ranges. Now you're covered! Right up until one of the authorized laptops gets taken over by a hacker while its owner is surfing the web at a coffee shop and used to run a buffer overflow that lets them into the configuration tool for your firewall, at which point they promptly dump ransomware on every machine on the network.
So you discover a flaw in the ransomware (the private key is hardcoded into the executable! Yay!) and fix it. Only to find a year later that, while you were infected, the ransomware installed a hidden copy of VNC on all your machines and has been using them to DDOS US government institutions, who are now quite unhappy about what your network has been doing. And so on, and so forth.
You, as an amateur security programmer can be wickedly smart, cunning and downright devious. You can have as much knowledge as a guy with a fresh Infosec degree about the subject. Yet none of that matters, because someone who's aware of some obscure little vulnerability that you've never even heard of can still own your network the moment they try it. So as Guy said: Don't try to do it yourself. Trust the pros, because the pros have proven that they can defeat hackers. A firewall built by a dozen competent pros is always going to win out over a firewall built by one wickedly smart amateur. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 13:11, 24 May 2017 (UTC)[reply]

@ᛗᛁᛟᛚᚾᛁᚱPants, thank you. Very impressive. I wouldn't try building a firewall. But it was fun to dream about it. Of course I have many other projects to busy myself with. --AboutFace 22 (talk) 14:23, 24 May 2017 (UTC)[reply]

How many people in the world use smartphones?

How many people in the world use smartphones or how many active smartphones are there? What's a good, recent source to verify this? I was surprised not to find it in the WP article on smartphones. Thank you for your help! --122.108.141.214 (talk) 10:20, 23 May 2017 (UTC)[reply]

How about these pages...?
CiaPan (talk) 10:36, 23 May 2017 (UTC)[reply]
There's a bit of a dispute over the ways to measure "active smartphones" as a lot of online stat counters use internet usage as a defining factor. This heavily cuts Android phone numbers and massively increases iphone users to the point where they're pretty much pointless to look at. Our own articles that include these tend to struggle with the issue... Thanks Jenova20 (email) 10:43, 23 May 2017 (UTC)[reply]
Thanks CiaPan - I did try DuckDuckGo-ing for it myself, but I didn't recognise Statista as a good source to use. Jenova, where is this discussed on WP? I looked in the main smartphone article and briefly in the bottom navigation box there (as well as doing a search for smartphone use and smartphone usage), but couldn't readily find such information. Is it only available on individual brand/model pages? --122.108.141.214 (talk) 11:01, 23 May 2017 (UTC)[reply]
I've seen it crop up on both Android sales figures a few years back and recently on the Ipad article, where the figures are blatantly not possible to gauge without estimating or using something like internet usage to estimate. Both are unreliable as i've mentioned. It may have happened other times but those are two that I know of. Thanks Jenova20 (email) 12:05, 23 May 2017 (UTC)[reply]

Why does Japan have only 39% smartphone use ?

As per http://www.businessinsider.com/how-many-people-own-smartphones-around-the-world-2016-2?IR=T.

I am guessing heavy taxation ? StuRat (talk) 11:31, 23 May 2017 (UTC)[reply]

See Galápagos syndrome. --122.108.141.214 (talk) 11:43, 23 May 2017 (UTC)[reply]
Thanks, that led me to feature phones, which are apparently a popular alternative in Japan, where phones have built-in features that would require downloads on smartphones. I have to admit, that sounds better, and more secure, to me. I have a smartphone but no time to research and download apps, so it currently does very little. StuRat (talk) 12:27, 23 May 2017 (UTC)[reply]
Japan has a very mature/old population in general. Old people don't adapt to new tech like youngsters. Could that be it? Thanks Jenova20 (email) 12:05, 23 May 2017 (UTC)[reply]
Yes, and those old people may also prefer phones that do everything from day 1, versus phones that require downloading apps to become useful. StuRat (talk) 12:29, 23 May 2017 (UTC)[reply]
Coincidentally my dad only just started using his smartphone to it's full. He was content with texting and calls for the last 3 years, but we've finally got him using Whatsapp and youtube now. I never realised he was Japanese so this has come as a very big shock. Sorry. Thanks Jenova20 (email) 12:44, 23 May 2017 (UTC)[reply]
What I'd really like is a hybrid. That is, a phone that comes preloaded with features, perhaps from a list I choose when I order it, which have already been installed and tested. I could then download additional apps, if I choose to do so. StuRat (talk) 13:17, 23 May 2017 (UTC)[reply]
Old people are smart. Why pay 900$ for a superphone when one for 50$ does everything a phone should do? Young people are stupid! Also why should old people want to watch youtube on a 4" micro display? You ever noticed most old people put on glasses to read? --Kharon (talk) 13:32, 23 May 2017 (UTC)[reply]
I paid $5 for my phone (LG-L38C), and would only choose to watch video on a tiny screen as a last resort, so I guess that makes me super-old. :-) StuRat (talk) 16:37, 23 May 2017 (UTC) [reply]
So when you get a smartphone, you have to download basically everything? It doesn't come with most features pre-loaded? Nyttend (talk) 02:21, 24 May 2017 (UTC)[reply]
Most features, yes. Candy Crush, no (thankfully). Thanks Jenova20 (email) 08:52, 24 May 2017 (UTC)[reply]
Mine (LG-L38C) seems to lack some rather basic features on it's own, like the ability to type in notes and use the GPS, but maybe it's defective or I just haven't figured it out. StuRat (talk) 15:19, 24 May 2017 (UTC)[reply]
Funny enough I just remembered that the first tablet I bought (Motorola Xoom) came with an SD card slot which didn't work until months later. It shipped with hardware it didn't actually support yet and a future update sorted that. That's something i've not seen before and really shows commitment to a product. Thanks Jenova20 (email) 09:47, 25 May 2017 (UTC)[reply]

May 24

Signed zeroes

In most contexts, zero holds a unique place: it's neither negative nor positive, because it sits in the very middle, and the numerical values of all other numbers represent their distance from zero in a number line context. In computing contexts with signed zeroes, does anything occupy the median, neither-negative-nor-positive place occupied by zero in other contexts? Nyttend (talk) 02:20, 24 May 2017 (UTC)[reply]

The standard IEEE 754 number system has only the two signed zeros, and I'm not aware of any other number system that has three zeros (Positive, negative, and neutral.), if that's what you're asking.
They both occupy the center of the number-line, of course. And they equal each other.
ApLundell (talk) 03:48, 24 May 2017 (UTC)[reply]

Do you mean like a datum?--Shantavira|feed me 08:02, 24 May 2017 (UTC)[reply]

  • Signed zeroes aren't numbers, they're bit patterns that represent a number. There are potentially multiple bit patterns that can represent the same number. Mathematically this is all just the same one number. This is a nuisance - it makes comparisons more complicated.
A similar problem exists in truthiness (read the talk: - one editor's ego keeps removing it from the page), where one value is defined as "false" and all other values (very many of them, up to the size of the words used) are treated as "true". This too can be a tricky situation to work with for the unwary. Comparing values for equality to a true value (rather than inequality to the singleton false) will fail with many false negatives. Andy Dingley (talk) 08:25, 24 May 2017 (UTC)[reply]
most processors have a "compare with zero" or similar instruction ("or" a register with itself and set flags, or even a flag bit which is all bits in a register or'ed with one another at all times etc). why is checking for nonzero a problem? Asmrulz (talk) 14:20, 24 May 2017 (UTC)[reply]
But the point here is that some representations (such as setting the sign bit on a zero magnitude) mean that the pattern is still a valid representation of a mathematical zero (and isn't forbidden by the representation standard), even though its bit pattern is no longer a binary zero pattern, as a binary processor ALU would see it (a numeric coprocessor ought to understand it though).
In practice, if just the exponent part of IEEE 754 is zero (whatever the mantissa bits), then the overall value is so close to zero (a magnitude comparable to 1E-38 at most) that it's probably a mistake to not evaluate it as being equal to zero. But of course, no good programmer compares floats to zero, do they?
Have a play with this: https://www.h-schmidt.net/FloatConverter/IEEE754.html
Andy Dingley (talk) 17:25, 24 May 2017 (UTC)[reply]
I thought this was about truth values. Nevermind, I re-read your paragraph and see what you mean - there's only one bit pattern for "false" but many for "true" (which I'd say is not a problem either, at least not in C, where the idiomatic way of checking two variables for truthiness is to write a && b, which checks them for nonzero rather than equality to "true.") As to good programmers, I imagine they don't compare floats to any constant, but constant±epsilon Asmrulz (talk) 12:51, 25 May 2017 (UTC)[reply]
Good programmers know that blindly replacing "unreliable floating point comparison" (which is a myth: 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1!=1, but that's because of rounding in the addition, not because of anything to do with the comparison) with toleranced comparison produces a non-transitive "equality" which, not being an equivalence relation, invalidates many sensible uses of equality (e.g., in conjunction with hashing). Which form of comparison to use thus depends on understanding the problem, not on knowing a "good programmer" rule. --Tardis (talk) 13:48, 26 May 2017 (UTC)[reply]
those are very good programmers. Asmrulz (talk) 21:39, 26 May 2017 (UTC)[reply]

Oh boy - this is the second time this week I've had to deal with somebody storing booleans in floating-point data types... For better or for worse, programmers of most computer software can interpret bit patterns in any way they like. Most of the time, they choose to use standard bit representations, because it's easier and more consistent and it's harder to mess up. But - if you needed some kind of extra special tagging system for a particular application - beyond the mathematical conventions used in standard representations like IEEE-754, then could pack additional status into a compound data type (a "struct," in many languages). To do so in a way that is simultaneously useful, mathematically rigorous, and extensible - WLOG, as the mathematicians say - would be very difficult. But you could! Consider:

int main(int argc, char** argv)
{
  typedef enum {
      positive,
      negative, 
      exactly_zero
    } sign_convention;

  typedef struct 
  {
    double value;
    sign_convention flag;
  } number;

  number x;
  x.value = 2.718;
  x.flag = exactly_zero;

  return 0;
}
/* Note to novice programmers: don't do this. */
/* Note to advanced programmers: don't do this either. */

This is a legal C program and it compiles without any problem on my computers. How you wish to interpret a "number" data type whose sign convention flag differs from its value is at your discretion. But before you say it is wrong - consider that in modern mathematics, we have the power of definition. If, for the purposes of my application, I define the positive-ness or negative-ness of my data type to depend only and exclusively on my sign_convention flag, then I have the freedom to use this in whatever fashion I see fit. If I had decided to be particularly obtuse, I could have used type punning to pack the status-flag inside the value, provided that I used the value with extraordinary caution. In response to the original question's implicit ask: why would we ever do this? Why not just use positive and negative floats the way our forebears intended? My mind races toward interesting use of the negative sign in various elements of graph theory and topology and oriented surfaces in arbitrary dimension; and toward the esoteric basis-sets that extend the real plane into higher dimensions (like the quaternion); and so on. These are very real and very common data types. It is a near-certainty that the computer you are using right now includes a graphics-processing arithmetic unit that is capable of using, and interpreting, such esoteric sign conventions - at least in its internal data representations. As our great computer scientists frequently remind us, we can and should exercise our brains, and reevaluate the fundamental mathematical assumptions that exist in our standard machine representations of numeric theory. Messing around with the way your machine automates its sign convention might shake out a fundamental flaw in your application-software. It never hurts to inject a little bit of paranoia into your floating point code. Nimur (talk) 14:24, 24 May 2017 (UTC)[reply]

As to why have a signed zero, the simple reason is it worked better than the alternative. Originally there was going to be a floating point mode setting and one setting would say that 1/0 was infinity with no distinction between positive or negative infinity, and the other was the current standard that 1/+0 = +infinity and 1/-0 = -infinity. The first 'hyperbolic' case just wasn't useful enough. The reason one would want zero and infinity is that floating point numbers are approximations. The idea of actual absolute zero just is not so useful in that context - it is something that is more associated with integers. If we really wanted to do the job right we would use interval arithmetic or something along those lines instead of floating point numbers. Dmcq (talk) 14:20, 25 May 2017 (UTC)[reply]

Managing e-books on ELectronics

I was searching for, "HOW TO MANAGE E-BOOKS ON ELECTRONICS" on this website and others for days now. I really need the answer so I will know how to do this.

ENID BLITON (talk) 23:44, 24 May 2017 (UTC) WEDNESDAY 24TH MAY,2017[reply]

What's the problem you are having ? For example, if you have too many e-books in one folder to find what you want, then sub-folders, by topic or author, for example, might be the solution, assuming your device allows you to create such folders and move files between them. StuRat (talk) 01:00, 25 May 2017 (UTC)[reply]

May 25

Erratic scrolling

This problem occurs only with Chrome, not with Edge. One of my computers is a laptop with infrared mouse connected to a USB port. The mouse pointer behaves normally and can be moved around the screen very fast, but page scrolling is jerky when holding down the left button on the up/down boxes at the top and bottom of the scroll bar. Dragging the scroll bar itself is fine. The jerkiness is very bad. The scrolling sometimes stalls briefly, and believe it or not, the page sometimes reverses direction briefly, ie. it moves in the opposite direction to that of the box clicked, and then resumes in the correct direction. These symptoms also happen with the touchpad and buttons built into the keyboard. Laptop was originally XP, was upgraded to Win7, then 10. The mouse is Lexma brand and is identified in Device Manager as HID-compliant and drivers do not seem to be available. Anyone have a suggestion? Akld guy (talk) 10:54, 25 May 2017 (UTC)[reply]

Check for hardware issues first by removing the USB-mouse. However, the internal mouse pad will have other problems than the external mouse. Changing the direction might be causes by a dirty encoder disc in the mouse wheel, see rotary encoder. There are two photo transistors, one reading the clock signal when the wheel is moved, the other returns the direction. A failed solder dot can be detected by resoldering with adequate equipment most reliable and quick. The micro switches are also used to bypass crossing wires on the single layer printed circuit board (PCB).
Before assuming a hardware failure, Windows and Internet Explorer have settings in control panel about smooth scrolling. This checkboxes are made to choose a compromise between computer graphic performance and reading while scrolling. As the computer came with Windows XP, it might have a problem with memory size, causing a delay on user input. As we are used to stop scrolling when reaching the targeted part of the page, the computer might have buffered the mouse wheel input until performed. A wheelmouse should be working as a standard USB HID. Special buttons only might require a driver. Useful brand name mice are avail from €6 or $7. --Hans Haase (有问题吗) 11:40, 25 May 2017 (UTC)[reply]
I removed the mouse. Still the same problem with the integral touchpad and buttons. There is no scroll wheel on the mouse - I removed it some time ago to try to solve the problem and because my finger was continually moving it, making the scrolling even more difficult to control. I have an identical mouse, also with the wheel removed, which also exhibits the same symptom. Why is this happening only with Chrome and not Edge? Akld guy (talk) 12:45, 25 May 2017 (UTC)[reply]
  • It would be interesting to know, when you still had the mouse wheel, if clicking on it and then scrolling by moving the mouse up and down worked well. StuRat (talk) 13:54, 25 May 2017 (UTC)[reply]
  • Also, does this happen only when the page is busy loading ? (For some pages, they are always busy loading and reloading content and ads, with videos that auto-play being the worst culprits.) Try this text-only page (weather forecast) and let us know if it has a problem, too: [1]. StuRat (talk) 14:21, 25 May 2017 (UTC)[reply]
Oooh, that's a good page for troubleshooting. Nothing but text, links and a button. Kudos. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:52, 25 May 2017 (UTC)[reply]
@MjolnirPants: AMD Sempron, 32 bit, 2.00 GHz, 2.00 GB. Don't tell me that's inadequate. It should be ample for simple text pages. Why does it work fine in Edge, but not in Chrome?
@StuRat: No, it never worked properly. It happens long after the page is static with no more data arriving (no LED indication on router). That weather forecast page is so short that there is hardly any scrolling from top to bottom, but it did seem like the problem was present. Akld guy (talk) 20:57, 25 May 2017 (UTC)[reply]
I can now say with near-complete assurance that the problem is Chrome. Chrome -while a good browser- is a resource hog. It uses a lot of memory, processor threads and virtual memory to run. Your system is rather low-end (at the current time), and the combination of these two factors is almost certainly responsible. I have observed the very same behavior on systems with very low specs, or on systems under a very high load. This also explains why Edge works well; it is less resource intensive than Chrome. My advice would be to use Edge in the future, or to switch to Firefox or possibly Safari for your browser if you do not want to use Edge. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 21:03, 25 May 2017 (UTC)[reply]
@MjolnirPants: OK. I'm reluctant to abandon Chrome because it stores my Bookmarks in the cloud, so whenever a computer fails and gets replaced, all my bookmarks are still there. I know nothing about Firefox. Can it store bookmarks like that? I could google that but appreciate advice from someone who understands why I'm considering changing and may have relevant tips. Akld guy (talk) 21:17, 25 May 2017 (UTC)[reply]
Yes. Indeed, it can store not only bookmarks, but browser extensions, plug-ins and a great deal of other types of personalization. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 21:25, 25 May 2017 (UTC)[reply]
I realise it can store bookmarks, but that wasn't my question. Can it store them independently in a cloud so that they're still there when the computer fails and gets replaced? Akld guy (talk) 21:51, 25 May 2017 (UTC)[reply]
The Firefox Sync article has some good info about how their synchronization works. I haven't used it myself but it seems pretty straightforward. Random character sequence (talk) 22:01, 25 May 2017 (UTC)[reply]
It is. It's pretty user friendly, with good default settings and one-button activation. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 22:04, 25 May 2017 (UTC)[reply]
Sold. Gonna try FF for the first time ever. Thanks Random character sequence and MjolnirPants. Akld guy (talk) 22:36, 25 May 2017 (UTC)[reply]
Firefox is barely any better. Still jerky, but at least the page doesn't reverse direction. No doubt it will do that once it starts getting bloated. Sorry, but FF wasn't a solution. Looks like I'm stuck with the problem in Chrome or need to revert to Edge. Akld guy (talk) 00:03, 26 May 2017 (UTC)[reply]
Stick with Edge then. I know it's the "sequel" to Internet Exploder, but people online seem to think it's a pretty good browser. And, being made by MS, it's almost certainly more efficient in its use of resources than most others. According to the tech review sites, it does great on benchmarks, which is what you're looking for here. But it lacks most of the advanced features of browsers like FF or Chrome. Alternatively, you could also try Opera and Safari. As a last resort, it may be time to replace your machine, and turn your current one into a file server or something. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 13:06, 26 May 2017 (UTC)[reply]

Java finding values in a Map which match a String, and creating a Set of the results

I'd like to write a Java method that iterates over a Map of objects. I want it to look at one of the objects' attributes, match a String which I will provide, and add those matching objects to a new Set. Beyond a vague idea that I should use a while loop, I am lost. Can anyone help me get started? 129.67.116.232 (talk) 20:51, 25 May 2017 (UTC)[reply]

What do you need? You need a map of original objects. You need a map (initially empty) of matched objects. You need a string. Declare all of those. You need them. Now, iterate over the original map. For each iteration, check the attribute against the string and, if they match, copy the object to the matched objects map. You could make a clone of the object or copy the object itself - meaning that the object will be in both maps and if you change it in one, it changes in the other. When you are done iterating, the new map will have matching objects in it. So, what is the problem? Do you know how to define a map? Do you know how to iterate? Do you know how to compare strings? Do you know how to add an object to a map? 209.149.113.5 (talk) 12:24, 26 May 2017 (UTC)[reply]
Note that your initial container being a Map is irrelevant (unless the attribute in question is also the key for the map); its structure does not help the search. Therefore you're using the generic Collection interface. --Tardis (talk) 13:10, 26 May 2017 (UTC)[reply]

May 26

Viruses, worms, Trojan horses, malware, and cyberwarfare

I know almost nothing about cyber security beyond "Is my computer compromised?" Tell me how this work and where to start. For example, how can nations attack each other using computers? Television sets receive and send long-distance signals too. Can they be infected by a virus, or do viruses only affect computers? How is the Internet connected? 50.4.236.254 (talk) 03:45, 26 May 2017 (UTC)[reply]

I know almost nothing about cyber security... - Professor Messer has study materials for CompTIA certification. While I'm not recommending some sort of career change, it is a good resource for making yourself more familiar with computer security. I'd link to more but the Great Firewall is currently blocking all of my VPNs (even my SoftEther VPN, which I don't understand how they can target without shutting down HTTPS), and I'm getting the rather distinct impression that China doesn't want people to learn computer security except through channels they can monitor (like classrooms). (Considering most of the computers around here use "88888888" as the password and are loaded with software that would trigger at least a yellow alert on any non-Chinese security software...) Mr. Robot (TV series) is also noted for its technological accuracy.
...beyond "Is my computer compromised?" - That's not all there is to worry about. Check Have I Been Pwned to see if any of the passwords to your accounts have been leaked. Enter your email(s) and if it registers any hits, change your password. There's some debate about what makes a good password but a few statements that are generally accepted:
  • Do not write it down or share it with anyone. What I usually tell people is "Rule number one of passwords: NO."
  • It should use all of the following: uppercase letters, lower case letters, numbers, and other characters (e.g. !, @, #, $). Some websites and programs won't let you use other characters and those site designers are idiots.
  • It should be long, at least 16 or so characters. You really shouldn't need one longer than 32 characters. Some website and programs won't let you make the password longer than 16 characters. This is not unreasonable but still uncool. If they don't let you make the password longer than 12 characters, they're stupid and you probably shouldn't bother making an account with them.
  • Do not use a word or name from any language, or phrase that comes up in a web search, unless you've put it through some sort of code (I don't mean a computer code but a cryptography). It doesn't have to be random gibberish that you'll never remember, though. When I need a quick password that I won't completely forget, I could look for a Barbarous name or nonsense Patter from a rare grimoire on my shelf (making sure it doesn't come up on the net), or a string from A Million Random Digits with 100,000 Normal Deviates chosen on the basis of Numerology, and process it through leetspeek and Kabbalah. Word search books (similarly processed) could also work, though a collection of word search books could stick out unless you're a hoarder. Then I can just write a note somewhere else with the page number and a shorthand note of which cipher I used and another shorthand note in a third place to remind me which book belongs to what account.
how can nations attack each other using computers? - If you mean "what would they do that for," they might want to gain access to classified documents, monitor or even disrupt communication, adversely affect a nation's private industry, etc... As for the actual techniques, WP:BEANS aside it's pretty much the same principles as trying to hack someone's personal computer or a small business, just on a much larger scale.
Television sets receive and send long-distance signals too. - Older televisions, especially analogue CRT models, aren't programmable (or at least, not on the level of complexity needed for a virus). It simply translates a signal and that's it. Some newer televisions have some limited computer functions but there's very little reason to write a virus for them.
How is the Internet connected - You can think of the Internet as just a really really big computer network. A computer network is when you connect at least two computers together so they can send messages to each other. Ian.thomson (talk) 05:06, 26 May 2017 (UTC)[reply]
The claim about new televisions is IMO misleading. Technically it's true viruses for televisions are I think basically unheard of. But "virus" in computer terms is often used simply to mean some variant of malware. And there is definitely malware for smart TVs. Beyond the infamous CIA programme which realisticly probably has its counterparts in most other major spy agencies, there is sufficient concern over smart TVs being used as other Internet of things have been to make a botnet for DDOSing or other purposes that the US government specifically gives it as an example [2]. Considering that smart TVs are potentially more powerful than a number of other devices which have been targeted there's no reason to think they won't be targeted. Probably the reason they haven't been yet on a significant scale (AFAIK) is because while their security isn't good, it tends to be slightly better than other internet of things devices. Mirai (malware) for example just tries to log on to devices and then use them for some purpose, but smart TVs are less likely to have such functionality (possibly not for security reasons but simply because it's useful). TVs may infact be less likely to be "listening" to the internet at all although they do sometimes. (I once had a weird connection attempt to my TV, since then I've disconnected it.) If the TV isn't listening, you'd need to be actively using it in some risky way, which tends to be less common with TVs. (And plenty of people with smart TVs just don't use the "smart" functionality so never connect them.) Of course TVs can be and have been infected with malware which targets whatever software they're running. E.g. Android [https://www.bleepingcomputer.com/news/security/android-ransomware-infects-lg-smart-tv/ [3]. Nil Einne (talk) 11:51, 26 May 2017 (UTC)[reply]
"Do not write it down or share it with anyone."
Well, don't share it with anyone, sure. But advice to not write it down can do more harm than good.
Forcing people to memorize passwords leads to weak passwords. If you can't memorize a strong password, then a strong password written down in a locked drawer is far better than using a poor password just because it's easy to remember. ApLundell (talk) 15:07, 26 May 2017 (UTC)[reply]
Do not follow suddenly appearing messages. Most of them are made to guide You to an infected website. When You wanna troubleshoot the computer, use a reliable security software which got several reviews. A simply way is to google search for the exact words of the appeared message. It causes You to find causes, not something offered as a so called "solution". It also avoids You to follow the hoax, when somebody reliable has written about it. About newer TVs, see them as a smartphone with missing GMS/UMTS adapter and a large screen, with all abilities to run any installed software or app. Also mention, this what Apple calls "Appstore", Google named his one "Playstore" or similar repository might be resticted to consumers and managed by a provider or manufacturer. Using remote administrated device in Your network might be spending some ideas about what could be achieved by this configuration. Mention, detecting gestures require a camera. Detecting voice commands require a microphone. And I think, it is my living room. --Hans Haase (有问题吗) 08:03, 26 May 2017 (UTC)[reply]

How does this work?

How do the Similar Authors section in this website work?--Joseph 05:58, 26 May 2017 (UTC)[reply]

In collaborative filtering, "similar" is not defined. You make up a metric and use it to find things that are similar. It is highly likely that the site considers authors to be similar if they share a large portion of people who like them. They could say "People who like X also like Y", but Amazon uses that and actually has a patent on it that is very general and they can use to stifle competition [4]. So, while we cannot say what the exact metric is, the overall use of the metric is no different than what anyone else is doing. 209.149.113.5 (talk) 12:21, 26 May 2017 (UTC)[reply]
In most cases, Google's algorithms are kept pretty close to the vest, to prevent people trying to game them, so I doubt anyone can provide a reference as to how this exact thing works.
If you're looking for how such systems work in general, it's an area of ongoing research, but our articles on Recommendation engine and Collaborative filtering would be an excellent place to start, as would the sources in those articles. ApLundell (talk) 14:14, 26 May 2017 (UTC)[reply]
Such things generally work similarly to the Music Genome Project, but using qualities of books and authors, not songs and musicians. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:25, 26 May 2017 (UTC)[reply]
The Music Genome Project is very labor-intensive because it involved getting expert opinions on the content. I'd be very surprised if Google was operating like that. They tend to be much more into using Big Data to extract the wisdom of the crowd. ApLundell (talk) 14:59, 26 May 2017 (UTC)[reply]
They don't need to gather the data the same way (there's plenty of free sources of data about books they could pull from with a bot), they just tend to handle it the same way when serving up suggestions to the end user. Indeed, I would imagine that one of their data collection methods would be looking for keywords in different internet postings about the book, a classic Google move. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 19:54, 26 May 2017 (UTC)[reply]

Python 2.7.10, Firefox 53.0.3, MacOS 10.12.5: new bug

I have some little Python scripts that use the library function webbrowser.open(); as you might guess, its job is to pass a link to my default browser. Since MacOS updated to 10.12.5, it gives this warning every time:

0:70: execution error: "https://en.wikipedia.org/wiki/List_of_coronae_on_Venus" doesn’t understand the “open location” message. (-1708)

... although it still works!

(To see whether the bug is in Firefox, I made Safari my default browser, and restarted. The next time I ran the script, Firefox opened.)

What's going on? And where should I complain about it? —Tamfang (talk) 18:33, 26 May 2017 (UTC)[reply]