Jump to content

Wikipedia:Reference desk/Archives/Computing/2010 February 12

From Wikipedia, the free encyclopedia
Computing desk
< February 11 << Jan | February | Mar >> February 13 >
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.


February 12

[edit]

What is this anti-pattern re pointers called?

[edit]

I'm curious if there is a name for a certain programming idiom I see occasionaly in C where a particular object is looked up through a series of pointers and data structures. For example, in systems programming where the machine might have to search through arrays or lists to find the object they're interested in. After a pointer to the object is located, several of the member values are read and some result is set in the object. However, instead of handling the struct pointer locally, it is re-computed again and again. Example:

Instead of this sensible code:
obj *pstr;
pstr = j->k->l->m->n->o->p;
pstr->result = pstr->x + pstr->y * pstr->z;

you get this mild exaggeration:
j->k->l->m->n->o->p->result = j->k->l->m->n->o->p->x + j->k->l->m->n->o->p->y * j->k->l->m->n->o->p->z;

Squidfryerchef (talk) 00:32, 12 February 2010 (UTC)[reply]

I don't have a name for the act of writing code like that, but please note that, on some compilers, both pieces of code will run at the same speed, due to common subexpression elimination. (The Law of Demeter is probably being violated in both examples, but that's a concept from OO, and very little systems stuff is written in OO style.) Paul Stansifer 02:33, 12 February 2010 (UTC)[reply]
That's what's vexing; we have a large category of articles about "anti-patterns" that isn't reflective of the real world. The closest I can find might be cargo cult programming, but the metaphor is pretty weak and I'm thinking of AFD'ing the article.
Yes, it's possible a compiler would essentially optimize the second case into the first, if the optimization is set high enough. But the problem remains of the code being horrible to follow and maintain, as well as to debug. The first case would dedicate a register to pstr, the second case would likely use an "accumulator" register for each step in the pointer arithmetic, making a debugger useless.
As far as Demeter, yes, if this was in good OO style there wouldn't be all these chutes and ladders to get to the object and the object might contain a method to do this operation internally, but I'm thinking of the case where the data structures are legacy and the programmer is patching an existing function. Squidfryerchef (talk) 14:33, 13 February 2010 (UTC)[reply]

Looking for a program/software

[edit]

hey guys.. Can anybody tell me if there are any programs that records whatever's coming out of your speakers?? And I mean programs as in softwares, not actual recording devices. And it would be a huge plus if that software was a free one. Thanks in advance. Johnnyboi7 (talk) 00:41, 12 February 2010 (UTC)[reply]

Audacity can do it if you sound card will let it. If not, it may take getting a cable. --Mr.98 (talk) 01:02, 12 February 2010 (UTC)[reply]
Audacity is defintely the way to go. The user above is correct, you can set your recording options to 'Stereo Mix' and this essentially lets you record whatever sound is travelling to your speakers.

ffmpeg question

[edit]

I run into the same problem with ffmpeg a lot. I have a set of photos and a sound file. I need to make a video that fades from one photo to the next for the length of the song. I am left doing a lot of calculations to guess at the frame rate. Then, I have to keep increasing or decreasing it little by little until it actually matches the length of the song. To avoid this, is there a way to tell ffmeg that I want the photos to be evenly dispersed over a specific time period? -- kainaw 01:08, 12 February 2010 (UTC)[reply]

I'm not aware of a method to do that automatically; perhaps you could write a pre-processor script (python, e.g.), to perform the calculations you want and generate the arguments to FFMPEG explicitly. Alternatively, maybe you could investigate other tools, such as Kino (software), which has neat features for this sort of video editing. Nimur (talk) 05:35, 12 February 2010 (UTC)[reply]

There's a -vsync option that nobody really knows how to use. :p It would probably really hurt quality though.
s=$(mplayer -identify -frames 0 input | grep LENGTH | sed s/.*=//); p=$(ls *.jpg | wc -l); secondsPerPhoto=$((${s%.00}/$p))
¦ Reisio (talk) 10:45, 12 February 2010 (UTC)[reply]

Richard Stallman and Proprietary Software Keywords

[edit]

I'm looking on Google for articles that talk about how or if Richard Stallman wants proprietary software "banned" or "outlawed" or "repealed" or "not protected" through law. I've tried searching using each one of those terms in a separate Google search:

richard stallman wants proprietary software <insert one of the terms here>

I have not gotten all that good search results I've also tried:

richard stallman codified gpl

but I want to use a more common word than codified. Is there any common word that is more appropriate or applicable than "banned" or "outlawed" or "repealed" or "not protected" that I can use, in the form of:

richard stallman wants proprietary software <insert one of the terms here>

--Melab±1 01:38, 12 February 2010 (UTC)[reply]

I don't think you'll find anything along those lines. Stallman's position has always been that there should be a free alternative and that people should choose the free alternative. The non-free alternative should be left to die off due to lack of support from the community. He does not suggest banning or outlawing non-free software - just undermining the profitability of it. -- kainaw 01:54, 12 February 2010 (UTC)[reply]
Yeah, I don't know why you'd think he wants it banned, outlawed, or repealed... none of those are really his sentiments at all. I have never heard him suggest that non-free software should have any kind of legal action taken against it. It is one thing to not approve of something, it's another thing entirely to say it should be banned. --Mr.98 (talk) 02:41, 12 February 2010 (UTC)[reply]
The closest Stallman has come to this sort of thing is saying that software patents are wrong (e.g., GPL3). — Man in shack (talk) 05:14, 12 February 2010 (UTC)[reply]
I agree with the above three, and that's the reason Googling isn't helping you. Comet Tuttle (talk) 17:32, 12 February 2010 (UTC)[reply]
I think the OP's biggest problem is he/she is concentrating on proprietary software. Richard Stallman often talks about copyright in general. There are plenty of articles on his views of copyright in general [1] [2] [3]. For example his view "One important dimension of copyright is its duration, which is now typically on the order of a century. Reducing the monopoly on copying to ten years, starting from the date when a work is published, would be a good first step. Another aspect of copyright, which covers the making of derivative works, could continue for a longer period." while something quite a few people would support is obviously fairly controversial. Also "As a computer user today, you may find yourself using a proprietary program. If your friend asks to make a copy, it would be wrong to refuse. Cooperation is more important than copyright. But underground, closet cooperation does not make for a good society. A person should aspire to live an upright life openly with pride, and this means saying no to proprietary software." Nil Einne (talk) 20:19, 14 February 2010 (UTC)[reply]

Probably not the place but...

[edit]

Alright, here's my situation. I have AOL, but it's very slow (especially on Wikipedia), and often freezes. Today, I started to use my Internet Explorer 8, however my mouse has broke on me so I cannot scroll at all. Instead, I tend to click the scroll button and scroll with the mouse. However, when I click the scroller down to stop scrolling, I often click the Rollback button by accident (has happened twice so far today). A new tab then opens and says that my rollback was successful. Is there some way I can change the settings so a new tab does not open and I do not rollback quality edits? Any help is appreciated. Thanks, Eagles 24/7 (C) 04:29, 12 February 2010 (UTC)[reply]

Yes, the help desk is probably a better place for this sort of question. I personally use User:Ilmari Karonen/rollbacksummary.js, which, as a side effect, will prevent accidental rollbacks from happening. decltype (talk) 07:44, 12 February 2010 (UTC)[reply]
Thanks for the advice, but that script seems to only work when you physically click the rollback button, not when you click with the scroller. Thanks anyway, Eagles 24/7 (C) 14:08, 12 February 2010 (UTC)[reply]

Analysis of Quicksort

[edit]

This is a question related to quicksort why is in analysis of quicksort running time of partition function arbitrarily assigned running time theta of n i want a detailed explanationSb122010 (talk) 07:57, 12 February 2010 (UTC) prefix:Wikipedia:Reference desk/Archives[reply]

The partition operation hits each element once and only once. That is n operations, which is Θ(n). That is not an arbitrary assignment, it is a value based on analysis of the algorithm. If you explain why you believe it to be different, we may be able to provide more of an answer. -- kainaw 14:18, 12 February 2010 (UTC)[reply]

Quake 3 Arena

[edit]

I've just started playing Q3A again after a long hiatus, and I'm a little bit lost. I'm not really interested in getting all the best and newest mods, I just need enough so that I can try out most of the public servers on my list. So... basically, what do I need other than the latest updates, and team arena? And are there any "necessary" map packs that I should get for either? Thanks! 210.254.117.185 (talk) 09:25, 12 February 2010 (UTC)[reply]

Seriously, you might be better off asking this on the official Quake 3 Arena forum. Somebody there might know. --KageTora - (影虎) (A word...?) 07:27, 13 February 2010 (UTC)[reply]

power efficiency of 27" iMac processor options (core2 duo @ 3.06 GHz vs. quad core i5 @ 2.66 GHz vs. quad Core i7 @ 2.8 GHz)

[edit]

If I got a 27" iMac I could get it either with 3.06 GHz Core 2 Duo, or either of two quad-core options: quad-core Intel Core i5 at 2.66 GHz or quad-core Intel Core i7 at 2.8 GHz.

What would the power efficiency difference be between the three models?

(I don't know if it makes a power efficiency difference, but as far as I can tell the only other difference is a 512MB ATI Radeon HD 4850 graphics with 512MB in the i5/i7 options versus a ATI Radeon HD 4670 graphics with 256MB in the Core 2 Duo option - you can see the options here by clicking "Buy now" above-right of the pictured iMac.)

Thank you for any information you might have. 84.153.242.184 (talk) 12:42, 12 February 2010 (UTC)[reply]

(ps. is there a huge difference in power efficiency compared with the 21.5" option due to the screen size?) 84.153.242.184 (talk) 12:48, 12 February 2010 (UTC)[reply]
Calculating the 'power efficiency' is going to be rather difficult without significantly more info on what your requirements and expected usage pattern is. Most modern computers are quite good at adjusting speed (both in the CPU and to a lesser extent in the GPU) based on the requirements. (The GPU can definitely make a difference BTW, the 4850 is a lot more power hungry then the 4670.) Different CPUs particularly when it comes to completely different families like the Core2 family and the Core iX family work better in relative areas in some areas then in others. In other words, it depends on things like what applications you're running. Are you running these applications 24/7? Do you turn your computer off when finished or leave it on? A 27" screen would definitely use a resonable amount more power then a 21.5" BTW, everything else being equal. To use a simple example, the Core i7 would probably be somewhat more power efficient at running a highly multithreaded app. However it will also complete a lot faster then the Core i5. If the Core i7 then sits idle this will be different from if you turn off the Core i7 computer (and the i5) as soon as they complete this task. (Of course power efficiency is only one part of the equation. If you are waiting for the computer to finish, the fact that the i7 finishes a lot faster is also likely to be an advantage.) If you don't actually expect to tax the computer much, then going for the one with the lowest idle usage is likely your best bet from a power efficiency standpoint given it will sit idle for most of the time. Nil Einne (talk) 18:55, 13 February 2010 (UTC)[reply]

can someone explain what the i7's hyperthreading (HT) means in practice?

[edit]

So, I have bad memories of hyperthreading, from the Pentium 4 era I think. Back then, it was in many ways WORSE than having a single-core computer WITHOUT the hyperthreading, I think largely because many, many programs, including maybe even windows itself, were not threadsafe. But has that all changed? In reality, what does the quad i7's 8 virtual cores mean compared with the i5's four physical cores? If I write a threadsafe number-crunching app for some parallel problem that easily divides into 2, 4, 8, 16, whatever number of nodes, it's just a linear divide, then would THAT app be twice as fast on an i7 (where 8 threads could each be on a virtual core) versus the i5 (where four threads could each be on a core)? Or, would it be something less than twice as fast? Thank you for any information you might have... —Preceding unsigned comment added by 82.113.106.96 (talk) 16:18, 12 February 2010 (UTC)[reply]

Before symmetric multiprocessing was common (i.e. when Hyperthreading first came out, before single systems with multiple cores were remotely popular) the Hyperthreading feature was certainly a niche, you could only really benefit from it if your programs were fully SMP capable, and the time wasted managing two virtual cores was not recovered in speed improvements for many practical tasks. Now, however, since HT has been around a while and full blown SMP has even been in the mainstream for some time, software is really ready to take advantage of it. That being said, back to the benefit of HT. The chief gain is when two threads are running and neither can fully utilize the CPU due to bottlenecks elsewhere such as cache loads from RAM or the HDD. Since these will never be quite as fast as the CPU (especially when considering very high clock CPUs) you can get more out of the CPU during heavy load because HyperThreading gives each thread a very fast way to give work to the CPU.
However, there are a number of other technologies to consider when estimating the advantages of HT. In the past (i.e. when HT was first available), power/frequency scaling was very hard to do at the CPU level, and not terribly effective. So, you wanted to get the most out of that one CPU that you could, since adding a second would not only be costly but it would double your power consumption. Now, frequency scaling is very effective and multi-core chips with low power envelopes are common. This means that having four cores instead of two cores and two virtual, hyperthreaded cores is not very costly. --Jmeden2000 (talk) 17:44, 12 February 2010 (UTC)[reply]

Thre is any program that i can use to get the average Amplitude of a song?

[edit]

Thre is any program that i can use on a sound file to get the average Amplitude of a song?201.78.204.108 (talk) 16:19, 12 February 2010 (UTC)[reply]

I don't know if it has the average amplitude feature, but Audacity will show you the waveforms of a song. Ks0stm (TCG) 16:40, 12 February 2010 (UTC)[reply]
If by "amplitude" you mean "volume", normalizers are used to calculate the average volume of a song. Then, the song is increased/decreased in volume to move the average to the volume that the listener wants. -- kainaw 16:53, 12 February 2010 (UTC)[reply]

FORGET about amplitude, what I meant was frequency. PS:sorry, i am new to this sound related names. 187.89.31.29 (talk) 22:44, 12 February 2010 (UTC)[reply]

The frequency spectrum of the entire song can be determined by simply taking the fourier transform of the entire song (or taking the transform of many frames and stacking them). Then you can choose the peak frequency, or you can perform some type of averaging. Do you expect this result to be meaningful in some way? Nimur (talk) 22:15, 12 February 2010 (UTC)[reply]
Maybe, i want to test, if by creating a database with the EXACT average frequency value of some songs, you would be able to find similar songs, by getting a song and looking the other songs that have closer average frequency values.
Is just a wierd idea that i had. 187.89.31.29 (talk) 22:44, 12 February 2010 (UTC)[reply]
See acoustic fingerprint, which is the technical term for it, though it requires much more than just average the frequencies. It is not a trivial problem - there are entire companies that dedicate themselves to developing it. —Akrabbimtalk 22:48, 12 February 2010 (UTC)[reply]
Averaging volume or frequency isn't going to find you similar songs - period. You need much more sophisticated analysis to do that. Extracting the 'beat' of the song and calculating the number of beats per minute might go some way to do that - but even so, it would be pretty sketchy. Services that do this (Pandora Radio is one) do it by noting your reactions to music and comparing them to those of other people for the same music - when it finds other people with the same likes/dislikes as you - it suggests that you might like the other things that they like. It's amazing how good it is at doing that. But it's not using anything as simplistic as an average frequency/amplitude! SteveBaker (talk) 14:46, 13 February 2010 (UTC)[reply]
Pandora does more than just compare what you like with what other people like: see the Music Genome Project. Sites like last.fm and services like iTunes Genius are more genre/taste/popularity-based. —Akrabbimtalk 15:08, 13 February 2010 (UTC)[reply]

I knew that better ideas then mine existed, and my idea would not work most of the time (or every time), I just asked that because of curiosity, i just was curious to see what recommendations, my idea would show. About last.fm/pandora/..... I already know them and use them. They are good.187.89.164.224 (talk) 04:13, 15 February 2010 (UTC)[reply]

can I force windiows 7 into a VERY low resolution (e.g. 640x480)

[edit]

I have an eee pc 1005H and would like to force it into go to 640x480 (windows 7). can I? how? thanks. 82.113.106.96 (talk) 17:26, 12 February 2010 (UTC)[reply]

Possibly. Go into Control Panel -> Display -> Change Display Settings -> Advanced Settings and click on List All Modes. The list will show all the modes that your graphics card/driver supports (which will include 640x480 if supported). However, your EEE PC has a widescreen monitor so 640x480 is going to look stretched on it! ZX81 talk 17:50, 12 February 2010 (UTC)[reply]
yeah, thanks, it "worked" - only it doesn't look stretched, instead there are super-thick black borders with a small 640x480 window in the middle (typing on it now). man, with such thick borders screen looks just like an iPad :) anyway thanks. —Preceding unsigned comment added by 82.113.106.96 (talk) 17:59, 12 February 2010 (UTC)[reply]
I suspect you will have to fiddle with the video driver software if you want it to "stretch" rather than add borders. --Mr.98 (talk) 03:38, 13 February 2010 (UTC)[reply]

Scan cancelled; no items to scan

[edit]
Resolved

This refers to [4].

I emailed Norton about this and was told to use chat support. I was quite busy last week with the weather and didn't take the time to do it. This week when I did, the person, after taking control of my computer and watching the scan I started manually and looking at other things, asked to see the error message.

There was only one way to do that without waiting a week. I scheduled a new full system scan. Well, that didn't work. The scan started normally. Which solved the problem. Like Dorothy, had the power all along. I just didn't know. The scheduling was done with the old software, but this new scan was scheduled with the new software. Problem solved!Vchimpanzee · talk · contributions · 20:14, 12 February 2010 (UTC)[reply]

Apparently my computer does have a backslash key. For some reason I never noticed it. I also realize that shift and backslash produce a piped link.Vchimpanzee · talk · contributions · 20:52, 12 February 2010 (UTC)[reply]

Check when a folder was last accessed in Mac OS X 10.6

[edit]

Is there software that will allow me to check the history of when a particular folder has been opened since its creation? —Preceding unsigned comment added by 72.208.7.232 (talk) 22:24, 12 February 2010 (UTC)[reply]

The last access time (called the "atime") is (generally) stored, and you can see those by saying ls -lu (rather than just ls -l). For an explanation of the different kinds of time stored for a unix inode see stat (Unix). But this has a performance cost - it means every time you look at a file (or a folder) the filesystem has to update its inode, which can get rather expensive. So for this reason it's not uncommon to mount filesystems saying "noatime", which prevents this (and makes the atime field meaningless). If you want every time it's been opened, and not just the last, that's not something a conventional filesystem will do - it'd have to keep a huge log. While I can see a very few applications for super-secure environments like banking or an intelligence agency (and even then, would they want this log at the filesystem level anyway) but not for normal uses. Note that if you wanted to be able to store all the previous revisions of a file then a versioning file system can do that. -- Finlay McWalterTalk 00:16, 13 February 2010 (UTC)[reply]

is there a thunderbird add-on for better split-file downloads from Usenet?

[edit]

I am trying to download open-source Linux ISO's from usenet with Thunderbird, but naturally these are split into many, many files, and Thunderbird doesn't seem to have any built-in capability to download/collate them all at once. However, it seems to have a robust add-on system.

My question is: is there a Mozilla Thunderbird add-on to better download binary files from Usenet that are split across many messages?. THanks. 84.153.242.184 (talk) 23:09, 12 February 2010 (UTC)[reply]

I have no idea whatsoever why you would ever want to download a Linux .iso with Thunderbird from Usenet (or even how?!), but I can tell you that if you want to download a bootable .iso (bootable from a flash drive) then UNetbootin is your answer - it has all the major distros. If you want it bootable from a CD, then just go to the site in question and download it from there. I really have no idea why you have chosen such a (in my mind) ridiculous way to do something which is really simple. :) --KageTora - (影虎) (A word...?) 07:23, 13 February 2010 (UTC)[reply]
Haha, okay. I should have said:

Notice the quotation marks. Now, does anyone have any ideas? 82.113.106.195 (talk) 12:58, 13 February 2010 (UTC)[reply]

(He means "porn") SteveBaker (talk) 14:38, 13 February 2010 (UTC)[reply]
I think that you would think so says more about you than about me. All I'm saying is, how do I get an add-on to make the process of downloading totally Free, open-source Linux ISO's from usenet less of a pain with Thunderbird. Whether this would apply to any other kinds of files is irrelevant. (Obviously it would). 82.113.121.88 (talk) 16:05, 13 February 2010 (UTC)[reply]
There may be, but I've never come across them. There are far better binary grabbers of course some of which are free including ones specialised for NZB some of so I'm not that surprised no one has bothered to try add this to Thunderbird. Nil Einne (talk) 18:42, 13 February 2010 (UTC)[reply]

MIDI on modern computers

[edit]

In the old days I bought a MIDI cable that connected my keyboard to the "joystick"-type (serial?) port on my old computer. This old computer even had built-in support for SoundFonts in the Windows Control Panel -- I could download a SoundFont and hear a better piano reproduction, for example, through the audio attached to the computer. My modern computer has none of this capability. How do you connect MIDI these days? Does one need to buy a non-integrated sound card to get the appropriate port, or can you connect via other means? If you accept bonus questions, is support for SoundFonts hiding in all Windows systems with integrated audio or would I again need a sound card that supported it? (The old computer just had integrated audio, but maybe it was really special...) Thanks Llorando (talk) 23:22, 12 February 2010 (UTC)[reply]

It's very common to make the MIDI connection over USB [5]; a lot of modern keyboards (etc.) have a USB port themselves, and you're tunnelling MIDI over USB end-to-end. For older, and sometimes for cheaper, equipment you end up with a usb-MIDI bridge, and a normal MIDI port at the instrument end. -- Finlay McWalterTalk 23:33, 12 February 2010 (UTC)[reply]