Wikipedia:Reference desk/Archives/Computing/2013 April 12

= April 12 =

Does any programming language have a "control" class?
Hi, I'm designing an app in ios/objective c, and have found that one of the big nuisances is working out when I've initialised things or not. The app involves play and record functions, and graphing to go with them, so you get all sorts of problems working out when you've "zeroed out" something, such as deleting a sound file, or redrawing the graph. Finally, I've set up a "control" function to direct the play, and I'm thinking of turning it into a full class. Does anyone know whether such a thing exists already in ios/objective c (or any other language, for that matter)? Such a class, to be useful, would have something like boolean markers for different objects, that could be set as part of certain methods, according to whether the object is viable (properly initialised) or not. I know it would be tricky, because the class would have to interact carefully with other classes, and much of the work would be done manually (you would have to consciously remind yourself to set the flags etc), but it strikes me as possible, in principle, and potentially very useful. IBE (talk) 02:37, 12 April 2013 (UTC)
 * In C-like languages, one trivial way to do it is to allocate/free the various objects when constructing/destructing them (to borrow the C++ terminology) and use the nullity (or not) of pointers to them as your flags. (This is very common: most programming does not emphasize the possibility of allocated but uninitialized objects.  Some languages (like Java and Python) preclude the possibility more or less (respectively) absolutely.)  If for some reason dynamic memory allocation is out, you would write a bunch of methods: e.g., getA that creates the A if it doesn't exist and returns it, tryA that returns a pointer to the A (even if it's not a pointer from malloc) or null if there is no A, and killA that destroys the A if there is one currently.  If other code uses just those methods, and doesn't maintain a pointer to A across any event that might result in a call to killA, you'll be assured that the A is not used uninitialized.  In C++, we might write a sort of smart pointer (a template class) that would use new/delete (or placement new and manual destructor calls in the no-allocate scenario) to implement these methods for any class, and then your control object could simply contain a number of these smart pointers.  --Tardis (talk) 03:07, 12 April 2013 (UTC)


 * Thanks - this is pointing me in the right direction, although I was already using this to some extent. I can incorporate some of these tricks, although the only way I can do things at the moment is to partly initialise things, and complete them later. I need to set up the sound data, then the view, and for some reason I can't quite recall, it is impractical to fix up the data in one go, then do the graph. It's largely because I didn't know much obj-c when I started the app, so learning on the job is a pain, and you can't structure your code if you don't know when "viewDidLayoutSubviews" is called. You can look that up, but the docs are a pain if you know nothing at all - great reference, very bad textbook. But I can do stuff like "getA" that creates it if it doesn't exist, I think. More ideas welcome IBE (talk) 03:19, 12 April 2013 (UTC)


 * This is why you should always have properties on the outside instead of variables. For instance, there are many reasons a graph needs redrawing: the property Scale is changed, AddValue(X,Y) was called, or LineThickness was changed. Or you just got the event SizeChanged. These things would all set GraphIsDirty to true, to be used later. I can imagine a language in which you can add that fact to the definition of a property or method (like "AddValue (X,Y) ") but in most case explicitly defining the boolean yourself would probably be more clear and would allow for more subtle control. For instance, changing the property LineThickness could only set the GraphIsDirty boolean when the new Value is not the same as CurrentLineThickness to avoid unnecessary recalculating the graph. Adding checks like "WeKnowWhatFileToPlay = true" instead of "FileName !="" " when you receive "PlayClicked" are almost free in terms of programming time, code readability and computing power. IMHO, only in very rare circumstances (like an operation that will run thousands of times per second or of which millions of instances will exist) you could consider skipping those checks or rely on pointers not being null. Joepnl (talk) 00:21, 17 April 2013 (UTC)

Page Break Comlumns in Tables for Word 2007
I have a table with only one cell in it (making it essentially a box), and I would like to make the text inside the box/table into two columns - but, I do not want a two-column table. I want the text inside the box to be arranged into two columns (one left-oriented and the other right-oriented) like it would be when using the 'columns' button in the ribbon, as if the surrounding box/table were not there. What I have been doing (to no avail) is attempting to put a page break inside the box and then I click the 'columns' button in the ribbon, but the entire box/table then gets stuck in the left column - because the page break is appearing outside and above it. Can anyone help here? KägeTorä - (影虎) ( TALK )  08:51, 12 April 2013 (UTC)
 * Do you absolutely have to have only the one cell? Personally, I would split the cell in two, but set up the borders so only the outer border is visible. It should still look the same, but you'd be able to get the effect you're after. - Cucumber Mike (talk) 09:24, 12 April 2013 (UTC)
 * I have just experimented with that, and it seems to work. I suppose I will have to go with that. Thanks.  KägeTorä - (影虎)  ( TALK )  09:31, 12 April 2013 (UTC)

Firefox broken after reset plugin.disable_full_page_plugin_for_types
Firefox opens my PDF files inside the broswer which I wanted to stop. I found something in the Firefox help database that said to reset about plugin.disable_full_page_plugin_for_types. So in about:config I right click on that thing and clicked reset. I then exited the browser. I then started the browser again. Firefox said it was checking my plugins for compatibility. Now Firefox is all wrong. My session didn't restore. The option to restore it is greyed out. Also my back and forward buttons no longer work. Please help!

I can't link to the instructions because there's something wrong with my address bar. The contents of the address bar do not change while I move from one page to another. You can find the instructions by Googling the line: Find the preference plugin.disable_full_page_plugin_for_types and, if it is present, right-click on it and select reset.

When I try to start Zotero I get error:

Alert

There was an error starting Zotero.

2.97.27.107 (talk) 11:25, 12 April 2013 (UTC)


 * Backup your profile directory, uninstall Firefox, delete your profile directory and any system (“program files”) directories/files related to Firefox, reinstall Firefox, restore data from profile directory backup as you please. ¦ Reisio (talk) 18:03, 12 April 2013 (UTC)

what are my options for fouling up a PC with a bunch of &#*($$ in a "private" mode?
So I got a laptop with a pretty pristine windows 7 installation on it. I'd like to try installing a bunch of random development tools on it, completely mess with it, but when I'm bored I want to lose all these, same as closing a bunch of tabs in private mode in a browser.

in my experience after all this stuff to turn it into a dev machine, when I don't want it anymore it's still full of $%#@. what are my options here? It's not really powerful enough to do it all in a VM, I'm afraid. 91.120.48.242 (talk) 14:02, 12 April 2013 (UTC)


 * If VM isn't an option, you could partition the hard drive and install a "testing" OS where you play around, and a "healthy" OS that you keep nice/ functional. If you're willing to use Unix/Linux, you could create a "testing" user, and only do experimental things in that user's space. Or you could only install things once you are fairly certain that you understand how to uninstall them and clean out any debris :) Some additional related concepts are discussed at sandbox_(software development) and sandbox_(computer security). SemanticMantis (talk) 14:45, 12 April 2013 (UTC)


 * Alternately, create an unprivileged new user account for your toolkit, and log in as that user. Never allow that user account to do anything that requires administrator privileges.  The OS will do a great job enforcing that the user cannot modify the system!  Unfortunately, some "development tools" like debuggers often require superuser (administrator) privileges to run; but others (like the Java compiler and SDK, or the Python interpreter) can run entirely in user-space, and can be installed and run without ever requiring administrator privileges.  When you are done, delete the user-account, and the system will not be modified.  Nimur (talk) 14:46, 12 April 2013 (UTC)


 * I wouldn't assume that a VM needs an especially powerful machine. With modern processors, the VM works pretty much the same as the host machine.  The only issue would be getting an OS to install on the VM.  Depending on the development you want to do, a Linux variant might well be suitable.--Phil Holmes (talk) 16:01, 12 April 2013 (UTC)


 * Wouldn't it be possible to do this using System Restore? Looie496 (talk) 16:20, 12 April 2013 (UTC)


 * If you really want to start over completely from scratch after you're done, then reinstalling the O/S is one way to go, although rather time consuming.


 * There are Linux implementations which allow you to keep the O/S on a separate device from the applications and data. For example, you could have the O/S on a memory stick, and all the apps on the hard drive.  This allows you to simply wipe the hard drive partition in order to reset to just the O/S.  I'm not aware of any implementation of Windows 7 that allows you to do that, though. StuRat (talk) 19:20, 12 April 2013 (UTC)

only 1 USB port works on desktop
Hi everyone, only 1 USB port of my parents' computer seems to work. This is a problem as they would like to have 2 functioning ports, i.e. one for a USB mouse and one for a dongle in order to access the internet. Both the dongle and the mouse will work in the functioning port, but neither work in any of the other ports. I have spoken to a couple of friends about this, and they suggested this may be something to with the number of USB1 and USB2 ports and suggested I needed a USB splitter. The mouse and the dongle are several years younger than the desktop. The desktop is quite old now, bought in approx 2005, it was bought and is being used in the UK.

The computer is 'manufactured and supported by emachines' and there is the code E3016. It is running on Windows XP, home edition version 2002 service pack 3.

Do you think a USB splitter would help in my case? Apologies if I have not provided enough info, I will post more if required! Thanks, RichYPE (talk) 14:41, 12 April 2013 (UTC)


 * I think a usb hub is very likely to solve the problem, and probably the least expensive option. Amazon has several models in the $7-$20 range, which isn't much to risk for a potentially easy fix. SemanticMantis (talk) 14:48, 12 April 2013 (UTC)
 * Can you report what you see in the Device manager? Are those ports shown as working or as problematic? Ruslik_ Zero 19:01, 12 April 2013 (UTC)

I've just opened device manager, There are 6 ports, this is what I see for each of the ports: 1. HUAWEI mobile connect (this is my dongle I'm guessing) 2. Standard enhanced PCI to USB host controller 3. Standard openHCD USB host controller 4. Unkown device 5. USB root Hub 6. USB root hub

At the time of writing, the only thing plugged into any of the ports is my mouse.

I hope I have provided an adequate elaboration for you Ruslik. Thanks RichYPE (talk) 19:14, 12 April 2013 (UTC)
 * might be worthwhile opening the case to see if any wires are just loose. Gzuckier (talk) 01:36, 13 April 2013 (UTC)

Problem with Skype
Few days ago, when logging into Skype, it updated automatically to the version 6.3.60.105. After that the video calls have worked poorly, and my contacts haven't been able to see my video well. I have never had this kind of problem before and for example video calls on Facebook work normally, so the problem shouldn't be my computer. Does someone have a solution for this? 84.251.121.188 (talk) 17:18, 12 April 2013 (UTC)


 * Downgrade, disable automatic updates. ¦ Reisio (talk) 18:10, 12 April 2013 (UTC)
 * Reisio, because Skype is a network-enabled program that depends on a client-server model, that is probably not a functional solution. You are assuming that the previous client-version is compatible with the current network and servers.
 * 84.251.121.188, consider asking at the Skype community-forums, and if your problem is not yet known, the developers will instruct you on how to file a bug-report against Skype. Nimur (talk) 19:36, 12 April 2013 (UTC)


 * Not assuming, no. ¦ Reisio (talk) 22:26, 12 April 2013 (UTC)

How Can You Do A Free Reverse E-mail
I been going through reverse E-mail. Sites and had no luck. They all charge for me to look up this persons. Other E-mail accounts. I have 1 of his E-mail accounts however he does not use that one. So I to do a reverse E-mail look up. But I cant pay for it right now. Is there a way to do it for free. My question.


 * You could ask him for an email address he uses. ¦ Reisio (talk) 22:23, 12 April 2013 (UTC)
 * Didn't you ask this a few weeks ago? Perhaps if you told us what your final goal is, we could help you get there by other means. Dismas |(talk) 02:03, 13 April 2013 (UTC)


 * You had best check with your lawyer about the legality of such an activity. As I recall, you were told this 10 or 11 days ago when you brought the same subject up. ←Baseball Bugs What's up, Doc? carrots→ 02:54, 13 April 2013 (UTC)
 * I'm going to raise this matter at WP:ANI, as I think we could put ourselves into a questionable situation if we pursue this. ←Baseball Bugs What's up, Doc? carrots→ 21:02, 13 April 2013 (UTC)
 * The answer seems to be that any such service, free or otherwise, is only legal if it has obtained and accumulated publicly-available e-mail addresses. So at any price, legally, you're only going to get a subset of possibilities. And the point was made that since the data accumulation effort requires work, why would anyone want to give it away? ←Baseball Bugs What's up, Doc? carrots→ 14:48, 14 April 2013 (UTC)

Chess: computer against human + computer
Would it make a difference if a human helped a group of computers in a chess game against another group of computers? I don't mean whether letting the human be a kind of manager who chooses a computer good at openings and another good at endings at the appropriate moment would be beneficial, but could the human add something of value to the game strength? OsmanRF34 (talk) 23:31, 12 April 2013 (UTC)


 * As in Advanced Chess? I don’t see how, unless a human noticed a blatant flaw in something to do with a computer (that is, unless it came down to something not particularly related to chess theory). ¦ Reisio (talk) 23:57, 12 April 2013 (UTC)


 * People can (sometimes) see things that the chess engines don't. Bubba73 You talkin' to me? 04:13, 13 April 2013 (UTC)


 * Such as? Chess engines have been designed by (a myriad of) people. ¦ Reisio (talk) 04:55, 13 April 2013 (UTC)


 * I had a position in a tournament game about a year and a half ago that I could see was a win. Houdini 2.0C, 64-bit version, running on a quad-core hyperthreaded i7 doesn't see the win. See Horizon effect. Bubba73 You talkin' to me? 05:04, 13 April 2013 (UTC)


 * I could see how that might happen in Go or other games (for the time being), that have a great many more possible moves, but not Chess, not without inferior hardware or software. Would you consider Houdini 2.0c with that hardware to have been state of the art? (Or even just the software.) Ignoring that, do you think you could have won two out of three games against such a box? Would you have gone against the engine’s suggestion? I took Osman’s question as one posed against ideal situations. ¦ Reisio (talk) 05:36, 13 April 2013 (UTC)


 * As a chess player and ref-desker, I agree with Reisio's interpretation of the question, but I agree nonetheless with Bubba's claim. It is all the more true in Go, but sufficiently true in chess, for a grandmaster to be more adept at certain situations, and to be capable of outwitting a computer. "State of the art" and "ideal" situation must apply to the choice of computer and the selection of the human, and grandmasters are in a class of their own at understanding what is really building in a position. Hikaru Nakamura won this classic game against Rybka by knowing the computer's specific weaknesses. For a human/computer team, you would need the human to get practice at working with the computer, and you would need a long time limit (to allow the human to go back and forth between the computers suggestions and his own thoughts), but having the option of the human would be an advantage. IBE (talk) 08:54, 13 April 2013 (UTC)


 * By knowing them ahead of time, or just figuring them out? To me the former would be a “blatant flaw…not particularly related to chess theory”. Not to draw out a conversation well farther than could possibly matter… :p ¦ Reisio (talk) 11:11, 13 April 2013 (UTC)


 * Ok, I get we don't want to go on in detail, but you can look at the game I linked, where Nakamura makes one of the strongest engines look utterly stupid. For whatever reason, humans can still sometimes outwit computers, so a human/computer combo would be able to avoid a defeat like the one Nakamura inflicted. IBE (talk) 12:37, 13 April 2013 (UTC)


 * Certainly and I agree, but there’s winning and there’s winning two out of three; there’s beating an opponent and actually being (statistically) superior to that opponent. ¦ Reisio (talk) 12:43, 13 April 2013 (UTC)


 * Good point - that's why I say the human would have to spend time playing with the computer, since at first he might not know when to trust the computer and when not to. But with time, the human-computer combo would get better, although the advantage over a pure computer might be small. I still believe, based on what I've seen as a chess dilettante, computer dilettante, and chess computer dilettante, that computers on their own can be corrected, albeit carefully. IBE (talk) 13:55, 13 April 2013 (UTC)


 * Note: as Reisio pointed out above, yes, I mean ideal situation, not any situation when the computer/program is substandard. So, I simply don't see how the human is not completely deprecated in chess (at the moment of playing). Even giving the human some DBs and time, could he correct the computer? OsmanRF34 (talk) 12:21, 13 April 2013 (UTC)


 * An infinite amount of time and a sound mind, maybe. :p The way I look at it, though, is that if you’re simply programmatically recalling the best possible move in whatever situation you find yourself in based on study of whatever, you aren’t really proving much except that you have a good memory. To me this makes even a lot of professional human chess participants impressive demonstrators of memory, but not necessarily strategy or logic. ¦ Reisio (talk) 12:49, 13 April 2013 (UTC)


 * Properly speaking, if the human is using DBs and looking into the position, he is doing research. That's (more or less) how you build chess computers in the first place. A human looks at the errors they make, and works out improvements. Admittedly you are talking about a different situation, where you do this while a game is in progress, but with a lot of info and time, you are doing something quite similar. Computers make mistakes that humans can detect, but the mistakes are subtle. Humans make mistakes that computers punish much less subtly. IBE (talk) 13:55, 13 April 2013 (UTC)


 * On the other hand, if you and a computer were playing against a human grandmaster, you might be able to help the computer beat him. For example, if you knew a particular weakness of the grandmaster, and the computer gave you a range of equivalent moves to choose from, you could pick those moves which steer the computer towards his weakness.  (In theory, the computer could analyze the opponent directly, by reviewing all his past games for weaknesses, but I'm not aware of any programs that do that.) StuRat (talk) 15:58, 13 April 2013 (UTC)


 * That was more or less how Deep Blue beat Kasparov - it was programmed for him specifically. Not quite the same, since it didn't analyse his games on its own, but not unrelated. IBE (talk) 10:07, 14 April 2013 (UTC)