Wikipedia:Reference desk/Archives/Computing/2008 April 4
From Wikipedia, the free encyclopedia
Computing desk | ||
---|---|---|
< April 3 | << Mar | April | May >> | April 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. |
[edit] April 4
[edit] C++ classes: supporting padding and preserving stream state
In C++, if I wish to print an integer width padding, I use cout << setw(10) << i;
. If I have a class whose printed representation should be "*42*" (for some value of 42), how do I write its insertion operator overload such that I may write cout << setw(10) << obj;
and get (for a two-digit number like 42) only 6 spaces of padding instead of 9? Moreover, how do I handle cout << left << setw(10) << obj;
, which would tend to put the padding after the first asterisk? I could hack something together with an ostringstream
, but I suspect there's a better answer. Perhaps it's somehow related to another question: what is the best way to restore a stream's state if, within an insertion function, one needs to, say, specify a radix for a sub-insertion? --Tardis (talk) 05:43, 4 April 2008 (UTC)
- For restoring a stream's state, try this Boost library. You might also be interested in Boost Format, which combines the type safety and extensibility of iostreams with the doesn't-suck of printf formatting specifications. --Sean 12:46, 4 April 2008 (UTC)
- Thanks -- Boost is awesome, isn't it? I (am fortunate to) rarely need precise output formatting, so I tend to design my entire IO formats based on "what iostream does with the least effort on my part". In other work, that might be a sadly insufficient choice, so I'm glad to have iomanip de-spookified that way. Moreover, I suppose my original question has been answered: if what boost::format does with a width is print to a string and then print the string with the width (though see more advanced width-processing in their Rational example), then surely that's the best I can do! Proof otherwise is nonetheless invited. --Tardis (talk) 13:51, 4 April 2008 (UTC)
[edit] Btech IT and BIT
what is the difference between Btech IT and BIT —Preceding unsigned comment added by 202.70.64.41 (talk) 13:08, 4 April 2008 (UTC)
- You're going to have to give us something more to work with - where are these organizations for one thing? --LarryMac | Talk 13:16, 4 April 2008 (UTC)
-
- Bachelor of Technology in Information Technology and Bachelor of Information Technology are probably what (s)he is talking about. Kushal 16:29, 4 April 2008 (UTC)
-
-
- To the OP:Please provide more information on what you want to know. It would help if you could be more specific and/or provide more details. Thank you. Kushal 13:06, 5 April 2008 (UTC)
-
[edit] Low-resource firewall for XP
Hi!
I'm currently installing windows XP on my MacBook, since I'm going to visit the DreamHack computer festival later this year. Since it's a LAN, and a good playground for hackers, I know I must have a firewall etc. The problem is that I need one that doesn't take all of my CPU etc, do you know anyone?
Thanks in advance! 90.231.145.160 (talk) 14:28, 4 April 2008 (UTC)
Windows XPSP2 comes with a built-in firewall that blocks unwanted incoming connections. Do you have it enabled? Kushal 16:25, 4 April 2008 (UTC)
[edit] Font size
Since I upgraded to Firefox 2.0.013 (using Mac OS 10.4.11) some web sites display in tiny fonts. But others remain as they were. How, please, can I up-size the tiny displays?90.9.83.53 (talk) 15:23, 4 April 2008 (UTC)DT
- Don't know what's causing your problem, but here's something you can try to deal with it: (1) Set a minimum font size to prevent the text on web pages from becoming too small (Tools->Options...->Content->Fonts & Colors->Advanced...->Minimum font size). (2) Install the NoSquint extension to enable per-site setting of text size. --71.162.241.83 (talk) 22:54, 4 April 2008 (UTC)
I can hardly believe the answer was right in front of me! Many thanks it was so frustrating.86.202.26.118 (talk) 14:23, 5 April 2008 (UTC)DT
[edit] Black and white photographs
Can black and white photographs or old film can be converted into color? For example by a computer algorithm which detects different shades of gray and converts them to their associated color. xxx User:Hyper Girl 15:30, 4 April 2008 (UTC)
- There's no automatic way to do this. A certain shade of red and another certain shade of blue, for example, will be the exact same shade of gray in a B&W photo. You can't "back out" that color information, because it just ain't there. It can be done manually, as described in Film colorization, pretty much the same as coloring in a line drawing in a coloring book. Some technological automation exists to help speed the process along if there are multiple frames, as in a movie. jeffjon (talk) 16:12, 4 April 2008 (UTC)
-
- In the old days, it was done by hand-tinting/hand-colouring the prints.
- There was also a brilliant photographer is Tsarist Russia who took three greyscale (what people mistakenly call "black and white") photos of each scene, one with a red filter, one with a green filter, and one with a blue filter. He reasoned that the three pictures could one day be combined into full color pics, which we have now done. Thus we have wonderful full color pics of Tsarist Russia: [1],[2]. Had an American thought of this approach, we might now have color pics of the Civil War and Abraham Lincoln. The only limitation of this method was that movement between when the three pics were taken would mess up the color, as in the girl in the lower left corner of this pic who apparently moved her head: [3]. StuRat (talk) 18:03, 4 April 2008 (UTC)
-
- Well, plenty of others knew that you could take monochrome photographs with lenses to capture different color channels (this approach goes back to the 1850s). The problem is combining them into a permanent photograph, and even our Russian friend Prokudin-Gorsky couldn't do that. The full-color photos of Tsarist Russia we have today are modernly produced from his negatives; he never saw them printed in color. --Captain Ref Desk (talk) 22:24, 4 April 2008 (UTC)
[edit] Bill Gates Quote
I have often heard that the Microsoft founder once was quoted as saying "who will need more than 640K of RAM". Is this an actual quote or an urban legend?24.224.215.10 (talk) 15:32, 4 April 2008 (UTC)Corpen
- A legend, at least if you believe Wikiquote. See wikiquote:Bill Gates#Misattributed, though I'm sure someone has more to say about this. --ÖhmMan (talk) 15:45, 4 April 2008 (UTC)
[edit] c# what is it?
So is c# typically compiled or bytecoded->interpreted like Java? —Preceding unsigned comment added by 194.223.156.1 (talk) 16:27, 4 April 2008 (UTC)
- C# runs on a "common language runtime", which would be equivalent to the Java Virtual Machine, it's interpreted. --LarryMac | Talk 17:20, 4 April 2008 (UTC)
-
- No, that doesn't mean it's interpreted, nor is Java interpreted either. The CLR-bytecode format, like the JVI-bytecode format, is just an intermediate language; prior to execution (and, increasingly, during execution too) that IL is translated into native machine language. Java, at least on desktop and server platforms, hasn't been interpreted for nearly a decade; C#, Java's kissing cousin, never has been. -- Finlay McWalter | Talk 17:56, 4 April 2008 (UTC)
-
-
- Calling Java (and C#) "bytecode-interpreted" is mostly accurate. A major complaint about Java is that you cannot compile your code to a standalone executable. You compile to get a "class" file which requires the Java Virtual Machine to run. C# compiles to an "exe" file, which gives the impression that it creates a standalone executable. Unfortunately, this is just a nasty trick. The exe produces is not a standalone executable. It requires C#'s virtual machine to run. Neither language (without third-party tools) compiles to a standalone executable file. As such, it is not possible to compile a program and send it to someone who does not have the virtual machine and expect them to run it. For some unknown reason, the Java and C# developers feel that standalone executables are a relic of the past and that everyone is eager to install a wide variety of virtual machines on their home computers. -- kainaw™ 18:01, 4 April 2008 (UTC)
-
-
-
-
- The questioner asked about whether the language is "bytecode interpreted", not about linking. Calling either C# or Java interpreted is not "mostly accurate", it's utterly false. Being dependent on external code does not make something interpreted. Not being compiled into an executable is not the same as being interpreted. A translator is not an interpreter, and neither is a dynamic translator. The term "bytecode interpreter" has a specific meaning, that the intermediate language is interpreted opcode by opcode by a software loop. C# is not bytecode interpreted, nor is Java. -- Finlay McWalter | Talk 18:18, 4 April 2008 (UTC)
-
-
-
-
-
-
- Actually, Java was originally implemented as byte code interpreted language. Later, JOT (Just On Time) compilers were developed that compile the byte code into machine code before executing the program. However, there is nothing in Java or C# language that would require using byte code. They can be compiled directly into native machine code just like any other language.
- Java and C# do not need any virtual machine if compiled into native code. However, they do need the runtime library. The idea with runtime library is that there is no need to link the same routines again and again with every application. Of course technically it would be possible to link the whole .NET library with your .exe file, but then the exe file size would be at least several tens of megabytes.
- --PauliKL (talk) 22:51, 4 April 2008 (UTC)
-
-
-
[edit] SQL Query.. how to exclude a character?
I want to write a sql query for viewing employees who don't have the letter 'a' in their first name.
I tried this query:
Select *
From Employees
Where [First Name] Like '%[^a]%'
then..
Select *
From Employees
Where [First Name] Like '[^a]%[^a]%[^a]'
then..
Select *
From Employees
Where [First Name] Like '%[b-z]%'
then, many other things..
but all in vain.. it doesn't give me the desired results.. any suggestions guys? Supersonic8 (talk) 18:05, 4 April 2008 (UTC)
- You mean they can't have an 'a' anywhere in their first name, right? How about this:
- SELECT * FROM EMPLOYEES WHERE [First Name] NOT LIKE '%a%';
- -- Coneslayer (talk) 18:31, 4 April 2008 (UTC)
- Thank you very much, Coneslayer.. It works.. Supersonic8 (talk) 19:10, 4 April 2008 (UTC)
[edit] to anyone who has worked with adobe acrobat: create a script to un-blank a form?
I am using Adobe Acrobat to create forms with interactive scripting in the forms.
I want my users to click a button before starting a form. The button is just their way of saying they agree to my terms and conditions before filling out the form.
Is there a way to make it so the pdf form looks completely blank every time they open the pdf, and stays blank until they click the "I Agree" button?
Thanks for any info NoClutter (talk) 21:00, 4 April 2008 (UTC).
- Sounds pretty ridiculous to me. I use the fantastic (FOSS) Sumatra PDF so that I don't have to put up with that crap. So be aware that people aren't necessarily clicking Agree. :D\=< (talk) 21:02, 4 April 2008 (UTC)
- I know this sounds low tech but what about a check box at the top of the form saying "I agree that by filling this form I am <list here>" ? Even better would be a small check box saying "Please read the pages 365-396 and mark your option in one of the the check boxes above. You must agree to fill this form." just below the header in page 1 of the form. However, I am pretty sure that what you want can also be done. Which version of Adobe Acrobat are you using? Kushal 21:24, 4 April 2008 (UTC)
-
-
- @Froth Frankly it is ridiculous, annoying too. I don't have authority on the operations though, I'm just the button-pressing IT guy that does what they tell me to do. So yeah, it sucks, but I gotta deal with it.
- @Kushal Acrobat 7.x. The checkbox is considered by the higher-ups to be an unacceptable solution because there's other stuff that gets put inside the PDF contingent upon them pressing the "magic button". In other words, they just want that button pressed before *any* interaction with the form is possible at all ... and they want that *every* time someone opens the pdf. NoClutter (talk) 22:17, 4 April 2008 (UTC)
- The higher-ups need to talk to the lawyers. Not legal advice, but my layman understanding is that they just need to include legal text that "by filling out and submitting this form you agree to..." The technical rigamarole will just make the PDF more difficult for your end-users, some of which might not have a version of Acrobat that could handle the button anyway. I say, kick it back up to them as a legal issue, not a technical one. -- Kesh (talk) 02:53, 5 April 2008 (UTC)
- Kesh, I don't know if "they" would be willing to talk about usability, much less legalese with IT. What you say makes a lot of sense. It seems plausible to divide the form up to two parts and hand the second part only when they are have "correctly" filled the first part. However, NoClutter does not seem to have much say in it. NoClutter, is there possiblity of a form on a webpage? (That would be really helpful. However, I doubt it.) NoClutter, if it is possible to do what Kesh says without risking yourself, please do so. Or try to push for a two part pdf solution. If the the participation in this form is not very big, it could even be manual. Kushal 13:35, 5 April 2008 (UTC)
- The higher-ups need to talk to the lawyers. Not legal advice, but my layman understanding is that they just need to include legal text that "by filling out and submitting this form you agree to..." The technical rigamarole will just make the PDF more difficult for your end-users, some of which might not have a version of Acrobat that could handle the button anyway. I say, kick it back up to them as a legal issue, not a technical one. -- Kesh (talk) 02:53, 5 April 2008 (UTC)
-
[edit] Flash player file association
I currently have the file extention SWF to open up with Internet Explorer. How do I set it so it would open up with Macromedia Flash Player instead? I tried using the "Open with..." option, but I couldn't find where the location of Flash Player was. Can anyone please help me with this?
Thanks in advance, 63.24.152.183 (talk) 21:54, 4 April 2008 (UTC)
- Flash Player usually doesn't exist as a stand-alone program unless you've got some of the Flash development tools installed. This could be your problem. --Mdwyer (talk) 22:01, 4 April 2008 (UTC)
-
- Oh well, thank you anyway. Aside from Adobe Flash CS3, are there any alternative programs (preferably freeware) that would allow me to open the SWF file with Flash Player? Thanks, 63.24.152.183 (talk) 22:58, 4 April 2008 (UTC)
- You could download a third party standalone player, such as this or this. D0762 (talk) 19:31, 5 April 2008 (UTC)
[edit] Firefox crash
Firefox keeps crashing when using for seemingly no reason and gives the following error:
“ | The instruction at "0x601142c7" referenced memory at "0x03e330a0". The memory could not be "read". | ” |
What does this mean? How does one "fix" it? NanohaA'sYuriTalk, My master 22:48, 4 April 2008 (UTC)