Wikipedia:Reference desk/Archives/Computing/2007 February 23

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


February 23[edit]

Appleworks[edit]

Here are the troubles: When I try to open an appleworks file i receive a message saying "An unexpected error ocurred (error code -600)." Appleworks is permanently open for unknown reason(s). It resists my Force Quit attempts. Clicking on Appleworks on the dock does nothing. Any solutions? Thank you in advance 63.231.243.111 02:10, 23 February 2007 (UTC)[reply]

Have you tried rebooting? --24.147.86.187 02:56, 23 February 2007 (UTC)[reply]
Try deleting any Appleworks Preference files...(Do not worry, Appleworks will create a new one). There should be a "Library" folder in both your home directory, (the one that has the home icon for it), and the directory thats under the name of your internal hard drive. After your in either Library folder, go to a folder called "prefernces", and delete any Preferences that have the word Appleworks in its name. (Do NOT tuch any of the other files in the Libray folder, since part of the OS X operating system is in those folders also.)Zeno333 19:52, 25 February 2007 (UTC)[reply]

Typecasting char array to floating point in C[edit]

I'm writing data acquisition software in C on a PIC 18F2680 microcontroller. I have a serial stream in, which is double precision floating point, in IEEE 754. The stream is read by the chip one byte at a time (the buffer is only one byte wide). Thus, I have an array of 8 bytes, which I want to manipulate as it's value instead of as an array of bytes. Eventually, I want to typecast it to floating point, to cut the data size. How do I make the micro recognize the data as a double instead of as an array of characters? anonymous6494 03:24, 23 February 2007 (UTC)[reply]

*IF* your microcontroller also uses IEEE 754, that is, if its internal floating-point format is exactly the same as (bit-for-bit compatible with) the external data you're trying to read, you can sidestep all sorts of messy bit-twiddling conversions and "pun" the types, with a typecast as you've already suggested. The recipe might look like
char chardata[8];
double realdata;
...read in the chardata array...
realdata = *(double *)chardata;
You might also have to worry about alignment. If so, we can explain that, too. —Steve Summit (talk) 03:34, 23 February 2007 (UTC)[reply]
Be careful of endianness; you might have to swap the byte order if the endianness is different. Also, it might save some precious bytes if you, instead of using pointer tricks, use a union:
union data {
	char chardata[8];
	double realdata;
};
Doing so can also avoid flipping the bytes if you have an endianness mismatch; just fill the array from the opposite direction. You might have to align the whole union, if your microcontroller needs the alignment; I didn't check the datasheet (if it's the compiler which is doing software floating point emulation, the information about alignment would be on its manual instead). --cesarb 13:32, 23 February 2007 (UTC)[reply]
If proper alignment is an issue, using the union is a good way to achieve it. —Steve Summit (talk) 13:46, 23 February 2007 (UTC)[reply]

Choosing a type of linux[edit]

Which would you guys say is the most semi-competent-windows-user-friendly Linux-based OS? I'm feeling like giving one a try. Is there one that can still run most windows-friendly programs, like Adobe stuff, realplayer, word, rosettastone, firefox, itunes, daemontools and many others? Thanks, 70.108.199.130 04:21, 23 February 2007 (UTC)[reply]

Ubuntu or Kubuntu. And you won't be able to run the Windows-specific programs you mentioned without WINE (daemontools won't run at all, though you can generally mount ISOs without any extra tool [1]). There is a Linux version of Firefox as well as free alternatives to most of those. Do you know what you're getting into? You most likely can't use your existing partitions in Linux; you'll have to resize or reformat them, the latter of which kills all of the data contained within. -- Consumed Crustacean (talk) 04:29, 23 February 2007 (UTC)[reply]
What do you mean by partitions?
Sections of the hard drive; see the article on Disk partitioning. The file systems won't be compatible with Linux, and you'll likely want an extra partition or two for the bootloader and swap partition. If you install Linux and go through with the default settings, you'll completely reformat your existing partition, meaning any data in Windows goes down the drain. Ubuntu does allow you to simply resize your Windows partition(s) to free up room, but you have to be certain that you don't select the wrong option. If all of your data is backed up somewhere else, then there's naught to fear. -- Consumed Crustacean (talk) 04:47, 23 February 2007 (UTC)[reply]
Damn. I think I'll wait till I get a new computer
Why does the bootloader need another partiition? I thought that special areas of the HD were set aside for such things? I personally, am planning on five partitions; one each for WinXP, Ubuntu and OpenSUSE and one for the swap and one for data. I wasn't expecting to have to create one for the bootloader as well. If its necessary to make a partition for it, how big should it be? --Seans Potato Business 08:08, 24 February 2007 (UTC)[reply]
Some bootloaders are small and don't require space on a regular partition, e.g. GAG. Others are multistage, e.g. BING. I have GRUB4DOS and BING sitting on a FAT32 partition (with Win 98); and GRUB sitting on a JFS partition (with OpenSUSE). I think a neat option is putting DOS on a FAT32 partition, adding imaging software (e.g. Image), antivirus (e.g. F-prot), GRUB4DOS, and some images. I used to dig around my shelves to find a good boot disc / floppy, but it's easier to use GRUB; map --mem and map --ramdrive.172.146.58.73 08:33, 26 February 2007 (UTC)[reply]
It doesn't have to be set up that way, no. That's just a way that some people do it; right now, I just have the files within my main partition. I'm not talking about the MBR, but GRUB/LILO/etc.. -- Consumed Crustacean (talk) 06:15, 26 February 2007 (UTC)[reply]
Ubuntu and Kubuntu and many other distributions of Linux come in the form of a LiveCD. This means you can use the operating system without having to install anything. So you just boot up the computer with the LiveCD in the drive, and you'll get the option to run Ubuntu/Kubuntu or whatever from the CD. This way, you can play around with it, make sure your drivers work and stuff before installing anything. It's a little slow, but it's good enough to play around with to see if you like it. - Akamad 11:16, 23 February 2007 (UTC)[reply]
In general, it's best to use the Linux equivalents of whatever Windows software you want to use, just as if you had a Mac, you would use the Mac equivalents, rather than expecting to keep using Windows-only software. Free programs like Open Office, The Gimp, Inkscape, and XMMS cover most people's needs for desktop software on Linux. If only the Windows versions of those kinds of software will do, you should ask yourself why you want to switch to Linux? --TotoBaggins 15:26, 23 February 2007 (UTC)[reply]
You could fit another harddrive and install Linux on that? You could then choose between starting Linux or Windows when you switched on your computer. What are the specifications of your current computer? --Seans Potato Business 06:50, 24 February 2007 (UTC)[reply]
Alternatively, you could resize their current partition using the free [gparted LiveCD] --Seans Potato Business 08:08, 24 February 2007 (UTC)[reply]
Ubuntu and a few other distros have that built in to the installer CD/DVD. -- Consumed Crustacean (talk) 06:15, 26 February 2007 (UTC)[reply]
If you can afford it, Transgaming's version of WINE is designed for games. And Crossover is good for office software. For instance, Crossover used to run AOL 7.0, while the installation would fail on stock WINE. And the fonts are decent. There are other ways to run Windows applications like qemu, Bochs, and VMware.172.146.58.73 08:16, 26 February 2007 (UTC)[reply]

Does Kazaa give a lot of problems?[edit]

Does anybody here use kazaa? does it give any problems with your computer?04:39, 23 February 2007 (UTC)shindo9hikaru

According to Wikipedia's Kazaa article, there's a lot of problems with malware and the like. So it's probably best to stay away from it. - Akamad 11:13, 23 February 2007 (UTC)[reply]

Have to defend Kazaa - I have used it for about 2 years (maybe longer now) and providing you follow some basic rules you should be fine. I always found avoiding downloading strange file names was he easiest way to avoid malware or viruses. Also its dependant on what your downlaoding - if it is music then its normally quite safe though some files will not play as they require codecs or licences. If its videos you might find more of a problem as there are a lot of files that look like video files but when you open them there is nothing there or they require a licence. (Be careful with videos as you can downlaod large files with nothing there or require a pay licence).

Just to go back to your question I find it gives my computer no problems what so ever. Its a tad slow opening up but once that's over with I never have problems. It used to drop a lot of annoying files onto your hard-drive like adware and like but nothing harmful, but the free version I recently downlaoded didn't do that this time. --PrincessBrat 11:55, 23 February 2007 (UTC)[reply]

Kazaa is notorious for its malware, don't use it --frothT 20:44, 23 February 2007 (UTC)[reply]
If you absolutely must use Kazaa, and not some other file sharing platform, use one of the modified clients that has the malware stripped out, such as Kazaa Lite. SubSeven 21:02, 23 February 2007 (UTC)[reply]

Does my dream laptop exist?[edit]

I've been searching with no success. I figured if anybody could help me, it'd be you guys. I'm looking for (and I may be getting the technical names here slightly off, but hopefully it's somewhat clear) a ~15inch non-Apple laptop with a Core Duo ~2Ghz processor, a hard drive of 150+ gigs at a high clock speed (hopefully 7200ish), good resolution, great internal speakers, 2 gb of memory, a DVD burner, a battery that can last ~3-4 or more hours, and nice, sleek (as in simple, like Macbooks or the Voodoo Envy, not fancy gamer-looking like Alienware or the Dell XPS.) I couldn't care less about graphics cards or gaming potential. I just want a computer that can deal very well and quickly with lots of non-game stuff and multimedia and is very portable. Not a Mac. Hopefully for $3000 or less. Impossible, right? Is there anything that comes to any of your minds, or anything that comes close? If I wait half a year, are my odds of finding something this good going to increase? 70.108.199.130 04:40, 23 February 2007 (UTC)[reply]

Checking the standard places like Newegg.com will probably get you a better answer than asking here. This system looks similar to your specs. It is true that you'll be able to get more bang for your buck if you just wait 6 months, but that will be true in 6 months, too. :) --TotoBaggins 15:32, 23 February 2007 (UTC)[reply]
Well there's my computer, which fits those specs exactly and only cost about $2000. Try the ThinkPad T series. You can probably find identical specs for a lower price from another manufacturer though; thinkpad is a notoriously-expensive famously-good line of products. --frothT 20:39, 23 February 2007 (UTC)[reply]
Sorry, but "great internal speakers" is an oxymoron. Other than that try an assisted search such as Pricewatch. look for a machine that can run Linux. -Arch dude 02:20, 25 February 2007 (UTC)[reply]
Dell Inspirons (at least my 9300) comes with two tweaters and a built in mini subwoofer. I think it sounds pretty good.--Russoc4 22:11, 25 February 2007 (UTC)[reply]

Copyrighting a programming language[edit]

Is this legally kosher? For example, if I wanted to create my own free implementation of a programming language which was claimed to be copyrighted, would I be violating copyright?

  • On an ethical level, Id have said so - the person who created the language was given copyright for a reason, to defend against unauthorised copying, regardless of you not making profit from it, all your doing is taking revenue away from the copyright holder.
I would refer you to the wikipedia article on copyright which should help as it depends which country you live in as to the laws and how they are enforced by a Court. --PrincessBrat 12:00, 23 February 2007 (UTC)[reply]
You can't really copyright a language, since you have to copyright a specific work, while a language is an infinite set of acceptable works. You can't, for example, write a BNF grammar, and then declare that you have copyrighted all strings accepted by that grammar. That said, the law is not logical, so you should consult a lawyer. I personally would not touch a "copyrighted" language with a ten-foot clown pole, as any company that makes that claim is likely to be populated by dicks. --TotoBaggins 15:39, 23 February 2007 (UTC)[reply]
[edit conflict] You can't copyright a programming language. You can copyright its specification (but that only prevents people from duplicating the specification), and you can copyright an implementation (typically a compiler or interpreter: then people can't duplicate or modify-and-distribute those), and you can copyright any support structures, like standard libraries, so that people can't link them into their programs and distribute the result. (Obviously, any of these could be done partially by granting a license to copy this part of the specification and not that one, or link to the libraries for non-commercial use, or whatever.) But you can't copyright the language itself, and the mere fact that my compiler can compile the same things that your compiler can does not in any way infringe on your copyrights on the compiler itself. You can (in some jurisdictions) patent the algorithms used by the compiler or by built-in functions in the language, but if I can find a different way to implement them (or there exists prior art for them) I'm in the clear there as well. Finally, you can trademark whatever names you want in regards to their use with the language, but I can still write the compiler: I just can't market it as "The Official FooLanguage Compiler". (I can market it as "Tardis' compiler for the FooLanguage language", since that is use of the trademark as a name not as a brand.) However, you can't, for instance, trademark the names of the built-in functions in the language and so prevent me from implementing them by claiming that it would infringe the trademarks: see Sega v. Accolade. This very limited control over a standard of information is a good thing: without it the competition between compiler vendors would be totally based on locking customers into their language rather than implementing a common, useful language in the most effective way possible. --Tardis 16:20, 23 February 2007 (UTC)[reply]
Depending on the claims granted in a given patent, finding additional implementations may not get you outside the patent. If I patent the idea of "sending backwards text across the internet" then I've patented that thing in any implementation (you'd be infringing if you had anything which did that, no matter how it did it). This is but one of the many reasons that software patents are evil. --24.147.86.187 02:07, 24 February 2007 (UTC)[reply]
Patent law is crazy. I ran across one that patents the automatic control of master / slave PATA on 2 drives to give different combinations of boot OS. That idea is common sense to any engineer (or even Geek Squad employee).172.146.58.73 08:42, 26 February 2007 (UTC)[reply]
Yes, if you came up with some new programming-language feature deemed novel, then you can patent it in jurisdictions that allow software patents. For example, if you had been American and the first person to invent object-oriented programming, then you could probably have patented it. However, with regards to the question at hand, the claim of copyright is most likely over the compiler, interpreter, or IDE. A free reimplementation in that case ought to be fine. --Delirium 10:34, 26 February 2007 (UTC)[reply]

Google Adwords, but for adult sites[edit]

Suppose you want to run an Adult site. Text and images, but no movies. Profit isn't your main motive-- so, a "pay-for-access" site is off the table. That said-- it would be nice if you could at least be break-even-- i.e. having unobtrusive banner ads that could at least page for the domain name, hosting costs, and bandwidth. And in the unlikely event that that your site became super-popular, you would like _you_ to be the one to maintain ownership of the site-- rather than putting it up on some some adult-oriented version of Geocities.

I'm a computer geek by nature, and I've been setting up websites for as long as there have been webrowsers. But I've never had to try to set up adult-site banner ads or the like. Normally I'd just do Google AdSense in a situation like this, but they explicitly forbid sites that contain pornographic content. Is there anyone like AdSense, but open to adult sites?

(While I'm asking, I'd be open to host recommendations). Wouldbewebmaster 12:49, 23 February 2007 (UTC)[reply]

I would just go to any other adult site, and see where they get their sleazy ads from. You are not going to get corporate ads, like salmonella peanut butter; they have a reputation to uphold! --Zeizmic 12:59, 23 February 2007 (UTC)[reply]

programming langauges[edit]

i was thinking of starting my own little home project to a help my programming skills and b help me learn all these dam confusing maths equations. basically i want to create a program where i can put in various initial conditions and viola i can create my own solar system. so does any1 one know a good language to try this in. i want to start it from the beginning so i'm really just looking for a good mathematical language that has some end user graphic capability's--Colsmeghead 14:31, 23 February 2007 (UTC)[reply]

Any general programming language will be able to express the sorts of equations that you're talking about. If you're a new programmer, I'd suggest using something that will let you focus on the math at hand, rather than external complexities. I'd suggest Haskell (programming language), Python (programming language), Perl, or Java (programming language), as they're all nice and understandable languages, in active development, with good libraries, documentation and communities to help you along. Those latter items tend to be more important than the intrinsics of the language itself. --TotoBaggins 15:46, 23 February 2007 (UTC)[reply]
I'd suggest Java. --h2g2bob 18:11, 23 February 2007 (UTC)[reply]
Many people will go, "Oh no! Not Java!". It is good to start because you can learn all the C/C++ syntax without learning about memory management. Once you have Java down, it is much easier to make the jump to C/C++. --Kainaw (talk) 18:17, 23 February 2007 (UTC)[reply]
If you go for C (or C++) then the Allegro library is a good way to do graphics. --h2g2bob 21:01, 23 February 2007 (UTC)[reply]
It was probably meant seriously and I can see some advantages to the suggestion, but I'm still chuckling that TotoBaggins recommended Haskell as a good place to start for a programming newbie. --Delirium 10:32, 26 February 2007 (UTC)[reply]
Unless you want to learn a programming language for the sake of learning a programming language, I would suggest something like Matlab or Maple instead. Those are programming languages, but they're equation-oriented. Because with a language like Java, you'd have to implement all the functions and graphics capability yourself, or find a library that does it all. ColourBurst 16:39, 2 March 2007 (UTC)[reply]

I understand that the Unix command at mails the output of the job to the user who scheduled it. What does it do if the system has no email system? Thanks. --87.194.21.177 15:51, 23 February 2007 (UTC)[reply]

Two possibilities:
  1. The system has a rudimentary email system (typically installed by default), but it is not configured to actually be able to send mail. The email notifications which at attempts to send therefore bounce. root's local mailbox, probably /var/spool/mail/root, fills up with these bounce messages.
  2. The system has no mail software installed at all. When at attempts to email a notification, it gets the equivalent of "no such command: mail". That error message probably gets logged to a log file, but the scheuled job probably runs successfully.
When I just can't get email notification for at and cron jobs to come through correctly, I often redirect the job's output to /tmp/my_at_job_output, or something, for debugging. --Steve Summit (talk) 16:12, 23 February 2007 (UTC)[reply]
Another choice is to send it to syslog, as below. --TotoBaggins 16:28, 23 February 2007 (UTC)[reply]
$ at now
at> echo "this is my job" | logger -t atjob 2>&1
at> ^D
job 3 at 2007-02-23 11:20
$
$ tail -1 /var/log/messages
Feb 23 11:20:40 mymachine atjob: this is my job

xbox 360[edit]

The bandwidth of the 'northbridge' is quoted at about 20GB/s xbox 360, yet each processor runs at 3.2GHz and the length of a PowerPC instruction is 4 bytes? 3.2x4x3=38.4GB/s - almost twice as much - can someone explain the discrepancy to me.87.102.43.239 16:57, 23 February 2007 (UTC)[reply]

I'm no expert but nothing ever runs at full operating power so maybe 20 gb/s was on average or perhaps there some extra error check codes sent as well that take up some bandwidth?--Colsmeghead 17:30, 23 February 2007 (UTC)[reply]

The northbridge, and everything else outside of the CPU, will often run slower than the processor itself, which is why there are various levels of cache memory closer to (or integrated with) the processor. Locality of reference allows the caching to be effective in keeping the CPU from being too I/O bound. --TotoBaggins 17:48, 23 February 2007 (UTC)[reply]

The processor will not fetch instructions all the time. Looping is extremly common, so it will not need to fetch nearly as many instructions. The ones it fetch will be in the instruction cache, so they will not need to be fetched again within the loop. --cesarb 18:37, 23 February 2007 (UTC)[reply]

Well, the instructions are fetched, they just (hopefully) exist in convenient cache. It's not just loops, either. Branch prediction, OOOE, and similar concepts are absolutely crucial for making deeply pipelined superscalar architectures perform well. This is why you typically see cache hit rates in the 99.9% range; main memory access is such a slow and costly operation. -- mattb @ 2007-02-24T17:32Z

Thanks for your replies - which I found useful.87.102.3.88 17:54, 26 February 2007 (UTC)[reply]

Lempel-Ziv-Welch compression algorithm example on Wikipedia (moved from Math ref desk)[edit]

in the example shown on page 3 of http://en.wikipedia.org/wiki/LZW could you explain why during encoding the first 5 sysmbols of the string TOBEORNOTTOBEORTOBEORNOT# a 5 bit output code is used and then 6 bits are used to encode the remaining symbols. Why aren't 6 bits used at all times. How does the decoder know that it is only the first 5 symbols that are using 5 bits? --anonymous

The answer is on the page, if you know what to look for:

In order to keep things clear, let us assume that we're dealing with a simple alphabet - capital letters only, and no punctuation or spaces. [...] The # is a marker used to show that the end of the message has been reached. : Clearly, then, we have 27 symbols in our alphabet (the 26 capital letters A through Z, plus the # character). A computer will render these as strings of bits; 5-bit strings are needed to give sufficient combinations to encompass the entire dictionary. As the dictionary grows, the strings will need to grow in length to accommodate the additional entries. A 5-bit string gives 25 = 32 possible combinations of bits, and so when the 33rd dictionary word is created, the algorithm will have to start using 6-bit strings. [2]

Basically, we set 27 basic symbols to the first 27 five-bit strings, which leaves 5 more five-bit strings open for the start of our dictionary. After that, we need to go to 6 bits, because five bits won't hold any more strings. As the decoder also knows the alphabet being used, it can calculate this.
Conceptually, the decoder "know[s] that it is only the first 5 symbols that are using 5 bits" in the same way you know that 10 is the first number that uses two digits. After 9, the only way to write the next number (in the decimal system) is 10, so you move to two digits. You could have written the previous numbers with two digits, but there was no point. Why write "09" when "9" will do? --FunnyMan 20:08, 25 February 2007 (UTC)[reply]

Vista user icon[edit]

Does anyone know how to turn off that user icon in vista? In XP you could use TweakUI to take it out of your start menu and you could disable the welcome screen to get a more professional looking login, but I don't see any option in Vista to turn it off. The icon sticks randomly out of the otherwise-greatlooking start menu and it would look a lot better without it. Also my "This computer is locked" screen is dominated by this ridiculous icon- but it would look great without it.

Does anyone at least know what registry key that TweakUI for XP changes to turn off the icon in the start menu? (Regmon could find this.) The same key might still work in Vista --frothT 21:13, 23 February 2007 (UTC)[reply]

XSLT Gurus?[edit]

Given...

<element>special fruit name</element>

... is there a way to get

<element type="apple">
  <apple>.....</apple>
</element>

or

<element type="orange">
  <orange>.....</orange>
</element>

That is to say, I can determine the type, but I need to grab the child element's name from the result XML. Is that possible? One thought I had was to run the output XML through a second XSLT to handle this, but I'd really rather do it in one transformation. Thanks! --207.216.243.201 21:32, 23 February 2007 (UTC)[reply]

Ah, found my own answer.

<xsl:variable name="fruitType">apple or orange</xsl:variable>
<element type="{$fruitType}">
  <xsl:element name="{$fruitType}">.....</xsl:element>
</element>

Thanks anyway! --207.216.243.201 21:46, 23 February 2007 (UTC)[reply]