Wikipedia:Reference desk/Archives/Computing/2012 July 5

From Wikipedia, the free encyclopedia
Computing desk
< July 4 << Jun | July | Aug >> July 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.


July 5[edit]

Visibility modes and Inheritance influence[edit]

1. What are visibility modes? Please explain the impact of visibility modes on access specifier of inheritable members of base class. 2. How does inheritance influence the working of constructor and destructor? — Preceding unsigned comment added by 164.100.45.146 (talk) 09:21, 5 July 2012 (UTC)[reply]

If you read your textbook, you might find the answers.  :)

Bytes and Class AUTHOR[edit]

1. How many bytes will be required by an object belonging to class AUTHOR? 2. How many bytes will be required by an object of vehicle and heavy vehicle classes respectively? 3. How many bytes does an object belonging to class C require? — Preceding unsigned comment added by 164.100.45.146 (talk) 09:28, 5 July 2012 (UTC)[reply]

Seriously, you need to do your own homework. We're happy to point you to articles, but you need to do the work, and show that you've tried. If you've reduced yourself to just typing the questions you're being set into online forums and expecting someone to do them for you, you're guaranteeing you're going to fail the class. -- Finlay McWalterTalk 09:37, 5 July 2012 (UTC)[reply]
Actually, you're guaranteeing you're going to fail your life. (Although I suppose getting others to do your work is good training for management ;) By way of some constructive help, you need to decide how much information you are associating with your object. Take Author, for instance. Decide what fields are associated, such as Forename(s), Surname, Date of Birth, a Key field, and perhaps foreign key pointers to Genre, Publisher, Gender, etc. Work out what size in bytes each field should be (e.g. what is the longest name you'll support, what will be the length of the key & foreign key fields). Add them all up, and you have your answer. I'm presuming that in the homework you;re doing, you have some specification of the sorts of data associated with the classes of objects you're enquiring about. --Tagishsimon (talk) 14:56, 5 July 2012 (UTC)[reply]
Here are some guidelines to how many (8 bit) bytes various forms of data require:
1) Character strings: 1 byte per character, assuming 255-256 possible characters. (There are also 2-byte character codes, for languages with many symbols, like Chinese.) Also, variable length character strings need to add at least one character to the maximum length string, for a null terminator, or 2 characters, if a character count is stored, instead, and the maximum string length exceeds 255. (The average string length, on the other hand, is typically shorter than the fixed length string.)
2) Integers: 2 bytes (65536 values), 4 bytes (over 4 billion values), or 8 bytes (over 18 quintillion values).
3) Reals: 8 bytes is typical.
4) Dates: 2 bytes with a 2 digit year, and 3-4 bytes for a 4 digit year. However, dates stored in character form follow the character string rule, and are larger, from 5 characters: "11365" (365th day of '11) to 29 characters: "Wednesday, September 26, 2012".
5) Gender: Could be a single bit, if you only allowed male and female. However, since many systems can't efficiently use a single bit, it might be best to represent gender as a single character (1 byte). This also allows you do use " " or "?" to represent an unknown or indeterminate gender. StuRat (talk) 18:53, 5 July 2012 (UTC)[reply]

Classid object element.[edit]

At W3C page It says that the attribute 'classid' from the object element it is for specifying the location of the object.

"This attribute may be used to specify the location of an object's implementation via a URI.
It may be used together with, or as an alternative to the data attribute, depending on the type of object involved."

But some pages put classid like this <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="180" height="60" bgcolor="#FFFFFF">
clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 is not the location of the object. But how object dtd says otherwise? 15:57, 5 July 2012 (UTC) — Preceding unsigned comment added by 190.60.93.218 (talk)

Well, you can look up the clsid in a database to find the implementation. I think that's all that "locate" ever means. In what sense is "http://en.wikipedia.org/" a location? -- BenRG (talk) 16:24, 5 July 2012 (UTC)[reply]
Yeah, but that is not an URI, is it? 190.60.93.218 (talk) 18:55, 5 July 2012 (UTC)[reply]
It is. 1 2 77.97.198.48 (talk) 22:57, 6 July 2012 (UTC)[reply]
OH WOW IT'S ACTUALLY AN URI!! 190.158.212.204 (talk) 05:19, 7 July 2012 (UTC)[reply]

preinrement,postincrement in c[edit]

hi friends! ineed explanation for the below statement.please give some detailed explanation. 1)"IN C LANGUAGE ++i YIELDS AN RVALUE .FOR POSTFIX ++ TO OPERATE AN LVALUE REQUIRED":. 2)is ++i++ valid in c?if not why it is not valid? i hope you explain with good example. — Preceding unsigned comment added by Phanihup (talkcontribs) 16:17, 5 July 2012 (UTC)[reply]

It is not valid. I don't know if I can give a reason. It's just forbidden by the C language standard, and you could argue either way about whether it ought to be.
More precisely, what's forbidden is changing the same variable more than once "at the same time" (between sequence points). So you also can't write i = ++i, for example. -- BenRG (talk) 16:33, 5 July 2012 (UTC)[reply]
As for your first question, it's true that ++i yields an rvalue (which is just a value) and not an lvalue (which is a modifiable variable-like thing) in C. But that's not really relevant here. In C++ it yields an lvalue, but (++i)++ is still illegal in C++. One other thing: your expression ++i++ means ++(i++). That is, it does the postincrement first. But it's illegal either way. -- BenRG (talk) 16:39, 5 July 2012 (UTC)[reply]

Collapsible lists on other MediaWiki-licensed wikis[edit]

I'm sure there's a better place to ask this, but I suspect it's a coding issue and someone knowledgeable will see it here. I'm trying to establish collapsible lists, such as Template:Collapsible list, on a wiki I use at work. It uses MediaWiki software and basically resembles Wikipedia before the interface change. I suppose I want to either import that template for use on the work wiki or hard-code it somehow. Any ideas? (n.b. Unfortunately, this wiki is not viewable to outsiders.) --BDD (talk) 17:26, 5 July 2012 (UTC)[reply]

It uses code in MediaWiki:Common.js. If you can edit the MediaWiki namespace at work then maybe you can simply copy it, or copy the parts related to collapsing. PrimeHunter (talk) 18:56, 5 July 2012 (UTC)[reply]
Pardon my ignorance. Do I need to copy all of Common.js into the work wiki, or just part of it? And will it be a new page on that wiki, like a template, or should the code be used directly where I want to use it? --BDD (talk) 18:59, 5 July 2012 (UTC)[reply]
See mw:Manual:Interface/JavaScript. The needed parts of MediaWiki:Common.js should be copied to the same page name "MediaWiki:Common.js" on your wiki. You probably need the "Collapsible tables" part and "Dynamic Navigation Bars". I'm not sure of the details or whether you also need parts of MediaWiki:Common.css, and I don't have my own wiki for testing. You can try asking at mw:Project:Support desk if there are problems. PrimeHunter (talk) 23:20, 5 July 2012 (UTC)[reply]

New & Improved, My Foot[edit]

I use Google Chrome on Windows 7. I just installed a new version of Java, and now nothing that requires Java works. In particular, I am trying to gain access to the Free Internet Chess Server, but when I try to log in I receive this error message:

java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at free.jin.JinApplet$UserAuthPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

I tried uninstalling and reinstalling Java (when I went to the Control Panel I noticed that the old version was still there, but that probably isn't relevant), but that didn't have any effect. What is happening? Interchangeable 18:34, 5 July 2012 (UTC)[reply]

The obvious thing to try is removing the current version of Java to see if the old version still works. You might also try another browser, like Firefox or Internet Explorer, and see if Java works there. StuRat (talk) 18:38, 5 July 2012 (UTC)[reply]
I tried that, and it didn't work. And it doesn't work in Firefox or Internet Explorer either. Interchangeable 22:47, 5 July 2012 (UTC)[reply]
It seems your program provides the stack trace - which is the technical information about the error, rather than a simple "plain English" explanation. Basically, this message isn't Java's fault, it's an error due to "server not found." Several things can cause this: the server might not be running any more; or, it might be overloaded. It's also possible that the server is fine, but you can't connect because of a network firewall, either on a router, or on your host OS. Consider checking your Windows security settings to see if you're blocking internet-access for your program. Nimur (talk) 23:03, 5 July 2012 (UTC)[reply]
(I formatted the error message to appear the same way it does in the source. --Bavi H (talk))
I agree with Nimur, out of the long error message you posted, the only important part is the "connection timed out" at the beginning. I agree checking firewalls or security programs for any items that look like they might be blocking Java is a helpful idea. Perhaps checking Java's network settings may also be helpful.
To better understand the problem, is this the log in page where you're getting the error message?: Jin Applet. If so, are you able to see the username and password fields or do you get the error message before they even appear?
On that page I'm able to see username and password fields and "Login" and "Login as Guest" buttons. I clicked "Login as Guest" and a window like the one shown here appeared: Jin Screenshots. The text in the black window begins with "Trying to connect to www.freechess.org on port 5000... Connected" followed by a welcome message and basic instructions. So the server seems okay. How far through this process do you get before you get the error message above? --Bavi H (talk) 03:12, 6 July 2012 (UTC)[reply]
If I wait for a very long time, the login screen comes up, but once I enter my username and password that window just says "Connecting" and does nothing. On one occasion the Jin screen did come up, but then I didn't get the "Connected" message, only "Trying to connect to www.freechess.org on port 5000..." and then an error message. Interchangeable 15:09, 6 July 2012 (UTC)[reply]
Do other pages from the www.freechess.org website load correctly?
To test connection to the chess server in a crude, alternative way, you can go to http://www.freechess.org:5000/ in your web browser. If you see the server welcome message, press Esc or click the stop button in your browser to cancel the connection. (Although the browser is sending a web request the chess server doesn't understand, the browser still shows the chess server's messages. If the connection is successful, you'll see the server welcome message, but then the server will just keep complaining the username isn't in the proper format, so it's a good idea to stop the connection right away if you see the welcome message.)
These tests might help suggest if only Java has a problem connecting or if all connections to www.freechess.org are having problems for you. This will help us decide what to test next. --Bavi H (talk) 04:18, 7 July 2012 (UTC)[reply]
I do get a welcome message if I go to that page. (And as some more good news, other things with Java have started working again.) Interchangeable 17:07, 7 July 2012 (UTC)[reply]
Since the FICS Java applet has problems connecting in Chrome, IE, and Firefox, but going directly to freechess.org:5000 displayed the welcome message, I hypothesize that something is blocking Java connection attempts. If you have any security software, you might turn it off temporarily (allow all connections), test if the normal log in works, then turn it back on. If the log in works, you can further examine the security software settings for any items that list java, www.freechess.org, or port 5000. --Bavi H (talk) 04:03, 8 July 2012 (UTC)[reply]
I turned off my McAfee firewall and was on the server in an instant. Then I logged out, turned it on again, and was blocked. So, problem solved, but it's rather annoying to have to risk viruses every time I want to log in. Interchangeable 15:05, 8 July 2012 (UTC)[reply]
I agree leaving the firewall off isn't wise, but we have now narrowed down the cause. The next step would be to find the specific setting or rule in McAfee that is blocking the connection then remove or reverse it to allow the connection. Once the setting is corrected, you can keep the firewall on and connect to the chess server.
More information: In firewall software, there's usually a settings page somewhere with lists of programs, sites, or ports that are allowed or blocked. After the firewall is first installed (or maybe after a major update or resetting all the settings to defaults), when a new type of connection is attempted for the first time, the firewall typically asks if you want to allow or block that type of connection, then saves the setting in one of these lists. If you or someone else using your computer accidentally clicked to block the chess server connection, you may have to find the appropriate list where the setting was saved and remove or reverse the setting. For example, you could look for items that mention java, www.freechess.org, or port 5000. --Bavi H (talk) 19:48, 8 July 2012 (UTC)[reply]
Alternatively, there may be other advanced firewall settings preventing the chess server connection from working. If you've paid for your McAfee firewall, you might look for a McAfee tech support website, e-mail, or phone number to ask for help setting the firewall to allow the chess server connection. Even if your firewall service is free, you might still do a search online for the exact McAfee version number and a few keywords describing the problem, someone else may have had the same problem and found a solution. --Bavi H (talk) 20:16, 8 July 2012 (UTC)[reply]

Restoring old audio[edit]

Someone recently sent me an old newsreel from the 1940s (converted to VHS, then DVD, then ripped by me to MP4) which has pretty good visuals (for all of that transcoding), but the audio is almost incomprehensible. It has a "squished" feeling to it. I've uploaded a sample here to one of those free file sharing sites (go down to "slow download" and it should be free). It's only 1.2MB in size. Anyway, you can just make out "United States" at the end of it. The voice also has a "pinched" sound to it that I'm sure is not original to the speaker.

I figured there must be some way in Audacity or something similar to make this a little easier to understand, but frankly I just don't know how to edit audio. (I mean, I know how to use Audacity's interface — I just have no clue where to start to get the kind of results I want, in terms of what filters to apply or whatever.) Can anyone who knows about such things give this a listen and give any suggestions? I'm not really sure where to begin in trying to extract some quality from this, if it's even possible. --Mr.98 (talk) 18:48, 5 July 2012 (UTC)[reply]

You could use Mediafire (or a less spammy hosting server) next time you want to upload a file, it's less spammy and all.... also see this it might help.190.60.93.218 (talk) 19:07, 5 July 2012 (UTC)[reply]
I don't usually upload files to services like that, so I just picked one at random, to be honest. Thanks for the other link, but it doesn't seem to address the kinds of problems that my audio has. --Mr.98 (talk) 21:08, 5 July 2012 (UTC)[reply]
Mr. 98, regrettably the sample you have uploaded is pretty much a canonical example of "totally unrecoverable" audio. There has been actual loss of data; I can only surmise that this was due to "something" in the multiple conversion processes. (From the sample we have, I'm reluctant to be more specific than that). As a result, the track has a very large amount of noise and resampling and reencoding artifacts. Mostly, it just has a very large amount of white-noise overlayed on top of the signal. Furthermore, while the file is technically sampled at 44.1 kHz, most of the audio information has been lost below about 1kHz and almost totally attenuated beyond 4kHz (strongly suggesting that an intermediate stage of conversion did not preserve all useful audio information). In theoretical examples, a human voice is still "intelligible" even with such limited bandwidth, but this example is compounded by a very poor noise environment.
Conceivably, one could play with this in Audacity for a few hours to try to boost the treble without boosting the noise. Even more hypothetically, one could write a one-time-use heuristic noise suppression algorithm in MATLAB or GNU Octave and apply that algorithm to this file in the hopes of recovery (the track is stereo and one might be lucky enough to find useful redundant information there, improving the signal by amplifying the common-mode only - but maybe not, and it would take time and effort to even validate that hypothesis, let alone use that information to improve the signal). So, I have concluded that the audio content in this file is effectively "totally destroyed, totally unrecoverable." You'd reap far greater returns expending a few hours of effort to try to find (another copy of) the original source audio, rather than trying to repair this copy. Nimur (talk) 16:13, 7 July 2012 (UTC)[reply]
Thanks — not encouraging but still useful. --Mr.98 (talk) 03:02, 9 July 2012 (UTC)[reply]
Was the DVD that you ripped it from any better? Re-ripping with different audio settings (perhaps even just preserving the DVD audio stream) could at least eliminate problems introduced by one of those steps. 209.131.76.183 (talk) 13:47, 9 July 2012 (UTC)[reply]

Turn off half of a screen[edit]

Is it technically imaginable to turn off half of a computer screen? Does this maybe exist? I've never heard of it, but that doesn't imply non-existence. OsmanRF34 (talk) 19:11, 5 July 2012 (UTC)[reply]

You can obviously generate a black image for half of the screen, but the electronics behind the picture will be either on or off and it does the whole screen at once. If you have some wacky need for this, buy two screens, put them side by side and turn one off. -- SGBailey (talk) 19:15, 5 July 2012 (UTC)[reply]
Very funny. Anyway. Why not divide the electronics in two and turn one side off? I mean, imagine a real life scenario: you are working on your laptop but just have to send emails or read some small text. You won't need the full screen would you? Excuse my ignorance, but would a black square consume less than a equal size white square on the screen? OsmanRF34 (talk) 19:21, 5 July 2012 (UTC)[reply]
My understanding is that for LCD screens, the majority of the power usage comes from the backlight. I'm not sure it's feasible to turn off half of the backlight, but I don't really know the technical aspects of it. I don't see why it would be impossible assuming more than one backlight is being used. --Mr.98 (talk) 21:12, 5 July 2012 (UTC)[reply]
Some big LED backlit LCD televisions ARE actually doing this already. Some LED screens which use a LED matrix backlight can detect which part of the screen is "dark" and the LEDs that illuminate that part of the screen turn off (or just become dimmer) to increase the contrast of the screen. Backlight is actually not a terrible article. I personally don't like this effect because you can actually SEE it happening. The reason why they do this is because a LED matrix is a configuration which is suitable for this kind of effect. CFL backlights however typically use just one or two tubes to illuminate the whole screen and they typically run the LENGTH of the screen because there's less distance between the top and the bottom of the screen. So if you had 2, turning one off would let you dim either the top or bottom of the screen which doesn't seem very useful. To turn off the left or the right you would need 2 or 4 tubes which probably increases the cost and complexity probably more then you'd save by occasionally being able to turn half the screen off. OLED is what I'm waiting for, it won't suffer from this issue at all because it doesn't require a backlight to begin with. Black IS off. Vespine (talk) 00:29, 6 July 2012 (UTC)[reply]
Blackle claims to save electricity with its predominantly black screen. HiLo48 (talk) 03:13, 6 July 2012 (UTC)[reply]
But just claiming something doesn't make it so. --Mr.98 (talk) 18:33, 7 July 2012 (UTC)[reply]
A screen with a dynamic contrast ratio automatically dims the back-light for dark scenes, but I'm not clear if any do this by area, or if they just dim the entire back-light evenly. There are some large, industrial screens which use true LED screens (as opposed to the LED back-lit LCD screens frequently marketed to customers as "LED screens"). Since they don't use a back-light, then off is really off, and dark regions of the screen shouldn't use any electricity. StuRat (talk) 03:38, 6 July 2012 (UTC)[reply]