Wikipedia:Reference desk/Archives/Computing/2010 November 4

From Wikipedia, the free encyclopedia
Computing desk
< November 3 << Oct | November | Dec >> November 5 >
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.


November 4[edit]

Newsgroup / computer newbie type question[edit]

Having recently joined a couple of newsgroups (one is alt.usage.english) I have been happily posting. I type in MS Word, and then paste it into the newsgroup. What I would like to do is set up a blank MSWord document template so that it has exactly the proper margins, left and right, so I know that WISIWIG. That is, I know that my MSWord writing will appear just like that in the newsgroup, so I can make it look perfect. I don’t know where else to ask for help, as Google have discontinued their help desk forum. Any idea on how to do that?

Also while I’m here, I’m told that Google does not have the capacity for a sig file on newsgroup contributions. I don’t know why not, but I would like one on my posts. Any idea on how that could be done? Myles325a (talk) 04:23, 4 November 2010 (UTC)[reply]

Unless there has been a mighty change in how usenet works, newsgroups do not have any of the formatting you are concerned about. It is plain text. Google performs formatting based on common trends in newsgroups. For example, if I type _this_, Google will make it look like this. Margins do not exist. You are just seeing the text in the width that your browser allows. But, ignoring that this is based on a misconception... you want a document template. Open Word. Get the page set up just like you like. Save it as a template. In the save window, you will see types of files to save. Choose template. Then, next time you want to work, open the template and it will have all your formatting in place. -- kainaw 12:05, 4 November 2010 (UTC)[reply]
You can send encoded text, e.g. HTML. However it's considered very bad form in the vast majority of newsgroups (well I don't know any that allow it but I always say it's a bad idea to use absolutes). Nil Einne (talk) 20:08, 4 November 2010 (UTC)[reply]

Building a Storage Area Network Head - Operating System[edit]

Hello Everyone,

   I am exploring the option of building my own SAN head. I'm aware that a SAN head consists of a motherboard, processor(s), memory, a RAID controller, and a load of HDDs; but I want to know what software a SAN head runs on. I assume that it must have an operating-system which operates the management and assignment of LUNs to multiple hosts, and I want to know what software provides these functions (and whether there are any open-source SAN operating-systems available)?

   Thanks as always. Rocketshiporion 05:43, 4 November 2010 (UTC)[reply]

You can make a network accessible file system using Linux and NFS, FUSE/SSH, or SAMBA. Technically, that is a file server. Network-attached storage, storage area network, and file server differ in the "layer" that they provide. You'll have a hard time building a SAN out of commodity hardware and free software; and you probably won't reap the cost/performance benefits unless you are scaling to truly enormous enterprise sizes. As CPU costs decrease and performance becomes trivial, file servers are probably your best bet - let the remote system handle the file system details and provide the attached storage space at a high-level, as a network drive. Regarding specific software: you can run a NAS or file server using any Linux; BSD is popular; and FreeNAS is basically a pre-configured FreeBSD installation with fewer general-purpose features. The best choice ultimately depends on your needs. Nimur (talk) 06:12, 4 November 2010 (UTC)[reply]
You can build an open source SAN using technologies such as Logical Volume Manager (Linux) (to create and manage the LUNs) and a block device exporter (eg vblade or an iSCSI-target). Googling 'linux san' will give you various guides and distributions on how to set such things up. Whether you would want a SAN (exporting block devices) or a NAS (exporting file systems) depends a lot on your requirements. Unilynx (talk) 06:48, 4 November 2010 (UTC)[reply]

   The specific purpose is for four diskless computers to each be connected via iSCSI to its boot volume. AFAIK, it's not possible for computers to boot from a NAS or file server. The four diskless computers will also be clustered, and be connected to a shared LUN (which is also to be stored on the SAN). As for cost, all I really need (other than the operating-system) in terms of commodity hardware are; a motherboard, a processor, some RAM, a quad-port Ethernet card and a few SATA HDDs; which I estimate can be obtained for under $2,000. Rocketshiporion 13:05, 4 November 2010 (UTC)[reply]

BitTorrent[edit]

I was reading the article on it, including the part where it mentions that computers on the network that have full versions of the file are called seeders. That there's a special name for computers that have full versions implies that there are other computers that have pieces which would seem to be useless to them. Is having a bunch of pieces which are of no use to you (in addition to whatever full files for which you are a seeder) just the cost of being a reputable member of a swarm? 20.137.18.50 (talk) 13:35, 4 November 2010 (UTC)[reply]

A computer with only some pieces of the file can share those pieces with others, and vice versa. So even if there are no seeders at all, the various pieces across the swarm can account for the entire file and thus the entire file can still be downloaded. This is good because it means seeders aren't the only source for the file 82.44.55.25 (talk) 13:53, 4 November 2010 (UTC)[reply]
A main benefit of bittorrent is that while you are downloading a file, you can share the parts of the file you already downloaded with other people who are downloading it. Often, more people are downloading a file than there are seeders. So, most people only have parts of the file. As a courtesy, it is common to keep connected after you download a file, becoming a seeder. You no longer need any parts of the file, but you share what you've got for a while just to help others. -- kainaw 13:56, 4 November 2010 (UTC)[reply]
Nobody has files which are "useless" to them, because they are, presumably, interested in eventually downloading the entire file. So just because I have the last 25% of the file in question and not the first 25%, doesn't mean that the last 25% is useless to me (even if I can't "use" it for anything at this point), because presumably I'm hoping to get the entire file, and the last 25% puts me that much closer to that goal. Remember that people aren't just hosting because they are being generous — the entire point of a torrent is to distribute the file on all of the computers participating, including those who are participating in distributing it.
Seeders are special because they have the entire file yet are still distributing — thus they are being somewhat altruistic, because at that point, there is no personal gain to distributing the file (because the only "gain" in distributing is that you get a copy of it yourself). They aren't required but it greatly helps make sure there are redundant copies of the entire file on the network, which speeds things up (because maybe otherwise the only fellow who has on part has a very slow internet connection, thus introducing a bottleneck until others get that part... without seeders, it is not uncommon to see torrents "stuck" at 99%, never quite able to find that last 1%). --Mr.98 (talk) 14:06, 4 November 2010 (UTC)[reply]
I think there's a basic misunderstanding here, but I'm not sure where. When you join a swarm you have none of the file. While you're downloading you'll be accumulating pieces of the file. The pieces are not, on their own, useful to you because you want the entire file, but you can redistribute those pieces to people who don't have them yet. (Everyone downloads the pieces in a different order, so even if you've only downloaded one piece, you can still help people who are halfway finished.) Eventually, if you keep downloading, you'll have the entire, complete file. (You'll have all the pieces.) You are now a "seeder", and ideally you'll continue distributing pieces to people that need them, though that's not strictly necessary.
Unless there's a glitch, at no point will you download a 'piece' that you don't personally need to complete a file that you personally are trying to download. APL (talk) 15:17, 4 November 2010 (UTC)[reply]

does exist any c syntax that is forbidden in c++?[edit]

t.i.a. --217.194.34.103 (talk) 14:19, 4 November 2010 (UTC)[reply]

int new = 0; and many others. --Stephan Schulz (talk) 14:22, 4 November 2010 (UTC)[reply]
To clarify, C++ reserves some extra keywords. In C they would be valid as variable names or function names, but in C++ they are reserved for the use of the language. Here's a list of C++ keywords not reserved in C :
asm         dynamic_cast  namespace  reinterpret_cast  try
bool        explicit      new        static_cast       typeid
catch       false         operator   template          typename
class       friend        private    this              using
const_cast  inline        public     throw             virtual
delete      mutable       protected  true              wchar_t
APL (talk) 15:09, 4 November 2010 (UTC)[reply]
And this is valid C89, but not C++
int test()
{
   int i;
   i=1 //**/1;
   return i;
}
The code requires // not to be a comment marker, which is true for C89/C90 and older. However, the code is formatted for C99, which will reject it.
Also, in C,
  • The return type can be unspecified (defaults to int), must be specified in C++
  • The parameter-list can be 'void', must be empty if no params in C++ (which can mean K&R param passing in C)
  • K&R param passing is allowed (but discouraged)
  • The parameters to main can be what every you want - in C++ main must be on of
  • int main()
  • int main(int, char**)
  • int main(int, char**, /* any other params */)
  • In C void* can be implicitly cast to any pointer type; C++ needs an explicate cast. —Preceding unsigned comment added by Csmiller (talkcontribs) 15:27, 4 November 2010 (UTC)[reply]
CS Miller (talk) 15:24, 4 November 2010 (UTC)[reply]
See Constructs valid in C but not C++. --Sean 18:12, 4 November 2010 (UTC)[reply]
The article linked to by Sean is a very, very good starting point. For more differences, see Annex C of the C++ standard (ISO/IEC 14882:2003). For example,
int main(void) { return main(); /* valid (but useless) C, invalid C++ */ }
. Regards, decltype (talk) 05:20, 5 November 2010 (UTC)[reply]

hard drive[edit]

Can I leave my external hard drive on 24/7, or should I turn it off when not in use? My computers internal drive is on 24/7, is there a difference between internal and external ? —Preceding unsigned comment added by 91.193.69.210 (talk) 14:51, 4 November 2010 (UTC)[reply]

Most computers will put a drive to sleep if it is inactive for a period of time, so leaving the drive powered up is not itself a problem. Any drive will wear out over time (so always make backups) but for the most part drives will outlast computers, unless you keep your computer a long time or make heavy, heavy use of the drive (constant read-write action). --Ludwigs2 15:25, 4 November 2010 (UTC)[reply]
[citation needed] on the claim that "for the most part drives will outlast computers". Comet Tuttle (talk) 16:28, 4 November 2010 (UTC)[reply]
I'd read this as "computers get replaced before hard drives fail", not as "usually other components fail before the hard drive". But yes, a source for either interpretation would be nice. --Stephan Schulz (talk) 16:32, 4 November 2010 (UTC)[reply]
Depending on how you look at it, the MTBF of a hard disk (and all the other components) is less than the average time a computer is in primary use thanks to the software lifecycle. Greenpeace quotes a figure of 2 years for the average PC lifespan in developed countries, but this is not cited. Regardless, it's obvious by the tonnage of computers that show up in the landfill and the number that fly off shelves to replace them that the used life isn't that long. I would be shocked if it were more than 5 years in the US; most HDD warranties are as long. --Jmeden2000 (talk) 17:56, 4 November 2010 (UTC)[reply]
Again, please provide citations. This is a reference desk. Simply discussing warranties and the MTBF claims (which are notoriously exaggerated by the manufacturers) isn't evidence of anything. Comet Tuttle (talk) 18:48, 4 November 2010 (UTC)[reply]
But ah, we are not writing a scholarly article we are trying to come up with a useful answer to the question at hand. No offense, but his question is no closer to being answered as a result of putting [citation needed] next to every response. --Jmeden2000 (talk) 13:40, 5 November 2010 (UTC)[reply]
CT, relax. the point is that a hard disk is not going to unduly suffer by being powered on continuously, unless it is also subjected to extreme conditions (high levels of disk read/writes, excessive temperatures, etc). A hard disk is obviously more likely to fail than the computer itself (by virtue of moving parts), but hard disks are constantly increasing their lifespan through technological improvement, and the average consumer replaces his computer at regular intervals. The OP should not worry about it beyond the normal caution to maintain regular backups. --Ludwigs2 21:50, 4 November 2010 (UTC)[reply]
"but hard disks are constantly increasing their lifespan" - well, that's arguable. We have a batch in a large recording system over here where 20% per year are failing...big-brand, heavy duty server class drives at that. Hard drives are optimized for capacity, speed, price, and reliability, and I would expect priorities to be roughly in that order. --Stephan Schulz (talk) 21:59, 4 November 2010 (UTC)[reply]
All of the computers that I've had fail on me (2 of them) have been failed hard drives (well, I had a CD drive fail, but I still used the computer for a bit). There have been many more computers that I've gotten rid of before anything fails, but I would say that a hard drive, with mechanical moving parts, is one of the most likely things to fail on a computer. Interestingly this site says that power supply issues are the number one way to fry your computer. I've yet to have a power supply problem. Buddy431 (talk) 01:22, 5 November 2010 (UTC)[reply]
Here's a highly non-scientific poll of failing parts; storage drives have the plurality. Buddy431 (talk) 01:24, 5 November 2010 (UTC)[reply]

polynomial shift[edit]

I have the coefficients of a polynomial of one variable. I want the coefficients of the equivalent polynomial in terms of another variable (u=t+constant); in other words, the function that defines the same curve with a shifted origin. Before I reinvent the square wheel, is there a more efficient way than expanding and adding up the results? (Or better yet a numpy library function?) I'd search but I don't know the appropriate keyword. —Tamfang (talk) 17:11, 4 November 2010 (UTC)[reply]

You've got a function
f(x)=a0+a1x+a2x2+a3x3+ etc etc
and you want to know the b's in
f(x)=b0+b1(x-c)+b2(x-c)2+b3(x-c)3+ etc etc
then Taylor series will work (in many cases, in particular for polynomials) and gives you bn's fairly trivially, since
bn=(1/n!) x dn[f(x)]/dxn evaluated at x=c
Is that what you want - it's easier to implement (and quicker I think) than the expansion (especially when it's a long polynomial) , ask if you want pseudocode
(apologies if that isn't what you are asking, I'm a bit sleepy). I've given you two functions that give the same value for a given x? (on second thoughts it may not be any better than the binomial expansion, maybe, maybe not) 94.72.205.11 (talk) 20:35, 4 November 2010 (UTC)[reply]
Treating it as a Taylor series makes eminent sense; it may not be speediest but it's easy on the programmer, since I already have a "deriv" routine. Thanks. —Tamfang (talk) 19:45, 5 November 2010 (UTC)[reply]

Windows command prompt FOR loop[edit]

First, I am really sorry for clearing all previous information by accident. I don't know how it happened. Second, Does anybody have a solution for this problem? If I use the FOR loop under windows command prompt as in this example:

for /l %i in (1,1,10) do (@set x=%i
 @echo %x% , %i)

The result is:

)
10  , 1
C:\>(
)
10  , 2
.
.
.
)
10  , 10

Why does x always take the value of 10 rather than i?--Email4mobile (talk) 17:54, 4 November 2010 (UTC)[reply]

See this page for the solution. -- BenRG (talk) 04:46, 5 November 2010 (UTC)[reply]
So all I had to do was just set the local variable at the beginning as in this line:
 setlocal ENABLEDELAYEDEXPANSION
Thank you very much.--Email4mobile (talk) 09:03, 5 November 2010 (UTC)[reply]

How has this image been generated?[edit]

How has this image been generated? I understand that the "crisp" version on the left is simply a screen grab, but I'm asking about the "blurry" version on the right. The "blur" is, after all, only present in the real, analog world, and the computer's memory is completely oblivious to it. So therefore a screen grab would produce an identical copy of the version on the left side, regardless of what the image was viewed on. Grabbing it via the real world instead of straight from the computer's memory, in other words by photographing it, would very likely not produce such a pixel-perfect copy with only the "blur" effect, because various real-world details would induce minute differences. Is the "blur" effect merely a simulation added afterwards, or what magic has been used? JIP | Talk 18:56, 4 November 2010 (UTC)[reply]

I think you'd have to ask the person who made it to know for sure. I guess if someone took the left image, made the 3 colour layers into 3 separate layers (e.g. in gimp) and then moved one colour a pixel right, and another a pixel left) you'd get something like this. -- Finlay McWalterTalk 19:05, 4 November 2010 (UTC)[reply]
No, it's a more complex effort. I verified it with xmag, and it's not as simple as shifting one RGB channel left and another right. I've asked the original creator, User:NewRisingSun, about it. Let's see if he responds. JIP | Talk 19:49, 4 November 2010 (UTC)[reply]
The source code used to generate the image is on the image page. Does that help at all? --Tagishsimon (talk) 20:05, 4 November 2010 (UTC)[reply]
No. The source code is only usable for direct screen grabs. It has no effect whatsoever on the image quality, because after all, the program itself is a mathematical abstraction, and as far as it is concerned, the image quality is always 100% perfect. JIP | Talk 20:27, 4 November 2010 (UTC)[reply]
This is almost certainly a variant of what Finlay has suggested. Definitely generated by taking 3 slightly shifted (+/- 2 pixels) copies of the original image, possibly modifying them and superimposing them in some manner. So an attempt to digitally reverse engineer the imperfections of the analog world. 213.160.108.26 (talk) 23:34, 4 November 2010 (UTC)[reply]


The image was probably generated with an emulator like DOSBox or MESS, or a program that uses similar algorithms to emulate CGA composite artifacts. Read on for a little bit about how such an algorithm might be created.
To put the image in context for other responders here, it illustrates the color artifacts seen when the CGA adaptor is connected to an NTSC composite monitor, see Color Graphics Adapter - Special effects on composite color monitors. I myself was fascinated by the palette images shown a little lower in that section, and wondered how the patterns generated colors on the composite monitor.
Edit: Just to clarify, in the image shown above, the screen on the left is what you'd see on an RGB monitor. The screen on the right is what you'd see on an NTSC monitor. The CGA adaptor sends different signals for an RGB montor than an NTSC monitor, so it's slightly incorrect to think of them as a "perfect" screen shot and a "blurry" real-world simulation of the same image. The CGA adaptor is using the same video memory pixels to generate both signals, but the RGB signal is able to represent the color of each individual pixel, whereas the NTSC signal must use a color wave that ends up being four pixels wide. —Preceding unsigned comment added by Bavi H (talkcontribs) 02:06, 5 November 2010 (UTC)[reply]
Part of the answer requires you to know about how the NTSC composite signal works, especially the color burst and color encoding. I can't find a good description of the NTSC signal to link to yet. You can find information about how the NTSC signal works online, but you might have to read several different documents to get a good understanding of it.
The other part of the answer is knowing what signals the CGA adaptor sends on its composite output. Go to CRTC emulation for MESS and scroll down to the section "Composite output" for details about that.
Basically, for each CGA color, the CGA adaptor composite output generates a square wave shifted by a certain amount with respect to the color burst. In the 640×200 mode, the color wave is four pixels wide, so you can actually use groups of four black-or-white pixels to make your own color wave. If you shift the pattern by one pixel, you'll get a different hue. Here's an example I made with QBASIC running in DOSBox to help understand the order to the black and white patterns: cga-composite.png
In the 320×200 modes the color wave is two pixels wide, because the pixels are twice as wide. By carefully calculating where the CGA composite output color wave for each color is sliced and combined, then decoding the wave as an NTSC color signal, you can predict the resulting color on the composite monitor screen.
After studying this, I began to see how the colors are predicted, but didn't go far enough into the math to understand it all. (For example, I don't yet understand how a square wave is "seen" as a sinusoidal wave of NTSC color signal. Edit: Or how partial or irregular color waves become color fringes like those in the text-mode image above.)
--Bavi H (talk) 01:00, 5 November 2010 (UTC)[reply]
While researching this I also found Colour Graphics Adapter Notes - Color Composite Mode which has a zip file with images captured from an actual CGA adaptor (captured using a TV card with an NTSC composite video input). It includes image captures of the same palettes simulated in the CGA article above. In also includes image captures of Flight Simulator, which is interesting to compare to the Flight Simulator images on the MESS video emulation page linked above. --Bavi H (talk) 01:18, 5 November 2010 (UTC)[reply]

who's got money? How do I find an investor with vision?[edit]

I want to find an investor with vision, so that if I explain to them in a few words what I would like their money for, they will see that (or whether) it works. I don't want to waste my breath on people who wouldn't understand anyway! How do I find these people? If anyone here knows, they can also leave some contact information and I can ask them personally. Thank you! 84.153.205.142 (talk) 20:42, 4 November 2010 (UTC)[reply]

It depends entirely on the quantity of money you seek and what you plan to do with it. You can start by investigating bank loans and credit card advances. These organizations will happily lend you large sums of money, at market interest-rates, for you to use for almost any purpose. Nimur (talk) 21:47, 4 November 2010 (UTC)[reply]
Unfortunately, your request is unlikely to be handed to you like this, because human communication is more difficult than anyone thinks, and everyone has their own opinions about things like risk and how likely your idea is to succeed. Business owners' ability to raise money is a core requirement of being a business owner, for most businesses; and usually they have to pitch their idea and plan many, many times before an investor says "yes". Our article Angel investor has some links in the References section that may help you. Comet Tuttle (talk) 22:24, 4 November 2010 (UTC)[reply]
With the exception of people who already have a track record of building successful businesses, most inventors and entrepreneurs have great difficulty getting an angel investor even to speak to them. If they do, they mostly want to see a working prototype or a business that's generating revenue (Dragon's Den, for all its faults, isn't a bad indication of what angel investors are looking for). Tony Fernandes, who started Air Asia after seeing an Easyjet ad, mortgaged his house to pay for it. No-one was interested in James Dyson's ballbarrow, despite his having many working prototypes, so he mortgaged his house too. It took Ron Hickman, inventor of the Black and Decker Workmate years, and apparently about 100 prototypes, before he persuaded someone to market it; and Hickman had an impeccable record of design and engineering management, as the chief engineer of Lotus Cars he had already designed the Lotus Elan and Lotus Europa. Paul Graham (whose investment company Y Combinator is roughly an angel investor) has a bunch of what he/they look for when investing in new enterprises here. Several VC books I've read come to roughly the same conclusions: they invest in people (that is, people who have a proven track record of making stuff and getting things done) and in working product; some are pretty blunt in thinking that if you're still working at BigCo and haven't quit to work on the project yourself, to your own obvious cost and risk, then you don't believe enough in the thing, so why would they. -- Finlay McWalterTalk 23:09, 4 November 2010 (UTC)[reply]
Nice overview, Finlay McWalter! Almost the first question any investor will ask (or research) is "What do you have in it?" And the answer should include great amounts (by your personal standard) of time, money and experience. Bielle (talk) 23:21, 4 November 2010 (UTC)[reply]
Also as a minor correction but as mentioned in our articles Tony Fernandes didn't start Air Asia. He bought there then failing airline for a nominal sum and turned it around into an extremely successful budget airline. Nil Einne (talk) 09:20, 8 November 2010 (UTC)[reply]
The people I know who can drum up quick cash for projects use angel investors (as opposed to venture capitalists — the difference is the amount of money and control, angels being less in both, thus a bit easier to work with, they say). There are lots of sites that come up if you google "finding angel investors"; I've no experience in it (other than chats with friends who have made good on such things), so I can't tell what's good advice or not. I would note that exemplars (like those Findlay names) are not necessarily "normal" models — they are notable because they are rare cases for one reason or another. --Mr.98 (talk) 00:55, 5 November 2010 (UTC)[reply]
No-one (except perhaps a close relative) is going to give you wads of money in return for a "few words". You need to have a well-researched business plan. 92.29.112.206 (talk) 19:48, 5 November 2010 (UTC)[reply]
To add a quick note here and a twist on how difficult it is to get investment... and this is from personal experience. The people I went to with my partner didn't want to give us the money because they were concerned if either of us were hit by a truck that the business would not have a driver and would suffer. So make you go with a solid business plan as well as a backup plan, even for yourself, because the investor wants to avert risk too. Sandman30s (talk) 07:11, 9 November 2010 (UTC)[reply]