Wikipedia:Reference desk/Archives/Computing/2012 August 31
Computing desk | ||
---|---|---|
< August 30 | << Jul | August | Sep >> | September 1 > |
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. |
August 31
[edit]Encoding in Command Prompt
[edit]Hi. I use Windows 7. I want to use the Command Prompt (cmd.exe) to move a file between two directories. The problem is that the file name is in non-Latin characters (UTF-8), so, when I type its name in the prompt it is converted to question marks. How can I make the Command Prompt display UTF-8 characters? (P.S. I know that I can rename the file using Windows but this doesn't solve my problem.) --41.129.101.27 (talk) 02:26, 31 August 2012 (UTC)
- This probably won't solve it, but is worth a try: In XP you can click on the icon on the far left of the title bar, then select Properties, which brings up a pop-up menu. From there you can pick the Fonts tab. Now XP doesn't seem to have any fonts which support unicode, but perhaps Win 7 does. StuRat (talk) 02:33, 31 August 2012 (UTC)
- Doesn't work. The only fonts there are Consolas, Lucida Console and Raster Fonts. Maybe I can use an external program that supports UTF-8? --41.129.101.27 (talk) 02:46, 31 August 2012 (UTC)
- According to this page you can make a font available by adding it to HKLM\Software\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont. However, you should be able to move the file even if you can't see its name in the current font, unless you're using a third-party command-line tool that isn't Unicode aware. UTF-8 has nothing to do with this, by the way: Windows stores filenames as UTF-16 and the console window and cmd.exe both use UTF-16 internally. -- BenRG (talk) 04:07, 31 August 2012 (UTC)
- Doesn't work. The only fonts there are Consolas, Lucida Console and Raster Fonts. Maybe I can use an external program that supports UTF-8? --41.129.101.27 (talk) 02:46, 31 August 2012 (UTC)
- Try this: In the Command Prompt properties, try changing the font to either Consolas or Lucida Console. (I don't think Raster Fonts will work.) Then at the command prompt, enter
chcp 65001
to set the code page to Unicode UTF-8. --Bavi H (talk) 03:35, 31 August 2012 (UTC)- As far as I know chcp will have no effect on cmd.exe, since it uses wide characters internally. -- BenRG (talk) 04:07, 31 August 2012 (UTC)
- Ok. I noticed when pasting characters into the Command Prompt, they were correctly displayed (if they were available in the font) and were interpreted correctly by commands, no matter what the code page was set to. I wasn't sure if typing characters on the keyboard also worked and didn't change the keyboard layout to test.
- Setting the code page does seem to affect how cmd.exe interprets bytes in files when it displays them on the screen, for example, when you use
more file.txt
. Here are some additional tests someone conducted. I haven't yet found official documentation that details the effects chcp has in cmd.exe, there might be other effects or consequences we haven't noticed. --Bavi H (talk) 02:22, 1 September 2012 (UTC)
- An alternative solution to this problem would be to use a copy program which can read the filename from a text file. FastCopy can do this, the command would be fastcopy.exe /srcfile_w="files.txt" /to=newdirectory AvrillirvA (talk) 03:40, 31 August 2012 (UTC)
- Try typing part of the name and hitting the Tab key. That normally completes the command, and may insert the characters you need automatically.--Phil Holmes (talk) 08:56, 31 August 2012 (UTC)
- If all you want to do is move the file, try using wildcards to represent the non-typable characters. Eg,
move abc*.def
. Obviously you need a combination that covers the file you want to move and not any files that you don't want to move. Mitch Ames (talk) 06:48, 1 September 2012 (UTC)
Java Question
[edit]In Java, what does the 24 refer to in the following: return String.format( "%24s: %s\n%24s: %s", ..., ... ,..., ... ); ? And similarly: return String.format( "%02d:%02d:%02d", ..., ..., ... ); ? Thanks. 92.6.157.179 (talk) 11:29, 31 August 2012 (UTC)
- The java manual page about this is here. It works like printf in C - the %24s expects a string of 24 characters (shorter strings will be padded with spaces); the %02d will output an integer with a minimum of 2 digits and a leading zero if there is only one digit (often used when outputting dates like 31/08/2012). Astronaut (talk) 13:03, 31 August 2012 (UTC)
- Thanks Astronaut! Much appreciated! happy editing! 92.6.157.179 (talk) 14:04, 31 August 2012 (UTC)
Unix Command Syntax
[edit]The Unix man command uses a specific notation to describe the correct syntax of a command. Alternate options are separated by vertical '|' symbols, and optional arguments are surrounded by [brackets].
- Is there a name for this format, and/or an article about it?
- and how would I specify "You must use at least one of the options -a,-b,-c and -d; you can also use option -e"?
Thanks, Rojomoke (talk) 13:33, 31 August 2012 (UTC)
- I don't quite know (I'd say it's some convention loosely based on EBNF or regexp syntax and doesn't have a name), but maybe you'll find further pointers (he he) in the GNU and POSIX guidelines concerning command-line interfaces 92.224.244.40 (talk) 16:12, 31 August 2012 (UTC)
- Since the point is to be helpful to users, I would explain anything as complex as that in the text of the man page rather than asking the user to decipher some obscure symbology. Note also that even more important than having a good man page is to give a good explanation if the user types your command with a --help option. Looie496 (talk) 16:27, 31 August 2012 (UTC)
- Your second question might be answered:
mycommand -a|-b|-c|-d [-e]
- It's not a formally-defined "format", so I doubt there's a specific name for (or Wikipedia article about) it. (We do have a Man page article, but it doesn't discuss these details.)
- The second link provided by a previous poster gives specific advice about the format of the SYNOPSIS section, but I've found very few others. (Evidently, very few people have asked the question you're asking, and even fewer have answered it.) —Steve Summit (talk) 12:05, 1 September 2012 (UTC)
Automatic Update Failing
[edit]I leave my computer on overnight (for various reasons), and recently I have been waking up to find that it has restarted itself. When I login to Windows I get a message saying Windows Update has failed to install. This has been going on for a few weeks. I manually installed the update and the message said it installed successfully, but somehow this problem persists. It keeps checking for updates every night and failing to install the same ones, again and again. What should I do? Win7 Home Premium. KägeTorä - (影虎) (TALK) 14:05, 31 August 2012 (UTC)
- It's hard to say what is happening without more information on what ones are failing and what error codes are generated. Microsoft does have a "Microsoft Fix it" tool that can clear up some common Windows Update issues, and detailed instructions for resetting the Windows Update components. One of those may fix your problem: [[1]] 209.131.76.183 (talk) 19:34, 5 September 2012 (UTC)
Removing "Live Security Platform" malware
[edit]How can one get rid of the malware "Live Security Platform" once it has installed itself and disabled measures such as using the normal means of removing a program? — Preceding unsigned comment added by 98.220.239.210 (talk) 17:56, 31 August 2012 (UTC)
- I assume you mean "Live Security Platinum". Try the instructions here. -- BenRG (talk) 18:27, 31 August 2012 (UTC)
can a microsite be under a different person's control?
[edit]could I produce a page and have it be on my servers, while it is at mypage.theirpage.com, right in DNS (so if someone types only mypage.theirpage.com then it gets right to my page without ever hitting theirs)? I'm asking because I don't fully trust them to report visitors correctly otherwise. If I can't do it right in dns, what's the closest I can come where we don't have to trust each other? Thanks. --80.99.254.208 (talk) 18:48, 31 August 2012 (UTC)
- They can certainly make yoursite.theirdomain.com resolve to an IP address that's entirely out of their control (hosted in a different location with an unaffiliated ISP), but you have to trust them to do that much. If they're merely incompetent, they're less likely to screw this up than visitor reporting. If they're malicious, you can't safely use their domain. -- BenRG (talk) 22:18, 31 August 2012 (UTC)
- Thanks, BenRG, but can't I test where yoursite.theirdomain.com resolves myself? While it can start resolving somewhere other than my IP that I give them, if I have a script that checks from time to time, I can know immediately, can't I? I ask because the same is not true for visitor reporting. So is it at least "tamper-evident" - or can they resolve it "correctly" as far as I can tell (that microsite goes to my IP) while stealing some of the traffic? Isn't this done at the DNS level which I can verify? --80.99.254.208 (talk) 06:52, 1 September 2012 (UTC)
- Is nslookup yoursite.theirdomain.com what you're looking for? --NorwegianBlue talk 08:27, 1 September 2012 (UTC)
- Thanks, BenRG, but can't I test where yoursite.theirdomain.com resolves myself? While it can start resolving somewhere other than my IP that I give them, if I have a script that checks from time to time, I can know immediately, can't I? I ask because the same is not true for visitor reporting. So is it at least "tamper-evident" - or can they resolve it "correctly" as far as I can tell (that microsite goes to my IP) while stealing some of the traffic? Isn't this done at the DNS level which I can verify? --80.99.254.208 (talk) 06:52, 1 September 2012 (UTC)