Wikipedia:Reference desk/Archives/Computing/2007 August 24

From Wikipedia, the free encyclopedia

Computing desk
< August 23 << Jul | August | Sep >> August 25 >
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.


Contents

[edit] August 24

[edit] itunes music cards

Hello there,

I recently bought my first itunes music card and i went to the store to redeem it but after i entered the code correctly (checked code many times) it wouldn't recognize my card as a "free music card".

please remedy

thanks

142.161.239.199 00:53, 24 August 2007 (UTC)

http://www.apple.com/support/itunes/store/ ~ lav-chan @ 02:03, 24 August 2007 (UTC)

[edit] PHP Lexicon

Hey there, I'm writing a search engine in PHP and I need a way to distinguish between proper nouns and regular English words. Does anyone know of a fast-access lexicon implemented in PHP? Or maybe it wouldn't have to be implemented in PHP, but accessed via PHP? It also wouldn't need to have definitions, just a comprehensive list of English words. I'd very much appreciate any direction in which you folks could point me.

Thanks. Codeblue87 01:44, 24 August 2007 (UTC)

Well, there are lots of world lists around (i.e. [1]). The difficulty would be that to use it with PHP you'd have to load it up into PHP, which could be memory/processor intensive unless you do it carefully (i.e., have the words indexed by first three letters, or more if necessary). It wouldn't be too hard to set up a system like that, using a sufficiently large word list—a lot of processing done at one time (dividing up a text file of words into multiple text files of words by their first three letters) would relieve the processing needed to be done later. --24.147.86.187 02:21, 24 August 2007 (UTC)
I actually have a good Lexicon class implementation in C++ that can read in from a file. Is there a way to make an instantiation of this Lexicon class from a .php page? So far I've looked at COM objects and SWIG, and both have left me feeling confused. Thanks for your help. Codeblue87 03:08, 24 August 2007 (UTC)
Hmm, that sounds like more trouble than it is worth.
Here's what I'd do: download one of those word lists above, pick the text file you like the most, then write a little script (in PHP, in whatever) that divides it up into multiple text files based on the first three letters. Once you have all of those, then you can write a quick PHP function that will take a given word, get its first three letters, load the appropriate text file into an array, and check if the word is in it. --24.147.86.187 11:22, 24 August 2007 (UTC)

[edit] The Printshop

Does the Printshop have Garamond 3?

--Writer Cartoonist 02:58, 24 August 2007 (UTC)

Just for the record, various versions of this question have been doing the rounds this week. See Free Downloading and Garamond and Adobe Printshop from the Miscellaneous Desk. --jjron 10:01, 24 August 2007 (UTC)
We haven't even established there is anything called "Adobe Printshop." If you want Garamond 3 so bad, why don't you just buy it as a separate font? --24.147.86.187 11:30, 24 August 2007 (UTC)

[edit] color space

I know there's an extension of POV-Ray that allows light intensity to vary by factors of more than 256; this can make a difference with indirect effects like radiosity (i guess) even with standard output. So I'm curious: when Hollywood does digital effects, do they use standard 24-bit color or more precision than that? Related question, how many colors should I expect to be able to distinguish by eye on my monitor? —Tamfang 06:19, 24 August 2007 (UTC)

(32 bit colour is more common nowadays - that's 3 x 8 bit RGB plus 8 bit exponent - giving an accuracy of more than 1% in colour and a range of +/- 2127 which is about +/- 1038 this in general is known as high dynamic range lighting High_dynamic_range_rendering. - though that's really just 24 bit with an intensity additon - this would be the minimum for hollywood at least..)87.102.79.29 12:25, 24 August 2007 (UTC)
There's one thing I don't quite understand about 32 bit color. Isn't intensity already specified by the RGB combo ? That is, 0-0-0 RGB would be equal values of red, green, and blue, but pure black, while would be equal values of red, green, and blue, but pure white. So how would the intensity byte figure into this ? Would 0-0-0-0 be even blacker than pure black and be even whiter than pure white, somehow ? StuRat 13:08, 24 August 2007 (UTC)
Think of it as being illuminated - 255,0,0,10 would be pure red lit (or glowing very dimly). 255,0,0,250 would be a pure red star - very very bright.
So 255,255,255,200 would be pure white but much brighter than pure white 255,255,255,100 - think of a white wall on a dull day and a white wall on a very clear day - both are still white - but one is brighter.
Yes. The fourth value is really a brightness factor. - so anything with 0,0,0,x would be black no matter how brighlty illuminated.
I thought the 4th value was always the alpha channel... --frotht 13:43, 24 August 2007 (UTC)
..Depends... though if you are using HDR you need an exponent (OR use 16 bit colour values instead - leaving space for 4 in a 64bit unit - RGBalpha.... There are numerous ways to store the data.87.102.79.29 13:48, 24 August 2007 (UTC)
Currently computer monitors scale these 32 bit values if used since they can only usually display 24 bit values - have you ever played oblivion? - this game gives a good example of how 32bit values are used.87.102.79.29 13:40, 24 August 2007 (UTC)
This link High_dynamic_range_rendering#Preservation_of_detail_in_large_contrast_differences might answer your question better than I can - see the image on right - in this case not oblivion but far cry87.102.75.201 15:37, 24 August 2007 (UTC)
Please continue answer below:
Does Color depth#Beyond truecolor answer your question ? StuRat 13:08, 24 August 2007 (UTC)

Your second question ("Related question, how many colors should I expect to be able to distinguish by eye on my monitor?") is of interest to me so I've posted a similar on the science page see: Wikipedia:Reference_desk/Science#Colour_question_.(related_to_one_above.) I'll pop the answer here anyway if I get one.87.102.79.29 13:53, 24 August 2007 (UTC)

MAIN QUESTION ANSWER see Digital cinema - the answer is - more than 24 bits.. quotes a 12bits per component - 36bits - so that accuracy will be continued down the production line to post production..87.102.79.29 13:58, 24 August 2007 (UTC)

[edit] Simple Question about Myspace and HTML

Or at least i hope so! you know the part in a profile that says "About Me:" in myspace? and usually you enter things in the text box and it appears below that part?

Is it possible to write some code to appear ABOVE that? heres the start of my code....

<span class="orangetext15">Join the Chillspot Experience:</span><br>

This basically makes a bit of orange text just like the words "About Me:".... but i need them to be ABOVE that section. is this in any way possible? if so, what is the code please?

172.133.149.52 06:28, 24 August 2007 (UTC)

[edit] Quick Java question

I'm trying to translate some relatively simple Java code into PHP. I don't know Java but most of it is just juggling variables and that's pretty straightforward. One line that I can't figure out, and that I couldn't find anything on with a quick Google search: for (;;) { Obviously it is the beginning of a for loop but what do the two semi-colons (without any other variables or instructions) indicate? How would I do this in php? Is it basically just an unconditional loop (later on in the code it breaks out of the loop)? --24.147.86.187 12:49, 24 August 2007 (UTC)

It's an infinite loop. There's no stopping condition. Also synonymous for while(1) {...} or while(true) {...}.
The same construction is valid in PHP. --Sean 13:36, 24 August 2007 (UTC)
OK, that makes sense. Thanks. I guess I in general never create infinite loops (seems like a scary thing to do), which I guess why I never recognized it. --24.147.86.187 21:05, 24 August 2007 (UTC)
Generally, the reason for constructs like that is that there is a condition that breaks out of the loop in the middle. Its good for when you don't want to duplicate code, as in instead of
pre();while(test()){ post(); pre();}
it may be more intuitive to write it as
while(true){ pre(); if(test()){break;} post();}
this is especially true if you have multiple tests (or a select case statement), each of which could possibly break you out of the loop. Root4(one) 01:38, 25 August 2007 (UTC)

[edit] DOS Torrent

Does a DOS version of Torrent software exist? 82.198.250.7 13:39, 24 August 2007 (UTC)

Almost certainly not, given that DOS has pretty much gone the way of the Do-do and the number of people who would be interested in such a program is probably pretty much just one (you). What's the specific purpose for? If you want a command-line torrent program, though, you could probably rig it up via perl and have that run from the DOS prompt, but it would take some workin'. --140.247.240.228 18:42, 24 August 2007 (UTC)
If you just want a command line bittorrent software, there are probably plenty out there for linux. If you're looking for that software because the computer is actually that old, I doubt it will be able to hold the data at all. You might also try something like DeLi Linux for really old computers, but STILL probably not that old --lucid 21:31, 24 August 2007 (UTC)

[edit] Effort formula to move a load up an incline with weight on two wheels

Hi, Can you advise if there is a fairly simple formula that can compute the amount of effort needed to raise a weight load up various encountered inclines on a two wheeled cart with known wheel radius? Use would be for ramping a boat on a sulky by hand and understanding the effort needed to do so after taking a measure of the incline. It would also help one understand what aids need be employed as tire stops, pulleys, winches or perhaps motorized assists given any given incline. For this tire flex, bearing friction, and surface changes could be considered constant, Plenty of discussion about wheel impacts on inclines but have yet to find anyway to quantify the portion of load need for effort given an incline plane. Can you advise what this formula might be?

You may have more luck with this over at the mathematics or science reference desks — Matt Eason (TalkContribs) 14:49, 24 August 2007 (UTC)

Quickly (in brief)

Force needed = mg sin(a)

Where (F)force = newtons, m = mass of cart (kg), g=gravity acceleration (9.8m/s/s) and a = angle of incline (0=flat 45degrees=1 in 1 slope)

This formula excludes friction which might be approximated to be proportional to the mass of the load

F = mg sin(a) +mk

what k is you would need to find experimentally..87.102.75.201 14:57, 24 August 2007 (UTC)

[edit] Video recording

I have a digital video camera Sony DCR TRV15E.I like to convert the video taken on the tape to CD's on my PC.How can I do it? -Amrahs

From what I could find on the web, that particular model has a Firewire port. If your computer also has Firewire and you have Windows XP (or later), then you should easily be able to bring the video into Windows Movie Maker. Here is an article from Microsoft talking about the process. Once you have the video on your computer, you should be able to burn it to a CD or DVD, again depending on the specifics of your computer. What is it you want to do with the discs once you have created them? --LarryMac | Talk 17:51, 24 August 2007 (UTC)

[edit] Is it possible to manipulate strings in dos/batch (windows) without using anything but the built in windows commands (not using temporay files)

Hi I am a novice in dos scripting, and have been quite successful in writing small dos/batch scripts to do some tasks. But one thing I haven't figured out yet is how to avoid using files for storing temporary data. My scripts always have to write to some temporary file when using string manipulation.

What I want to accomplish is to avoid using the harddisk when I use findstr and find and type, so basically, can you point me to some sources where I can grasp how you use escape characters in combination with stringparameters.

This is an example script where I use a temp file to extract a string

@type "%~f1"|findstr /R /I ".*ProductCode>.*</ProductCode>" >%TEMP%\result.TD

ROUND0

@call:Extraction "<ProductCode>" "" %TEMP%\result.TD >> %TEMP%\result.TD

ROUND1

@call:Extraction "</ProductCode>" "" %TEMP%\result.TD >> %TEMP%\result.TD

ROUND2

@call:Extraction " " "" %TEMP%\result.TD >> %TEMP%\result.TD @for /f %%a in (%TEMP%\result.TD) do @set TRXCODE=%%a @set TRXCODE=%TRXCODE:~0,-1% echo %TRXCODE%

The extraction routine also use a temp file. Is it possible to pipe my way around...instead?'

I know it's easier to just use a java script or something, but...some code snippets that does string manipulation/substitution without using temp files....

Possible?? Asked by Danni 85.81.121.107 19:59, 24 August 2007 (UTC)

GAG. Do yourself a favor and use bash. --frotht 20:22, 24 August 2007 (UTC)
I have to agree with froth that you are really trying to do things which are beyond the complexity of the DOS batch scripting, and so the only "solutions" are hack-y workarounds, which is a really bad approach (especially if you are planning to have this work on other people's computers). I have little doubt that whatever you are trying to do, there is a better way to do it. In any case I can't really figure out what you are trying to do. Instead of piping into temp files, can't you just pipe into a variable (i.e. %%result)? --24.147.86.187 21:48, 24 August 2007 (UTC)
The trouble with using bash, or indeed Windows PowerShell, is that you generally can't assume a machine has it installed. So if you're writing code to run on someone else's machine (as opposed to your own) they're an unappealing option. You might wish to write in VBscript or Jscript, which are far more fully featured than BAT script; you can generally assume a windows machine will support these via Windows Script Host. -- Finlay McWalter | Talk 11:09, 25 August 2007 (UTC)
Unless you're using a pretty old version of Windows, none of this has anything to do with DOS. cmd.exe is a Win32 executable. It's a lot more capable than command.com. That said, I have no idea whether it can do what the original poster asked.
If you're just using batch files to avoid dependencies on installed software, I must point out that any system that supports Windows batch files will support Windows executable files. There are a gazillion languages that can compile to self-contained executable files. (Personally I'd use Glasgow Haskell. Haskell is pretty good for shell-scripting stuff.) -- BenRG 00:35, 28 August 2007 (UTC)

[edit] I've typed that license key like ten times already!

Just another thing to bog my success. I've got an Office 2007 Upgrade disc, and a Microsoft Works 9 disc. Now, on the side of the Office packaging, "Microsoft(R) Works 6.0--10.0" is listed as a product that will allow the installation. So I go and buy Works 9. I install it, agree to the EULA, then put in the Office disc. I type the license key in (after so many times, it burns itself into your memory), and lo and behold, it can't find a previous version of Office! Why not?! I've got what the packaging tauts as a qualifying upgradeable product, so why can't it install?--The Ninth Bright Shiner 20:46, 24 August 2007 (UTC)

On this one, perhaps you've got to call Microsoft and hash it out. One thing to potentially try is to at least run Works once before trying to install Office, though I doubt that will fix it. --24.147.86.187 21:01, 24 August 2007 (UTC)
I'd do that, but Microsoft is stubborn enough to charge me $50 to call them. I probably could get Works support for free right now, but the problem is really Office.--The Ninth Bright Shiner 21:46, 24 August 2007 (UTC)
Hey man, you're the one so hot to trot about upgrading to Vista. ;-) Personally I would have avoided it for a year or two until they got all the bugs out, at the very least. --24.147.86.187 23:33, 24 August 2007 (UTC)
Office 2007 is annoying.. not that works is better but seriously 2007 is screwed up :x --frotht 00:48, 25 August 2007 (UTC)
Well, I did wait for like six months. And I was sick of XP. It's been five years already! Office 2007, annoying? Well, it does have its flaws, but I don't think it's that bad. It's better than Wordpad and Works, at least.--The Ninth Bright Shiner 22:47, 25 August 2007 (UTC)
If you want change you can just tinker with Linux, free of charge, until your brain melts... --antilivedT | C | G 00:12, 26 August 2007 (UTC)
Agreed- vim is much more powerful than Word ;) --frotht 18:49, 28 August 2007 (UTC)

[edit] Wireless Internet Lock

Hi! Does anyone know if there is any way to set-up your wireless internet so that in order to connect to the internet, you must have a password? I don't mean encrypting it - not a WEP key or something. What I am thinking of is something where every time you open your browser or something, you have to enter a password to allow access to the internet...

Thanks so much! -- Vamooom 21:51, 24 August 2007 (UTC)

You connect the access point to a proxy, which on the first time a computer connects, redirects them to a login page; and after they login, subsequent connections from the same computer are passed through. --Spoon! 01:49, 25 August 2007 (UTC)
Any free software that can do this? I don't think squid or privoxy can. --frotht 05:04, 25 August 2007 (UTC)
You're looking for a captive portal. F 12:49, 25 August 2007 (UTC)
UC Berkeley does this with its AirBears network. However, I'm not sure what the software is; if you want, post on my talk page, and I'll try to look it up. --M1ss1ontomars2k4 17:01, 26 August 2007 (UTC)

[edit] PHP user security

I've been programming in PHP for a long time but I never really wrapped my head around the best way to do user security (i.e. if I have a part of a script which requires a password, how best to deal with that). Obviously sending passwords in the clear (via GET or POST) is not really very secure. What are the various options that are used for this, and what are their ups and downs from a practical point of view? Keep in mind that in many cases I have only limited control over server settings. Thanks! --24.147.86.187 23:25, 24 August 2007 (UTC)

I think one way would be to set up a login form with a https connection. Check the input to that against a database of username/password pairs with the passwords stored as md5 hashes. If successful, provide a random value (a token) to store in a cookie, and anyone from that IP address is logged in, provided they have that token (cookie). The token should expire after a while. This solution would require a second database table with username, token, ip and expiry time. That's the sort of solution I'd aim for, though I must admit to not being very experienced in these matters. --h2g2bob (talk) 00:28, 25 August 2007 (UTC)
Can you use HTTPS if you don't have much server access? From what I can tell HTTPS requires you to be able to exec() cURL, and I'd be pretty surprised if my server allowed me to exec() random files I uploaded to it. I don't have that much security access (and I'm not going to be getting it anytime soon). --24.147.86.187 03:27, 25 August 2007 (UTC)
No... you just have to set up your server to accept connections on port 443 and be able to negotiate SSL. There's absolutely no way you can configure the server to do this if you have limited control. After a weekend of frustration I was completely unable to get Apache2 for windows to do it (and I had direct access to the machine). Later I found an installer than includes openssl and ssl extensions as part of the package, but you're not supposed to distribute it or somtehing o_O Anyway yeah, just set up to accept SSL connections, then just point your form action to https://whatever.com/whatever.php. You can use md5 hashes in a text file or database to validate logins and the builtin php session functionality to keep a login persistent across pages --frotht 05:02, 25 August 2007 (UTC)
Well, as I said, I have very limited control over the server, and as you said, that probably won't work if I have limited control over the server. --24.147.86.187 11:59, 25 August 2007 (UTC)
Yep, even if he has openssl previously installed and his server daemon just happens to be set up to recieve connections on SSL, you'll still need root access to bind the server to port 443. Unless it is already- try going to https://yoursite.com/yourpage.whatever and if it just happens to work and connect securely, then skip everything I said up above until "anyway yeah" --frotht 16:34, 25 August 2007 (UTC)
I am he and he is me. Anyway I checked the phpinfo(); and openssl isn't installed (and that means it never will be — I'm dealing with a university-as-host here, and they don't change things nor do they really know what they are doing). I think what I'll end up doing is just sending the password in the clear at first and then just use sessions after that. It's not perfect but since this is a very low-profile project at this point, it'll work; for anything serious I'll get into the ssl stuff. thanks! --24.147.86.187 18:48, 27 August 2007 (UTC)