Wikipedia:Reference desk/Archives/Computing/2007 October 11

= October 11 =

C Code: Sorting list of pointers
Hello, I am trying to use qsort to sort a list of pointers. My trouble is in the compare function. The compare function is passed pointers to items in the list, which are pointers to the structure. But when I run this data pb1 in the compare function seems to point to rubbish and causes the program to crash. Thanks for any help! typedef struct {	int val; } MyS;

int compare( const void *arg1, const void *arg2 );

void main2(void) {	int i;	MyS **List; List = malloc(sizeof(MyS *) * 10); for (i = 0; i < 10; i++) {		List[i] = malloc(sizeof(MyS)); List[i]->val = i;	} qsort(List,10,sizeof(MyS *),compare); } int compare( const void *arg1, const void *arg2 ) {	MyS **b1; MyS **b2; MyS *pb1; MyS *pb2; b1 = (MyS **) arg1; b2 = (MyS **) arg2;

pb1 = *b1; pb2 = *b2;

return ((pb2->val) - (pb1->val)); }


 * Never mind, I found the mistake, the compare function should be:

int compare( const void *arg1, const void *arg2 ) {	MyS **b1; MyS **b2;

b1 = (MyS **) arg1; b2 = (MyS **) arg2;

return ((**b1).val - (**b2).val); }
 * Dacium 00:21, 11 October 2007 (UTC)
 * But that's the same. --Spoon! 02:23, 11 October 2007 (UTC)
 * Which is why I still dont see where the mistake is!--Dacium 05:28, 11 October 2007 (UTC)
 * What mistake? The version you have now is correct. Add a  include, change void main2 to int main, and it's a complete program that actually works. --tcsetattr (talk / contribs) 05:51, 11 October 2007 (UTC)
 * There is a difference - the new version of the compare function says b1-b2, the old version had b2-b1 - so the order of the sorting has been reversed. It's nothing to do with all of that in-between assigning of pointers and such.  Something really simple like this should work just fine:

int compare( const void *arg1, const void *arg2 ) {	return (*(const MyS**)arg1)->val - (*(const MyS**)arg2)->val ; }
 * (This should also get rid of a couple of compiler warnings about casting away 'const') SteveBaker 14:16, 11 October 2007 (UTC)
 * I think you meant MyS *const *. The way you have it is still casting away const from the first layer pointer target (and adding const to the second layer). But if we're gonna critique style, I'd do it like this:

int compare( const void *arg1, const void *arg2 ) {       MyS *const *p1=arg1; MyS *const *p2=arg2; return (*p1)->val - (*p2)->val ; }
 * Taking advantage of the implicit conversion from void *, there is no need for casts at all. And beware of using a simple subtraction as comparison, when the numbers get big enough it'll overflow and give the wrong answer. It would be more future-proof to return (*p1)->val > (*p2)->val ? 1 : (*p1)->val < (*p2)->val ? -1 : 0 --tcsetattr (talk / contribs) 01:46, 12 October 2007 (UTC)

Why does Firefox take so bloody long to start downloading things?
I'll open up a few tabs with images, for example, right click, and hit save image as. Then I'll have to wait 7-10 seconds for the download window to pop up, because it's so slow. I don't have any spyware/adware on my machine, and I have 2GB RAM. Is this just more of the same "let's eat tons of memory!" from Firefox, or can this be fixed with some nifty gadget? - Woo ty   [ Woot? ]  [Spam! Spam! Wonderful spam! ] 01:27, 11 October 2007 (UTC)
 * Works perfectly for me. And firefox eats so much memory because it's caching things- not to mention the massively memory-expensive "instant back" feature that lets you hit back/forward and see the site already downloaded and rendered. This can be fully tweaked in about:config--⁪frotht 04:36, 11 October 2007 (UTC)
 * I have seen bad save times when 1 - a network drive is broken, or 2 there are thousands of files in the directory to save to. Graeme Bartlett 05:44, 11 October 2007 (UTC)


 * I use Firefox at home under Linux and at work under msWindows. Under msWindows it's much slower, but then everything is, because it does all sorts of downloads and installs. Once those are over, it works just as fast. Might that be it? DirkvdM 06:00, 12 October 2007 (UTC)


 * I know what you mean. I have the same problem. I don't know why this is, but it can be partially remedied by by cleaning your download history (the 'clean up' button on the downloads window). That helps a little bit. I do hope they've managed to fix this for firefox 3.0. risk 12:50, 13 October 2007 (UTC)

phd topic
I am searching for a research topic for a phd program. and I prefer it to be in the domain of database and networking  —Preceding unsigned comment added by 129.78.64.100 (talk) 01:36, 11 October 2007 (UTC)


 * This is something you need to talk about with your dissertation advisor. There's no way for us to know what they would consider a good topic. --24.147.86.187 12:58, 11 October 2007 (UTC)


 * Have a look at MonetDB. It's an open source research oriented database system. They're always trying to get students to combine development with a research program. I'm sure they'd be more than happy to offer suggestions.
 * risk 23:43, 12 October 2007 (UTC)

Lance Fortnow has a piece of [good advice] on the topic of choosing a problem to work on. 84.239.133.38 11:53, 13 October 2007 (UTC)

MP3 to WMA
Could someone do me a favour and encode this, a short mp3 to wma. I don't want to get a program for a 2 second clip. TYVM!
 * If you don't want to download a program, you could use an online service like Zamzar which converts MP3s to WMA. You may wish to use a disposable email address for this site to avoid receiving unwanted email. -- Kateshort forbob  12:54, 11 October 2007 (UTC)

Bitrates when ripping from CD
If I have a track that is encoded at 128kbps, but my programme is instructed to rip at 320 - where does the extra information come from? I appreciate that the track isn't going to magically get any better, but is the extra space simply empty? Is there any difference in quality (bad or good)? Thanks. 195.60.20.81 08:17, 11 October 2007 (UTC)
 * The track will be the same quality if ripped at 320kbps, as you said. It may have less read errors than if it were ripped at 128, but there would be not noticeable difference. As for where the extra space comes from, it is probably repeats of the bits in the data stream; like having several CDs playing with the same song on them at the same time - you still hear the song but you've doubled the space requirements. Think outside the box 12:34, 11 October 2007 (UTC)
 * Any conversion between lossy file formats will only degrade the quality, and any output cannot be better than its input. If you chose VBR for the encoder, I think it would be clever enough to only use enough bits to encode the already compressed music, and the resulting file will only be slightly bigger than the original. --antilivedT 04:49, 12 October 2007 (UTC)

EMail ID - 3rd post
Please give me theEMial Id OF Tiffany Taylor.Dont make me more mad.Try to understand me.Pleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaase.This isthe third time I am asking.09:51, 11 October 2007 (UTC)Hedonister —Preceding unsigned comment added by 218.248.2.51 (talk • contribs) 09:51, 11 October 2007


 * We don't normally have any idea what the email address of an article subject is. Other editors have already responded to your question; please don't keep asking it. EdJohnston 10:00, 11 October 2007 (UTC)


 * Hedonister- most famous people just don't want to receive emails (or other direct communications) from people they don't know. This is expecially true of female models, actresses, and porn-stars, who have every genuine reason to worry about weirdos and stalkers.  So the contacts they publicise (mailing addresses, phone numbers, or email addresses) are for management companies who screen out the weird stuff, respond to most queries themselves (requests for photos etc.), and only forward on a very limited amount of stuff (if any).  So the only legitimate way to contact Ms. Taylor is through either her modelling agent or through Playboy.  If you did manage to, by some means, get hold of her personal email address she'd a) change it, b) she'd be frightened that her privacy had been violated, and c) she'd quite possibly call the cops. -- PrettyDirtyThing 12:06, 11 October 2007 (UTC)


 * And honestly I see no reason why she'd want to talk to you in particular. You love her? Right. Join the club of people who "love" celebrities that they know almost nothing about as people. Even people in prison get dozens of love letters. I'm not sure why you think she'd want your letters, or mine, or anyone else on here—I'm not trying to be particularly harsh here, but that's just how celebrity works. --24.147.86.187 13:00, 11 October 2007 (UTC)


 * Forget it. Celebrities are putting on an image whenever you see them - they are totally different people when meet them for real.  Besides she is NEVER going to reply to any message you send her - at best you'll get a canned reply from a publicist.  Honestly, this is ridiculous - get to know some real people - they are much more interesting anyway.  But either way, stop asking the reference desk.  We already gave you the only answer we can - and (as predicted) it didn't work.  You're done.  Get over it. SteveBaker 13:52, 11 October 2007 (UTC)


 * Congratulations, 218.248.2.51/Hedonister! For your obsession with some random porn star, your inability to take the normal social cues that we don't know her email address even if that makes you "more mad", your questionable posting history, and your signing this post on the topic of "can i fuck you?" as "RAPIST", I hereby award you this barnstar for being among the creepiest trolls that Wikipedia has to offer.  You've earned it!  --Sean 14:15, 11 October 2007 (UTC)

You have to contact Playboy. Tell them why you want to meet her and discuss everything through. If they agree they'll put you in touch with her modelling agent and you can schedule a meeting with her. It is going to cost you in the order of thousands to tens of thousands of dollars, and will probably take a long time, because both Taylor and her agent are probably very busy people. If you are looking forward to a personal relationship with Taylor, forget it. Professional meetings are the only thing you can even hope for. J I P | Talk 16:31, 11 October 2007 (UTC)
 * I know Tiffany! Her email address is email removed.  She's a big Rage Against the Machine fan... Zach de la Rocha.. roach, get it... anyways, she's a really down to Earth chick, and she always does her best to respond to fan mail.  Good luck! Beekone 20:27, 11 October 2007 (UTC)
 * Moreover, even if we did know her email address, we wouldn't be able to divulge it, per Wikimedia's privacy policy. Sorry. -- slakr  \ talk / 23:11, 11 October 2007 (UTC)

Congratulations to all contributing here. This trolltastic debate wins the eighth User:Dweller/Dweller's Ref Desk thread of the week award. Good job. --Dweller 13:00, 12 October 2007 (UTC)

Wireless connection: Offline even when online
My Wi-Fi connection is showing "offline" even now - when I'm online! Why is this, what can I do to sort it? It only started yesterday. In "available wireless networks", it shows mine and has the graph of how strong the signal is, but still says 'not connected', though the button at the bottoms does say 'disconnect'. There have been no new installations recently. Any advice? Porcupine (prickle me! · contribs · status) 12:42, 11 October 2007 (UTC)


 * We'll have a better idea of the problem if you tell us what OS you're using - from the sound of it it sounds like Windows though - i had all sorts of problems with Wireless networks on Windows, particularly before XP SP2. It could however be a router problem, specifically if it's an encrypted network - if you are using Windows you can check the wireless device -right click the wireless icon on the taskbar and click properties i think- and see if you're receiving packets from the router, if not it's likely a router authentication problem. -Benbread 18:11, 11 October 2007 (UTC)

Win XP. Porcupine (prickle me! · contribs · status) 18:34, 11 October 2007 (UTC)
 * It's possible that your computer/laptop has a wireless card that isn't connected, while another one is. This can frequently happen on laptops that have internal wireless antennae and someone attaches a wireless card to a PCMCIA slot.  The user connects the latter while the former is still disconnected.  If that's not the case, you might try rebooting to see if it goes away or simply try disabling and re-enabling the card in network connections.  -- slakr  \ talk / 23:05, 11 October 2007 (UTC)

RAM question.
I'm buying a new computer in the next few weeks from CyberpowerPC, but I'll be replacing the RAM and motherboard with better ones from Newegg. I was wondering if the 512MB of RAM that will come with the Cyber computer can be used to upgrade my old desktop (which currently only has 512MB as well), regardless of brand, speed, timings, etc., or if they have to be identical in specifications. Thanks. · AndonicO Talk 13:23, 11 October 2007 (UTC)


 * This really depends on the age of the old RAM modern computers use DDR RAM now while computers from a few years back used SDRAM, generally. You'll have to see if the new RAM is compatible with your old machine, generally a good way to find out is if the new RAM doesn't fit into the new socket :P The real question is what RAM will you be putting in your CyberpowerPC if it's in your old desktop? ;) -Benbread 18:08, 11 October 2007 (UTC)


 * My old desktop is a little over two years old; it's a Compaq SR1430NX, not sure about the motherboard/RAM specifications. I'll try to see if the new RAM fits. :) One question though, the new RAM will be DDR2, not DDR; can they both work in tandem? The answer to "the real question": 4GBs of gold. :) Thanks for helping. · AndonicO Talk 21:16, 11 October 2007 (UTC)


 * Please see DDR2_SDRAM. Long story short, DDR2 is not designed to be backwards-compatible with DDR1. However, DDR1 that is of higher clock speed is usually backwards compatible with boards that don't support the full speed offered by the DDR1 module.  -- slakr  \ talk / 23:01, 11 October 2007 (UTC)


 * Please note that buying 4GB of memory is useless unless you have a x64 version of Windows. - Woo ty   [ Woot? ]  [Spam! Spam! Wonderful spam! ] 02:32, 12 October 2007 (UTC)


 * For the old desktop, if it's only two years old, you might be better off just buying a full complement of the fastest memory it will support. My guess is that we are talking $90-120 to put in 2GB, assuming the machine will accept that much. This should give you a speed improvement on the old desktop and allow you do more work, if it will remain in actual service. The rules for mixing RAMs and motherboards are so elaborate that trying to move the surplus memory into it might actually reduce its performance. Your model of Compaq is listed at www.kingston.com, and that model is supposed to accept DDR2 memory. This link at hp.com tells how to check that system for how much memory it will accept. EdJohnston 03:03, 12 October 2007 (UTC)
 * Alright, thank you for helping, it is much appreciated. :) · AndonicO Talk 14:41, 12 October 2007 (UTC)

Camcorder / Apple Mac
Does anyone know of a hard disc camcorder that will connect seamlessly to an Apple Mac computer. I have tried the Sony range and they do not recognise Mac's except for still photo's. Help will be appreciated please.--88.110.173.135 13:36, 11 October 2007 (UTC)


 * I don't understand the question. Almost all current digital video cameras have a Firewire/IEEE1394/iLink output, and most, if not all, Macintosh computers have a Firewire input.  You connect the cable, put the camera in playback mode, fire up iMovie, and Bob's your uncle.  There is a very good chance that trying to use USB instead of Firewire will not work at all for video.  Here is a brief overview of the cables, ports, and software needed for digital video.  -- LarryMac  | Talk  14:56, 11 October 2007 (UTC)

You are, of course, quite right, but Sony hard disc camcorders, for example, don't have a firewire connection, but USB2 and I have not found any other with Firewire yet. Can you name names please? Thanks--88.110.173.135 16:09, 11 October 2007 (UTC)


 * Are you sure they don't have a "1394" connection? Sony tends to call it iLink and use the miniature (4-pin) connector, but they're big fans of that standard.


 * Atlant 16:26, 11 October 2007 (UTC)


 * No, he or she is correct, no iLink on the Sony hard disk camcorders that I've researched (the hard disk being the operative thing here).  Not on the Canon or Panasonic that I've looked at so far, either.  I guess I'm living in the past (i.e. last year).  -- LarryMac  | Talk  16:39, 11 October 2007 (UTC)


 * You're still in today LaryMac, the situation is unchanged as far as I can tell!--88.110.173.135 08:57, 12 October 2007 (UTC)
 * Heh, no my expectation that DV camcorders would have Firewire is what puts me in the past. Apparently that's no longer true.  However, here is PDF about the JVC GZHD3 which mentions the Macintosh support and requirements.  -- LarryMac  | Talk  12:53, 12 October 2007 (UTC)

All hard disk camcorders are absolute nightmares to edit with. As a media professional, I would avoid them at all costs. Like mini-DVD camcorders, you exchange compatibility and edit-ability for convenience. None of them record to DV, but rather use MPEG-2 or AVCHD. Only AVCHD has Quicktime compatibility with Final Cut Pro and iMovie 08. Even then, the computer will have to convert it to an intermediate format that's editable. You'd think (expect?) that hard drive camcorders would be the easiest to manage, just plug in and drag video files to your desktop. That's the way it *should* work, but it doesn't. --24.249.108.133 01:20, 14 October 2007 (UTC)


 * Yeah, thanks for all that...I'll just buy a sketch pad instead !!--88.111.33.45 07:44, 14 October 2007 (UTC)

Authentication through Flash webapps
How does one go about authenticating users of a site through an Adobe flash-based chat/videoconferencing web application, assuming that the login form is separate from the application itself? What security measures should one take to ensure that such a system is foolproof? I have heard many people say, several times, that flash webapps of this sort are notoriously insecure, is there any truth to this? —Preceding unsigned comment added by 66.238.233.150 (talk • contribs) 23:46, 11 October 2007
 * Google up "XMLSocket." They're insecure unless client-to-server communications are encrypted.  -- slakr  \ talk / 00:08, 12 October 2007 (UTC)
 * Oops, it appears we have XMLSocket. Check there first. :P  -- slakr  \ talk / 00:09, 12 October 2007 (UTC)