Wikipedia:Reference desk/Archives/Computing/2008 October 23
Computing desk | ||
---|---|---|
< October 22 | << Sep | October | Nov >> | October 24 > |
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. |
October 23
[edit]Anyone know of any free software that will actually clone a hard from from one to another, not just create an image file?
[edit]Anyone know of any free software that will actually clone a hard from from one to another, not just create a useless image file? I looked through the lists of and comparisons of software in the pages wikipedia had, checked them all out and of the free software that works on FAT32 or does a raw copy, it all says it only creates worthless, junky image files instead of copying a hard drive to another outright. I've asked on some of the forum of those websites and they never answer. So.. Anyone know of any free software that will actually clone/copy all the contents of a hard from from one to another, not just create a useless image file? Are you ready for IPv6? (talk) 00:42, 23 October 2008 (UTC)
- Try GParted. Boot it off a live CD and you can easily copy partitions from one hard drive to another. Works fine with FAT32. I've used it again and again. Really pretty straightforward piece of software—a real gem of open-source work. --98.217.8.46 (talk) 01:44, 23 October 2008 (UTC)
- It's not free, but I'd recommend Norton Ghost. I've tried it; it works well and gives you full control over how the disc is cloned. I've also tried a program from Acronis, but it was really fragile.--Account created to post on Reference Desk (talk) 02:09, 23 October 2008 (UTC)
- Really, try GParted. I used to use Norton Ghost before I found GParted. GParted is just as easy, works just as well. --98.217.8.46 (talk) 04:12, 23 October 2008 (UTC)
Try Clonezilla (http://clonezilla.org). It's an excellent piece of open source software that allows you to do exactly that i.e. copy an entire harddisk or partition from one harddisk/partition to another. It comes as an ISO image file, so just download it, write it to disk. Then boot off the CD you've just made and follow the instructions. It allows you to copy directly from one harddisk/partition to another, or to choose to backup your harddisk/partition onto an image file that you can use later on to restore your harddisk. Additionally, you may find it bundled together with GParted - another opensource tool for partitioning harddisks.
Quicker way to add placemarks on Google Earth
[edit]Hi all. I find Google Earth's method of placing placemarks to be rather slow when creating lots of placemarks. With the current method, you have to click on the add placemarks button and move the placemark to where you want it. Is there some sort of hack available whereby you can select the add placemarks button, and click away on the screen with the mouse like twenty times and cretae twenty placemarks in the locations that you clicked? Thanks. - Akamad (talk) 00:45, 23 October 2008 (UTC)
phones
[edit]i wasn't sure if i ought to place this question here but anyways..i'm going to buy a phone in Kenya ..i want a basic phone but it should at least have a camera ,fm,blue tooth and usb.. budget should be around 100 dollars . something like a nokia 3230 or nokia 3500...I wouldn't mind an Ericsson but i don't know which type is good..So if anybody knows of a phone he or she has used and can recommend i buy it that would be awesome... Just a smart classy good phone ... —Preceding unsigned comment added by 196.1.26.35 (talk) 06:48, 23 October 2008 (UTC)
64-bit Rootkits
[edit]Are 64-bit machines susceptible to rootkits (particularly Vista if that matters)? While I was looking for a scanner I read a forum comment that x64 machines are unaffected by rootkits. Is that true? If not, do you know of a scanner for them? Thank you Louis Waweru Talk 11:03, 23 October 2008 (UTC)
- There are some free scanners here.--ChokinBako (talk) 11:27, 23 October 2008 (UTC)
- I'm afraid they don't run on 64-bit macihnes. Louis Waweru Talk 11:32, 23 October 2008 (UTC)
- Going from 32-bit to 64-bit is a binary-incompatible change, so a kernel driver binary (malicious or not) that's designed for a 32-bit OS is unlikely to work on a 64-bit version of the "same" OS. But more likely the forum comment was referring to Windows driver signing, which is optional on 32-bit versions of Windows but mandatory on 64-bit Vista. Drivers don't have to be signed by Microsoft but they have to be signed by someone who's purchased a certificate from VeriSign, which in principle gives a way to track them down if something goes wrong. Of course, rootkits tend to exploit bugs to gain sysadmin privileges in the first place, and there's no reason there couldn't be an exploitable bug in the kernel that could be used to load an unsigned driver. And there are probably ways to game the VeriSign application process (about which I know nothing). But it does make it a lot harder. -- BenRG (talk) 13:17, 23 October 2008 (UTC)
- Thanks for the explaination, BenRG. My paranoia level dropped a bit. I'm not sure I understand the driver signing criticism, since driver signing can easily be disabled. I opened a question on the articles talk page if you are interested. Louis Waweru Talk 00:02, 24 October 2008 (UTC)
- Yes! and Yes! Both BlackLite and gMer both have 64-bit versions. RootKit revealer I dont think works.
- Driver Signing has nothing to do with root kits. I had all the security for driver signing in place, and got a trojan rootkit.
- AND Microsoft has a patch for a bad verisign signature that someone got from verisign to sign things as coming from microsoft.
- Let us know what works. BE PARANOID! --99.185.0.29 (talk) 12:40, 24 October 2008 (UTC)
IP Address
[edit]How do I find out the IP Address of: 1. A PC; 2. A printer attached to the PC; Regards!--ChokinBako (talk) 11:21, 23 October 2008 (UTC)
This sounds like homework to be honest so I'll only answer the first bit. I'm going to assume you are using windows, since 90% of people are. First bring up your start menu, and go to the Run menu, then type cmd, and press enter. A black box should show up with "command prompt" in the title. Type "ipconfig" and it will be listed. 88.211.96.3 (talk) 12:04, 23 October 2008 (UTC)
- Hm your profile says you're an IT instructor? 88.211.96.3 (talk) 12:05, 23 October 2008 (UTC)
- I knew that already. Sorry, I should have been a bit more specific. I was thinking of a way to do it without the DOS prompt. We used to be able to do it at a company I used to work for. Something to do with right-clicking and properties, or something. I can't remember. The printer one is still bugging me, too.--ChokinBako (talk) 12:39, 23 October 2008 (UTC)
- If you're using Windows XP, 2000 or 2003, open Network Connections, right-click on a connection, and click Status. Then choose the "Details" tab. --grawity 13:27, 23 October 2008 (UTC)
- I, too, am assuming Windows (please let us know if it's not.) I'm using Windows 2000, your mileage may vary. If the printer is already hooked up to the PC and working properly, try this. Hit Start, open your Control Panel, and open Printers. You'll see a list of printers that you're connected to. Right-click your network printer and choose "properties." Click on the "Ports" tab. Highlight (don't uncheck!) the only port in the list that's checked. Click the "Configure Port" button. The printer's IP address should be listed somewhere on the "Configure Port" window.
- Depending on how flashy your printer is, you may be able to see the IP address on its screen, or make it print a configuration page that lists the IP address.ColorfulNumbers (talk) 20:41, 23 October 2008 (UTC)
- There is a GUI for Ipconfig, that at first was on a server kit for windows 2000, but now you can download. Ill post the Microsoft URL, when Im stitting at the server next time.
- Found it
- [1]
- Called wntipcfg.exe have fun! --99.185.0.29 (talk) 12:53, 24 October 2008 (UTC)
Thunderbird is lying to me!
[edit]I have Thunderbird set up to check for mail automatically every so often, and I keep getting a message saying I have new mail in my local folder when I actually don't have any. It's annoying because I have to check it to get rid of the notification. Is there anyway to stop it from lying to me, but STILL check automatically?--ChokinBako (talk) 12:42, 23 October 2008 (UTC)
- 1) Do you have any unread messages?
- 2) I'm not sure if it's the default configuration, but I have Thunderbird set up to show me the name and subject of any new messages as part of the "new mail" popup. Do you see any messages in your Inbox which match the ones in the "new mail" popup?
- - SigmaEpsilon → ΣΕ 22:51, 23 October 2008 (UTC)
- Are you sure you don't have spam waiting for you? As I recall from Thunderbird (I primarily use google apps now, instead of local software) if it fetches a new message it notifies you right away, but if the message is filtered out as spam or junk (due to the built in filter or one you set up) it may disappear from your inbox before you have a chance to open it up. --66.195.232.121 (talk) 15:27, 24 October 2008 (UTC)
Why won't the Cook Islands allow registration of obscene .ck domain names even though they could potentially get a ridiculous amount of money from it? Vitriol (talk) 13:48, 23 October 2008 (UTC)
- At only $150 a domain every two years, I'm not sure how much money that would be. It's not a "ridiculous" amount. Most likely the reason not to do it is from internal political pressures; somebody would get a chance to get high and mighty about how the government is doing such and such. --98.217.8.46 (talk) 14:05, 23 October 2008 (UTC)
- Some people have morals and want to make the Internet a nicer place. It's an interesting idea - I say we try it! SteveBaker (talk) 03:22, 24 October 2008 (UTC)
- I do hope you're kidding, Steve. Dismas|(talk) 03:28, 24 October 2008 (UTC)
- Why would he be kidding? Everyone knows porn is evil, look at all the nasty things it's done to people! Just think about it, the ultimate immoral list, 1) Murder, 2) Porn, 3) Country Music. Let's save the world, one MP3 and one JPG at a time. - Jimmi Hugh (talk) 10:22, 24 October 2008 (UTC)
- Their businesses use .co.ck - is that obscene enough? DendodgeTalkContribs 11:22, 25 October 2008 (UTC)
- Why would he be kidding? Everyone knows porn is evil, look at all the nasty things it's done to people! Just think about it, the ultimate immoral list, 1) Murder, 2) Porn, 3) Country Music. Let's save the world, one MP3 and one JPG at a time. - Jimmi Hugh (talk) 10:22, 24 October 2008 (UTC)
- I do hope you're kidding, Steve. Dismas|(talk) 03:28, 24 October 2008 (UTC)
aac audio codec
[edit]I use virtualdub to convert my mpeg video files to h.264 format. I have ffdshow installed which helps me compress the video stream. But I can't encode the audio to aac. Can anyone please tell me where to find aac encoder for windows (which can be used in virtualdub->audio->compression) ? As I have ffdshow installed, I suppose I could use the ffd audio encoder, but that's absent in the compression list. 218.248.70.235 (talk) 16:24, 23 October 2008 (UTC)
- I recently switched to this combination for my encodes as well. The free NeroAACEnc is an amazing little encoder. The codec really sounds great. If you're interested MeGUI can provide a shell for it (as well as x264). There are instances when I still use vdub, but MeGUI is by-and-large a great replacement for encoding jobs. Louis Waweru Talk 00:07, 24 October 2008 (UTC)
PayRoll Problem
[edit]Name Salary Marriage Status Income Tax Withheld Social Security 401K Retirement Total Deductions Net Pay Employee 1 $5,600.00 S $408.80 $280.00 Employee 2 $2,500.00 M $182.50 $125.00 Employee 3 $4,000.00 S $292.00 $200.00 Employee 4 $2,800.00 S $204.40 $140.00 Employee 5 $3,000.00 S $219.00 $150.00 Employee 6 $4,400.00 M $321.20 $220.00 Employee 7 $2,200.00 S $160.60 $110.00 Employee 8 $6,000.00 S $438.00 $300.00 Employee 9 $2,300.00 M $167.90 $115.00 Employee 10 $3,400.00 M $248.20 $170.00 Employee 11 $4,000.00 S $292.00 $200.00 Employee 12 $2,600.00 M $189.80 $130.00 Employee 13 $5,800.00 M $423.40 $290.00
Income Tax withholding rates Single Married Rate for SS Rate for Ret Over 3000 18% Over 3000 15% 7.30% 5% Under 3000 10% Under 3000 10%
Write one formula for income tax withholding that can be used for all employees. Hint this will be an If function formula. Write other formulas as needed to calculate Social Security, retirement, total deductions and net pay. Good luck!!!!!! —Preceding unsigned comment added by 206.176.119.180 (talk) 18:17, 23 October 2008 (UTC)
- Please note the guidelines at the top that we won't do your homework for you. If you have made a serious attempt at solving the problem and have a specific question, we will be happy to try to help. --LarryMac | Talk 18:33, 23 October 2008 (UTC)
- The obvious solution is to use a Fourier transform to get a function of the employee's income, social security and retirement fund status, parameterised for their marriage status (generalised to a complex variable, of course - don't forget the imaginary girlfriends!) 79.78.52.62 (talk) 22:18, 24 October 2008 (UTC)
uservalidation in c
[edit]i've created a small function that should get user input, and will keep asking the user for new input if they dont specify a number
/*validates user input returns the number as a double or if error condition
is set it will recall itself*/
double userValidate(char *value)
char buff[BUFSIZ],*ptr_buf;
double returnvalue=0.0;
int buffsize=sizeof(buff),errno=0;
printf("Please enter a numercial value for %s", value);
fgets(buff, buffsize, stdin);
if (buff[0] == '\n')
{
printf("No input, try again\n");
userValidate(value);
}
returnvalue=strtod(buff,&ptr_buf);
if (errno == ERANGE || errno != 0)
{
perror("strtod");
printf("Not a valid number, try again\n");
userValidate(value);
}
if (ptr_buf == buff)
{
printf("Not a valid number, try again\n");
userValidate(value);
}
free(buff);
return (returnvalue);
}
note value is just a text string respresenting what i want to ask ie "Value for object 1"etc
i validate whether the number is the correct size ie greater than some value, less than some value etc, inside a do-while loop that calls this function
now i have a few questions:
1) if i attempt to call free(ptr_buff) at the end of the fucntion i get a bus error, any ideas why/ suggestions to get round it?
2) is there a need to check if user enters a value greater than a double can hold, as its a very buig number?
3) is there anyway i can improve it? it seems to have problems if someones enters a lot of junk input in one go, it seems to have to run sereval times before it then recongises a number as being valid
thanks--82.16.140.152 (talk) 21:26, 23 October 2008 (UTC)
- Regarding #1 -- You shouldn't do "free(ptr_buf)" or "free(buff)". "buff" is not dynamically allocated memory (allocated with malloc() or strdup() or some function that calls them or something similar) which is what free() is for. An array declared as "char buf[123]" is allocated on the stack when the function is called and will be removed when the function exits. And "ptr_buf" just points to somewhere within "buff".
- Regarding #3 and having a lot of junk input -- iff "buff" fills up, fgets() will stop reading and your function will process just what it got so far. But the rest of the user's input line will be received in the next call to fgets(). That's probably what you're seeing. -- Why Not A Duck 21:56, 23 October 2008 (UTC)
- Yikes! I see at least a dozen things wrong with this function! That's gotta be some kind of a record!
- I'm now going to meticulously shred your code into tiny, TINY little pieces and bitch and whine at every single thing I can find. Please don't be discouraged by this. Everyone (me included) started off programming like this. You'll learn - you'll get better - but even after 35 years - you'll still look back at code you wrote the year before and say to yourself: "Did I really write that crap?". I wrote about 2,000 lines of complicated graphics code today - and it all worked pretty much first time - and I'm getting paid $130,000 a year for doing it. But that's because I learned to program in 1973 and I've been writing code pretty much every single day since then - and I'm a FANATIC about good style, good algorithms and taking care to sweat the teeny-tiny details of everything I do. But look carefully at what I'm telling you...take careful pride in every character you type. Style and prettyness really DO matter for practical programmers.
- Certainly you can't free up memory that's allocated on the stack as a local variable - that's why it crashes on 'free'. Just remove the call to 'free' - local variables are automatically cleaned up when the function exits - so you don't need to (and cannot legally) 'free' them.
- Another MAJOR complaint I have is that you call the function recursively if the user mistypes something. Each recursive call eats memory (notably - that BUFSIZ'd buffer). So if your user types (say) a million lines of illegal crap - your function will have called itself a million times and allocated a million copies of all of those local variables. That'll pretty much for sure run you out of stack space after a few hundred bad entries. It might seem unlikely that any user would do that - but you can redirect stdin from a file by mistake when you start the program running - and stuffing a few thousand lines of garbage is all it would take to crash the program. You may not care about that in the case you are thinking of - but it's sloppy programming - which is ALWAYS bad. Try to refactor your code to use something like:
do { read input ; check input ; } while ( input is crappy ) ; return good value;
- Worse still - when the function gets good input the first time around, it returns that good value. But if things go wrong and it calls itself recursively - you don't return the value from the (eventual) good input from all the layers of function call that went wrong. At the very least - the lines that call 'userValidate' from INSIDE 'userValidate' should say "return userValidate(value);"...but as I said - using recursion in this situation is just plain nasty for a million other reasons! However, that's why the program doesn't work when you enter crap into it. It's really quite rare for recursion to be a good way to solve a problem...use it with EXTREME caution - and only when you have a lot more programming experience than you do now!
- Sadly - you mistakenly declared 'errno' as a local variable. Your local definition overrides the standard declaration of errno in the header file - so you'll never detect a non-zero value because you're checking your local private variable and NOT the one that the standard library functions are declaring!
- You wrote: if (errno == ERANGE || errno != 0). This is redundant. Any non-zero value of errno represents an error...so checking for errno being equal to ERANGE is a waste of time - ERANGE isn't equal to zero so a simple 'if ( errno != 0 )' would do just fine. In fact, most C programmers are aware that the 'if' statement treats any non-zero value as 'true' so they'll typically write 'if ( errno )' and read that as "if errno is showing a problem". That's why so many UNIX/Linux functions and pretty much all of the standard library functions use zero to indicate success when they return an integer error code. But 'if ( errno != 0 )' is perfectly OK too.
- I dislike your function prototype. The 'value' parameter isn't altered inside the function - and you should say so by declaring it as: double userValidate ( const char *value ) ;
- I dislike that you check (buffer[0]=='\n') and tell the user that his input was empty. Firstly, that fails if he types a space before hitting return - that's still "empty input" - but you're not detecting it. You might as well not bother with that test and just let the rest of the checking say that his input was bad when he hits return.
- The word is "numerical" not "numercal". Always ALWAYS ALWAYS put everything in your program thats between quotation or comment marks into a spell checker! Better still, use an editor that spell checks as you type.
- Why do you need the variable 'buffSize'? You already declared a constant 'BUFSIZ' someplace - so why not pass that into 'fgets' and save some memory?
- Even if you did want to declare it for some reason, buffSize never changes so it should be declared 'const int' and not just 'int'.
- 'sizeof' doesn't return an 'int' - it returns an object of type 'size_t' which may or may not be an int. (It's often an unsigned int). Many compilers (Microsoft's Visual studio for one) will issue a warning to tell you that there is possible loss of data here. In this case it's OK - but you should at least cast the results of 'sizeof' into an 'int' if that's what you're going to use. In general, it's better practice to declare variables and constants that contain sizes of things in memory to be of type 'size_t' just to be on the safe side.
- A major problem with your testing is that 'strtod' only looks at the first thing in the buffer. If your user INTENDED to type "0.00001" as input but accidentally misses the period key and inserts a space before it (or after it - or instead of it) then he'll have typed "0 .00001". strtod will happily read the 0 and return it to you and your program will proceed as if the user had typed a zero. This could be horribly important in some applications - so you ought to check not only that he typed a valid number - but also that he ONLY typed a number (plus - perhaps - some surrounding white-space)...if he enters what seems to you to be TWO numbers - then you should error-out and have him try again. Literally ANYTHING you can do to help the guy out is a good thing.
- You aren't checking the results of fgets() - it returns NULL when there is some kind of input problem with stdin...which is perfectly possible (if for example, the user gets sick of your error messages and types an end-of-file mark). When that happens (without checking the result of fgets) your program will probably loop forever printing error messages!
- In answer to your question, you don't need to worry about checking for inputs too big to be a 'double' - strtod already does that. It will return HUGE_VAL (or possibly -HUGE_VAL) and set 'errno' for numbers that are too big (or too negative). For values that are too close to zero for a double precision number to store, it'll return zero - but errno will still be set to a non-zero value. This doesn't work in your program right now because you declared 'errno' as a local variable - but when you fix that, it'll work automatically.
- You are using 'printf' to display error messages and user-prompts. In general, that's a really bad idea - even for command-line programs. People are entitled to redirect the output of 'stdout' to a file so they can store any useful results your program might happen to generate. It's considered much nicer to put user-prompts (and CERTAINLY all error messages) to 'stderr' (the standard error stream) instead. This is easy to do - just replace 'printf(' with 'fprintf(stderr,' and all will be well.
- A thing I personally HATE (but far too many programmers do) is putting the value you are returning in a 'return' statment inside parentheses. They aren't needed. You could have said 'return returnVal;' and it would be perfectly OK. This isn't wrong so much as an ugly stylistic thing. It makes it seem like 'return(yaddayadda);' is a function call - and it's most definitely not! Putting the brackets there say to me "this is a guy who doesn't know C"...but it's not strictly WRONG...just evidence of woolly thinking.
- I dislike that your function always says "Please enter a numercial value for..." before displaying the message from the calling function. If this function is used in dozens of places for numerical input - the output will be very monotonous and the "Please enter a numercial value for..." string on every single line will piss off your users because their eyes have to scan all the way across the line to get to the actual interesting part of the message. On a small display, this message will get so long, it may cause the window to scroll sideways and that's a MAJOR no-no because it makes your poor user have to fiddle with the mouse in order to see what you're telling him. Let the calling program pass in ALL of the message. So it can say nice, concise things like:
double string_length = userValidate ( "How long is a piece of string? " ) ;
- Your indentation "style" is non-existant. Line stuff up neatly - choose a style and stick to it. A good rule with programming is: "If it doesn't look neat - it won't work." - this is clearly not true - yet every poorly indented program I ever saw was broken in dozens of ways. That's because sloppy intentation is evidence of sloppy thinking and sloppy work. You might think I'm overly paranoid about style - but I work with game programs - the last game I worked on contained TWO AND A HALF MILLION LINES of C++ code. If you can't keep it neat - you stand zero chance of getting something like that working.
- Please stick with one variable naming style. Some people like longnamesallinlowercase (I don't) - some people like CamelCaseWords where each word is captialised and then run together - others like words_with_underscores. You use all three of those - and it's ugly! Pick a style - stick with it.
- PHEW! Well, that's all I could find in a single glance. Doubtless there would be more for me to hate if I thought about it some more. But like I said - don't be disheartened - if you stick at it, you'll get good - and you'll enjoy doing it.
- thansk,really didnt realise theres that much wrong, there was a proper identing style though it seems to of gotten lost in copying over--82.16.140.152 (talk) 07:38, 24 October 2008 (UTC)
- I'm pretty sure gcc will optimize the recursive call (when written correctly, with
return
) into a goto. But most other compilers won't, and it's a bad idea to rely on it. I tend to use an explicitgoto
in the source code when I really want tail recursion but can't rely on the compiler to optimize it, but some people would disagree and say that it's never okay to usegoto
. - Getting rid of
buffsize
won't save any memory or time if you're optimizing. Any modern compiler will produce exactly the same code as if you'd usedBUFSIZ
directly in the call tofgets
. - Personally I don't mind redundant parentheses, but given that you (SteveBaker) complained about the parentheses after
return
, I'm surprised you didn't also complain about the parentheses aftersizeof
. A simplefgets(buff, sizeof buff, stdin)
would do fine. I think this is better thanfgets(buff, BUFSIZ, stdin)
because it can't lead accidentally to a buffer overrun vulnerability if you later change the declaration ofbuff
. On the other hand it would break if you decided to dynamically allocatebuff
. I dunno. - I don't see the point of assigning
0.0
toreturnvalue
, since this value is never used, and doesn't seem an especially sensible default in any case. Some people might argue that it's good practice to always assign a default (modern compilers will optimize it away), but I think it would be better practice to declarereturnvalue
at the location where it gets its actual value:double returnvalue = strtod(buff, &ptr_buf)
. Standard C has supported this for almost a decade (the new standard was published in 1999). If your compiler doesn't allow it for some reason, switch to C++. (I recommend switching to C++ anyway; there's no reason not to, unless your compiler doesn't support it, which is almost unheard of these days, except on embedded systems, which I don't think you're using since they tend not to havestdio
.) -- BenRG (talk) 12:24, 24 October 2008 (UTC)
- I'm pretty sure gcc will optimize the recursive call (when written correctly, with
- thanks for extra input, the bit with the bufsize was orginaly done for the reason you said(if i ever changed the size of it, which i did, which is why it got left there), unfortunaly i'm stuck with a compiler pre c99, its a university run server thats no longer activily manged and we were told explicity to use c not c++, which also means i've had to define my own definitions for complex numbers--82.16.140.152 (talk) 17:02, 24 October 2008 (UTC)
- It's really ridiculous to rely on the compiler to optimize anything. Particularly something like recursion - which is pretty tough to optimize even by hand and veers into a situation where the compiler is changing your algorithm - which is a big "no-no". I can't count the number of times where some piece of slow, clunky code was speeded up immensely by writing it efficiently sometime after the original author thought the compiler would do it for him. Get into the habit of writing efficiently from the get-go. It's easier to slip into bad habits because you "know" the compiler will fix it - then you flip over to another compiler (or even another language) - the optimization goes away - and you're SO hosed because you've lost your natural instinct for eliminating waste 'by hand'.
- Goto's are obnoxious and are absolutely NEVER needed - not for style, not for efficiency, not for algorithmic necessity - you can always improve some aspect of goto-riddled code by refactoring it without the goto's. There are a few cases (very few) where they are merely benign and cause no harm - but because 99% of the ways people use them are evil - it's better to do without them and not allow weak programmers to screw up so badly. Always remember - even if you are a superprogrammer who can keep goto-sources in his head and not screw up - the people who come along to read your code later may not be so smart...and the smarter you are - the higher the probability that I'm right about that! I have not written a goto in real code in 35 years (we're not counting 'JMP' instructions in machine-code or microcode where it's unavoidable)...I've never once met a really good programmer who used them either. In the 2.5 million lines of C++ code that I worked on in my last job - and the 1.5 million in the job before that, there was not one single goto. They are a crutch for the weak-minded.
- Arguing between those forms of fgets is tricky. Any one of the three 'obvous' ways can break if code elsewhere changes. There is no single way to determine how long a 'char *' is that's bulletproof - so you might as well pick the simplest and cleanest.
- I agree that the brackets around the thing to the right of 'sizeof' is a little redundant - but sizeof behaves a lot like a function does and if people think of it as a function - that's not so terrible. Also, its operator precedence is a little bit weird - and using brackets redundantly around the kinds of things that have weird precedence rule is a reasonable defensive strategy. But 'return' changes the flow of control in ways that a function cannot ever do - and there are NO operator precedence issues that can justify using them. Putting the parentheses around it doesn't add anything to the value of the program.
Quicker way to add placemarks on Google Earth
[edit]Hi all. This entry of mine got deleted in this edit: [2] along with a whole bunch of other edits, so I'm reposting:
I find Google Earth's method of placing placemarks to be rather slow when creating lots of placemarks. With the current method, you have to click on the add placemarks button and move the placemark to where you want it. Is there some sort of hack available whereby you can select the add placemarks button, and click away on the screen with the mouse like twenty times and cretae twenty placemarks in the locations that you clicked? Thanks. - Akamad (talk) 00:45, 23 October 2008 (UTC)
Backup Hardware suggestions
[edit]Hi, I'm looking for backup hardware suggestions. I don't need to have an automated solution; I just want to have a fast and inexpensive external backup option. If it's faster and cheaper, then even serial-access options (like tapes?) may be what I want...? Or are tapes obsolete? I have no idea what's out there nowadays. Ideally, I could use it for both my old Mac tower (old G4 and old system OS X 10.2) with IEEE1394 and USB connections, and new Sony laptop (Windows XP and Ubuntu) with IEEE1394 and USB2 connections. Any ideas? Thanks! TresÁrboles (talk) 23:16, 23 October 2008 (UTC)
- AFAIK, tapes are expensive for most personal use. I would go with a cheap USB hard disk. From this source, I got info on this hard disk. I think we can help you research with the best deals in town (I mean the Interwho). Kushal (talk) 00:15, 24 October 2008 (UTC)
- It all depends on how much you need to back up - and how paranoid you're going to be. Using an external USB drive is pretty easy - and you can easily automate it. But you only have ONE backup. If you leave your USB drive sitting next to your PC then if a meteor smashes into your living room (or if you spill a cup of coffee - which I suppose MIGHT be more likely!) then the odds are very good that you'll lose your main drive AND your backup in the same accident. Also, a lot of people take backups because they worry that they might accidentally screw up the contents of a file and need to get it off the backup. But if you only have one backup - then you might not notice that you screwed something up until AFTER the next backup...so now both your 'live' copy and your backup are equally screwed. There are software solutions to that - but they mean that the backup drive has to have a much larger capacity than your main drive.
- Alternatively - you could back up by dumping your files onto (say) a DVD-ROM on a regular basis. If you have just a couple of gigabytes of files - so everything fits on one disk - that's great. Blank DVD's are becoming cheap enough to where you could afford to back up once every couple of days - archive disks going back a year or more - and (VERY important) you can take some of the backups away from where your computer is so that even if your house burns to the ground - you'll still have last month's backup disk in the trunk of your car - or at grandma's house - or wherever you kept them.
- The trouble with DVD-ROM is that the capacity isn't that big. If you have come close to filling up your 500Gbyte hard drive - then it's going to take literally hundreds of DVD-ROMS (or even BluRay-ROMS) to store all that stuff. You could go with an 'incremental backup' solution - which entails using software trickery to save only the files that changed since the previous backup (which in turn stores only the changes from the one before that). Since it's highly unlikely that more than a gigabyte or two of files will change between one backup session and the next - there is really no limit to the size of hard drive you can back up onto DVD-ROM if you do it incrementally.
- The problem with incremental backups is that to restore your files, you may have to go back through a very large number of backup DVD's to restore files that have not changed in years. You might find that acceptable if you don't trash hard drives all that often - but remember that no laser-disk-style backup is bulletproof - they can get scratched - and the lose data with age. This doesn't matter if you're doing a complete backup every week - but it matters a lot if you are only doing incremental backups because loss of any one of dozens and dozens of disks will make restoration from the backup very problematic.
- Tape solutions are out there - but they are horribly expensive and get outdated quickly. I wouldn't do that.
- Probably the best solution if you can afford the cost and be disciplined enough is to buy SEVERAL USB hard drives. Back up onto them in strict rotation - so you always have a backup that's a week old, another that's two weeks old and a third that's three weeks old. Keep at least one of the drives in another building somewhere - or consider buying a fourth drive for a special once-a-month backup that always lives at grandma's house. Assuming you don't keep all three of your weekly backup drives anywhere near your computer - then it's unlikely that anything short of a house fire or a really LARGE meteor strike will take out all three backups...so even if a USB drive fails on the very day you need to use it - you always have another (albeit slightly more outdated) drive sitting in the background.
- A final alternative is to pay for off-site storage. I have a web-hosting service (for which I pay less than $10 per month) - and that comes with enough disk space to hold all of the files I actually care about. I do my backups by running a 'subversion' server on the webhosting site and checking my files into that every night. This does several things for me:
- Because subversion is a version control system - I can wind back the file history on any file I've screwed up too badly.
- Because the web hosting guys are professional IT types - they handle all of the backing up of the subversion repository.
- Because the web hosting company are in California someplace and I live in Texas - it would take a REALLY big meteor strike to take out both my computer AND their copy of all my data!
- Restoring a backup is as simple as installing subversion on the new machine and doing a 'checkout all' type command...but this lets me use any computer in the world on a short-term basis. If I'm at a friends house and I forget my laptop - I can create an account on his machine, install subversion - then check out just my home directory preference files and whatever directory has the things I'm actively working on. Then, when I'm done - I check it all into subversion's repository at the web hosting site and wipe my files from my friend's PC. When I get home, I do a checkout on my home machine and all the work I did while I was away from home comes flooding back onto my local machine.
- I like this solution for many reasons - and the $10 a month the hosting service costs me is also running my email, hosting my web site and my Wiki - plus the websites, email and Wiki's for my wifes home business, my son's website and the car club I run. It's worth that much to me without the subversion thing - so backups are essentially free to me.
- this looks like a good deal too. Kushal (talk) 20:37, 24 October 2008 (UTC)
- Yowza! What a detailed answer! Thanks Steve, I think this will help other people, but I wasn't really looking for this level of backup myself. I don't have any super-critical files, I'm not running a business, my data doesn't change that much... It sounds like Kushal and you are saying hard drives are the way to go (besides possibly off-site storage). I would probably look into IEEE1394/FireWire hard drives (they still make them, right?) more than USB because my Mac only has the old slow USB, and I'd like to backup both my Mac and Sony laptop. However, I was really hoping more for a good removable storage option since it would never fill up, and also I'm concerned that I would not be able to share a disk drive between my Mac and my XP/Ubuntu laptop because of filesystem format problems. (E.g. Windows XP and Ubuntu can read and write to an NTFS partition, but I don't think my Mac can.) I'm surprised that tape drives are a more expensive option. (If disk drives are cheaper and more convenient, why would anyone get tape at all? Speed?) DVD-ROMs will be too low-capacity for me I think. TresÁrboles (talk) 05:57, 26 October 2008 (UTC)
- I would imagine tape is better suited for long-term archives that do not need to be fetched often. Kushal (talk) 17:49, 26 October 2008 (UTC)
Laptop issue
[edit]I own a HP Pavilion dv1000 laptop with Windows XP installed, a couple of years old. A month ago, it failed to boot up at all. I turned it over to my father, who got it checked out (I was busy at the time), and the issue is a bad motherboard, which Best Buy (I know, I know) says will cost $358 to fix. I am a student in a graduate program, so I usually have my laptop in class. At the end of class, I usually shut it down and pack it up in my bookbag. I suspect that the frequency of this damaged the laptop, and I was thinking that even if I got it fixed, the same problem may take place again. Considering the cost of the two-year-old laptop, is it worth fixing or just getting a new one? I am not looking for anything particularly high-end. Probably will accept Vista on the next one. Not a gamer or a multimedia person. Any professional assessments? 98.223.188.95 (talk) 23:55, 23 October 2008 (UTC)
- You might try calling HP directly. When my dv2000 (which I'm typing on as we speak) had a dead CD-ROM drive they were very helpful and much, MUCH cheaper than any of the high-street stores I tried. SteveBaker (talk) 01:21, 24 October 2008 (UTC)
- PROTIP: Don't buy HP products. I have had a printer, display and a laptop from HP. All have failed. Message from XENUu, t 13:40, 24 October 2008 (UTC)
- Don't get a pet. I've had a rabbit, a rooster, and a puppy. All have died. Kushal (talk) 20:34, 24 October 2008 (UTC)
- I don't consider your statistical sample size valid and since the same person could easily have abused all three - they cannot be considered uncorrelated data. I have three HP OfficeJet K80 printers and three HP laptops and all have worked beautifully for many years. The ONLY problem I've had with them is the CD-ROM drive crapping out on one of the laptops - and I was deeply impressed by the quality of the HP service team...even after they discovered I'd wiped the hard drive so I could run Linux so they couldn't run their remote diagnostics. However, neither of those things gives you any significant information about whether HP products are good or bad. You can find dissatisfied customers from ANY of the computer manufacturers - unless the statistical sample size is a LOT bigger and the failures are uncorrelated - you know nothing about whether you should or should not avoid the products for reliability reasons. SteveBaker (talk) 20:31, 24 October 2008 (UTC)
- Are you just putting it in your bookbag? I've found that really takes a toll on ANY laptop except the ones meant for abuse. My recommendation would be to get a GOOD laptop case if you don't have one. I use one from InCase and it is very plush, very tough. My current laptop has not had one tenth the problems of my last one when I didn't have a case at all. Everyone I know who doesn't use good cases and carried them around a lot has had problems. I suspect most laptops are not really made for the kind of wear and tear that grad students subject them to. I know this is not what you asked but I thought I'd chime in for future reference. :-) By the way, the Best Buy price they quoted is really not that bad considering the labor involved in installing a new motherboard. The part isn't cheap by itself and it is not an easy installation (you have to basically take everything out, practically every screw in the thing; it's not like putting in new RAM or putting in a new CD-ROM). --98.217.8.46 (talk) 23:10, 25 October 2008 (UTC)
Free/open source DXF / DWG to SVG converter?
[edit]Where do I get a free/open source DXF / DWG to SVG converter? I would like to get a hold of a free software or printer driver that will rasterize all or part of a DWG (drawing) or DXF (Drawing Format Interchange) file to SVG (scalable vector graphics image). Thanks in advance. —Preceding unsigned comment added by 69.254.47.85 (talk) 23:56, 23 October 2008 (UTC)
- SVG drawings are not "rasterized" - they are in vector/shape form - just like DXF - except they only exist in 2 dimensions where DXF's can be in 3D. The only path I'm aware of is that the 'blender' package can import DXF and there is an SVG exporter available for blender (I haven't tried either plugin however - so I can't vouch for how successful this might be). If you have a lot of files to convert, you can run blender in a command-line mode which will allow you to write scripts to convert lots of files consecutively without human intervention. You can't print natively within blender - but you could use inkscape to print out your SVG's or rasterize and export them as PNG or JPEG or whatever. Both blender and inkscape are opensourced and both work well under both Linux and Windows...probably on Mac too...but I've never tried that. SteveBaker (talk) 01:18, 24 October 2008 (UTC)
- Thank you. I meant "vectorize" then :-S. So I installed Blender and then I searched for the SVG exporter and found one called Pantograph. It requires a bunch of other files (which to function require other software themselves) which I installed according to the instructions of the Pantograph author, but I am either doing something wrong or the plugins don't work because I still can't find any indication of SVG exporting abilities on Blender. So, should I concentrate on Blender as the way to go and just keep looking for an add-on that will allow it to export to SVG, or is there other software that might also do it? (Oh, and the only thing I am willing to invest on this is time). Thanks again for the help. 69.254.47.85 (talk) 19:08, 25 October 2008 (UTC)
- Edit: I forgot to mention, I'm on Windows XP.69.254.47.85 (talk) 19:10, 25 October 2008 (UTC)
- have you tried sk1 or Inkscape? they are Open Source tools that can open DXF files and save as SVG.