Wikipedia:Reference desk/Archives/Computing/2008 July 15

Computing desk
< July 14 << Jun | July | Aug >> July 16 >
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 15

edit

What's wrong with this php

edit

I have my php installed on this computer. The html and php are in the same folder. Here is the php page:

<?php
    $n=$_POST['n'];
    print "Your prime number is $n.";
    ?>

And here is the HTML page:

<html>
<head>
<title>Prime Number</title>
</head>
<body>
<form method="post" action="prime.php">
<input type="text" name="n" id="n"/>
<input type="submit" value="Submit" />
</form>
</body>
</html>

Whats wrong with it my PHP Designer said Undefined index n in C:\Users\Public\Public Documents\prime.php on line 2 Melab-1 (talk) 01:46, 15 July 2008 (UTC)[reply]

I'm not sure but try removing $n=$_POST['n'];. ---J.S (T/C/WRE) 03:12, 15 July 2008 (UTC) Nevermind. ---J.S (T/C/WRE) 03:21, 15 July 2008 (UTC)[reply]
Your PHP code is fine. The problem is on your server. What all did you install on your computer? You need an http server and php running to make this work. Trvr3307 (talk) 06:19, 15 July 2008 (UTC)[reply]
The error is saying, basically, that it doesn't know what you're talking about when you reference item "n" from the system variable $_POST. The fact that it's telling you this tells you that PHP is installed fine. I'm not sure why it doesn't get the variable, though. It might be due to it not receiving POST variables at all; it might be due to the error reporting settings telling you that when the variable is null.
Try this on line 2 and see what it gets you, it should tell you what the script is receiving, if anything: echo "POST variables are: ".print_r($_POST,1); --98.217.8.46 (talk) 14:37, 15 July 2008 (UTC)[reply]
I have heard of a bug with Windows web server (IIS, I believe it is called) not passing post variables when connected to the local machine. It is possible that this is the problem the questioner is experiencing. -- kainaw 14:51, 15 July 2008 (UTC)[reply]

Backup of Windows files using Linux

edit

I had a problem with my Windows installation and so I tried to access my data with Puppy Linux. I could copy the files, but as I try to open the pdf files, I receive an "Access denied" message as I try to open them in Windows.

How can I access these Windows files? —Preceding unsigned comment added by 83.40.8.91 (talk) 09:46, 15 July 2008 (UTC)[reply]

The problem happens only as I try to access the files under another Windows installation. If I try to access my pdf files under Linux the problem disappears. The same happens to directories of my own files. —Preceding unsigned comment added by 83.40.8.91 (talk) 10:13, 15 July 2008 (UTC)[reply]

What about non-PDF files in the same directories? And can you move the PDF files around (copy them from directory to directory, attach them to emails, etc.)? -- Hoary (talk) 10:16, 15 July 2008 (UTC)[reply]

Under Windows I cannot move them around. Other files (html) are okay. Under Puppy Linux I can do what I want (read, copy, etc). —Preceding unsigned comment added by 83.40.8.91 (talk) 10:20, 15 July 2008 (UTC)[reply]

How about using ntfsclone from ntfsprogs for backup purposes (since a non-raw copy of a windows installation is not bootable)? Also, might access not be denied to those files if accessed by a more priviledged user (ie administrator)?--209.151.139.252 (talk) 04:19, 17 July 2008 (UTC)[reply]

A3 Printer / Scanner

edit

I'm looking for an multifunction printer / scanner that can print and scan A3 in color. It would be for light to medium small office use, on a daily basis. Cost isn't too much of an issue, but I don't want to go overkill considering the aforementioned usage. Are there any solutions for this, or would you suggest I get an A3 printer and scanner separately? Thanks. 81.187.252.174 (talk) 10:18, 15 July 2008 (UTC)[reply]

occlusion test for cube in directX/openGL ?

edit

Is this possible?

What I want to do is:

1. calculate which faces of the cube are visible (can do)
2. tranform the faces to polygons in screen coordinates eg Zdepth, x and y (can do)
3. For each face start the 'polygon fill' process but simply compare the z depth of each pixel with the z depth in the screen buffer
i. If the polygon z pixel depth is less than the screen buffer z depth then 'TOTAL_OCCLUSION'=FALSE. and exit
ii Do the next, and all the pixels from the polygon in 3.i.
iii 'TOTAL_OCCLUSION'=TRUE and exit.

Note, I want the proceedure to exit early if the polygon is shown to be not occluded at a point, and that there is not write to the screen buffer - just read?

Is this do-able - if so what are the commands? Thanks.87.102.86.73 (talk) 12:37, 15 July 2008 (UTC)[reply]

MS Office - changes between versions

edit

(Caveat: A month ago I shifted positions where I "work", and found myself too busy to troll the RefDesks. I now find myself so busy that I probably should consider myself to be actually working. Dammit. But, I can come here if I need help, can't I?)

Background: I had been using a PC running XP/Pro and MS Office 2003 Premium. Among other things, I use Excel to create and maintain a simple list of related items. While some fields were calculated, most were manually pulled from various sources, all coughing up data as text. I had my company-mandated Outlook set to show all email as text, so even those things I used the Windows Clipboard for came across as simple text, and all was good. Now: I have been "promoted", and now have a newer PC running Vista Ultimate (like a very sick dog, btw, until I gave it enough RAM) and I have MS Office 2007 Professional to maintain that list with, and I can no longer do what I used to do. Anything I copy from another source into Excel retains the font, size, and attributes of the original. Thus, a small field that displays fine with the attributes I told Excel to use becomes unreadable with the (effectively) random font, size, bold, italics, etc that got dragged over from the web page, incoming email, etc that was copied.

Does anyone know how to do any of:
1) convince the clipboard in Vista to only copy ASCII text without all the formatting garbage,
2) convince MS Oulook 2007 to display all email as ASCII text only -I found the setting to make all _outgoing_ email text, but I can't find the setting to make all _incoming_ email show text only. I get to see all incoming email exactly as rainbow bright wanted me to, with beautiful colors, different fonts and sizes, etc. There's gotta be a "Just show the text" setting somewhere...
3) convince MS Excel 2007 to enforce field settings, instead of allowing the clipboard to change them all?

(I miss you guys. Actually, I miss being so under-worked that I could troll the RefDesks, but, hey, let's be polite!) -SandyJax (talk) —Preceding comment was added at 14:16, 15 July 2008 (UTC)[reply]

I don't have all those fancy new software versions, but in similar situations, I've become used to keeping a "scratch" notepad open, and I use a two step copy/paste, i.e. copy from mail to notepad, then ctrl-A, ctrl-C (shift focus), ctrl-V. It's far from ideal, but it works, and I have to do it seldom enough that it's not onerous. --LarryMac | Talk 14:48, 15 July 2008 (UTC)[reply]
I agree, the two-step process works well, since Notepad strips all formatting, but it's definitely not my first choice for a solution. (Actually, my FIRST choice would be an automated filter on the email server sending a text-only copy of the relevant emails to a bot which inserted the relevant data into the table, but since this company doesn't believe in test servers, any such development would have to be done on the live servers that paying customers and paid employees use world-wide. Things don't get fixed or improved very often, here.) -SandyJax (talk) 15:31, 15 July 2008 (UTC)[reply]
I've used "Clipboard Washer" to do #1. You need to install Yahoo Widgets to use it. —Preceding unsigned comment added by 66.92.130.188 (talk) 01:25, 16 July 2008 (UTC)[reply]
Try the Edit > Paste Special menu option in Excel. Depending on the copy-from source, this should give you the option to paste plain text only, which should leave the formatting alone. -- Tcncv (talk) 03:25, 16 July 2008 (UTC)[reply]
That sounds like what I want. However, this new MS program does not seem to have the standard MS Windows program drop-down menus, like File/Edit/Tools/Help/etc. All Excel 2007 offers is "Home / Insert / Page Layout / Formulas / Data / Review / View" to let me do anything I want with this spreadsheet. I just can't find the Edit menu that you are probably talking about. -66.55.10.178 (talk) 13:47, 16 July 2008 (UTC)[reply]
Did you click the magic bubble in the upper left? -- kainaw 14:55, 16 July 2008 (UTC)[reply]
Yes, I did. Do you know of an option in that menu that does something helpful? If so, can you tell us where it is? -SandyJax (talk) 19:27, 16 July 2008 (UTC)[reply]
If you right-click in the cell where you want to paste, the menu should include "Paste Special". Alternatively, if you paste normally (like with Control-V), there should be a little clipboard icon after the pasted text. If you click that, you should get a drop-down menu that lets you choose to "Match Destination Formatting". -- Coneslayer (talk) 19:48, 17 July 2008 (UTC)[reply]
When I paste something in Office 2007, a little icon appears next to the stuff I just pasted offering to: "keep source formatting", "use destination formatting" or "keep text only" (or some similar wording). I nearly always use the last option. Astronaut (talk) 14:23, 18 July 2008 (UTC)[reply]
Both of those should work, and look useful as one-off tools. However, I'm asking if there is a global setting for either Excel itself or for "this worksheet" that would allow me to NOT have to do this every time I "paste" something. Alternately, my question was "Does anyone know how to get Outlook 2007 to drop all formatting for incoming messages?" to attack the problem at the "cut" end. -SandyJax (talk) 14:22, 20 July 2008 (UTC)[reply]

SLI vs. CrossfireX

edit

Is there a difference between motherboards that do SLI and those that do Crossfire? My video card says it can do SLI (it's a GeForce 8800 GT Superclocked), and I was looking at this motherboard. Can I SLI a pair of 8800 GT's (assuming I eventually buy a second one) on that particular motherboard? 216.49.181.128 (talk) 17:09, 15 July 2008 (UTC)[reply]

And that mobo is compatible with this CPU, right? 216.49.181.128 (talk) 17:15, 15 July 2008 (UTC)[reply]
Yes. While there is little difference as far as I know at the physical level, chipsets need to be licensed with built in support to do SLI or Crossfire. Nvidia in particular isn't licensing SLI to anyone meaning unless you have an Nvidia chipset, you're not going to have SLI. Now it is potentially possible to hack the drivers to enable SLI on an unsupported motherboard, but this is going to be rather iffy to get to work. Also be aware that the motherboard you linked to has only one true 16x slot, the other one only offers 8 lanes according to the Foxconn manual (which isn't surprising since it's using the P45 chipset) which may reduce performance slightly (although probably not by much). In any case, IMHO SLI is nearly always a waste. As you are hopefully aware, SLI performance is quite variable and is often not double and can indeed have no increase. It's simply not worth the hassle, unless your insane and are using 2 of the best cards possible. You're nearly always far better just buying a new card, whatever offers the best price/performance for your budget at the time, which may not be much more expensive then the price of a second 8800GT but could easily offer double the 8800GT and selling your old one for whatever you can get. Nil Einne (talk) 19:50, 15 July 2008 (UTC)[reply]

why no browsers in app store

edit

Why is that all the applications in iPhone app store is small games or small apps. Why no browsers like opera or firefox etc? Does Apple prohibit or discourage them by some means like say, they are not possible with the current SDK like that? —Preceding unsigned comment added by 59.92.119.219 (talk) 17:42, 15 July 2008 (UTC)[reply]

I'm somewhat doubtful the terms of the App Store SDK licensing make it likely or possible for free software like FireFox to be released. Nil Einne (talk) 19:56, 15 July 2008 (UTC)[reply]
As I suspected... [1]. Potentially a browser could be derived from FireFox and released under the LGPL or MPL (although I'm not sure) but I suspect Mozilla will put their foot down on it being called FireFox Nil Einne (talk) 19:59, 15 July 2008 (UTC)[reply]

More C++

edit

For my second C++ program I am trying to write one to take the average of three numbers. Here's what I have:


#include <iostream>

using namespace std;

int main()
{
    float a, b, c, average;
    cout << "Please enter 3 numbers." << endl;
    cin.get >> a >> endl;
    cin.get >> b >> endl;
    cin.get >> c >> endl;
    average = (a + b + c)/3;
    cout << "The average is:" << average;
    system("pause");
    return 0;
}

When I try to compile this, I get three errors that say this: "C:\Documents and Settings\Zachary\Desktop\Average.cpp invalid use of member (did you forget the `&' ?)" for lines 10, 11, and 12. What I would like to know is what to change in order for this to compile correctly. (By the way, I'm using the Dev-C++ compiler.) Thanks, Ζρς ι'β' ¡hábleme! 17:49, 15 July 2008 (UTC)[reply]

I just wrote a program so I could check the "cin" function. I don't know what's going on because if I try to use "cin" in the above program, I get way more errors than if I use "cin.get". But I just used "cin" and it worked fine; in fact it would not work with "cin.get". I would give me the error message: "10 C:\Documents and Settings\Zachary\Desktop\simple.cpp no match for 'operator>>' in 'std::cin.std::basic_istream<_CharT, _Traits>::get [with _CharT = char, _Traits = std::char_traits<char>] >> mystring' " which is the error I get if I try to use just "cin" in the average program. (The test program is written as below.)


#include <string>
#include <iostream>

using namespace std;

int main()
{
    string mystring;
    cout << "Please enter a phrase to echo:  ";
    cin >> mystring;
    cout << "You entered the phrase:  " << mystring << endl;
    system("pause");
    return 0;
}

Thanks, Ζρς ι'β' ¡hábleme! 18:03, 15 July 2008 (UTC)[reply]

I am far from an expert (and in fact I kinda hate C++), but if I'm not mistaken, get is a function cin, and should be called with parentheses, e.g. cin.get() >> a; --LarryMac | Talk 18:23, 15 July 2008 (UTC)[reply]
Actually, that's probably not quite right either, except that if you use get, you will need parentheses. I think get() will limit you to one character, which doesn't really match with your declarations of a, b, and c as floats. --LarryMac | Talk 18:31, 15 July 2008 (UTC)[reply]
The problem is with these lines. "cin.get >> b >> endl;" This line is actualy two seperate statements, both wrong. The first is "cin.get >> b" cin.get is a function. You can't normaly use an operator (>>) on a function. The second statement is "b >> endl" this doesn't make sense. It's actually a bitshift, which is certainly not what you intended. You don't need an end of line there anyway.
Try replacing those three lines with something that looks like this : "cin >> b;" APL (talk) 18:33, 15 July 2008 (UTC)[reply]
Whoops. Yep, that was it. It's working now. :) Thanks, Ζρς ι'β' ¡hábleme! 18:51, 15 July 2008 (UTC)[reply]

Word 2007 Combine Documents

edit

In Word 2007, when combining documents is there any easy way to accept all insertions and reject all deletions without going thru it one by one. Thanks! Wiki131wiki (talk) 18:20, 15 July 2008 (UTC)[reply]

Info by Fingerprinting (a la Back to the Future II in 2015)

edit

On BTTF II in 2015, 17-year-old Jennifer Parker sits unconscious in an alleyway in 2015 after time-traveling. A vocal on the fingerprint reader says she's 47. The cops say, "That's one hell of a good facelift!"

1. But what if another time-traveler who visited a future year, was dead by that year? What would a fingerprint reader tell you then?

2. And assume someone travels back to the past when they're 27 years old, and the year they travel to is 20 years prior. If a cop fingerprinted the young lady and it told them her CURRENT age, then what?? (They would just assume a glitch, would they?) --Let Us Update Special:Ancientpages. 19:18, 15 July 2008 (UTC)[reply]

Well the fingerprint reader is probably just syncing it with a database of pre-existing fingerprints and grabbing the D.O.B. from there. Thus it thinks a 17 year old is 47—it's looking to her recorded D.O.B., not anything to do with the biological body laying there in front of them.
As for what would a hypothetical fingerprint system used in a fictional movie would tell them in other situations, and what the cops using it in question would think in respond to data that didn't make sense—who can say. It would depend on how the system itself was set up. --140.247.241.142 (talk) 19:25, 15 July 2008 (UTC)[reply]

Limitations of statically typed languages

edit

I copied and pasted the following from Type system: Compared to static typing (or 'early-binding'), dynamic typing is more flexible because of theoretical limitations on the decidability of certain static program analysis problems; these prevent the same level of flexibility from being achieved with static typing[citation needed].

My question is: anyone know what this means? Thanks --78.86.164.115 (talk) 19:28, 15 July 2008 (UTC)[reply]

I'd guess that it could include a program that loads a variable A into another variable B; where the data type eg integer/string/float/boolean is not known until the program is run, or may depend on use input. In this case a statically typed program would simply give an error, or would be required to convert all the possible data types of B into a standard representation where extra bits are added to show the data type.?87.102.86.73 (talk) 19:39, 15 July 2008 (UTC)[reply]
It is referring to the ability to use values. Consider static typing. Assume you have a value "6" and it is of type Foo. You have a function that takes type Bar as a parameter. You know "6" is a valid value for a type Bar, but you don't know of any reasonable method for turning a Foo type into a Bar type. You end up converting from one type to another type to another to try and get what you need. It may be very wasteful if you do something like create a FooBar object that has both a Foo and Bar value inside it and the ability to convert them. In dynamic typed languages, the value is pretty much stored the same way regardless of type. So, you can arbitrarily refer to a variable as one type and then another - whatever is handy at the moment. It does create problems itself. For example, consider PHP's instamagical conversion of 0 to False to Null. If you ask for the position of "a" in the string "abcdefg", it comes back as position 0. If you ask for the position of "z" in the string, it comes back as "False" (not in the string). So, how do you tell if you got a 0 or False? You have to use the triple comparator: if($position === false) print "It is not in the string!"; -- kainaw 19:55, 15 July 2008 (UTC)[reply]
why didn't they just make first position in string = position 1 ???????? is there a reason?87.102.86.73 (talk) 20:12, 15 July 2008 (UTC)[reply]
Yes, there is a reason. The number is the offset from the first character. If it is the first character, the offset is 0. If you returned a 1, you'd be claiming that the offset from the first character is 1, which makes no sense. -- kainaw 11:56, 16 July 2008 (UTC)[reply]
Unless you used counting, but it's too late now anyway. The thing has alrady been made.87.102.86.73 (talk) 13:15, 16 July 2008 (UTC)[reply]

Thank you for the responses. What I really want is either a refutation of the quoted statement or a confirmation of it with an example (or a theoretical example) - i.e. a static program analysis problem whose decidability is limited. If what I have just said makes you think that I don't understand the quoted statement then could you rephrase it for me? Thanks --78.86.164.115 (talk) 21:45, 15 July 2008 (UTC)[reply]

I think it's just terrible english - the sentence just mirrors itself "Compared to static typing (or 'early-binding'), dynamic typing is more flexible" would do, the last part "; these prevent the same level of flexibility from being achieved with static typing." simply repeats the beginning.:This shorter version says exactly the same thing:

Compared to dynamic typing, static typing (or 'early-binding') is less flexible because of theoretical limitations on the decidability of certain static program analysis problems.[citation needed].

I'd definately make that 'grammar' change regardless.
Aside from that you were asking what does ".. decidability of theoretical limitations on the decidability of certain static program analysis problems" mean or is it right...? Actually I can't think of "theoretical limitations" - I guess it means that it may be impossible to know what sort of data type a program subroutine may possibly be presented with. To me it just doesn't make sense.. I can assume that a subroutine may be presented with any data type and add error checking to compensate.
This much makes sense "Compared to dynamic typing, static typing (or 'early-binding') is less flexible" - it should be obvious why as well.
The thing is that in a statically typed language those assumptions is made by the compiler. And if the compiler is allowed to make the assumption that "any type" might come as an input then you are in fact operating with dynamic typing. Taemyr (talk) 01:30, 16 July 2008 (UTC)[reply]
I'd suggest removing it and replacing with the meaningful part I presented above. Discuss it on the articles talk page if anyone else is there, or just post the removed parts to the talk page and if anyone can come and prove/cite what was written they can sort it out. It's gibberish. 87.102.86.73 (talk) 00:56, 16 July 2008 (UTC)[reply]
Also note that the decidabilty problem actually affects dynamically typed programs, as described by user:kainaw above.87.102.86.73 (talk) 09:29, 16 July 2008 (UTC)[reply]