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

From Wikipedia, the free encyclopedia
Computing desk
< February 11 << Jan | February | Mar >> February 13 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


February 12[edit]

"telephone" character[edit]

I saw a "telephone" font-character once in a Wikipedian's signature; it was actually the shape of a rotary-style phone. Is that a Unicode character? And what's the code to recreate it without tracking it down and rigorously copying and pasting? --128.113.149.103 00:12, 12 February 2007 (UTC)[reply]

U+260E () and U+260F () are symbols for black and white telephones, respectively. See Miscellaneous Symbols. --Spoon! 00:21, 12 February 2007 (UTC)[reply]
Whilst it is a Unicode symbol (as Spoon correctly states) you might find that it doesn't display in a number of browsers or operating systems. The alternative may be to use a symbol from a font such as Wingdings (although note that this may also not work on some systems - if that font isn't installed) UkPaolo/talk 20:53, 12 February 2007 (UTC)[reply]
'(' (left parenthesis) is a black telephone in Wingdings. I don't think there's a way to use alternative fonts on Wikipedia though, if that's where you're planning on using it. — Matt Eason (Talk &#149; Contribs) 21:53, 12 February 2007 (UTC)[reply]
There is a way to use alternative fonts, but it's not recommended; not everyone has Wingdings, for instance. See That mysterious J for an example of how using font-specific characters instead of the correct Unicode codepoint can cause problems. --cesarb 00:06, 13 February 2007 (UTC)[reply]

External harddrive[edit]

I have an USB-connected external hard drive. If i back-up all my files onto it, will I be able to boot and run my computer from the external hard drive if someday my internal hard drive malfunctions? If so, is there any additional procedures I must undertake for this to work? Thanks. Jamesino 02:15, 12 February 2007 (UTC)[reply]

No. Also it's a bad idea so you don't want to undertake any procedures --frothT 03:00, 12 February 2007 (UTC)[reply]
Yes you can do that, if your BIOS supports it. Well it's not as much of a "bad" idea, just that it is gonna be slow. External harddrives are quite similar (and in many cases the same) to internal ones. --antilivedT | C | G 04:34, 12 February 2007 (UTC)[reply]
Oh yeah if by copying all your files you mean copying the MBR is well, then yes. Otherwise you will need to install a bootloader first. --antilivedT | C | G 04:35, 12 February 2007 (UTC)[reply]
Actually, it's not just the BIOS that has to support it, but also the operating system (which has to read part of itself from the disk). The operating system also has to be able to find which disk it's booting from without getting confused. --cesarb 14:42, 12 February 2007 (UTC)[reply]
Yes but that "confusion" is pretty easy to eliminate by chainloading and remapping device names --frothT 19:56, 12 February 2007 (UTC)[reply]

Wireless Routers ?[edit]

My ISP (MTNL, India) provides ADSL internet connections. With the package, they also provided an ADSL Router to me. Now, what I am supposed to do is, take the jack of my phone line, put it in the router, and connect the ethernet/usb to my computer. That works just fine. However, I wish to make this a wireless connection. I have heard a lot about "Wireless Routers", but I cannot find any details on them. Are they compatible with ADSL ? Or I still need to keep my ISP's router ? Also, my desktop pc has no provisions for wireless internet, from the hardware side. So, will the wireless router have ethernet ports as well, to provide for the older desktop pc ?

Thanks ! --RohanDhruva 03:22, 12 February 2007 (UTC)[reply]

You'll need to buy what is commonly sold as a "wireless router". Some of those have an integrated ADSL modem and you will probably be able to discard what your ISP sold you. Alternatively, with can buy one without it and connect the "ADSL router" to the "wireless router", usually via Ethernet, but some also provide an USB interface. I don't know if you really meant your ISP sold you a wireless router (which I take as having NAT functionality) or if it just a modem. In the former case, you may get into some trouble because you would be behind two NAT boxes. Most of the wireless routers will have extra Ethernet ports, usually 4 (with the ASUS WL-330g being a notable exception), so you would be able to connect your desktop. --Cataphract 03:52, 12 February 2007 (UTC)[reply]

You could run into problems here. I would suggest that you use this great resource and read up on router, etc. You have to assess exactly what you have before you can move on. --Zeizmic 13:32, 12 February 2007 (UTC)[reply]

Assuming the box from your ISP is a modem rather than a router, you should just be able to buy a wireless router, connect your modem to it, and then connect your computer to the router. As Cataphract says, the majority also support wired connections (via ethernet) as well as wireless. If the box from your ISP is a router, as you state, then you should be able to buy a wireless router with an integrated ADSL modem. You would connect this directly to your phoneline, eliminating the need to connect the box from your ISP. If the box you have is a router, connecting it to a wireless router could cause problems... UkPaolo/talk 20:56, 12 February 2007 (UTC)[reply]

Figure out checksum[edit]

Hi, I need to figure out how a checksum is made. An UDP data field has two bytes for a checksum, a x0A byte, a byte with the length of the rest of the data, and the then an arbitrary sequence of alphanumeric characters (let's call this sequence X)

Example (hex): 6D 85 0A 61 (X = "a", in this case, because a=x61)

I've captured the following checksums (hex), function of X:

X	1st B	2nd B
a	6D	85
b	6E	86
c	6F	87
1	3D	55
2	3E	56
aa	CF	5B
ab	D0	5C
ca	D1	5F
cb	D2	60
bb	D1	5E
wv	FA	9C
ww	00	9D
aaa	36	94
baa	37	97
caa	38	9A
bda	3A	9F
aaaa	98	35
baaa	99	39

It's easy to see that incrementing by 1 any of the characters of X will increment by 1 the first byte and by y the second byte, where y is the position of the changed character, counted from the end. The 'wv'->'ww' example also give an idea on how it "resets" the byte. I can't, however, find the general rule and help on that direction would be appreciated. Thanks --Cataphract 03:32, 12 February 2007 (UTC)[reply]

Our User Datagram Protocol article has a copy of the general rule. --cesarb 13:38, 12 February 2007 (UTC)[reply]
This is not the header checksum. It's implemented on the application layer, I think. For instance, if I understand correctly, the UDP header checksum is calculated by arranging the octets in pairs and then summing those pairs. A brief glance on these checksums is enough to realize this method is quite different. --Cataphract 15:39, 12 February 2007 (UTC)[reply]
Sorry about that. I just found out the rule for the first checksum byte: it's the sum of all the characters, plus the string size, modulo 251. Note that the initial 0x0A is part of the string. Now I'll take a look at the second checksum byte. --cesarb 20:09, 12 February 2007 (UTC)[reply]
The way the second checksum byte increments suggests some variation of Fletcher's checksum. I still do not know the exact formula, however. --cesarb 20:20, 12 February 2007 (UTC)[reply]
I found a simple (Fletcher-style) algorithm which fits all the data except the "bda" one. Are you sure you didn't mistype the checksum value for it on your table above? Here's the algorithm (in Python):
def csum(s):
	a, b, n = 0, 0xc, 0
	for c in s:
		a = (a + ord(c) + 1) % 251
		b = (b + a + n) % 251
		n = n + 1
	return a, b
Don't forget to include the initial 0x0A byte in the string. --cesarb 21:53, 12 February 2007 (UTC)[reply]
Yes, you are right, the second byte is 0x9D. I also made a mistake in the example, it should read "6D 85 0A 01 61" instead "6D 85 0A 61"; the length is included. So if we take the whole string, length included, we can write the simplified:
def csum(s):
	a, b = 1, 1
	for c in s:
		a = (a + ord(c)) % 251
		b = (b + a) % 251
	return a, b
Thanks a lot for your help. --Cataphract 22:59, 12 February 2007 (UTC)[reply]

Converting .tar.gz TO .exe Executable Installer[edit]

  • Tar (file format) (article) states it has an extension of .tar and is contained by (article) Gzip, which gives extension .gz.
  • In article SourceForge you will see that many developers make open-source softwares.
  • I downloaded one, but it had an extension of .tar.gz and I want to convert it to an Installer type .exe. Can some one help me out in this matter? And is there a free software that automatically does this for you? --Maclean1 04:02, 12 February 2007 (UTC)[reply]
You can't. It doesn't make sense. A tar.gz is just a compacted bundle of files. An installer type .exe is a program that installs something (usually another program). Maybe you mean a self extracting archive? --Cataphract 04:19, 12 February 2007 (UTC)[reply]
I think he meant compiling the source code inside the tar file and make an executable. Anyhow, it is too complex for you to do that in Windows (I don't think it's just ./configure&&make&&make install in windows) and you should just download the binary in the first place. --antilivedT | C | G 04:31, 12 February 2007 (UTC)[reply]
I want to install the software to my Windows XP Computer. Please Help. I am Computer Savvy. --Maclean1 04:41, 12 February 2007 (UTC)[reply]
Good! Being computer savvy will help. Your best bet is to check the downloads area of the web site, and if they have a version that says something like "Win32 binary", get that. There is no way to automatically turn a .tar.gz file into a windows executable. You might also look into the Cygwin Unix-like environment for Windows if you're feeling exceptionally savvy. Good luck! --TotoBaggins 05:07, 12 February 2007 (UTC)[reply]
Most of the SourceForge projects do not have Win32 binarys. --Maclean1 05:23, 12 February 2007 (UTC)[reply]
This is because free software culture, including SourceForge, has a stronger following among Unix people than Windows people, for various reasons. Your options are: Cygwin, install Linux or similar, or just seek out whatever free software is available for Windows. --TotoBaggins 14:47, 12 February 2007 (UTC)[reply]
And I would really appreciate if some creates an article (not redirect) for Win32 binary due to its Top Importance. --Maclean1 05:27, 12 February 2007 (UTC)[reply]
EXE says all you need. A full article on "Win32 binary" would just be a dicdef. That is: "Win32 binaries are typically executables for Win32". Not too exciting, to be honest. The reason for unavailability of said binaries depends on which project you're talking about. Some of them are only designed for POSIX systems. Some are incomplete and have Win32 versions planned. Some are coded in interpreted languages. And there are a plethora of other reasons. -- Consumed Crustacean (talk) 05:40, 12 February 2007 (UTC)[reply]

Computing/IT[edit]

What fraction of a millimeter is a nanometer? mando

10^-6, that is, 1:1 000 000. See SI prefixes. --Cataphract 04:15, 12 February 2007 (UTC)[reply]

Windows Media Player[edit]

I upgraded to WMP 11 and for the life of me I can't figure out how to add a folder to the Library or add just a singular audio file to the library. Thanks in advance. Deltacom1515 04:15, 12 February 2007 (UTC)[reply]

Drag and drop.

Doesn't work. Deltacom1515 23:30, 13 February 2007 (UTC)[reply]

Yes it does, it works every time for me when I do it. Drag a supported audio file (don't bother expecting WMP11 to support OGG or something esoteric) from Explorer into WMP11. It may automatically categorize the file, so you might want to have a look around. If that truly doesn't work, then I have no idea what's wrong with it.

Intel 82845G chipset[edit]

Hello again im wanting to see if i can intall a 1GB DDR RAM module into the chipset described in the subject. I am unsure if it would work for my motherboard, However i do have a 2.4GHZ pentium 4. Would it be a good idea to install the 1GB module into that chipset if anyone happens to know about those chipsets/motherboard.--Biggie 06:37, 12 February 2007 (UTC)[reply]

Google shows that it's a graphics controller... It'd help most if you can give the maker and model of the motherboard, assuming that's what you're doing. --Wirbelwindヴィルヴェルヴィント (talk) 06:40, 12 February 2007 (UTC)[reply]

i look on device manager and click the system devices but im not sure which one of those devices is the motherboard. I need to know the keywords in that system device menu to figure which one is the motherboard.--Biggie 06:48, 12 February 2007 (UTC)[reply]

From the last 4 letters of the name of the graphics controller, Intel 845G is likely to be the name of your motherboard. According to the Intel Website, it can take 3 types of memory: Single Data Rate (SDR) 133Mhz, Double Data Rate (DDR) 200Mhz and DDR 266Mhz. The latter are also often referred to as PC1600 and PC2100. So, you should check the instructions with the memory module, and make sure that it operates at one of those speeds. Johnnykimble 19:11, 12 February 2007 (UTC)[reply]
One of my computers is an 845GL. That can take 1GB, i'm sure. The only difference between the G and the GL is that the GL has no AGP socket and doesn't support Hyperthreading. CaptainVindaloo t c e 19:25, 12 February 2007 (UTC)[reply]
I wouldn't recommend it from a strictly utilitarian POV - 512 is enough for anything but gaming in my experience, and if you're doing gaming, you might as well be saving for a new computer. --Wooty Woot? contribs 04:52, 13 February 2007 (UTC)[reply]
A 2.4Ghz isn't that bad nowadays, unless you're doing much gaming. That motherboard seems a bit subpar for a P4 chip though, if those stats are right. --Wirbelwindヴィルヴェルヴィント (talk) 09:56, 13 February 2007 (UTC)[reply]
2.4 P4 is what I have, and it's good for daily stuff, but if you're not doing gaming, shelling out bux for RAM is better than shelling them out for a video card, but probably not worth it. 256 is bad, 512 is good, 1GB isn't much of a jump from the computers I've used. I have 2GB and it helps BF2142 load faster but not MS Word or all the crap that starts up on boot. --Wooty Woot? contribs 20:38, 13 February 2007 (UTC)[reply]

Deleting Document History in MS Word - Office Professional[edit]

I posted this question yesterday but discovered today it had been deleted, without apparent explanation. If I am doing something wrong here, will the person responsible for deleting my post please have the Cojones to advise what the problem is? I am getting utterly fed up with Wikipedia for this and similar behaviours by some (though clearly not all) of it's "editors". I repeat the question here: I use MS Office Professional at home and whenever I open MS WORD I see a column on the RHS that lists a selection of previous documents that I may not want other household users to view. How can I empty or remove that list of saved or archived documents please? Thanks in anticipation.

Your question was answered above by SubSeven (it's about 11 questions up) - "You can disable the list. Go to Tools --> Options, select the General tab, and uncheck the Recent Files option." — Matt Eason (Talk &#149; Contribs) 12:02, 12 February 2007 (UTC)[reply]
As Matt says, your question was answered above, and at no point has been removed from the page. I appreciate there's a large number of entries on the page, but it would be nice if you'd assume good faith and check a little more thoroughly before complaining... UkPaolo/talk 20:52, 12 February 2007 (UTC)[reply]
In thanking SubSeven and UkPaulo for their assistance and comments above, I unreservedly apologise for any unintended and unjustified offence I may have caused. But I remain adamant that when I checked for any responses to the question I posed earlier, it HAD been removed - I checked and re-checked several times - hence my ascerbic comments above. And I make no apology for having reported similar mischief on this and other Ref Pages in the past - something that has been spiritedly reported and adversely commented upon (the mischief) by other disgruntled Wiki Users. But that said, thanks again.
Thanks for making the effort to say so! All the best, UkPaolo/talk 20:28, 15 February 2007 (UTC)[reply]

How to close an alert box from a script?[edit]

Hello! Can I somehow close an alert dialog box from my script, without user having to press OK?

Maybe there is some method, for closing it. I have a script auto-submitting some values through a browser window. It worked fine, but now the designers of the site changed it a bit, and the page that is shown after submitting the form, pops up an alert saying that data are accepted. So my script cannot proceed any further until the user clicks OK, and, since there is no user, the script is stuck on it. Can I close the box from my script (which is currently written on Visual Basic)?

Alternative approches that I can think of, can be: 1. Using HTML-filtering engine such as Proxomitron to filter out the alert code 2. Killing the browser application forcibly each time after submitting a form, and opening it again to procees the next one.

Any solution which is simpler and more straigt-forward than those, will be very appreciated. The browser is IE, but I can switch to any other if it turns out I can use it for this task. You might ask, why I don't just POST those data from a perl script without use of any browser. The reason is that I use some scripts from the page where the form is situated. If I did it without a browser, I would need to emulate those scripts.

Crocodealer 14:56, 12 February 2007 (UTC)[reply]

Then emulate those scripts, or try running your script from rhino. --frothT 17:00, 12 February 2007 (UTC)[reply]
I did it via Proxomitron instead. Crocodealer 15:25, 14 February 2007 (UTC)[reply]

How do I alter this code?[edit]

===Begin mediation===


The case name in the box must include Wikipedia:Mediation Cabal/Cases/. After that, put the current date, which is 2024-05-14. After the date, put a space and give the case a name.
Example: Wikipedia:Mediation_Cabal/Cases/2024-05-14 United States of America

Enter the name of your case as described above in the box, after "Cases/":


There will be about a 10 minute delay before your case is placed on the case list.
help

  • To make it an edit box to input a comment on my usertalk? Also I need it to be about 100px sq. Thanks in advance, --User:Darkest Hour

You can't. Those boxes are only for inputting the NAME of the page. Once they enter the name of the page, they can be taken to an edit page for that page, or that page can be filled with premade content. --frothT 19:54, 12 February 2007 (UTC)[reply]

You can't make it an edit box for use in adding entries to pages, I'm afraid. UkPaolo/talk 20:49, 12 February 2007 (UTC)[reply]

Portable Mac WEb Browsers[edit]

Are there any free portable app web browsers for Macs?

What about the Mac version of Firefox...? UkPaolo/talk 20:48, 12 February 2007 (UTC)[reply]

SPYDAWN Unwanted software[edit]

'SPYDAWN' Does anyone have any idea how to remove SPYDAWN software? It showed up on my browser and I cannot remove it. When I open internet explorer, instead of my normal homepage, it goes to this crap. Some sort of website touting spyware. Pop ups, a different tool-bar. A real pain in the arse. When I go to programs, and try to uninstall, it says it can't remove because it's in use. I believe it's a program designed to get me to purchase software to remove itself. Here is a virus, for 19.95 we'll remove it for you. Please, any info will help.

It's not something I've heard of but it sounds like spyware — try Adaware (it's a free download) or Windows Defender (from Micro$oft) to see if they can remove it. Otherwise, you could try a commercial anti-virus program like Norton Anti-virus... UkPaolo/talk 20:47, 12 February 2007 (UTC)[reply]
Use Spybot S&D, Ad-aware Personal Edition, and HijackThis if it's stubborn. Splintercellguy 03:02, 13 February 2007 (UTC)[reply]

lol, a similar thing happened to me twice. i tried first deleting all the files,then i uninstalled the program. Also, try booting into safe mode.

It is another fake anti-spyware program that display false security alerts to trick the user to buy the paid version of SpyDawn. Remove SpyDawn

These rogue anti-spyware programs never give up! Now I got SpyDawn. I found the SpyDawn removal instructions on the web, removed the files and uninstalled the program using the Add/Remove app. SpyDawn files I found on my c:\windows\system32: higehsg.dll, spydawn.exe, and xkrdk.dll.

How does wikipedia survive without captchas?[edit]

Given its high popularity, I've often wondered why there aren't spiders just spamming the whole site all the time. That seems difficult to defend against without captchas or required logins or anything. Anyone know why they leave us in relative peace (knock wood)? --TotoBaggins 21:00, 12 February 2007 (UTC)[reply]

Hmm... other users can probably give a better answer to this, but here's my thoughts. Firstly, unless we required a captcha to be entered for every edit (which would have a serious usability impact) then captcha's wouldn't be all that helpful (since anon IP's can still edit). That said, the ability to require a captcha when creating a new user account is built into the MediaWiki framework. I believe it is implemented on some of the other language Wikipedia's, and is automatically enabled on the en-wiki under particular circumstances (if it is deemed likely the server is being subject to mass signup). Seem to recall this was discussed somewhere at somepoint. Also, remember that administrators can block a particular IP (including the IP of a particular user). Thus, if a bot tried to spam the site, their IP would be rapidly blocked, and thus any spammer attempting this would need to be in control of a number of IPs (a botnet perhaps). Finally, I believe the server's do monitor their load, and take steps to automatically reject mass edits. As I said, other users can probably give a better answer, and I'd be interested to hear it — an interesting question! UkPaolo/talk 21:06, 12 February 2007 (UTC)[reply]
They don't leave us in relative peace. We have blocking of spammers (both IPs and usernames), blocking of open proxies, the Spam blacklist, anti-spam bots, a special page to search for links (to find other instances of spamming), page creation restrictions, protected page titles, and several other measures I don't know about, and we still get a lot of spam (of course, like with vandalism, most of it is quickly reverted). --cesarb 21:30, 12 February 2007 (UTC)[reply]

Editing large Wikipedia articles[edit]

Folks - Bit of a strange problem, which has been annoying me for a while! In recent weeks, if I attempt to edit a large-ish Wikipedia articles (nothing ridiculous, not even big enough to merit the "this is a long article" notice) I am unable to save or preview my changes. Basically the browser just hangs, and then times out before it gets a response - no error, it goes for quite some time before giving up. The problem is present using both Firefox and Internet Explorer 7 (I use Windows XP SP2 by the way). Also occurs when using AWB. The problem doesn't appear to be intermittent - whilst it's not always been the case, it always seems to be the case currently. At first I thought it was a Wikipedia problem, but it has gone on for some time now. What's curious is that on several occasions I have tried editing from behind an open web proxy (after eventually finding one that wasn't blocked!). There was no problem in editing in this way which is interesting, since it implies it's not a problem with my computer setup / firewall / router. I'm thus at a bit of a loss! It's not the end of the world, since I can edit individual sections OK, but it's a bit of a pain, particularly if picking a previous revision of an article, and attempting to save it. Anyone got any sensible thoughts? UkPaolo/talk 21:13, 12 February 2007 (UTC)[reply]

The fastest and easiest way to read binary data from standard input in c is....[edit]

Hi!

I'm about to do a homework in c. We are supposed to submit the code to one of the schools computers for evaluation. We have this time-constraint on us (your program is not allowed to execute forever), and there will be LOTS AND LOTS of data to read from the standard input. That is how the computer will test the program. It will provide the input through the standard input and evaluate the generated output on standard output to see if it is OK.

Here's my problem. As far I can see there are like hundreds and hundreds of ways to read from standard input and write to standard output in C. Which one of these are the easiest and best way? I want to be able to read in huge amounts of data (nr. of bytes in the order 10^6), process it, and generate output. I can recall some function like this: c.in << ... & c.out >> ...! But I'm not sure. Are those good?

Another question: My program will be working with the data in blocks of 128 bits. But is it a wise thing to write data to standard output A.S.A.P? I mean, shouldn't I make my own buffer in an array and write large chunks of data to standard output instead of small ones. I am afraid that constantly writing out small parts would require way too much overhead. Am I right, or is it even worse to save the thing in an array?

Any kind of answer will be appreciated! PureRumble 21:45, 12 February 2007 (UTC)

If you're in C, you don't have iostream, but rather stdio.h. The standard way of getting a single character from a stream is getchar(), and the standard way of writing one is putchar(); avoid such things as fscanf() because they do incur noticable overhead. Perhaps slightly more efficient for block data would be fread() and fwrite(), or even just (on Unix) read() and write(), bypassing C streams altogether. You certainly don't need to worry about more than a function call of overhead when writing out little bits of data because the I/O facilities (even just the kernel ones) will buffer your data quite reasonably. Finally, the amount of time required to read and write a million bytes is entirely trivial (think 50 milliseconds, even counting disk access for both input and output), and your computation time on that data is likely to be so small as to fit in during the disk accesses and add nothing to the total time. --Tardis 23:04, 12 February 2007 (UTC)[reply]
Well, you will want to limit the number of system calls you make. Every time you go to the disk your code stops and the operating system takes over. So, if you can limit the number of times you do this, that would probably help the most. So when you go out to disk, grab the whole file, if you can. If you can't at least grab an entire page.
Writing will be just as expensive as reading, in general. So save up as much as you can before making the system call.
The good news is that the C-library may do all of this for you. Reading the manpage for fflush() might be useful. Mdwyer 23:10, 12 February 2007 (UTC)[reply]
It's not quite true that "Every time you go to the disk your code stops and the operating system takes over." Except under extremely primitive operating systems like MS-DOS, a system call to read or write data "to disk" does not necessarily mean that the operating system is actually going to go out to disk. The OS may implement its own buffering, caching, readahead, and writebehind, and even if not, on a multitasking OS the actual writing (at least) can go on in parallel, as control returns to your program. See my longer answer below. —Steve Summit (talk) 02:13, 13 February 2007 (UTC)[reply]

Tardi, Mdyer. Thanks for fast reps! Mdyer, if I read you right you're saying that (a) reading in a block (16 bytes) with fread, (b) processing it and (c) writing out the generated block with fwrite before going back to (a) should be no problem since fread and fwrite do nice buffering for me, am I right? The amount of data to be taken care of is 16*10^6 bytes. What about reading in ALL of it in one giant array, processing the blocks one by one, and writing back all of the array at the same time when done? Does that sound crazy or just ingenious? Note: I have no idea if my input is lying on a file or if a program on the evaluating computer keeps feeding my program with input. PureRumble 00:00, 13 February 2007 (UTC)

It depends. At least on *nix, it's common for the buffering level to depend on where the output is going to[1]. If you want block buffering, you should use setvbuf to change it. Other than that, premature optimization should be avoided; you should only worry about it if your code is too slow, and even then, you should first find out where the program is being slow and optimize just that part. 16 million bytes is next to nothing for today's computers; reading and writing them should take a very small amount of time (I just timed it here, and it took less than a second using a 1000-byte block, and only 4 seconds using a very inneficient 16-byte block; the stdio buffering will make it more similar to the first case than to the second). It's much more probable that your own processing of the data will take more time. --cesarb 01:33, 13 February 2007 (UTC)[reply]
There are of course two ways to go about this. One is to do lots of research and try to predict which methods will be fastest; the other is just to try them and time them and see. Both approaches are valid, and they work well in combination: analysis can refine your testing and suggest new approaches, while testing gives the final, accurate-in-the-real-world answer you need, which no amount of analysis on a complex system can generally give you with accuracy.
In terms of research, it is important to understand where the I/O overhead really is, and which layers of buffering and other optimizations are already being performed for you automatically. As others have noted, C's <stdio.h> package reads large blocks of characters from the underlying OS and doles them out to you however you want, and it treasures up the characters you write to it until it has a large block, which it then writes to the OS all at once. Also, the OS may do its own buffering, and more. For example, Unix has always performed readahead and writebehind. When you write data to the OS, it isn't necessarily written to disk right away. (This saves time if you rewrite the same block of data several times.) When you read several blocks from the same file in succession, the OS may read the next block preemptively, guessing that you're probably about to ask for it. These strategies make a huge difference, although they can make it harder to predict or control exactly when the physical disk I/O will take place and how much time it will take. (Finally, I'm pretty sure that modern disk drives do all sorts of caching, readahead, and writebehind right down on the drive.)
Once upon a time, stdio was much more efficient than raw OS reads and writes as long as you were doing lots of little reads and writes. However, using stdio ends up meaning that characters are copied hither and yon an extra time or two, so for high-throughput applications, stdio's overhead can be noticeable. If you're reading and writing very large blocks of characters, it can be more efficient to go to the OS directly.
Besides the overhead of copying characters around, you also want to think about function call overhead. If you're processing data a character at a time, and if reading (or writing) a character involves calling a function which calls a function which calls a function, the function call overhead is going to add up and be noticeable. System call overhead is generally greater than function call overhead, so if you're writing and reading small chunks of characters directly to and from the operating system without using stdio or any other user-mode buffering, it can be much slower. (On the other hand, on modern systems, function call overhead and system call overhead are much less expensive than they used to be, so these factors don't matter so much, either.)
For the very highest I/O performance, you can use the Unix mmap() system call or something like it, to map an entire file into your program's address space using the processor's virtual memory hardware. This can really scream, although the advantage is not always as dramatic as it once was, because modern operating systems contrive to do something very much like mmap even when you thought you were doing traditional read- and write-based I/O.
Everything I've discussed so far pertains mostly to traditional C and Unix. If you're using C++, things are somewhat different. If you're using Windows, things may be very different -- I don't know anything about its I/O architecture.
But, as others have noted, much of this is academic, because a megabyte of data just isn't as much as it used to be. One thing hasn't changed, though, which is that if you want numerical answers as to what's fastest and by how much, you're eventually going to have to implement it both ways and see. (There are so many optimizations already going on automatically, beneath your control, that it's very difficult to predict.)
You may also find that the differences are not noticeable, after all. I once coded what I thought was a much faster version of a key function, and perhaps it was, but I had to run it inside of a loop, calling it 10,000 times, before the difference was large enough to actually be measurable. —Steve Summit (talk) 02:02, 13 February 2007 (UTC)[reply]
Use the system calls, Luke. —Preceding unsigned comment added by 203.49.220.190 (talkcontribs) 08:30, 13 February 2007
(Such as read() and write()). --Wirbelwindヴィルヴェルヴィント (talk) 09:52, 13 February 2007 (UTC)[reply]
If he's reading 16 bytes at a time, those calls are almost certain to be a loss. —Steve Summit (talk) 13:14, 13 February 2007 (UTC)[reply]

! W O O O O O W ! What can I say... you ask a question and you get complete essays as replies! Thanks to you all. My current strategy is big internal buffer (500000*16 bytes) and I read directly from file/program that provides input/whatever with write() and read()PureRumble 20:17, 13 February 2007 (UTC)

Just a Captain Obvious remark really, but don't forget to set the -O2 optimisation flag when you compile. Does nothing for read/write optimisation, but helps the rest of the code. --h2g2bob 13:58, 14 February 2007 (UTC)[reply]

Code alterations[edit]

How do I alter this code to either get rid of the lone box in the left hand corner? I am talking about the bottom tabs script for css. The "loner box is right under userpage or in this case project page. Here is the code:

/* bottom tab styling (not for IE currently) */
#mytabs {
    margin: -0.3em 0 0  11.5em;
    white-space:nowrap;
    line-height: 1.1em;
    overflow: visible;
    border-collapse: collapse;
    padding: 0 0 0 1em;
    list-style: none;
    font-size: 95%;
}
#mytabs .hiddenStructure { display: none; }
#mytabs li {
    display: inline;
    border: 1px solid #aaaaaa;
    border-top:none ;
    padding: 0.1em 0 0 0;
    margin: 0 0.3em 0 0;
    overflow: visible;
    background: White;
}
#mytabs li.selected {
    border-color: #fabd23;
    padding: 0.2em 0 0 0;
}
#mytabs li a {
    background-color: White;
    color: #002bb8;
    border: none;
    padding: 0.3em 0.8em 0 0.8em;
    text-decoration: none;
    text-transform: lowercase;
    position: relative;
    margin: 0;
}
#mytabs li.selected a { z-index: 3; }
#mytabs .new a { color:#ba0000; }
#mytabs li a:hover {
    z-index: 3;
    text-decoration: none;
}
#mytabs h5 { display: none; }
#mytabs li.istalk { margin-right: 0; }
#mytabs li.istalk a { padding-right: 0.5em; }
#mytabs-ca-addsection a { 
    padding-left: 0.4em;
    padding-right: 0.4em;
}
/* offsets to distinguish the tab groups */
li#mytabs-ca-talk { margin-right: 1.6em; }
li#mytabs-ca-watch, li#mytabs-ca-unwatch, li#mytabs-ca-varlang-0, li#mytabs-ca-print { margin-left: 1.6em; }


/* remove comment tags if bottom tabs should be rounded as well in moz */
/* #mytabs li, #mytabs li a { 
  -moz-border-radius-bottomleft: 1em;
  -moz-border-radius-bottomright: 1em;
}*/

It is really quite odd I ve tried a lot of stuff to it but it will not change. Any one with bottom tabs please help. For quick reference see: user:Darkest Hour/monobook.js and User:Darkest Hour/monobook.css. Thanks in advance, --Darkest Hour 23:01, 12 February 2007 (UTC)[reply]

  • Also is it possible to add the extra tabs that you get with the addtabs.js and the dropdown.css(antivandal tools)?
  • Okay I now am using the IE version. I also know the code that is creating the issue is:
#mytabs { 
  width: 100%;
  position: static;
    margin-left: 14em;
    white-space:nowrap;
    line-height: 1.2em;
    overflow: hidden;
    border-collapse: collapse;
    list-style: none;
    font-size: 95%;
}

I am now testing it on the other version to see if I can remove it. --Darkest Hour 23:40, 12 February 2007 (UTC)[reply]

:* Nope can someone use the Ie version and get rid of the lines? --Darkest Hour 23:46, 12 February 2007 (UTC)[reply]

email address book[edit]

Hi, I use Mozilla Thunderbird for my email. The problem is I recently had some sort of a catastrophic failure in my computer an I can no longer access that program on my computer. In order to fix the problem I will probably have to reinstall Windows, which in the past has always wiped my address book (very bad!!!!!) My question is, where is the information in an email address book stored? Also is there some way (via the internet maybe?) to log into my email account and retrieve all my previous messages and addresses before I reinstall Windows. Thank you! S.dedalus 23:29, 12 February 2007 (UTC)[reply]

Mozilla programs typically store your information in a "Profile", which is (with modern versions of Windows) probably in your "documents and settings" directory's "Application Data" subdirectory. Look for "Mozilla" or "Thunderbird", and copy the directory for your profile. You should then be able to overwrite the default profile created when you (re)install Thunderbird with your old data, and have everything the way it was. --Tardis 16:23, 13 February 2007 (UTC)[reply]

Speed utility[edit]

Hi, I was wondering, does anyone know of any utility program that allows to directly modify the speed at which an application runs? By that I mean, lets it run faster/slower than it is normally intended to, and that works on Windows Vista. I've seen a few of these applications around, but all of the ones I can find aren't compatible with Vista. Any help? Thanks.

Do you mean Overclocking? If not, can I have a link to another such program, just to see what you mean? ST47Talk 00:23, 13 February 2007 (UTC)[reply]
This guy has a lot of info on this, geared towards slowing down games. Droud 00:27, 13 February 2007 (UTC)[reply]
Thanks for the info, but I was looking for something specifically about speeding up applications, maybe I should've elaborated. Note that this has nothing to do with overclocking/performance, any sort of hardware limitations, I'm just trying to find a program that lets you run an application faster than normally intended.
What kinds of applications are you thinking of? Unless they contain explicit internal delays which normally slow them down but which might (somehow) be bypassed, there's no magic way to make code run faster, except by running it on a faster processor.
Thank you, this is exactly what I was looking for, "internal delay", thanks for the term. A program that is coded to run constantly at a specific speed, and what I'm trying to do is modify this speed. So, does anyone know of such a program?
You might be able to successfully fool such a program with a piece of software that manipulates the system timer, setting it 1 millisecond ahead every half millisecond. I've never seen nor heard of such a program. Droud 02:47, 13 February 2007 (UTC)[reply]
Does anyone know of the existence of such a thing? I would make something of the sort myself, but I'm not much of a programmer. Any help would be appreciated...
I found a resource on MSDN for you. Droud 04:02, 13 February 2007 (UTC)[reply]
(If you're on a multitasking machine, you can make one program run faster by running fewer other programs in parallel with it, or by giving it a higher scheduling priority, but I don't think you're talking about that, either.) —Steve Summit (talk) 02:18, 13 February 2007 (UTC)[reply]
Maybe SpeedGear (Google it) satisfies your needs. --Taraborn 17:42, 13 February 2007 (UTC)[reply]
I tested this application and it didn't seem to work on Windows Vista, unfortunately...or maybe that was just the program in question. Maybe there is no solution.

Update: I got such an application working, but unfortunately, all it could achieve was to slow down the program, I'm assuming it must have some sort of anti-speed up mechanism built in...ways around this?

If you know how to hack a binary program, you could edit the binary executable itself and replace the delay code with either nothing or NOPs. 4.242.147.169 00:49, 18 February 2007 (UTC)[reply]