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

Computing desk
< July 19 << Jun | July | Aug >> July 21 >
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 20

edit

Help

edit

I have a strange folder: \AppData\Roaming\Microsoft\digital locker\

It has one file inside, called Urls.bin

Is this malware or something? What is this?--71.175.123.61 (talk) 01:47, 20 July 2008 (UTC)[reply]

Have you done any business with Windows Marketplace? ---J.S (T/C/WRE) 02:50, 20 July 2008 (UTC)[reply]

Cue sheet syntax for multiple titles in a single FLAC file

edit

I'm trying to create a FLAC file where the track information (title/artist) will change visibly in a media player display (XMMS or Winamp, for example) as index points are crossed. I've seen this done in streams, and I'm pretty sure I've seen this in single files, but I've not come across instructions for creating a file that works this way. (This page, for example, has 11 examples and none of them are what I'm looking for.)

I believe the metaflac command I want is this:

metaflac  --import-cuesheet-from=Doom_for_the_ADD_Generation.cue test.flac

The abovementioned cue sheet looks like this:

TITLE "Doom for the ADD Generation"
PERFORMER "Martha's 2008 WFMU Marathon Premium"
FILE "test.flac" FLAC
  TRACK 01 AUDIO
    TITLE "Jack Frost [excerpt]"
    PERFORMER "Saint Vitus"
    INDEX 01 00:00:00

    TITLE "The Still Lake"
    PERFORMER "Great American Desert"
    INDEX 02 05:13:00

    TITLE "Embittered Darkness [excerpt]"
    PERFORMER "Striborg"
    INDEX 03 10:43:00

What am I doing wrong here? I've tried a couple variations of the above, and none come close to what I want.

Bonus if someone can give me instructions for doing the same thing to an Ogg Vorbis file. I don't know the metaflac-equivalent tool for importing cue sheets into single .ogg files. / edg long-time listener, first time caller 02:25, 20 July 2008 (UTC)[reply]

the data types in c++ & JAVA

edit

why do we see same data type having different number of bytes range in c++ and JAVA

e.g.-->>in c++ the datatype int uses 2bytes while in JAVA int uses 4bytes?Prachi 08 (talk) 05:14, 20 July 2008 (UTC)[reply]
Actually, the C++ standard does not specify the exact width of the "int" or the other integer datatypes. The width is implementation-dependent. So for example, on my computer (32-bit Linux x86 GCC; and I believe on most implementations out there today), an "int" is 4 bytes wide. The "int" type is guaranteed to be at least as wide as "short", and at most as wide as "long" (neither of which have precisely-defined widths wither). "short" and "long" are guaranteed to be at least 2 and 4 bytes long, respectively, but can be more. Java does define exact widths for its datatypes. But there is no consistency of naming between languages (why should Java or any other language have to name its types the C way, for example?). For example, "long" in Java is 8 bytes long; whereas in most 32-bit C implementations "long" is 4 bytes long; and "long" in Python is arbitrary-length. --Spoon! (talk) 06:50, 20 July 2008 (UTC)[reply]

What was wrong with the hidden form input?

edit

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

<input TYPE=hidden NAME=A VALUE="0">
<input type="submit" value="A = 0" />
<input TYPE=hidden NAME=A VALUE="1">
<input type="submit" value="A = 1" />
<input TYPE=hidden NAME=A VALUE="2">
<input type="submit" value="A = 2" />
</form>
<?php
$A = $_POST['A'];
echo 'A = ' . $A;
?>

No matter which button I click, the post always assigns 2 to variable A. -- Toytoy (talk) 06:02, 20 July 2008 (UTC)[reply]


It doesn't work that way.

First, the "value" attribute works all the same for all inputs. For example, if you clicked <input type="submit" name="foo" value="hi" />, then it would assign "hi" to variable foo.

Second, because you have three inputs with the same name, they all get submitted, and the last one overrides the others. (You can use the get method to see how it works.)

I really can't explain this (my English is not good enough), so I'll just give the fixed code:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="submit" name="A" value="0" />
<input type="submit" name="A" value="1" />
<input type="submit" name="A" value="2" />
</form>
<?php echo 'A = '.$_POST['A']; ?>

oh, and try writing VALID code. In your example, you're using XHTML's /> but you're using uppercase attributes and you don't quote their values, which isn't valid XHTML.

--grawity 13:52, 20 July 2008 (UTC)[reply]

(edit: frikkin wikiformatting fixed by removing a <p> from the question --grawity 13:54, 20 July 2008 (UTC))[reply]

keys jamming

edit

these days how many concurrent keys can be pressed without problems? —Preceding unsigned comment added by 83.199.57.103 (talk) 06:26, 20 July 2008 (UTC)[reply]

As far as I know there isn't a standard for internal wiring of keyboards. In theory they could have a microcontroller with a GPIO pin for each key, which would mean each key would be completely independent. But people have gotten used to paying trivial sums for keyboards, so instead they generally are built around an ultra low cost keyboard matrix encoder. In this case depressing a key closes a connection between a "horizontal" and a "vertical" wire in a matrix - this arrangement is cheap (because the keyboard controller only needs about 30 input pins, rather than over 100) but means it can't properly distinguish keystrokes when multiple keys on the same row or column are depressed. The specifics vary by keyboard encoder chip: from some basic research it seems the Alcor AU9462 controller (info) has an 19x8 controller, the Philips Semiconductors ISP1130 an 18x8, and others up to a 20x8 ((info)). So in short "you'll need to experiment". See Rollover (key) too. -- Finlay McWalter | Talk 16:39, 20 July 2008 (UTC)[reply]
For regular run of the mill keyboards, I belive it is still quite low, something like 4 - 6. The reasoning would be unless you are gaming you rarely need to press more then 2 at a time. So even though technically these days it might be easy to make a keyboard with the capability to send a lot of simultaneous keystrokes, 99.9% of the time there is no need for it. Vespine (talk) 00:40, 21 July 2008 (UTC)[reply]
[1] A little expensive but SOOOOOO worth it if you do a lot of typing. You can hit every key at once. --mboverload@ 03:33, 21 July 2008 (UTC)[reply]
The site says "up to 12 keys to be pressed simultaneously", and given that combination keys like ctrl and alt are generally wired separately, that's not much better than the average. -- Finlay McWalter | Talk 08:41, 21 July 2008 (UTC)[reply]
(yes, I do realise that in practice you only have 10 or fewer fingers typing, but the devil is in the detail of how they wire keys - that "up to" and the details of which keys mean that, on the face of it, this doesn't guarantee that you'll be free to use a given configuration, particularly for gaming). -- Finlay McWalter | Talk 08:43, 21 July 2008 (UTC)[reply]
Thank you for pointing my error out. I know there IS a keyboard out there where you can hit every key at once. Obviously not that one though. --mboverload@ 15:38, 21 July 2008 (UTC)[reply]
And doubtless someone, somewhere has developed an Emacs key binding that depends upon that ability to hit every key at once ;-).
Atlant (talk) 16:23, 21 July 2008 (UTC)[reply]
I guess you're aware of Emacs pedals, for when there aren't enough fingers or enough keys. But really to fully utilise the power of emacs one must be Cthulhu. -- Finlay McWalter | Talk 16:29, 21 July 2008 (UTC)[reply]

What would this batch file do?

edit

I recently reverted some dubious additions on our Batch file article, in which someone was repeatedly adding a section encouraging readers to "try this" and make a batch file containing: @echo
:1
start
goto :1

As I'm not familiar with batch files, I was just wondering what that would actually do - my guess is that it just creates an infinite loop as in the standard "20 GOTO 10" prank, but I'm assuming someone here knows. Cheers ~ mazca t | c 10:17, 20 July 2008 (UTC)[reply]

This would just repeatedly start the command prompt again and again. (A better one would be using start "%~dpnx0") --grawity 13:45, 20 July 2008 (UTC)[reply]
Careful with it though. If you just let it continue to run it would lag you out. Ζρς ι'β' ¡hábleme! 21:09, 20 July 2008 (UTC)[reply]
Thanks. Evidently the person was malicious, but not very good at it. ;) ~ mazca t | c 13:01, 21 July 2008 (UTC)[reply]
Yes, it would have simply looped if it weren't for the start. Try this- open up a command prompt and run "start"- a new command prompt window will open. Now, imagine this looping. Yikes. JeremyMcCracken (talk) (contribs) 01:22, 25 July 2008 (UTC)[reply]

iptables question

edit

Is it possible to use iptables to redirect incoming connections on one destination ip/port to different ips/ports depending on the connection's origin IP?

For instance, is it possible to do this:

if 2.2.2.2 connects to 1.1.1.1:443 then forward to 1.1.1.1:10443

if 3.3.3.3 connects to 1.1.1.1:443 then forward to 1.1.1.2:10022

etc.

I guess it's kinda like NAT. We are trying to provide several secure services on one common port (because of firewall rules). Each IP will only need to access one service, so it's logically no problem. I'm just new to iptables and wondering if it's the correct solution to this custom setup. Thanks 58.150.240.103 (talk) 16:14, 20 July 2008 (UTC)[reply]

Messed up my MBR

edit

i was trying to redo my MBR, as i had grub installed from when i tried a Linux distro decided i didn't want Linux but couldn't get rid of grub. Now i tried to do FIXMBR from the repair option on a windows xp home cd but now all i get when i boot up is after POST screen "media is not a bootable floppy please insert bootable media and try again", how can i recover windows without reformatting everything? i have a backup image made with drive xml but i dont want to use it unless i have to cheers--90.207.78.105 (talk) 17:10, 20 July 2008 (UTC)[reply]

Do you have a floppy disk inserted? Remove it, if so, and try again. --Russoc4 (talk) 17:13, 20 July 2008 (UTC)[reply]
nope nothing in any of the drives--90.207.78.105 (talk) 18:04, 20 July 2008 (UTC)[reply]
Did you do a fixboot as well? Nil Einne (talk) 18:39, 20 July 2008 (UTC)[reply]
There's a good collection of rescue cds at http://www.cgsecurity.org/wiki/TestDisk_Livecd that will help, assuming that MBR is the problem. The GParted one has worked for me. --212.149.216.13 (talk) 18:51, 20 July 2008 (UTC)[reply]
I didn't know that GParted fixed MBRs but I can vouch for it. The GParted livecd is one of the best opensource projects in the world in my opinion. It just works. --mboverload@ 05:21, 21 July 2008 (UTC)[reply]

iTunes stores

edit

So I go to the US iTunes store to buy a German song, but they don't have it. I switch to the Germany store, and there are about 5 versions of it. When I try to buy it, I have to create a new account. Why the hell are there completely different iTunes stores with different music to buy??? It's just as simple to universally purchase and sell a single set of all music. Reywas92Talk 18:56, 20 July 2008 (UTC)[reply]

Apple have to negotiate rights to sell the music separately in different countries, so they need to try and restrict sales on each country's iTunes store to people within that country. It's a holdover from when all music was sold on physical discs, but it's still pretty much a fact. ~ mazca t | c 20:51, 20 July 2008 (UTC)[reply]
In this case copyright Jesus will not smite you for grabbing it off a P2P application. Hey, you wanted to buy it but they wouldn't let you. OR buy the cd from somewhere like SecondSpin.com. I have bought over 500 bucks of stuff from them and they are awesome. --mboverload@ 03:31, 21 July 2008 (UTC)[reply]

Open Office 2.4 and Word 2007

edit

My trial version of word 2007 just locked up on me, so I downloaded Open Office 2.4. However, I am unable to access my word documents because my version of open office does not have the 'filter' for word 2007 (only word 2003 and back). Where can I find the filter I need? --Ghostexorcist (talk) 20:56, 20 July 2008 (UTC)[reply]

Would this be what you're looking for: odf-converter-integrator ? — QuantumEleven 10:57, 21 July 2008 (UTC)[reply]
That is exactly what I am looking for, but open office is still asking me to pick a filter when I try to read a word 2007 document. The instructions for the upgrade just say install and "that's it". --Ghostexorcist (talk) 18:01, 21 July 2008 (UTC)[reply]
Never mind, I figured it out. --Ghostexorcist (talk) 18:04, 21 July 2008 (UTC)[reply]

system("pause") function of C++

edit

I read on a webpage that one should avoid using the system(*) command in C++ because it is taxing. For the system("pause") function it said it causes the program to:

1.suspend your program
2.call the operating system
3.open an operating system shell (relaunches the O/S in a sub-process)
4.the O/S must now find the PAUSE command
5.allocate the memory to execute the command
6.execute the command and wait for a keystroke
7.deallocate the memory
8.exit the OS
9.resume your program

It said to use the cin.get() function instead because it is a native command and works on all OS's (whereas system("pause") would only work on Windows). Well, I tried the cin.get() function to pause the program and it did not work. It did the same thing it would have done without either command. My questions are what are your thoughts on this and how else can I use a native command to pause the program (using Dev-C++ on Windows XP)? (The webpage is [2].) Thanks, Ζρς ι'β' ¡hábleme! 22:23, 20 July 2008 (UTC)[reply]

I wouldn't think the overhead would be an issue, since you are trying to slow the program down anyway. Also, system calls are fine if you only call a few times. It's only if they are in a loop called hundreds of times that it will be an issue. StuRat (talk) 03:16, 21 July 2008 (UTC)[reply]

If you are writing a command-line program, then you should run it on the command-line in the first place. None of this oh I am writing a command-line program because I don't know how to make a GUI program in my OS; and yet I expect to be able to double-click on it in my GUI environment and have it magically work flawlessly nonsense. A command-line program is supposed to do what it does and exit. Adding some extra external command call inside the program because you don't like to run it correctly is completely the wrong thing to do, and fucks it up for other people. I get really pissed off every time I get some code only to find out that some Windows/DOS dimwit decided to call a "pause" command, especially when I don't even have a "pause" command on my system. --71.141.126.37 (talk) 05:03, 21 July 2008 (UTC)[reply]

Are you including iostream? Try std::cin.get();. A legacy way of waiting for keyboard input is to use getch(); from conio.h. 192.156.33.34 (talk) 05:08, 21 July 2008 (UTC)[reply]

Yes, I am including iostream. std::cin.get() doesn't keep the window open.
71.141.126.37, I am not writing a "command-line program". It's a console application. If I could do what I wanted with just the command-line interface, I would write a batch file. Furthermore, I am just starting C++ and can only find tutorials for console applications. I'm sure I will eventually write Windows applications, but seeing as how I am just starting, I think it's ok to try to learn syntax and get my barings by writing console applications. Ζρς ι'β' ¡hábleme! 17:38, 21 July 2008 (UTC)[reply]
See command line interface. A command line program isn't the same thing as a shell script or a batch file; it doesn't generally consist of commands as a user would type them, in other words. Rather, it is meant to be invoked from the command line, or from a shell script, or from a graphical program (typically invisibly), etc. I think it's clear that making such a program wait for user input before terminating prevents the use of the program by other programs, or the use of the program in an unattended fashion (as to, say, process thousands of files overnight). This is 71's complaint, that — because it makes the one use case of running things from Explorer easier — people write their programs in a way that makes them less useful in all other circumstances. The simple answer is to run your program from a terminal (or a "Command Prompt" in some dialects of Windows); just change to its directory (with cd) and type the program's name. This additionally lets you use things like I/O redirection, pipelines, command-line arguments, etc. (Those articles are written with Unix in mind, but almost every example will work unaltered on modern DOS/CMD versions.) --Tardis (talk) 22:18, 21 July 2008 (UTC)[reply]
Oh, my bad. Well, I'm just starting C++ and it appears that Windows apps are much harder to write than console apps. That's why I'm starting with console apps. Also, I did not know that console applications should be invoked from the command prompt. In all the lessons I've seen, it's never specified so I just assumed you could run them from either the GUI or the command prompt. Thanks for the info, Ζρς ι'β' ¡hábleme! 23:15, 21 July 2008 (UTC)[reply]

Need to figure out sizes of directories on my computer

edit

I'd like to figure out which directories take up the most space I have a 30gb hd and it is full already and I'd like to know what is eating all the space. I can right click, view properties in windows explorer to see what each individual folder is, but I'd like to see a list of all folders and which are the largest. Any software out there that can do this?

71.164.100.174 (talk) 22:44, 20 July 2008 (UTC)[reply]

Try this. I use it, but it gets kinda slow with large folders. Admiral Norton (talk) 23:22, 20 July 2008 (UTC)[reply]
i have 2.5gb text file in C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson ...do i need that? i could really use the space for something else. —Preceding unsigned comment added by 71.164.100.174 (talk) 00:15, 21 July 2008 (UTC)[reply]
Try WinDirStat. This provides a nice graphical overview of a complete disk. Trieste (talk) 00:24, 21 July 2008 (UTC)[reply]
(ec) If you want to find out where stuff is easily, try something like SequoiaView, which will visualize the whole drive. As for any specific file, tell us the file name, it will do more than just telling us the location. --98.217.8.46 (talk) 00:28, 21 July 2008 (UTC)[reply]
I agree that SequoiaView is a great piece of software. Very usefull for this sort of thing. APL (talk) 01:00, 21 July 2008 (UTC)[reply]
JDiskReport is a similar software. --71.141.126.37 (talk) 04:49, 21 July 2008 (UTC)[reply]

NOTE: Use CCleaner before you do this. It will get rid of the obvious junk. Although not needed you can check every option without harm. Yes, some things don't NEED to be cleaned out but there is no harm in doing it. --mboverload@ 03:28, 21 July 2008 (UTC)[reply]