Wikipedia:Reference desk/Archives/Computing/2009 June 30

Computing desk
< June 29 << May | June | Jul >> July 1 >
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.


June 30

edit

Need help with chess

edit

I want to play both sides. I want an AI to help me out by advising what moves White should take, then I move the black pieces on my own. That way, I can simulate playing against a human (myself) that doesn't always take the best moves. Any help is appreciated.--12.48.220.130 (talk) 00:31, 30 June 2009 (UTC)[reply]

Most chess programs allow you to set up the board any way you want and tell the AI to play from there so you could play black(human)vs white(AI) - but when the AI makes it's move, if you decide not to take it's suggestion then just move the piece where you want to play it - play your black move and then tell the AI to "play from this position". But many chess programs have a "suggest a move" feature. So I don't think that's a hard thing to do. SteveBaker (talk) 02:29, 30 June 2009 (UTC)[reply]
Most GUI programs also have a "kibitzer" functionality that allows you to add one or more engines to observe the game without interfering. Almost all engines are capable of displaying the principal variation. Some may also be configured to display multiple variations. decltype (talk) 06:28, 30 June 2009 (UTC)[reply]

Webmail and wifi security

edit

Using Yahoo! Mail, I log in to my account through a https page, but then viewing and sending messages are done at regular http pages. Suppose I use my webmail from a laptop over wifi at a coffee shop, where I do not necessarily trust the owners. I assume the owners can easily see any messages I view, as well as the content of messages I send, while I am there. But can they do more than that? For example, can they call up messages in my inbox that I do not view while I am there? Can they send messages from my account unbeknownst to me? And can they continue to do this after I leave the coffee shop? --Mathew5000 (talk) 01:44, 30 June 2009 (UTC)[reply]

They can intercept traffic but your login credentials are encrypted when you use HTTPS to log-in. Assuming the Yahoo! Mail is designed even semi-competently, they should only be able to read unencrypted traffic, which would not give them the ability to actually influence the account. Presumably when you log-in to Yahoo! Mail, whatever authentication it uses is hashed with your IP address. --98.217.14.211 (talk) 01:52, 30 June 2009 (UTC)[reply]
After I log in, Yahoo must give me a cookie (over https) confirming that I’ve given the correct password. Then when I compose and send a message (over http), you are saying that my web browser does not send back the cookie itself, but rather a hash of the cookie combined with the message I’ve composed? That would make sense I guess. Thanks. --Mathew5000 (talk) 02:15, 30 June 2009 (UTC)[reply]
I don't know specifically, but either way, the browser identifies itself as having logged in with some sort of hash value. That hash value probably has the IP and other identifying data encoded in it. That means that even if you had the hash value, logging in would not work if the other data did not match up. (Hypothetically. Some of that data can be spoofed. Your IP, though, needs to match up correctly, or else the server won't know where to send the response.) That's all I mean. There are probably even more complicated and clever things going on; all I've described is the bare minimum for using an encrypted/unencrypted arrangement that doesn't let a man-in-the-middle issue arbitrary commands. I am sure others will have more elaborate and learned explanations, though! --98.217.14.211 (talk) 03:05, 30 June 2009 (UTC)[reply]
Yahoo mail services check your IP, your browser make, your OS make and version, your Mail software version and WebService version, all down to the minor version numbers. The session cookie would include some or all of these. If you try accessing the mail from another browser on the same machine, it will normally require you (or the nefarious cafe owners)to sign in again. - KoolerStill (talk) 06:43, 30 June 2009 (UTC)[reply]
KoolerStill, all that can be spoofed, since the café owners can get my OS version and so forth from the http data going through the wireless router. --Mathew5000 (talk) 11:13, 30 June 2009 (UTC)[reply]
Yeah, now that you mention it, that's right. The router itself manages the IP to your individual machine. So obviously it could do all that. Bleh. Brain not working. --98.217.14.211 (talk) 00:34, 1 July 2009 (UTC)[reply]
The real question is, why does Yahoo use HTTP instead of HTTPS for the email data? The contents of your email should be protected as strongly as the session login authentication data. Perhaps you should consider switching to a different service provider, or see if there is an option in the Yahoo mail settings to enable HTTPS for everything. Also, sometimes (for reasons I do not understand) a web page will choose to load some data with HTTPS and other data with HTTP (e.g. by using HTML iframes, or AJAX or similar "web 2.0" technical methods). In that case, it is possible that your email contents are securely transmitted with HTTPS even though the URL you access is prefaced with http:// . If Yahoo allows raw access to its IMAP server, you can use a client-side email program (like Alpine (e-mail client)) which will use strong protection for the entire session, unlike the web interface version seems to be doing. Nimur (talk) 16:09, 30 June 2009 (UTC)[reply]
I often wonder about this too. All e-mail services should use HTTPS, really. It's an obvious and glaring problem to just send people's private e-mail in the clear. GMail can be told to use HTTPS for everything, though that is not the default option. Tempshill (talk) 18:46, 30 June 2009 (UTC)[reply]
If you want an actual reason, it's just money. Serving emails over a SSL connection is more intensive, computationally and bandwidth-wise, than plain-text HTTP. The mail provider can have less sessions per server, so switching to HTTPS would require them to buy more servers just to keep their current client base. Basically, it would cost them a lot of money for a feature that most of their clients don't care about. Indeterminate (talk) 20:42, 30 June 2009 (UTC)[reply]
And if you really care about e-mail security you don't use Yahoo! Mail. (I'm talking to you, Sarah Palin.) --98.217.14.211 (talk) 00:34, 1 July 2009 (UTC)[reply]
See this from the archives: HTTPS and Hotmail. Jay (talk) 10:13, 1 July 2009 (UTC)[reply]

Problem

edit

With reference to http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Computing#problem: Thanks a lot! I got the whole program and it's running properly except one thing.I didn't understand what the pointer const prompt is doing in the following function.

int GetRoomNumber( const char * const prompt ) { int roomNumber;

do { cout << prompt << " (1 - "<<MAX_ROOMS<<"): "; cin >> roomNumber; } while ( roomNumber < 1 || roomNumber > MAX_ROOMS );

return roomNumber; }

what will be the alternative if we don't use pointer prompt?--121.52.148.13 (talk) 05:51, 30 June 2009 (UTC) —Preceding unsigned comment added by 121.52.148.13 (talk)

It appears that you are using the function like this:
GetRoomNumber("\nEnter Room Number to be Reserved");
That is, you pass a string literal to the function. The string literal has type "array of const char". The function call is valid because an array of const char can be converted to a pointer to its first element, that is, a "pointer to const char". Thus, inside the function, prompt is used to refer to the address of the first element in "\nEnter room...".
cout << prompt ...
will cause the program to write characters from this location until it encounters a null character.
a (const) pointer to const char is a perfectly reasonable way to pass a literal to a function. Alternatives include using basic_string, a reference to the array, or passing the array by value. decltype (talk) 09:07, 30 June 2009 (UTC)[reply]
The second "const" is completely pointless, and should probably not be there. All it says is that in that the pointer variable won't be changed inside the function. But there is no point in declaring that, as since the variable is local to the function anyway, it will never matter to anyone outside the function. It's like if you declared one of your arguments "const int x"; well the const does not matter to anyone outside, so there is no point in declaring it. --Spoon! (talk) 09:59, 30 June 2009 (UTC)[reply]
I considered commenting on that. It does not matter to the caller, but it might matter inside (in this case it doesn't), since it prevents you from inadvertently modifying it. While I myself prefer dropping the const, I don't mind the alternative approach:
// foo.h 
int GetRoomNumber( const char * prompt );
// foo.cpp
int GetRoomNumber( const char * const prompt ) { /* ... */ }
decltype (talk) 10:42, 30 June 2009 (UTC)[reply]

How to replace an old url with the new url globally in all pages

edit

Hai,

I need to replace old url with new url in each page. I dont want to do it manually. I want to change globally in all pages whereever the old one is there. i.e for example : Replace http://www.doc.com with http://www.docum.com

With Regards, Chaitanya.

Since this is a question about links within Wikipedia, my advice to bring the question here was wrong: we'll discuss it back over on the new contributors' help page (though anyone from this refdesk who knows the answer is very welcome to contribute). Gonzonoir (talk) 09:53, 30 June 2009 (UTC)[reply]
Are you sure the question is about links within Wikipedia? That's not clear to me from the question. -- Coneslayer (talk) 18:28, 30 June 2009 (UTC)[reply]
The original question was specifically about a "wiki" - we can assume it is a MediaWiki install. This is just a repeat of the question in a different area. -- kainaw 20:05, 30 June 2009 (UTC)[reply]

What product is this ?

edit

This is bugging me I cannot remember what this product is called

1) think that microsoft is involved

2) User takes a picture of a nine by nine grid with their phone - the grid has black dots on it - phones with the right software then turn this into a URL and take the user to the relevant website. The idea is that those grids can be used on posters, packaging and so on - allow mobile phone users to quickly access content.

Anyone know what this is called? --Cameron Scott (talk) 15:47, 30 June 2009 (UTC)[reply]

Something like a QR Code? -- Coneslayer (talk) 16:07, 30 June 2009 (UTC)[reply]

Spot-on! thanks chum. --Cameron Scott (talk) 16:29, 30 June 2009 (UTC)[reply]

Microsoft is more heavily involved in their own competing format High Capacity Color Barcode. APL (talk) 19:10, 30 June 2009 (UTC)[reply]

Firefox 3.5

edit

Just tried out Firefox 3.5 today. It's HTML5 stuff rocks! The <audio> and <video> tags work without a hitch to deliver seamless streaming media right inside web pages.

I'm wondering, since Wikipedia uses ogg exclusively, is there any plan at the present time for WP to incorporate HTML5 tags in some way?

70.31.154.75 (talk) 18:27, 30 June 2009 (UTC)[reply]

Since this is a question about the direction of Wikipedia, it should be asked over at the Village Pump, probably in the "Technical" section. The reason: The people who help out over there are actually working on the software and configuration that Wikipedia uses. Tempshill (talk) 18:44, 30 June 2009 (UTC)[reply]
Thanks, I'll ask over there then. —Preceding unsigned comment added by 70.31.154.75 (talk) 19:37, 30 June 2009 (UTC)[reply]

machine code question

edit

Is this doable in x86 or Power/PC machine code (not ARM) without involving a jump ? :

flag:=(x<y) !ie flag(boolean) is set of reset on the condition x<y
if flag=true z:=a ! ie a is some constant
if flag=false z:=b ! b is a constant like a

I'm trying to avoid a jump on condition instruction - is this easily done - a formula like z:=b+g(a-b) seems to be the answer so I guess I need to get g (integer?) as either 1 or 0 dependant on the result of (x<y) - ie convert a flag to either integer 1 or 0 for use in a maths expression. I'm not very familiar with either ISA so please excuse if this question is somewhow fundamentally ignorant. Thanks.83.100.250.79 (talk) 20:44, 30 June 2009 (UTC)[reply]

There's conditional move instructions on modern x86's, they were put in with Pentium II I believe. In the past one could use a much longer sequence of logical instructions after using one of the SETcc instructions. I don't believe the PowerPC has anything comparable but it isn't such a problem because it can separate a test and a jump much better. Dmcq (talk) 22:12, 30 June 2009 (UTC)[reply]
Thanks! both setcc and move on condition were exactly what the sort of thing I was hoping for.
83.100.250.79 (talk) 23:58, 30 June 2009 (UTC)[reply]
The PowerPC can copy a condition code to a register so it can do the work without a jump. And in fact I think people do this when assigning a boolean 0 or 1 but it isn't worth it in general. The original POWER architecture had a conditional move but it was removed as not worth the effort. Dmcq (talk) 12:40, 1 July 2009 (UTC)[reply]
Thanks again. (going through IBM's pdf's is hard work for me I can never find anything) . Found the handle mfcr (introduced in POWER4 according to wikipedia). Now I know what I'm looking for, thanks again.
  Resolved

google question

edit

ive noticed that google is indenting all my search results by about 3 cm. i find this very annoying but dont know how to fix it. any help?--24.109.201.127 (talk) 21:04, 30 June 2009 (UTC)[reply]

Is this a new problem? and what browser are you using, that's probably relevent too.83.100.250.79 (talk) 21:07, 30 June 2009 (UTC)[reply]
yeah its new. firefox 3 on vista. --24.109.201.127 (talk) 21:16, 30 June 2009 (UTC)[reply]
Perhaps click "Hide options" at the top? "Show options" indents the results. If it's really chapping your hide you could fix it with Greasemonkey. --Sean 13:55, 1 July 2009 (UTC)[reply]

This just started happening to me too. Firefox 3.0.11 on XP. Thanks, gENIUS101 19:13, 1 July 2009 (UTC)[reply]

I'm looking for a JavaScript/Flash/C soucecode/GIF/APNG file that swapping black screen to white screen as fast as possible over and over again so I can use it on Full Screen. If possible I want to control the parameters (time, colors, monitor Hz) Same thing about RGB. Something like This, but it's way too slow. Thanks. 85.250.88.35 (talk) 21:29, 30 June 2009 (UTC)[reply]

How is Ogg pronounced? Is it similar to the pirate-ish exclamation of "Argh!" just without the 'r'? Or like the first part of the word 'auger'? Dismas|(talk) 23:46, 30 June 2009 (UTC)[reply]

I pronounce it simply /ɒg/. Wiktionary agrees. Algebraist 23:54, 30 June 2009 (UTC)[reply]
Does anyone actually say it out loud? The only time I've ever even read about it has been on Wikipedia. There can't be a "right" (i.e., common) way to say something until people actually talk about it offline.--24.8.176.112 (talk) 00:02, 1 July 2009 (UTC)[reply]
Believe it or not, some people in the internet age are still communicating with each other via speech. Algebraist 00:05, 1 July 2009 (UTC)[reply]
Why? Are you trying to impress all your "friends" while you talk about OGG? I bet all the girls love you.--24.8.176.112 (talk) 02:44, 1 July 2009 (UTC)[reply]
I have often had occasion to describe aloud files encoded with the Ogg Vorbis codec. I have always said "Ogg files". (Rhymes with "Dog Files") I have no idea if this is the 'official' way to describe a .ogg file, but everyone knows what I'm talking about and no one has ever corrected me. Neither the vorbis.com website, or the official format descriptions[1] contain a pronunciation key, or even a etymology, I figure we should just pronounce it phonetically. .APL (talk) 01:52, 1 July 2009 (UTC)[reply]
Hah. The article says that it comes from Netrek slang. In a Netrek "ogging" refers to a kamikaze attack. Usually against an enemy starbase. I don't think that helps, though. APL (talk) 02:02, 1 July 2009 (UTC)[reply]
Maybe I'm just weird, but I've always pronounced it "oh-gee-gee." Whichever is more aurally pleasing to you! -ankØku- (talk) 04:25, 1 July 2009 (UTC)[reply]
A somewhat related question: what do we call acronyms that look unpronounceable but that a significant number of people have figured out how to pronounce? (Example: SCSI interface pronounced "scuzzy interface"). --Goodmorningworld (talk) 15:21, 1 July 2009 (UTC)[reply]
I remember a very early Macintosh-enthusiast magazine claiming that for SCSI, PC users pronounced it "scuzzy" whereas Mac users pronounced it "sexy". Because that was how Mac users rolled, you see. Tempshill (talk) 04:51, 3 July 2009 (UTC)[reply]
Good one :D