Wikipedia:Reference desk/Archives/Computing/2006 December 8

From Wikipedia, the free encyclopedia

Computing desk
< December 7 << Nov | December | Jan >> December 9 >
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] December 8

[edit] Windows Media Player 11

I just downloaded and installed Windows Media Player 11 and tried to rip a CD in in the MP3 format, but when I do that, an error message pops up "Windows Media Player cannot rip one or more tracks from the CD." I clicked "Web Help" and got this "C00D0FAA Windows Media Player cannot rip the track because a compatible MP3 encoder is not installed on your computer. Install a compatible MP3 encoder or choose a different format to rip to (such as Windows Media Audio)." My question is this, how do I find an encoder thats free, and why didn't one come with my download? Deltacom1515 04:38, 8 December 2006 (UTC)

Windows Media Player has come with the MP3 encoder since WMP 10. Something is wrong. There are two things I can find to try, both in the registry. Open the registry editor by typing regedit into the run dialog (Win+R), and off we'll go.
  1. This one is recommended by Microsoft. Browse over to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer\Settings\MP3Encoding. Double click LowrateSample, delete the value that's shown under Value data, and click okay.
  2. If that doesn't work, try making sure that the PrefferredCodecPath key exists, and its value is C:\WINDOWS\system32\l3codecp.acm.
-- Consumed Crustacean (talk) 09:30, 8 December 2006 (UTC)
If you are not comfortable with editing your registry, which can be disastrous, then you can try install and uninstall, and if that still does not work, see if a downloaded codec (click on link) does the work. On second thoughts, if it were my problem, I would probably first install the codecs, and if that works leave well alone:) -- Seejyb 11:11, 8 December 2006 (UTC)

I tried the registry stuff, doesn't work. Oh and I could never rip tracks in as MP3 files when I had WMP 10 either. Deltacom1515 00:50, 9 December 2006 (UTC)

Try downloading the latest LAME mp3 encoder build and copy lameenc.dll to c:\windows\system32. If WMP asks where to find an encoder, point it at lameenc.dll --frothT C 04:34, 9 December 2006 (UTC)

The real issue is answered here: http://www.microsoft.com/windows/windowsmedia/player/faq/rip.mspx. Basically, choose an audio quality for ripping to something other than 128kb. I've seen this problem on 3 different machines and this has fixed it on all of them.

The registry route didn't work initially but I was then advised to either delete (or as I did, corrupt the name of) the LowrateSample file (changed to LowrateSampleXXX). I'm now able to rip to mp3 at 128kbps (albeit at a fraction of the speed I was doing it with WMP 10).

[edit] vi - moving about

I'm trying to write a collection of stories in vi so that at the same time as I'm writing, I can also learn vi. I realize that vi isn't really meant for this sort of thing.

Although, if a sentence runs over onto the next line, vi looks at this as a single line. So if I move up and down in the document, I move from one paragraph to the next instead of what is visually the next line up on the screen. Is there a way around this?

Also, if the answer is to just put in a hard return near the end of each line on the screen, is there an easy way to take out all those hard returns when I'm satisfied that I know vi and move the document into an actual word processor? Dismas|(talk) 08:00, 8 December 2006 (UTC)

As vi came from American unix techies in the 60's who were high on LSD, it was meant as a technical editor for unix and C scripts :) Therefore lines are inserted as strings, with even the J command to join split lines. Your best bet is a hard return as you say. To convert this document with all the <cr> into a DOS-like <lf><cr>, there is usually a utility called unix2dos in unix, not sure what unix you are using. Power editors like Ultraedit (my favourite) can also convert it for you. Sandman30s 09:42, 8 December 2006 (UTC)

If you have a version of VI which allows you to use the mouse, it's probably quicker to just click where you want to go. StuRat 10:46, 8 December 2006 (UTC)

For the hard return problem: If you are using hard return as end-of-lines, you would have to use a double return to indicate end of paragraph. Once imported into your word processor, replace all double returns with any unusual character string, e.g. replace "<cr><cr>" (or whatever symbols your word processer uses for a hard return; MS Word ^p or Ooo $) with say "@@@@@". Then replace all remaining hard returns with a space (e.g. "<cr>" with " "). Then replace your "unusual character strings" with a hard return (e.g. replace "@@@@@" with "<cr>"). Note Ooo Write replace function is lightly more obscure than that of MSWord, in that the former ues regular expression search for the $. --Seejyb 12:11, 8 December 2006 (UTC)

Ah so <cr> and <lf> are the codes used in Word? I've been frustrated for years trying to replace \n with \r\n :) If you want something maybe better for less technical work, try Emacs, though you might first want to take out a health insurance policy - and definately not report your emacs usage in the forms. --frothT C 20:37, 8 December 2006 (UTC)

No, no, in Word its ^p thats used for paragraph mark. To see all the codes do ctrl+f, click on More, and then on Special. And Ultraedit also uses ^p for paragraph. Shinhan 21:57, 8 December 2006 (UTC)

nvi wraps long lines, but not at word delimiters. Maybe there is an option you need to flip if you're not using it.

The standard way of formatting paragraphs in text files is as Seejyb said, with the double newlines for paragraph delimiters. But the solution isn't (or shouldn't be) to "just put in" all those newlines (as in pressing Enter that many times); most reasonable editors have a word wrap feature that, unlike in word processors, is a text-modification function, not a display setting. Then you can just type, and occasionally request wrapping (sometimes called "filling") unless the editor does it automatically. If/when you want to import this text (you could just use LaTeX, after all), it will be far easier to do the newline manipulation in the text editor that's meant to do such things; in Perl regex syntax it's as simple as s/([^\n])\n([^\n])/\1 \2/, although depending on your environment it may be tricky to actually apply that command to the two lines it needs to join (instead of to each separately). Alternatively, you might be able to ask for the same word wrapping feature but with a ridiculous "line length" of 99999 or so. Finally, the issue of newline format shouldn't bother you; all programmer's editors support all the standard formats. (Sandman30s: the DOS format is in fact CR LF, although one time I had to deal with a confused networked program that did send LF CR!) (Froth's comments aside, Emacs supports all of these things; if your available versions of vi don't, perhaps you'd want to switch for increased technicality rather than ease of use.) --Tardis 06:58, 9 December 2006 (UTC)

[edit] MSIE 6 on Win2000

Occasionally I do a "Delete Files", "Delete Cookies" and "Clear History". Basically these work ok. However my "home page" is a simple HTM page with a list of links to pages I often use. For reasons I do not understand, 3 of them remain highlit as having been visited. Anyone know why and how to stop this happening? -- SGBailey 09:16, 8 December 2006 (UTC)

That is..a very good question. I assumed you rebooted IE after clearing the history, and so forth. All I can suggest is getting IE7 or Firefox. Perhaps someone else can help more, when I use IE I never have this problem. --Wooty Woot? contribs 09:21, 8 December 2006 (UTC)
Ah, you're a victim of the uneraseable history bug. You should also be able to see this in the autosuggest for the address bar (but not in the history tab, which is empty). The culprit is a windows file called "index.dat". There are time-limited tools you can download that clean it up (they usually work for about 30 days), here for example, but I'm sure you can find freeware versions (you can't delete them manually, at least not without using safe mode and getting a bit technical). yandman 13:45, 8 December 2006 (UTC)

[edit] Window completely off the screen

I don't know how it happened, but a window seems to be completely off the screen of my Windows O/S computer, so I can't even pick the edge. How do I get it back ? I'm able to pick "Maximize" on the icon to make it full screen, but when I try to toggle it back to less than full screen it goes right back to where it was, entirely off the screen. I can probably close the application and restart it or reboot the computer, but I'd like to know a less drastic way to fix this, should it happen again. StuRat 10:43, 8 December 2006 (UTC)

Try Alt-Space to open the little window icon menu, then M. That, or click right click the taskbar icon and click Move. Either way, steer it about with the arrow keys; it should also snap to your cursor if you move it after having pressed an arrow key. -- Consumed Crustacean (talk) 10:57, 8 December 2006 (UTC)
When it happened to me with some apps a few years back, i got them back by using regedit and finding the window coordinates for the application therein and editing them from absurd large numbers to small ones that got it on screen. -- SGBailey 11:48, 8 December 2006 (UTC)

Thanks, those suggestions solved the problem ! StuRat 12:21, 8 December 2006 (UTC)

Yeah this used to happen to me all the time. I used alt-space-down-enter, or just changed my screen resolution- Windows is usually pretty good about not letting windows be lost outside of the screen space from a resolution change --frothT C 20:33, 8 December 2006 (UTC)
I use small program called Shove-It for that (Resizing too big windows and moving back windows that went outside). But alt-space-M is very usefull when Im not on home computer. Shinhan 22:02, 8 December 2006 (UTC)

Template:Strict I've added the above template primarily to show it to users, who are then free to add it themselves, if they wish, as:

{{strict}}

StuRat 09:53, 10 December 2006 (UTC)

[edit] viewing image galleries in wiki-sites

I can't see most of the images that are supposed to be seen in the gallery function. Especially in wiki-commons buy also in many articles of Wikipedia. The problem occurs when using Microsoft IE and with Firefox. What should I do? 84.108.245.1 11:25, 8 December 2006 (UTC)

This is not really an answer, but just to reassure you that you're not alone, I have the same problem with viewing wiki galleries (most other pictures display fine). Now, here's the catch - this is a problem on my laptop computer at home in both IE and Firefox, but they display fine at work in both browsers on the same computer. Indicates to me therefore that it's something to do with the connection. At home I am only on dialup, at work on broadband, so perhaps this is the issue (but I don't know why). I'd be interested too if anyone can answer this. --jjron 15:05, 9 December 2006 (UTC)

[edit] How to make a Graph in MS Excel ?

I know how to make a chart in MS Excel, but my question is how to plot a graph with given x and y co-ordinates, such as in a table.

If I fill in two colums with the corresponding x and y values, it gives me two curves instead of one.

Please help.


The easiest way: when you've got to choose a type of graph, pick the one with lots of little dots, not the curve, and then choose the sub-type which looks like a curve. Good luck. yandman 13:48, 8 December 2006 (UTC)
In the graph wizard screen you need to manually delete one of the data sets and specify that it is instead what you need for the X-axis. You are basically looking for this screen. Delete whichever dataset is supposed to be the X-axis from the list of Y-axises ("Series"), and put it into the X-axis field ("Category (X) axis labels"). --24.147.86.187 01:00, 9 December 2006 (UTC)

[edit] Tiny, battery-operated webcams?

Do the tiny, battery-operated webcams with inbuilt storage shown in several TV shows and films really exist? Well, obviously they exist, but for regular people without affiliation to the CIA, etc? —The preceding unsigned comment was added by 202.10.86.63 (talk) 16:57, 8 December 2006 (UTC).

Of course they exist. Are the only person who didn't suffer through the X10 ad blitz? I think they even found ways to get their annoying popup ads to pop up in your dreams. --Kainaw (talk) 20:55, 8 December 2006 (UTC)

There is even a camera the size of a pill, now, which you swallow to film your digestive system. StuRat 23:24, 8 December 2006 (UTC)

[edit] A little scripting challenge

I have text files which I need to manipulate a little and since I'm no scripting wiz myself I thought I'd ask you for help. The objective is to cut out a middle section while keeping the beginning and the end. The beginning section is everything up to and including the line reading "%%%%EndProlog" (there is only one such line). The ending section is everything from the last line reading "Gpdict begin" (there might be more than one such line) to the end.

For example, if I have this:

1
Gpdict begin
2
%%%%EndProlog
3
4
Gpdict begin
5
Gpdict begin
Gpdict begin
6
7

I want this:

1
Gpdict begin
2
%%%%EndProlog
Gpdict begin
6
7

Could it be done with sed, AWK or perhaps even something simpler? —Bromskloss 17:14, 8 December 2006 (UTC)

If you consider C "simpler" than AWK, yes. yandman 17:20, 8 December 2006 (UTC)
Since I only know Perl, here's an example:
$cut = 0;
for (<STDIN>) {
  print if ($cut == 0);
  $temp .= $_ if ($cut == 2);
  $cut = 1 if (/^%%%%EndProlog/);
  if ($cut != 0 and /^Gpdict begin/) {
    $temp = $_;
    $cut = 2;
  }
}
print $temp;
Well, could have been simpler, but... :D –mysid 18:07, 8 December 2006 (UTC)
Thanks, it works! (As if you didn't know that.) How can it be made to match lines that contain certain strings rather than equal them? I might only know, for example, that they contain "Prolog" and "Gpdict", respectively. (This is actually a closely related problem I have, I'm not making it up.) Thanks again! —Bromskloss 19:33, 8 December 2006 (UTC)
It's done with the match operator (//). If you wish to match lines that contain "Prolog", for instance, you would use if (/Prolog/) { ... }. This is actually a shortened form; the full statement would be if ($_ =~ m/Prolog/) { ... }. –mysid 20:23, 8 December 2006 (UTC)
Many thanks. —Bromskloss 22:05, 8 December 2006 (UTC)
The problem is that sed and grep read files line by line. They don't look at the whole file as one long string of characters. If they did, it would be easy to do something like "grep -v '%%%%EndProlog.*begin' somefile.txt" or "sed 's/%%%%EndProlog.*begin//' somefile.txt". As far as I know, there is no way to tell either sed or grep to read a file as one long string (as opposed to line by line). If some braniac here knows how to it, then your job will be a one-liner. --Kainaw (talk) 18:23, 8 December 2006 (UTC)

Here's two ways to do it in sed. The natural way, as far as anything in sed is natural, is

sed -n -e '1,/%%%%EndProlog/p' -e '/%%%%EndProlog/,$H' -e '/Gpdict begin/h' -e '$x' -e '$p'

How it works: The -n option disables automatic printing, so that the p command can be used to print only the necessary lines. The first command prints lines from the beginning to the first" %%%%EndProlog" line. The second command appends to the hold space (basically a temporary buffer) all lines from the first "%%%%EndProlog" to the end of the file. The third command copies lines matching "Gpdict begin" to the hold space, effectively removing anything that was there before. At the end of the file, the hold space only contains lines from the last "Gpdict begin" onward. The last two commands switch the hold space with the pattern space (the main workspace of sed), and then prints the pattern space.

Kainaw's idea of operating on the entire string at once is also possible:

sed -n -e H -e '$x' -e '$s/\(%%%%EndProlog\).*\(Gpdict begin\)/\1\n\2/' -e '$p'

This uses the H command to append every line to the hold space, and all the rest of the processing happens on the last line only: the hold space (containing the entire file) is switched back to pattern space, anything between "%%%%EndProlog" and "Gpdict begin" is removed, and the final result is printed out. Unfortunately GNU sed managed to segfault when I tried to add newlines to the regular expression in the s/// command; this definitely isn't the way sed was designed to be used. 84.239.129.42 15:52, 9 December 2006 (UTC)

[edit] hosts file for Firefox

I am trying to block some webpages, so i put them into the Hosts file. They were not blocked though they are in the hosts file. 24.39.182.101 17:53, 8 December 2006 (UTC)

Explain "put them in the hosts file". The hosts file is used to block web pages by adding entries that look like:
 some.site.to.block.com 127.0.0.1
If that is not what you were doing, you won't block anything. Also, if the computer recently visited the site you will need to empty your cache to get rid of the files on your computer. --Kainaw (talk) 18:25, 8 December 2006 (UTC)
Note that this is abuse of the HOSTS data and you really should find some other way to block them --frothT C 20:30, 8 December 2006 (UTC)
And your not actually blocking access, just concealing it. Power users will just delete the hosts file, use the IP address to the website in question, connect to it over proxy... Shinhan 22:08, 8 December 2006 (UTC)
Deleting the hosts file entirely is a bad idea since you can't use the localhost token anymore, but deleting lines from it wouldn't be hard. Also a proxy wouldn't help with an altered hosts file --frothT C 22:47, 8 December 2006 (UTC)

The Adblock Plus extension has the ability to block whole web sites / addresses. If you have the extension installed, you would find that under Tools>Adblock Plus>Preferences>Adblock Options>Site Blocking/Whitelisting. -- Seejyb 13:55, 9 December 2006 (UTC)

[edit] WRK54G

I know what a WRT54G is, but what is a WRK54G? What version does it contain? Any help is appreciated. —The preceding unsigned comment was added by 156.108.172.105 (talk) 18:39, 8 December 2006 (UTC).

Google "WRK54G" and you get all kinds of matches. Basically, it looks like a low quality version of the WRT54G, that has a lot of bugs and hardware issues, that everybody seems to recommend against ever wasting your money on. --Maelwys 19:37, 8 December 2006 (UTC)

[edit] Net Framework

can you delete net framework l and just use net framework 2

You should uninstall the .NET framework 1 and install the .NET framework 2 --frothT C 21:54, 8 December 2006 (UTC)
I think you should keep both, because some programs depend on the .NET Framework 1.0. There are some big differences between V1 and 2. --wj32 talk | contribs 00:53, 9 December 2006 (UTC)
The .NET 1.0 platform was replaced and extended with .NET 1.1, but the .NET 2.0 platform does not replace the .NET 1.1 platform. Thus, you need to keep the .NET 1.1 platform to enable software written for it. Droud 01:45, 9 December 2006 (UTC)
That's not true, I've been using the .NET 2 since it was in alpha and I've never had them both installed simultaneously. NET apps have always run fine --frothT C 02:28, 9 December 2006 (UTC)
Maybe your .NET apps are all .NET 2.0... --wj32 talk | contribs 05:25, 9 December 2006 (UTC)
Yes, there are problems. Documentation of backward incompatibility at this linkand others referenced in the Wikipedia .NET framework article. --Seejyb 14:19, 9 December 2006 (UTC)
Looking at those problems, if the programmer makes clean code that doesnt abuse functions (for example using isNumeric to detect if it's signed) it shouldn't be much of a problem. And I was using .NET 2.0 when the only application running on it was Visual Studio, and numerous other .NET apps that were 1.1 --frothT C 18:25, 9 December 2006 (UTC)

[edit] Circular spiral traversal of 2D arrays

Are there any algorithms that can traverse a 2D array in a circular spiral manner in O(number of elements) time? Or can someone give me a hint as to how to do one? (Just hints, please no solutions.) The best algorithm I can come up with involves adding every possible "next-closest square" (the squares to the top/left/right/bottom of the currently-being-visited square that's farther away than this square) and using a heap where the squares are compared according to their distance away from the square. —AySz88\^-^ 23:35, 8 December 2006 (UTC) clarified italicized 00:46, 9 December 2006 (UTC)

Maybe this: compute a archimedean spiral with b set so that it only advances one cell per revolution. Then compute the cells that intersect it, and colour them as you go. Now that might produce gaps due to rounding up, so instead, for each intersecting point, also check the "inward" adjacent pixels. Whether that meets your definition of a "correct" spiral depends on your actual definition of correct, and what your application is in this case. If you were particularly interested in speed over accuracy you could probably cook up some fast integer filled spiral thing. -- Finlay McWalter | Talk 00:33, 9 December 2006 (UTC)
Actually, to be more accurate, I needed to traverse things in order of increasing distance (so the cells 1 unit away first, then root-2 units, then 2 units, then root-5...). So I shouldn't have said "spiral", probably, though that'd be interesting too.
But my partner came up with a different solution that works without this kind of traversal, so this is a purely academic question now. :) —AySz88\^-^ 00:46, 9 December 2006 (UTC)

Here's a simple spiral, built from two loops in polar coords (I hope you like FORTRAN code):

     X_MID = (X_MIN + X_MAX) / 2 ! Calculate the
     Y_MID = (Y_MIN + Y_MAX) / 2 !  midpoint.
     ARY(X_MID,Y_MID) = "*"      ! Put a star at the array midpoint.
     RADIUS_MIN = 0.7
     RADIUS_MAX = sqrt((X_MAX-X_MID)**2.0 + (Y_MAX-Y_MID)**2.0) ! Distance from mid pt to corner.
     RADIUS_STEP = 1.00
     do RADIUS = RADIUS_MIN,RADIUS_MAX+0.5,RADIUS_STEP 
       ANGLE_STEP = 2.0*PI/(14.0*RADIUS)               ! There are 2.0*PI radians in a circle.  
       do ANGLE = 0.0,2.0*PI,ANGLE_STEP 
         X = 0.5 + X_MID + RADIUS*sin(ANGLE)           ! Here I convert to rectangular coords:
         Y = 0.5 + Y_MID + RADIUS*cos(ANGLE)           !  (I might have the SIN and COS backwards.)
         if ((X .ge. X_MIN) .and. (X .le. X_MAX) .and. ! Make sure we aren't off the
    +        (Y .ge. Y_MIN) .and. (Y .le. Y_MAX) .and. !  edge of the array.
    +        (ARY(X,Y) .eq. " "))                then  ! Make sure we haven't hit here before.
           ARY(X,Y) = "*"                              ! Fill the spot in the array with a star.
         endif
       enddo
     enddo

No matter what you do, you are likely to repeat the same values of X and Y occasionally, so I put a check in and don't do anything if that array element has already been hit. Let me know if you have any questions about this or want the source code or executable. StuRat 17:00, 9 December 2006 (UTC)