Wikipedia:Reference desk/Archives/Computing/2007 May 19

Computing desk
< May 18 << Apr | May | Jun >> May 20 >
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.


May 19 edit

Reserving one processor for a program. edit

Is there a way, in Mac OS X, to give a single program full control of a single core/processor? The OS and other programs would run on one core, the program would run on it's own core. Thanks for helping out!--Ryan 01:26, 19 May 2007 (UTC)[reply]

I poked around but didn't see any. The call that does this goes by the name sched_setaffinity() on Linux, bindprocessor() on AIX, processor_bind() on Solaris, and so on. I didn't see any mention of such functionality existing for the BSDs (at least in user space), which I guess would be the closest to Darwin. --TotoBaggins 02:44, 19 May 2007 (UTC)[reply]
Out of interest, do those calls need to be made in the program's code?--Ryan 04:25, 19 May 2007 (UTC)[reply]
No, there are nice equivalents for them. --TotoBaggins 12:34, 19 May 2007 (UTC)[reply]
I thought I would be nice and provide a link to nice (Unix), unlike that not-so-nice link to Nice, France. StuRat 16:26, 19 May 2007 (UTC)[reply]

Autotune settings edit

I've read in a lot of places that Auto-tune is used to achieve that distinctive vocal effect heard in many songs such as those by Daft Punk. However, I've not been able to find a guide that actually explains how to use the software version of Auto-tune to recreate this effect. Any help?

I'm not sure I ever used the specific software you have or even heard the song in question, but I think I know what you are looking for. You will probably find a parameter that determines how quickly the software will tune the voice to the correct pitch. Try setting that to the quickest possible. In general, set the software up so that it is as brutal as possible, forcing the voice to the correct pitch. —Bromskloss 11:17, 20 May 2007 (UTC)[reply]
I think the sound you are talking about is more specific to vocoder rather then "Auto-tune", whether that specific app was used on those songs is arguable but you can't argue that it's a vocoded sound. Find tutorials about vocoders, but to be honest from experience, vocoding in general, including Auto-tune are very difficult to just play with and get decent results.. Vespine 04:48, 21 May 2007 (UTC)[reply]


Bromskloss was exactly right. I just set the key of the retuning as the same key of the song, then upped the retune speed to 1, the fastest setting, and that did it. The song I was thinking of was One More Time by Daft Punk, where it is definitely Auto-Tune being used. There's also an example on the Auto-Tune website for one of their hardware processors, see example #4
http://www.antarestech.com/products/avp.shtml
Ah, nice to hear that. And I realise you had a hardware version, not pure software as I assumed. —Bromskloss 14:50, 22 May 2007 (UTC)[reply]

Apache log file entry edit

I have the following entry in my access_log for apache. I don't understand what it is meant to do (although I know it is designed to try and make my server send out spam). Can anyone explain it:

access_log:202.105.13.153 - - [15/May/2007:21:33:54 -0600] "name=gstdyvowmb&address=karl-marx-strasse+29&city=london&...tmail.ru%2F227.html%0A%5Burl%3Dhttp%3A%2F%2Felvis992.hotmail.ru%2F227." 200 4033 "-" "-"

Note: I edited out about 2,000 characters in the middle of the request. I don't think they are necessary for anyone who can understand why this isn't a "GET" or "POST" request. --Kainaw (talk) 03:44, 19 May 2007 (UTC)[reply]

Probably trying to exploit your server by a buffer overflow or similar, or possibly probing your firewall (ie: see if they get a "bad request" response from apache, or whether the firewall just drops it). Apache has no problems dealing with this kind of request. --h2g2bob (talk) 03:55, 20 May 2007 (UTC)[reply]

Compression mechanism edit

A while back someone mentioned an attempt to implement a (well-known) compression method that entailed decreasing the entropy of a given data file to achieve better compression rates. What was the method called, again?

the freezer?0h wait this is digital never mind. Is there some kind of digital entropy that is analogous to entropy and enthalpy as related by Gibbs free energy 69.241.236.12 07:28, 19 May 2007 (UTC)Adam[reply]

(to above - doesn't seem quite the same as entropy in a thermodynamic sense)

Try entropy encoding - scrolling down the page gives a list of methods that use a 'entropy encoding method' - not sure that was your question buthope it helps.12:23, 19 May 2007 (UTC) (the compressed file has lower entropy than the original? - not quite familar with these terms)87.102.8.85 12:26, 19 May 2007 (UTC)[reply]

I believe Morse code was an early example of this, using fewer dashes and dots for the most common letters. E and T required only a single dot or dash, while Q, for example, required 4 dashes and/or dots. StuRat 16:21, 19 May 2007 (UTC)[reply]
No, you don't understand. We want to decrease the entropy (make it more regular) and then compress it, not encode based on the current entropy. This would be used to help compress "incompressible" data, like JPEG images, for example.
Are you thinking of a Burrows-Wheeler transform ? --Stormie 07:09, 22 May 2007 (UTC)[reply]
I think that might be it. Thanks!

grep for anagrams edit

I'm trying to grep my word list for simple anagrams. So I've got a word, say "ate". I want all anagrams. I've tried, somewhat lamely - I can do this:

grep ^[ate][ate][ate]$ $MYWORDLIST

but this gives me:

ate
eat
eta
tat
tea
tee

and I don't want tee or tat. Where do I go from here to get rid of these? Or is there a better way? This isn't for homework, it's for cheating at crosswords, which is no more worthy perhaps... Thanks --87.194.21.177 11:35, 19 May 2007 (UTC)[reply]

I don't believe you can do this with simple regexes. Another solution is to generate all permutations of {'a', 't', 'e'}, and then match this up with $MYWORDLIST, but that is a solution on a par with brute force as the number of strings to test grows with the factorial of the number of letters.
Why not just use one of the many online anagram generators? --TotoBaggins 12:36, 19 May 2007 (UTC)[reply]
Because coding your own solution is just SO much cooler. Plus, if he's doing it for a crossword then he'd need to do a *lot* of permutations. JoshHolloway 12:53, 19 May 2007 (UTC)[reply]
I want to code it myself because I'll then be able to use any word list, also I already have a little script to find expressions like BLANK BLANK LETTER BLANK LETTER and am trying to build up a few tools to use together. Also it's fun. The way I see it, to get from the list above to what I want I just need to pipe it to something that does
grep "all the letters a,t,e in any order"
Surely this is possible? Don't know where to start in generating all permutations, but this is an option I suppose. Would this be doable (reasonably quickly) in bash? Or do I need to learn some C? Thanks for your help. --87.194.21.177 13:17, 19 May 2007 (UTC)[reply]
Okay, so I guess
grep ^[ate][ate][ate]$ $MYWORDLIST | grep a | grep t | grep e
works. Now to figure out a script.... --87.194.21.177 13:27, 19 May 2007 (UTC)[reply]
Actually that's not going to work for longer ones with repeated letters and such like. Back to drawing board... --87.194.21.177 13:32, 19 May 2007 (UTC)[reply]
Just out of curiosity, why don't you want tat or tee? --LarryMac | Talk 15:06, 19 May 2007 (UTC)[reply]
He only wants matches that include every letter in the list. And, if there are two e's in the list, he wants only matches with exactly two e's. StuRat 16:14, 19 May 2007 (UTC)[reply]

I agree with TotoBaggins; I don't think this is possible with ordinary regular expressions.

When I've worked on this problem in the past, I've constructed an intermediate index to assist. Take your word list, and generate a two-column file with the word in the first column and an alphabetical list of its letters in the second column. Then, to find all the anagrams of a word, sort the word's letters into alphabetical order, and do the obvious search on the second column of the index. —Steve Summit (talk) 16:31, 19 May 2007 (UTC)[reply]

Cool. That's O(N*log(N)) to process the dictionary (once), and if you sort or hash the result, then its O(Long(N)) or O(1) for each lookup. This means that on a modern couputer you could process teh word list in (say) an hour or so for a complete English dictionary, and then get an anagram list in a few milliseconds. -Arch dude 18:38, 19 May 2007 (UTC)[reply]
Depends on your definition of "modern computer", I guess.
"When I've worked on this problem in the past" was in 1985, and I doubt it took anything like an hour even on the computers of those days. I just dredged the program out of my archives and recompiled it on today's laptop. (Happily, it still compiles.) /usr/dict/words on this machine has 234,937 words in it, and the anagram-index-builder took... 0.8 seconds to build the index. Sorting the index took another 1.16 seconds. (As I have been called to task for pointing out, "Remember that computers are very, very fast.")
In fact, it could be argued that on a "modern computer", you don't even need to bother with the fancy intermediate index -- just process your dictionary in full each time, re-sorting its letters and comparing them to the target word's sorted letters. It'd still only take (on this computer, anyway) about 800 milliseconds for each word searched... —Steve Summit (talk) 16:03, 20 May 2007 (UTC)[reply]
[P.S. A quick analysis of the sorted, anagrammed word list reveals that the two largest single-word anagram sets in this dictionary are of sizes 10 and 11. They are (Elaps, lapse, Lepas, Pales, salep, saple, sepal, slape, spale, speal) and (angor, argon, goran, grano, groan, nagor, Orang, orang, organ, rogan, Ronga). Binary search on the sorted anagram list retrieved these sets in 0.017 seconds each.]
TotoBaggins didn't say that. —Preceding unsigned comment added by 203.49.212.212 (talkcontribs) 02:36, 20 May 2007

Thanks everyone, what Steve says sounds fun, will have a go. --87.194.21.177 21:59, 19 May 2007 (UTC)[reply]

Keep in mind that the previous example of first asking for each letter in a group ([ate][ate][ate]) and then grepping the result for "a", then grepping the result for "t", then grepping the result for "e" will work. The issue is repeated letters. For example. if you wanted anagrams of latte, you would have to grep the results for "l", then "a", then "t.*t", then "e". Notice that you don't grep for "t" two separate times. You grep for two entries of "t" in the results. --Kainaw (talk) 16:42, 20 May 2007 (UTC)[reply]
And there you have the solution to the original question: not one grep but a pipeline.
  • grep '^.....$' /usr/share/dict/words | grep l | grep a | grep 't.*t' | grep e
Instead of the first grep you can also use awk:
  • awk length==5 /usr/share/dict/words | grep l | grep a | grep 't.*t' | grep e
Or you can even do it all in awk:
  • awk 'length==5 && /l/ && /a/ && /t.*t/ && /e/' /usr/share/dict/words
Or perl:
  • perl -ne 'print if /^.....$/ && /l/ && /a/ && /t.*t/ && /e/' /usr/share/dict/words
The first or second of these is the way I usually do it when I want to. On this system grep turns out to be distinctly faster: the four versions take about 0.11, 1.10, 1.35, and 0.98 seconds respectively (/usr/share/dict/words has 235,882 words). Incidentally, none of them finds any hits: apparently the use of "latte" in English is too recent for it to be in /usr/share/dict/words.
So anyway, you can just write a program that you invoke as "anag latte /usr/share/dict/words", and it generates one of these and passes it to a shell (or if the program is in Perl if could just exec() the generated expression). If you want to pick up anagrams involving capital letters, you can use grep -i in the grep version and adjust the others similarly. --Anonymous, May 20'07, 17:19 (UTC).
It is technically possible to do this with just a regex; it'll just be a very long regex. In a discussion about this in comp.lang.perl.misc a few years ago I provided both a regex solution and a very fast non-regex solution. —Ilmari Karonen (talk) 22:18, 24 May 2007 (UTC)[reply]

internet architecture and protocol edit

my question on this what is the isdn? what is the isd? what is the dns? i want complete data about these question. please gives answer about this. i m very thankful to u.

ISDN, ISD, and DNS. —Steve Summit (talk) 16:25, 19 May 2007 (UTC)[reply]

Another Mac Question edit

I bought a 20GB Mac laptop a while ago and installed OS X on it. It works fine, even though the guy in the shop said it might slow the PC down a bit. I had about 15GB left. Anyway, a few weeks later, in a frenzy of desire to get as much software packed onto it as I can, I put the OS X disc back in hoping to look around on the disc to see if there was anything worth having on it, and the computer just automatically installed it again. Since then, I have only had 2GB left, and I have hardly used it. Also, I have deleted a load of stuff (including a lot that the previous owner had), and the free-space indicator hasn't changed a bit. So, my questions are: 1. What is happening? 2. Is it possible that there is loads of free space, but is incorrectly labelled? 3. If so, how do I get to use it all? Manga 18:11, 19 May 2007 (UTC)[reply]

I'm guessing that, during that second (inadvertent) installation, you and/or the installation program inadvertently partitioned the disk, and that you're operating in a smaller partition now, with most of the disk's space allocated to some other partition, unreachable and unusable. Or perhaps the disk was already partitioned, and the first time you used a bigger partition, but this time you used a smaller one.
Try running the Disk Utility application (in the Applications/Utilities folder), and see what it tells you. Or alternatively click on the Apple icon at the upper left of the screen, select "About This Mac", click on "More Info...", and drill down on the "ATA" or "SCSI" items until you find your disk, then click on it, and it should tell you about the available "Volumes" (which in this context are the same as partitions). —Steve Summit (talk) 19:05, 19 May 2007 (UTC)[reply]
Cheers, I did that, and I got this:
Volumes:
Macintosh HD:
 Capacity:	18.63 GB
 Available:	1.34 GB
 Writable:	Yes
 File System:	Journaled HFS+
 BSD Name:	disk0s9
 Mount Point:	/
which I take to mean there is only one 'volume'... Do you think that the deleted data may still be there, as I didn't run 'Secure Empty Trash' when I emptied the trash, and that this 'non-deleted' data may be clogging the system? Manga 19:48, 19 May 2007 (UTC)[reply]
Okay, well, never mind about the partitioning stuff, then.
If you've emptied the trash, then that shouldn't be causing the problem; there's no need to do a "secure empty trash" just to reclaim space.
Since OSX is Unix, and if you're comfortable typing commands into a Terminal window, you can use this idiom to find out what the big files and directories are:
du / | sort -rn | head
You'll get some errors about directories that can't be read (because they're secure), and some of the big directories listed will be system directories which are normal, but this will probably point you at some off-in-a-corner folder that you don't care about and didn't know about, that's using the lion's share of your disk.
For example, here's what I see when I run that command on my Mac:
$ du / | sort -rn | head
du: /.Spotlight-V100: Permission denied
du: /.Trashes: Permission denied
28389275        /
12601892        /Users
12226024        /Users/scs
5279512 /Library
5227084 /Users/scs/Mail
4179792 /Applications
2070320 /System/Library
2070320 /System
1620008 /Library/Printers
1565668 /Library/Application Support
The numbers are cumulative; they show how much space is used by each folder/directory and by all of its subdirectories. For example, if I go to my home directory, I won't find 1.2 gig of stuff right there; most of it is in subdirectories (for example, 500Mb of it is in and underneath my Mail directory).
If all the top-10 directories printed by the above command are okay, try du / | sort -rn | head -20 or du / | sort -rn | more instead.
You're likely to find that some of your biggest directories are the caches used by various networked applications. For example, among my other big folders are
1036400 /Users/scs/Library/Caches/Google Earth
28604   /Users/scs/Library/Caches/Firefox/Profiles/ttc5bnry.default/Cache
1184    /Users/scs/Library/Caches/Safari
These are, obviously enough, the folders where Google Earth, Firefox, and Safari keep their caches of downloaded stuff. If apps are caching too much, you can usually reconfigure them to cache less, and tell them to empty their caches now, to get rid of previously- and excessively-cached stuff. —Steve Summit (talk) 20:25, 19 May 2007 (UTC)[reply]

Turkish letters in Word (Mac OS X) edit

I use a friend's computer to read a .doc file which is written in Turkish language on Mac OS X (Tiger). It uses several fonts, most Times New Roman but also several others. When the document opens the Turkish letters look strange like "değifl" look like ""deEifl" in which E is the sign for Euro and fl is one character. I thought the letters are missing from the font, but when I look in Font Book at the Times New Roman I see all the Turkish letters. And some other fonts do not have this problem. How come this problem? Can I solve it? How can I make it not happen? Thank you. Hevesli 18:59, 19 May 2007 (UTC)[reply]

It sounds like some sort of strange encoding problem. I'm not certain, but you might want to make sure the Turkish keyboard/etc. is installed on the friend's computer, though I'm not certain why it wouldn't carry the encodings across correctly if it had the same fonts, OS, etc. --140.247.242.30 20:59, 19 May 2007 (UTC)[reply]

Gmail Paper edit

Is there any services like Gmail Paper? 68.193.147.179 19:38, 19 May 2007 (UTC)[reply]

I think it's called the "print" function. --140.247.242.30 20:56, 19 May 2007 (UTC)[reply]
Or mail. GDonato (talk) 21:03, 19 May 2007 (UTC)[reply]

FedEx-Kinkos will probably do something like this for you, but it won't be free. -- Phoeba WrightOBJECTION! 02:33, 20 May 2007 (UTC)[reply]

The US Post Office will accept, print, and deliver files, but not for free: [1] -Arch dude 23:28, 20 May 2007 (UTC)[reply]