Wikipedia:Reference desk/Archives/Computing/2009 February 11
Computing desk | ||
---|---|---|
< February 10 | << Jan | February | Mar >> | February 12 > |
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 11
[edit]Programs on Linux (advanced question)
[edit]I am interested on something called SFS Technology and other similar software. I am trying to make "portable apps" on linux, (and this program can do that by creating a self-contained executable), my question is: What does a program needs to run on most distros? I heard the worse problem to make "universal linux binaries" is the different versions of libc and desktop environment libraries, So... if I put all the dependencies into one file + desktop environment + libc and essencial libraries, would the file run on most linux distros? the kernel would be the only think to worry about, right? But as long as it is a recent one, it should work, right? Hope someone can clear up my ideas. Thanks SF007 (talk) 00:43, 11 February 2009 (UTC)
- Every linux distribution I've come across uses a Package management system to install software. If you want your application to work on different distributions, all you need to do is define your dependencies and document them properly. The problem with trying to pack all of your dependencies into a single file is that those dependencies have dependencies - you'd have to pack the entire system into a file. --HughCharlesParker (talk - contribs) 09:28, 11 February 2009 (UTC)
- Statically linking your binaries seems like an easy way to do what you want. --Sean 13:50, 11 February 2009 (UTC)
Disable Auto-Paragraph
[edit]In Internet Explorer 7, when I click enter in a when editing a html form, it automatically creates a new paragraph. I know that I can press shift+enter to get it skip one line. How can I make it so that when I press enter, it automatically skips only one line? -Wiki131wiki (talk) 02:19, 11 February 2009 (UTC)
Tracing a virus to an IP
[edit]How may one trace a virus which has infected a computer to an IP or domainin Windows Vista Home Premium? 76.5.24.16 (talk) 03:40, 11 February 2009 (UTC)
- In general, it isn't worth the effort (and often it isn't even possible). If your computer is infected, the most important actions you can take are to clean it thoroughly and inform anyone you might have inadvertently infected. Other than that, you can analyze why your computer became infected and take precautions to prevent a recurrence. – 74 04:04, 11 February 2009 (UTC)
- Viruses spread. Although they almost always originate from one source, an IP address which you may have traced the virus to would usually be a normal computer belonging to a normal user - they've just been infected by the virus! --wj32 t/c 07:57, 11 February 2009 (UTC)
- So, when the virus we're talking about is a key logger, how exactly do they get the information that they're attempting to harvest if info doesn't go to their own IP? Would the information pass through the botnet all the way back to the hacker? I don't think this is infection is a botnet type virus that propogates to other computers, but rather a trojan horse that came from a pop up ad. PCHS-NJROTC (Messages) 17:34, 11 February 2009 (UTC)
- Typically, a botnet-compromised computer will connect to an anonymous feedback channel (IRC, website, etc.) and post it's IP address and potentially other information. Any other account on the channel (for a successful botnet there will be many) could be the "bot herder". Security researchers will disassemble such viruses to identify these communication channels, then infiltrate them in an attempt to identify the person behind the attack. Since such investigation is a (very) non-trivial procedure that requires specialist knowledge, the best advice I can offer to a typical computer user is to recover and move on. – 74 18:39, 11 February 2009 (UTC)
- I agree. Also, even if you discover an IP, such an IP address is usually worthless. For example, I was once infected with the Vundo virus. All I needed to do was type netstat -ano at the command line to find out what computer was controlling mine. I also saw all of the mail servers to which my computer was connecting to send spam. The controlling server was in Russia. It was hosted by the Russian Business Network, an organization that promises never to take down any server you operate (a practice known as bullet-proof hosting). It was later discovered that the RBN is affiliated with the Kremlin. Thus, if I hadn't removed the virus, it's very possible my PC would have later been used to bombard a computer in Georgia.
- Typically, a botnet-compromised computer will connect to an anonymous feedback channel (IRC, website, etc.) and post it's IP address and potentially other information. Any other account on the channel (for a successful botnet there will be many) could be the "bot herder". Security researchers will disassemble such viruses to identify these communication channels, then infiltrate them in an attempt to identify the person behind the attack. Since such investigation is a (very) non-trivial procedure that requires specialist knowledge, the best advice I can offer to a typical computer user is to recover and move on. – 74 18:39, 11 February 2009 (UTC)
- So, when the virus we're talking about is a key logger, how exactly do they get the information that they're attempting to harvest if info doesn't go to their own IP? Would the information pass through the botnet all the way back to the hacker? I don't think this is infection is a botnet type virus that propogates to other computers, but rather a trojan horse that came from a pop up ad. PCHS-NJROTC (Messages) 17:34, 11 February 2009 (UTC)
- Viruses have become incredibly sophisticated, and the idea that you can beat the teams of FBI agents who are also looking for the authors of these viruses is absurd. If you could, you wouldn't find the answer by asking a short question on a site like this. Virus authoring is now an organized crime. I could see the server that was controlling my computer. It ran FreeBSD. It was bullet proof -- definitely more secure than my computer. So, I'd just stop before you hurt yourself.--K;;m5m k;;m5m (talk) 05:47, 12 February 2009 (UTC)
Dwight Cavendish versus Macrovision
[edit]What technology is being used in Dwight Cavendish System (DCS). How it comapres with Macrovision wrt its protection capability, acceptance by content providers and cost of implementation for a chip / STB manufacturer, operator? Krisfriend (talk) 10:04, 11 February 2009 (UTC)
Javascript pull down menus
[edit]Hello Wikipedia,
i'd like to use the functionality of this [1] menu, but format it so it comes to resemble my existing (beautiful) one. The style that they use is here:
.menu {position:absolute; font:12px arial, helvetica, sans-serif; background-color:#CCCCCC; layer-background-color:#CCCCCC; top:-90px}
#fileMenu {left:10px; width:70px}
#searchMenu {left:85px; width:100px}
A {text-decoration:none; color:#000000}
A:hover {background-color:#000099; color:#FFFFFF}
Essentially, i don't understand where its getting its top border from. (Perhaps the 'Top' attribute autmatically assigns a border?) As the I'm looking to create the 'tab' effect (whereby each tab has 4 borders apart from the 'current' tab, which has the bottom one missing), i'd really like to be able to play around with this -any ideas?
Many thanks,81.140.37.58 (talk) 11:11, 11 February 2009 (UTC)
- I didn't see a top border? Top does not automatically assign a border. I suspect the appearance of a border comes from the position of the element and its background or something along those lines. When in doubt, try using the Web Developer plug-in for Firefox to identify the styles affecting a given element. --98.217.14.211 (talk) 13:34, 11 February 2009 (UTC)
- (And while I'm add it, can I say that Javascript pulldown menus rarely work as well as intended? I hate the damn things and find them usually to be barely functional, and their use makes it hard to do simple things like quickly search the page for the link I'm looking for. IMO they're not great design practice. Just giving you my unsolicited two cents!) --98.217.14.211 (talk) 13:35, 11 February 2009 (UTC)
- I'll second 98's opinion: javascript was great when it was the only way to provide interactive menus, but it has been overly abused and better alternatives now exist (CSS). Anyway, the "border" you noted is actually a <hr /> tag in the page source—removing that should allow you to create true borders with CSS. – 74 13:57, 11 February 2009 (UTC)
That's really interesting! (If not a little frustrating, as i've just spent a week playing around with Javascript!). As an aside question then, is Javascript now becoming increasingly redundant or is it sill worth being familiar with?81.140.37.58 (talk) 11:01, 12 February 2009 (UTC)
Array of array
[edit]Even Applesoft BASIC, a 1970s language created for a 48 k RAM 8-bit CPU 1 MHz computer, has multidimensional array. Why do many recent and much more advanced languages use array of array? Even Cobol and Fortran have multidimensional arrays. Some may need jagged arrays. But most of us may need a simple and intuitive way to create rectangular multidimensional arrays. What are they doing? -- Toytoy (talk) 12:25, 11 February 2009 (UTC)
- This doesn't answer your question but in modern OO languages, you generally don't use either. Instead you create a class (or a structure) and then store them in some kind of collection. 216.239.234.196 (talk) 13:39, 11 February 2009 (UTC)
- I suspect that the multidimensional arrays are more messy, memory-wise, than arrays of arrays, but that's just a hunch. --98.217.14.211 (talk) 13:43, 11 February 2009 (UTC)
- But some popular languages started from a primitive non-OO model, such as the old-fashioned C and Perl. Perl was created after the 1980s. PHP is not OO but it has multidimensional arrays. Java, Python and Ruby are OO, they only have array of array. Why doesn't Perl 5 have multidimensional arrays? Perl 1 to 4 were even worse.
- On the other hand, I think static 2D arrays are pretty simple to implement. Member (3,4) of a 5 by 5 array (default base = 1) is equivalent to the member (5*3+4) of a 1D array. Even higher D arrays are equally simple to create. Array of array is more messy to use and possibly more clumsy to implement. However, it may be more difficult to create a dynamic n-D array (e.g., from 3 by 4 to 100 by 999 by 30000) using multidimensional array. PHP, VB VB.NET and even ALGOL 68 have multidimensional and dynamic array. -- Toytoy (talk) 14:04, 11 February 2009 (UTC)
- What advantage do you gain from a multidimensional array vs. an array of arrays? If you have a multidimensional array of fixed size then yes you can directly index to an element—the same can also apply to a fixed-size array of (equivalent) fixed-size arrays. But, when all your arrays are dynamic the overhead involved in creating a multidimensional array becomes quite excessive: worst-case dynamic addition of an element in a n x m array requires moving (n - 1) * m elements. If a language supplies a dynamic multidimensional array, the odds are good that it's implemented as an array of arrays. On the other hand, arrays of arrays can be unbalanced (saving memory), while multidimensional arrays cannot. The only real downside to an array of arrays is that accesses will require an additional index (often cached), which simply isn't seen as a significant problem. If it really bothers you, I might point out that you are free to store all your elements in a one-dimensional array and do the index calculations yourself. – 74 14:34, 11 February 2009 (UTC)
- I think the point is that the programming language should do all the allocating of dynamic memory behind the scenes, the programmer shouldn't have to worry about that or any other "bookkeeping" (although the ability to manual manage dynamic memory allocation should also be available). Also, let's say your program is creating a 3D voxel model with fixed dimensions. Isn't VOX(X,Y,Z) a simpler way to refer to each voxel than an array of arrays ? StuRat (talk) 15:06, 11 February 2009 (UTC)
- Vox(X,Y,Z) as compared to Vox[X][Y][Z]? While the latter might be slightly more complicated to type, I fail to see how it is any more complicated to use. It is also quite possible (in Perl, at least) to declare an array of (unnamed) arrays using syntax very similar to that used to declare a multidimensional array, so I'm not sure why dynamic-memory bookkeeping would be a concern. – 74 15:43, 11 February 2009 (UTC)
- I think the point is that the programming language should do all the allocating of dynamic memory behind the scenes, the programmer shouldn't have to worry about that or any other "bookkeeping" (although the ability to manual manage dynamic memory allocation should also be available). Also, let's say your program is creating a 3D voxel model with fixed dimensions. Isn't VOX(X,Y,Z) a simpler way to refer to each voxel than an array of arrays ? StuRat (talk) 15:06, 11 February 2009 (UTC)
- You're right. I suspect that many multidimensional and dynamic arrays are implemented on top of an array of array model. I just don't know why wouldn't they provide BOTH models. -- Toytoy (talk) 15:12, 11 February 2009 (UTC)
- Heh, someone complaining about an alternate way to do something that is missing from Perl? Perhaps if you ask nicely they will include it in their next version. – 74 15:43, 11 February 2009 (UTC)
- You're right. I suspect that many multidimensional and dynamic arrays are implemented on top of an array of array model. I just don't know why wouldn't they provide BOTH models. -- Toytoy (talk) 15:12, 11 February 2009 (UTC)
- The point of many languages -- notably C++ -- is that if having a particular type is important to you, you have the tools to make it yourself. The C++ language doesn't provide complex numbers, but with operator overloading you can roll your own (like the C++ standard library does). Same goes for matrices. --Sean 15:59, 11 February 2009 (UTC)
- It sounds weird to me that a modern language is without basic mathematical operations such as complex number and matrix. The inclusion of mathematical libraries shall solve the problem. Today, anyone can get the piece of needed software from the Internet. But these languages were developed two or three decades ago, long before the first dotcom bubble and the wide spread of affordable 24/7/365 Internet ... -- Toytoy (talk) 00:25, 12 February 2009 (UTC)
- There's no mystery here: Most computer programmers have little use for complex numbers, and most mathematicians have little use for a programming language; the overlap is simply not large enough to warrant the inclusion of complex numbers in the base language. – 74 01:05, 12 February 2009 (UTC)
- It sounds weird to me that a modern language is without basic mathematical operations such as complex number and matrix. The inclusion of mathematical libraries shall solve the problem. Today, anyone can get the piece of needed software from the Internet. But these languages were developed two or three decades ago, long before the first dotcom bubble and the wide spread of affordable 24/7/365 Internet ... -- Toytoy (talk) 00:25, 12 February 2009 (UTC)
firefox
[edit]Whay is firefox does it say "scanning for virus" even though i have none virus software? it takes a long time to do this, but whay if i have no virus checkers, what is it doing in this time to make the firefox ususuabkle and crash if i try to do other things during this time? —Preceding unsigned comment added by 194.80.240.66 (talk) 14:40, 11 February 2009 (UTC)
- 1. In the Location bar, type about:config, and press the enter key
- 2. Scroll down the list of preferences until you find browser.download.manager.scanWhenDone (do a ctrl+f to open search box)
- 3. Double-click on the preference name browser.download.manager.scanWhenDone to toggle the setting value to false.
- — Ched (talk) 15:06, 11 February 2009 (UTC)
- Firefox has a built in virus scanner... its very limited in what it can do. – Elliott(Talk|Cont) 16:14, 11 February 2009 (UTC)
- No, the files are only scanned if there is antivirus software on the system: "if a Windows user has an antivirus program installed, it is launched to scan files when they finish downloading...This preference only has an effect if you have antivirus software installed and are running Windows" [3]. Why it says it's scanning when there is no antivirus software installed is probably a bug. There is more information here plus advice on how to disable the feature. —Preceding unsigned comment added by 82.43.88.87 (talk) 20:33, 11 February 2009 (UTC)
When in the software development life cycle are you supposed to create estimates?
[edit]It bugs me to no end when clients want hard estimates given sketchy requirements. Assuming a standard approach with phases for business analysis, design, development, testing and deployment, when in this process are you supposed to create your estimates? AFAIK, you're supposed to do it after you completed your design. They want estimates before business analysis has barely started. I'm looking for something so I can explain to them that any estimate prior to business analysis and design is preliminary at best. A Quest For Knowledge (talk) 19:27, 11 February 2009 (UTC)
- You will need a two stage estimate, first estimate the cost to establish an accurate estimate for their requirement. Otherwise you may give a sketchy answer $1000 to $1,000,000 may cover it. Graeme Bartlett (talk) 20:53, 11 February 2009 (UTC)
- Welcome to the club. I was always expected to come up with accurate estimates before the specs were defined, which, of course, is quite impossible. I just gave a really high WAG estimate and hoped it was high enough. If they complained that it was too high I'd say I might be able to lower it once the specs were fully defined. Also, when you break the estimate down into many parts, they are more willing to accept a high estimate. StuRat (talk) 23:53, 11 February 2009 (UTC)
- Yep - sadly it's a part of the job. I always ask to split the task into two phases:
- PHASE I : Examine the problem, decide in detail how to solve it. Split the solution into modules that could each be written in one 3-week "sprint" and tested in another 3 week sprint. Document the modules and their interfaces. Add more sprints for integration and deployment. Add up the number of sprints and there you have your man-hours.
- PHASE II: Do the work. Make sure that each sprint does actually complete. If a sprint misses a deadline early on - don't be tempted to let that work flow into the following sprint. Instead add the slippage to your final delivery deadline and confess to your customer as soon as possible. That way they aren't surprised when there is a big overrun at the end - and they may be able to help you keep to your schedule by removing features or at least postponing them onto a second version. Because they see the slippage early - you'll be able to down-scope more efficiently.
- You can estimate the time to do phase I up-front - then at the end of phase I, you'll have the estimate for phase II. The trick is to fight off your customer's demand for an estimate for Phase II before you've completed Phase I. Point out to them that if they INSIST on you providing an estimate for the cost of phase II before phase I is complete then you will (by necessity) have to put in a much larger estimate to allow for worst-case conclusions from phase I.
Alternatives to VMware Workstation
[edit]If I want to run Windows and Ubuntu in the same computer, what are my alternatives to VMware Workstation? I want to run a normal version of Windows and not one upon WINE.--Mr.K. (talk) 19:55, 11 February 2009 (UTC)
- I'm assuming that you are using Ubuntu? VirtualBox offers pretty much the same features as VMware Workstation (plus it's free) where you can set up a virtual Windows system, or you may wish to try a dual boot whereby you install both Windows and Ubuntu onto separate partitions on a hard drive and use a boot loader such as GRUB to select which one to boot.
- You can also enable raw disk right-through with VirtualBox. (meaning you can install windows on a real hard drive)– Elliott(Talk|Cont) 20:38, 11 February 2009 (UTC)
- Thanks for the answers. I already have GRUB. I´ll give VirtualBox a try.--Mr.K. (talk) 21:00, 11 February 2009 (UTC)
Javascript for detecting the browser's language
[edit]Hi there, i am looking for a javascript code that can be placed at the top of a html file that will detect the language of the viewer's browser. I would also like this code to redirect the user to a new page based on the language it detects. i.e.:
If it detects English then i would like it to redirect to www.example.com/en/index.html
If it detects Spanish then i would like it to redirect to www.example.com/sp/index.html
If the JavaScript cant detect what language the viewer's browser is or if there is an error in executing the JavaScript (i.e. the user does not have JavaScript support, or it tries to redirect to a web page that does not exist) then i would like it to simply display the rest of whats on that html file.
Alternatively if this can be done in php that would be awesome. – Elliott(Talk|Cont) 20:00, 11 February 2009 (UTC)
- Here is a brief description of how language preference is transmitted as part of the HTTP request. This page shows some PHP code on how to extract the language information; be sure to scroll down to see the more generalized code. --LarryMac | Talk 20:35, 11 February 2009 (UTC)
UK map on a US keyboard
[edit]Hi. I have two keyboards, both US layout (shift-2 is @). I prefer UK layout (shift-2 is "). The problem is with the key labelled in the US layout with a vertical bar on top and a backslash below. One of my keyboards is already working with the UK layout. This keyboard has two keys labelled like this. One just to the right of the left Alt key, and one just above the Enter key. The one on the left produces backslash and vertical bar with the UK layout as well, as indicated on the key, and the one on the right produces the hash/pound sign and the tilde. In this way I can access all the normal symbols (though the positions are a bit weird).
The other keyboard, however, only has one key labelled like this. That key always produces hash/pound sign and tilde under the UK layout. Thus, I'm unable to type the backslash and vertical bar. The keyboard doesn't have any other dead or unknown keys, so it looks like this keyboard is missing one key from the other one. Because of this I'm unable to remap the key in the OS: there's literally no spare key.
So my question is: which keyboard, if any, is normal? Has anyone else encountered this? Is there any way around it?
Thanks. Amoe (talk) 20:42, 11 February 2009 (UTC)
- I don't know which layout would be "normal", but perhaps our article on keyboard layouts might prove helpful. My laptop keyboard substituted a useless "context menu key" for the right 'ctrl' key; I corrected the situation using keyboard remapping software. There is a list of free keyboard remapping tools in our article PC keyboard. – 74 21:24, 11 February 2009 (UTC)
- Are you sure you have no keys to spare ? I have 2 ALT keys, 2 CTRL keys, 2 SHIFT keys, 2 Windows keys, 2 Enter keys, and keys I never use, like Scroll Lock and many of the Function keys. Don't you have any of those you can use ? StuRat (talk) 23:44, 11 February 2009 (UTC)
- The keyboard in question is actually a miniaturized one, so most of the 'weird' functions are accessible through an Fn prefix key, which would make them a pain to type. I've realized, though, that I do have 2 keys in the Windows key positions (though they're not labelled as such). I can probably remap the left one to the necessary key, since I don't use it. As such I'll close this thread. Amoe (talk) 19:08, 12 February 2009 (UTC)
- You can also map key combinations (e.g. ctrl + ⇧ Shift + 2) for your missing characters. The only real problem is remembering where you put each character. – 74 07:04, 13 February 2009 (UTC)
Google Cash
[edit]What is this Google Cash thing? It's popping up everywhere and really getting on my nerves, some sort of scam? SGGH ping! 21:30, 11 February 2009 (UTC)
- What do you mean by "popping up everywhere", as in popups? Try Adblockplus if you're using FireFox. Or do you meant Google cache? —Preceding unsigned comment added by 82.43.88.87 (talk) 21:55, 11 February 2009 (UTC)
- Seems like a scam to me. This Google search reveals A) Google doesn't appear to have made an official statement, and B) a depressing number of people can't spell cache. I would strongly recommend avoiding "googlecash". – 74 21:59, 11 February 2009 (UTC)
- The pound has just fallen to a new low against the Google of 49 Google cents to the pound. - Jarry1250 (t, c) 17:54, 12 February 2009 (UTC)
Keyboard bug
[edit]Typing the above quick question has actually reminded me I need to ask a bigger one. My laptop keyboard has taken to jumping the cursor across to another part of the text I am editing every now and then whenever I hit the 'e' key. It is particularly common when typing "have". It can end up with my writing sentences like this:
The quicd over the lazy dogk brown fox jump.
Any clues? I have googled and troubleshooted a couple of times. No help. SGGH ping! 21:33, 11 February 2009 (UTC)
- I had exactly the same problem on an old laptop but only in MSword. Strange. I never did find out why it happened though. —Preceding unsigned comment added by 82.43.88.87 (talk) 22:03, 11 February 2009 (UTC)
- When this happens to me, it's usually because my palm/wrist is hitting the touchpad and causing an errant click. You might try disabling your touchpad to see if the problem goes away. It's also possible that your keyboard is sending the wrong keycodes (possibly because of dirt or debris under the keys); a program that shows key codes received might help to diagnose that problem. – 74 22:09, 11 February 2009 (UTC)
- Ah, so either way, the problem could be a nut loose on the keyboard ? :-) StuRat (talk) 23:37, 11 February 2009 (UTC)
VirtualBox video drivers
[edit]I have installed VirtualBox OSE on ubuntu, and from within VirtualBox i have installed WinXp SP3. I am trying to get Microsoft'sWorld Wide Telescope to work. Inorder to do so i will need to install the drivers for my Video card. So my question is this: What type of video card is VirtualBox using and where can i find the drivers? Thank you – Elliott(Talk|Cont) 22:33, 11 February 2009 (UTC)
- I think if you install "virtualbox additions" it will load the right drivers. —Preceding unsigned comment added by 82.43.88.87 (talk) 23:24, 11 February 2009 (UTC)
- Thank you very much. – Elliott(Talk|Cont) 07:03, 13 February 2009 (UTC)
C: putc is missing characters
[edit]I'm having a bit of coding trouble. I've managed to implement an SPN network to function properly on a single message block, and I've managed to get it to work in ECB mode on an array of blocks. However, I'm now trying to get it to encrypt a file and I'm having issues.
I can apparently read a (binary) file as a list of bytes just fine with putc, and I can pair them up into message blocks (16-bit) just fine. However, when I try to write them to file, a few at the end get missed. It's not a consistent number - if I change the message, it seems to stop writing at a different point. I'm using the following code:
outputFile = fopen("cipher.txt", "w"); writeMessage(outputFile, outputMessage); fclose(outputFile);
void writeMessage (FILE *outputFile, message inputMessage) { int i; int heldBitCount; block heldBits; assert(!(inputMessage.bitCount % 8)); heldBitCount = 0; for (i = 0; i < inputMessage.blockCount; i++) { heldBits = inputMessage.blockList[i]; heldBitCount = inputMessage.bitCount; while (heldBitCount > 0) { heldBitCount -= 8; putc((char)(heldBits>>(heldBitCount)), outputFile); heldBits = heldBits % (1 << heldBitCount); } } }
This should work fine - it goes through every block in the message, reads it into a local variable, then writes the top 8 bits to the file (as a char / byte) repeatedly until the block has been written completely. Just for some reason, the output file ends up not containing all the characters. Is there some kind of byte indicating EOF in a plain binary file?
(Also, yes, this is probably horrible code. It was meant to be a proof of concept and was meant to work ,at which point I'd do it nicely!)
92.238.108.207 (talk) 22:32, 11 February 2009 (UTC) (oops Rawling4851 22:33, 11 February 2009 (UTC))
- One potential problem is if the null terminator shows up prior to the end of the line, and that may be what's happening for you. In general, one never wants to print out binary characters, as many are, well, unprintable. Instead, print out the ASCII codes of those characters. Printing the ASCII codes and the characters will show you which are not printable. Only ASCII 32 through ASCII 126 are guaranteed to be printable. StuRat (talk) 23:29, 11 February 2009 (UTC)
- NO!!! That's a bogus answer...it's not the problem. You can write arbitary 8 bit data with putc. In UNIX systems, it's guaranteed to work - and on Windows machines, it works so long as you open the file in binary mode so that '\n' doesn't get turned into a CR/LF pair. SteveBaker (talk) 05:46, 12 February 2009 (UTC)
It's really hard to read what the heck your code is trying to do here - and we don't have the code for your 'message' and 'block' types - so who-knows-what is going on there. But one thing that seems like it must be wrong is that your 'while' loop first tests that 'heldBitCount' is bigger than zero - then subtracts 8 from it - meaning that it could quite easily now be negative. Next, you down-shift heldBits by that value. But down-shifting by a negative amount produces (I believe) an undefined result in C/C++...or at the very least it's a horribly bad practice - so who-knows-what is going to happen then? Most likely your 'while' loop is broken in some way - but the code is doing some wild and funky stuff and it's hard to know what you're even TRYING to do! However if I had to guess, I'd say that maybe you want to move the 'heldBitCount -= 8 ;' line down to the bottom of the while loop...but I wouldn't want to bet actual money on that. IMHO, you should restructure your code to use a 'for' loop to loop (heldBitCount/8) times - writing out 8 bits each time around - then, in a step after that loop, write out the last heldBitCount%8 bits at the end. That would be much clearer to read and would probably fix your bug. SteveBaker (talk) 05:43, 12 February 2009 (UTC)
- The code is somewhat... original, but it isn't that convoluted. True, 'heldBitCount' is required to be a multiple of 8, but that isn't uncommon when playing with bytes (and there's even an assert to check it first). Moving the 'heldBitCount' decrement will *not* fix anything (if you have 16 bits, you don't want to right shift 16 for the first byte). This line may be technically correct: "heldBits = heldBits % (1 << heldBitCount);" (though it looks like there might be an off-by-one error), but it could easily be replaced by a small change to the preceding line: "putc((char)((heldBits>>heldBitCount) & 0x00FF), outputFile);". All of which leaves us with no obvious problems. How are you verifying that all the bytes aren't getting written to the output file? (Attempting to view binary files as text can produce odd results.) Other than that, I would recommend adding print statements to the code inside the loop to verify that each byte is being processed correctly. – 74 07:27, 12 February 2009 (UTC)
- To begin with, I knew something was up because I was reading a text file, encrypting, saving to another file, loading again, decrypting, and saving the output - and the output was the input, but truncated. I then used a hex editor (as notepad wasn't opening the intermediate file right) to check lengths, and the intermediate file was shorter than the input, and the output shorter than the intermediate. I can't see why though - I'm going through a for loop a set (and, I'm pretty sure from debugging, correct) number of times, and should be writing a set number of bytes to file each time - they just don't seem to be making it. Rawling4851 08:04, 12 February 2009 (UTC)
- Hm... SteveBaker, opening the files with "rb" and "wb" instead of "r" and "w" seems to have fixed this, cheer :D ... so I guess I'm going to have to go read up on binary mode, and run some more tests to see where this was happening. Is the "\n" thing always an issue, or only with getc and putc? Rawling4851
- OK - well, rewrite it anyway. I find it hard to sleep at night knowing that somewhere in the world is a piece of code that ugly! SteveBaker (talk) 03:47, 14 February 2009 (UTC)
Appointments in Outlook
[edit]I have two calendars in Outlook, one for Scouting things and one for personal things. Sometimes I need to have an appointment shewing up in both. How can I quickly copy a single appointment from one to the other? DuncanHill (talk) 23:01, 11 February 2009 (UTC)
- Have you tried copy & paste? ie. highlight the appointment; click the edit menu and choose copy; switch to the correct date and time on the other calendar; click the edit menu and choose paste. Note: I would expect that procedure will create two unconnected appointments; if you were to move one, the other would not move with it. Astronaut (talk) 13:51, 12 February 2009 (UTC)
- No, it won't let you copy. You can drag an appointment from one calendar to the other, but of course that removes it from the first calendar. DuncanHill (talk) 21:59, 12 February 2009 (UTC)
- But thank you - it does have a "copy to folder" opting in a drop down, which does the trick! DuncanHill (talk) 22:01, 12 February 2009 (UTC)
- No, it won't let you copy. You can drag an appointment from one calendar to the other, but of course that removes it from the first calendar. DuncanHill (talk) 21:59, 12 February 2009 (UTC)
Image scaleup question
[edit]For the image Image:Flag of New Jersey.svg, is there a way to scale it up (Preferably without having to edit it) so that it prints to about the dimensions of an 8 by 11? I tried the "Scale:" option in Firefox, but it doesn't work at all. Thank you, 150.250.178.243 (talk) 23:07, 11 February 2009 (UTC)
- Your best bet is to save the file and open it in a program that supports SVG (for example OpenOffice.org which is free). You can then scale and print it. Make sure you click on the image preview to load the full size file (the preview is a PNG raster file - you want the SVG vector file for printing). -=# Amos E Wolfe talk #=- 23:20, 11 February 2009 (UTC)
- Firefox seems to work fine for me when I open just the image file, change the paper orientation to landscape, and set the scale to 125% or 150% (though AmosWolfe's recommendation will work even better). – 74 00:52, 12 February 2009 (UTC)
- OK, only now it's a little off centered. Can Firefox center it before printing it so I don't have to cut out the extra whitespace? Thanx, 150.250.43.254 (talk) 04:00, 12 February 2009 (UTC)
- Firefox is a poor choice for printing something like that. IMHO, you should download a copy of 'Inkscape' which is an opensourced/free SVG editor. It has much more comprehensive printing/scaling option. SteveBaker (talk) 05:27, 12 February 2009 (UTC)
- You could manually adjust the margins in "page setup" to center the image (which is probably going to be more effort than trimming the excess), but I think you're well passed the point where dedicated image-handling software would be beneficial, especially if this problem comes up often. – 74 16:37, 12 February 2009 (UTC)