Wikipedia:Reference desk/Archives/Computing/2009 April 18
Computing desk | ||
---|---|---|
< April 17 | << Mar | April | May >> | April 19 > |
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. |
April 18
[edit]SVG in Safari
[edit]When I try to view SVG images in Safari (version 3.2.1, Mac OS X 10.5.6) at full size, I can only see a part of the image, and there is no way to scroll around to see the rest. Is there any way to fix this, or is there another browser that works better? Lesgles (talk) 01:04, 18 April 2009 (UTC)
- I ran into the same problem (with IE) yesterday when trying to study this image from a PC that had only IE installed. Back home, with Firefox, it works nicely at full resolution, with scrollbars on the bottom of the page and on the right edge. --NorwegianBlue talk 06:14, 18 April 2009 (UTC)
- Try the Safari 4 Beta, or Opera, both of which have greater standards compliance. http://en.wikipedia.org/wiki/Comparison_of_web_browsers might help also. 144.138.21.23 (talk) 06:19, 18 April 2009 (UTC)
- Thanks, I'll try those! Lesgles (talk) 06:55, 18 April 2009 (UTC)
- Try the Safari 4 Beta, or Opera, both of which have greater standards compliance. http://en.wikipedia.org/wiki/Comparison_of_web_browsers might help also. 144.138.21.23 (talk) 06:19, 18 April 2009 (UTC)
Getting Sick of This 'Administration Priveliges' Bollocks
[edit]How do I set my own account on my own PC to have administration priveliges? It's a real PITA that I keep getting denied access when I need to do stuff. I am using Vista.--KageTora (talk) 10:27, 18 April 2009 (UTC)
- You mean the error messages or the continually being asked to confirm? - Jarry1250 (t, c) 10:43, 18 April 2009 (UTC)
- Well, in this particular case (prompting me to post this question) I have been told by a game I have just installed that I need admin priv to get protection or whatever. So, how do I set my account to be the admin?--KageTora (talk) 10:46, 18 April 2009 (UTC)
- Open the start menu, click on your picture at the very top of the menu, and then choose "Change account type" (or whatever the name of the option is in English). However, it is indeed very possible that you already are an administrator. Then, maybe it is UAC that annoys you, or you might need to run the game as administrator. To do so, right-click on the game's icon, select "Preferences", "Compatibility" and check "Run this program as an administrator". --Andreas Rejbrand (talk) 11:55, 18 April 2009 (UTC)
- Beware that this would give the game the power to mess up things which it couldn't otherwise do, so a downloaded game with a virus could cause more serious problems. StuRat (talk) 14:41, 18 April 2009 (UTC)
- Rather than disabling the entire User Account Control, might I suggest simply elevating yourself when needed? To do this simply right-click the program/shortcut and select "Run as administrator". Although the UAC can be a pain, security has never been convenient and it's there for a reason. ZX81 talk 15:33, 18 April 2009 (UTC)
Trucrypt Question
[edit]How do I find out my password for the files I have encrypted on TruCrypt? Or are they all just gone forever? I'm not having a good day on this bloody PC. --KageTora (talk) 11:43, 18 April 2009 (UTC)
- TrueCrypt does not contain any mechanism or facility that would allow partial or complete recovery of your encrypted data without knowing the correct password or the key used to encrypt the data. The only way to recover your files is to try to "crack" the password or the key, but it could take thousands or millions of years depending on the length and quality of the password/keyfiles, on software/hardware efficiency, and other factors. —Preceding unsigned comment added by 82.44.54.169 (talk) 11:47, 18 April 2009 (UTC)
- Do you remember anything about the password, like whether it contained an English word or any letters/digits/symbols that you're sure aren't in it? If you can narrow it down to a billion possibilities or less then brute-force password cracking might be feasible. I'd guesstimate that you could check ~100 passwords per second per CPU core on a modern PC. There's no known attack on a TrueCrypt volume that's faster than brute-force password checking. -- BenRG (talk) 16:50, 18 April 2009 (UTC)
- Let's be realistic here - the whole reason you encrypted the file in the first place was to prevent "the bad guy" from doing precisely what you are asking to do! Why would you imagine it's even possible? Forget it - if the contents of the files are worth less than a million dollars - they're history. SteveBaker (talk) 01:00, 20 April 2009 (UTC)
Dim monitor
[edit]Are there ways to dim monitor screens further than the default buttons allow? I find it very hard to focus on a bright screen in an area without any lighting. The operating system I'm using is Windows vista on an LCD monitor. Thank you for your help. -- penubag (talk) 12:18, 18 April 2009 (UTC)
- You can use software for that (I can't think of any right now, though). The application simply changes the brightness of each pixel, so that the LCD receives a dimmer image. Also, you could try to wear polarizing sunglasses, at an appropriate angle (in fact, you can adjust the apparent brightness of the LCD by tilting your head). A very interesting approach would be to place a polarizing thin film just in front of the screen. Then you could rotate this to adjust the brightness. --Andreas Rejbrand (talk) 13:32, 18 April 2009 (UTC)
- Many graphics drivers let you adjust the brightness via a control panel application. Perhaps you have an icon to open this control panel in the bottom-right corner (Swedish: meddelandefältet) of the screen, or in the Control Panel "folder". --Andreas Rejbrand (talk) 14:01, 18 April 2009 (UTC)
- This will vary quite a bit by monitor. On mine I can go to Control Panel + Display + Settings tab + Advanced button + Color tab. From there I can change the "Target Gamma" or all 3 "Color Splines" (for Red, Green, and Blue), either of which can make it dimmer. Another hint is to change the Desktop to black (or at least a dark color) and also change the window backgrounds to dark colors. I find white text on black background far easier on my eyes than the reverse. I've changed my Wikipedia profile to do this, as well. StuRat (talk) 14:33, 18 April 2009 (UTC)
- A minor note: I believe that it is more likely to vary, in general, by graphics card, not by monitor. --Andreas Rejbrand (talk) 15:39, 18 April 2009 (UTC)
Thank you, that method works okay but that doesn't dim the back light, only makes the LCD stronger. You method did help some though.-- penubag (talk) 04:30, 21 April 2009 (UTC)
PHP Hit Counter Help
[edit]Hi. I'm trying to create a PHP hit counter. I want it to display the number of unique visitors to the site. If the user has a cookie from the site, it does not increment the count. If he doesn't, it increments the count. In either case, it prints the number. Here's what I have so far. Right now, it isn't incrementing. If I get rid of the conditionals, it increments, but doesn't care if you've been to the site before. Thanks.
<?PHP
if (isset($_COOKIE['id']))
{
$filename= "counter.txt" ;
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
echo "$fstring" ;
fclose($fd) ;
}
else
{
setcookie( 'id', 'counter', time()+(60*60*24*7));
$filename= "counter.txt" ;
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
echo "$fstring" ;
fclose($fd) ;
$fd = fopen ($filename , "w") or die ("Can't open $filename") ;
$fcounted = $fstring + 1 ;
$fout= fwrite ($fd , $fcounted ) ;
fclose($fd) ;
}
?>
—Preceding unsigned comment added by Tim james 5 (talk • contribs) 12:47, 18 April 2009 (UTC)
Looks basically fine. In the else clause you may want to echo $fcounted after you set it (rather than $fstring before) if you want the new user to see the newly incremented counter. -- KathrynLybarger (talk) 17:40, 18 April 2009 (UTC)
- Your code is not thread-safe. If two people hit the site at the same time, the following may happen:
- Visitor 1 hits the code: $fc = fopen($filename, "w")... erasing the contents of the file.
- Visitor 2 hits the code: $fstring = fread($fd, filesize($filename)); ... reading an empty file.
- Visitor 1 finishes up, saving the count.
- Visitor 2 continues, opens the file ("w" erases the contents), adds 1 to $fstring (which is empty), and saves $fcounted (now 1) to the file.
- The end result is that your count will reset to 1. You must use flock (php command is flock) to ensure the file cannot be read while it is being written. -- kainaw™ 20:02, 18 April 2009 (UTC)
- Or even better, as some more complicated PHP hit counters do (like BBClone), have a series of possible files it can open in a queue, so that you can accommodate, say, 7 hits at the same time and not lose any data. Also, I suspect there are a lot of things that will hit your page (like bots) that won't allow cookies. In such cases looking at the IP address itself might prove more useful. --98.217.14.211 (talk) 03:04, 19 April 2009 (UTC)
Thanks for the replies. It works now. Here is the final code:
<?PHP
if (isset($_COOKIE['american'])) {
$filename = "counter.txt" ;
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
echo "Visits: $fstring" ;
fclose($fd) ;}
else {
setcookie( 'american', 'counter', time()+(60*60*24*7));
$filename = "counter.txt" ;
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
echo "Visits: $fstring" ;
fclose($fd) ;
$now = time();
while ($now + 1 > time()) {
}
$fd = fopen ($filename , "w") or die ("Can't open $filename") ;
$fcounted = $fstring + 1 ;
$fout= fwrite ($fd , $fcounted ) ;
fclose($fd) ;}
?>
I'm not sure what I changed, but it seems to work now.--Tim james 5 (talk) 17:36, 20 April 2009 (UTC)
- Your code is still not locking the counter file. Therefore, you are begging for two users to hit the page at the same time and reset your counter to 1. Waiting 1 second to write to the file isn't helpful. It just postpones overwriting the file for 1 second - technically making the problem worse. -- kainaw™ 22:36, 20 April 2009 (UTC)
Encryption
[edit]Is there a way to encrypt a single text file? I wouldn't mind either encypting the text in the file, or the file itself. --RefDeskAnon (talk) 18:06, 18 April 2009 (UTC)
- There are many, many ways; too many to list. A few easy possibilities, you could zip the file with a password, use an online encryption tool, put the text file in a TrueCrypt volume, or try this self modifying text program which acts just like notepad but with a password to secure your text. 8I.24.07.715 talk 18:28, 18 April 2009 (UTC)
- Beware of snake oil (cryptography). That online encryption tool looks completely worthless. fSekrit is a good idea, but it looks like it was written by a crypto novice and is pretty weak (no salt or IV). I think modern ZIP encryption is fine and it might be your best choice, but you'll probably have to save the file to disk in plaintext before you encrypt it, which might be a problem depending on what you want the encryption for. TrueCrypt is a good choice except that the container overhead is going to be pretty large for a single text file (at least 256K). Don't use random encryption programs you find on the Web, stick to
products with Wikipedia articles (and whose articles don't say they're snake oil)products that were mentioned in this thread. -- BenRG (talk) 21:44, 18 April 2009 (UTC)- It all depends on how secure Op needs the encryption to be.To just stop your friends from looking at your diary for instance, the above methods should be fine. If you protection missile launch codes then... you get the idea —Preceding unsigned comment added by 82.44.54.169 (talk) 22:29, 18 April 2009 (UTC)
- See GPG. --194.197.235.70 (talk) 00:36, 19 April 2009 (UTC)
- It all depends on how secure Op needs the encryption to be.To just stop your friends from looking at your diary for instance, the above methods should be fine. If you protection missile launch codes then... you get the idea —Preceding unsigned comment added by 82.44.54.169 (talk) 22:29, 18 April 2009 (UTC)
- Beware of snake oil (cryptography). That online encryption tool looks completely worthless. fSekrit is a good idea, but it looks like it was written by a crypto novice and is pretty weak (no salt or IV). I think modern ZIP encryption is fine and it might be your best choice, but you'll probably have to save the file to disk in plaintext before you encrypt it, which might be a problem depending on what you want the encryption for. TrueCrypt is a good choice except that the container overhead is going to be pretty large for a single text file (at least 256K). Don't use random encryption programs you find on the Web, stick to
- Someone mentioned Zip encryption. It's actually pretty rubbish, and there are a whole bunch of programs that will unpassword a zip file nearly instantly. The encryption on RAR files is better, at least I guess this from the fact that password braking programs for rars rely on brute forcing. Gunrun (talk) 08:13, 20 April 2009 (UTC)
- Open SSL has command line tools to allow you to encrypt an arbitrary text string, and I am pretty sure that there are some 3des utilities and blowfish utilities that come standard in a lot of *nix systems that will do the same thing. As a practical matter, GPG/PGP is what you want though. Shadowjams (talk) 19:52, 20 April 2009 (UTC)
- The original ZIP encryption was weak, but strong AES encryption has been in the official ZIP specification since 2003 if not earlier. At least PKZIP and WinZip support it. Info-ZIP apparently doesn't, judging from the man page, and moreover it still implements the weak encryption without so much as a warning. I suppose it might be dangerous to rely on other utilities' ZIP encryption for the same reason. RAR also had weak encryption initially but that was fixed some time ago, and since there's only one vendor for RAR compression you can be sure you're getting the strong encryption if you use a recent version. On the other hand it's a proprietary undocumented format and the software costs money.
- I wouldn't trust random command-line encryption utilities even if they're bundled with major Unix systems. Unix boxes traditionally shipped with a crypt utility which was insecure even on 1970s hardware. A Google search for "linux blowfish" turned up bcrypt as the first hit. It's available as a Debian package and it has a Wikipedia page and the page doesn't say it's snake oil, but there are a lot of warning signs in the documentation. I downloaded it and sure enough it's a joke: ECB mode, no integrity check, and probably other less obvious problems. So I'm going to have to change my earlier advice. Don't rely on Wikipedia to tell you what isn't snake oil.
- I'm not so sure that GPG is what the original poster wants. GPG is a complicated set of tools with a nontrivial learning curve. A lot of people just want to encrypt a file with a password. Although GPG is at least widely used and supported and written by people who know what they're doing. Those are advantages, I'll admit. -- BenRG (talk) 00:49, 21 April 2009 (UTC)
- Those are all excellent points I wish I'd made. Just two things: I don't think RAR's format is undocumented (there are open source RAR utilities including crackers); and RAR can be free, if not actually open source (not sure if the RAR version that's in the common repositories is open source or not). RAR apparently changed their encryption method with version 3, and it appears they use a key derivation function in a loop now, although I can't find the documentation. Shadowjams (talk) 17:56, 21 April 2009 (UTC)
Setting up RAID arrays / need disk imager suggestion
[edit]Okay, so I've got two 250 GB HDDs and two 1 TB HDDs. I want to set up two RAID arrays: the TB drives in RAID 1 (mirroring), and the two 250 GB HDDs in RAID 0 (striping); important stuff, photos, documents, videos, etc. go on the TB array, installed apps and the OS go on the other one. I know RAID 0 doesn't provide a huge performance benefit, but it's slightly better than plain spanning, and will let me install as many games and crap as desired without space concerns.
Am I right to assume that my motherboard's hardware RAID controller (Intel® ICH8R Southbridge RAID) will allow me to set up two separate RAID volumes? Will I hit any issues at all with this plan?
Also, both the 250 GB HDDs have data on them already. I'm going to need to do some disk image juggling to keep that data; anyone have suggestions for good disk imaging software?
Edit: Going to amend this with one more question: if I take an HDD out of a RAID 1 array, will it be accessible without issue by any other computer?
-- Consumed Crustacean (talk) 23:24, 18 April 2009 (UTC)
- Yes the ICH8R should allow you to create multiple RAID volumes, at least 2 and probably 4, although this may vary depending on your motherboard implementation.
- Do the 1Tb disks contain data? If not then the simplest solution rather than disk imaging is probably just to copy the data to them first and move it back when the RAID-0 is setup. I'm sure you are aware of this, but I just want to mention it in case, RAID-0 provides no redundancy. If EITHER 250Gb disk fails then you will lose the entire volume and you may want to consider keepin ghtme as separate disks or just having another RAID-1 mirror with the 250Gb disks, but obviously that's up to you though.
- You can break a RAID 1 array at any time and have two exact copies of the same disk - I do this all the time, it's VERY convenient. This is assuming the RAID-1 volume wasn't in a rebuild state obviously. Hope this helps! ZX81 talk 23:55, 18 April 2009 (UTC)
- Okay, cool. I know about RAID 0's limitations, and I'm still debating it, but like I said it's intended only for installed programs and the OS. The installed games, mods, and applications have basically filled a whole of one of the 250 GB drives, and I've still got several others that I've had to uninstall because of space issues. I wouldn't mind simply being able to install to that partition without any regard for how much space is left, rather than having to juggle between two.
- The imaging software would be used to keep the MBR and things straight, though I suppose I could just use fixmbr or whatever the equivalent is in Vista. -- Consumed Crustacean (talk) 00:08, 19 April 2009 (UTC)
- On running the HDD through SequoiaView, I've found a few things that I can do to save space on the main partition (relocating Steam to the TB array will save a hell of a lot of space and cause no inconvenience, for instance), so I'll just RAID 1 both sets. Thanks for the help. -- Consumed Crustacean (talk) 00:44, 19 April 2009 (UTC)
- I use R-Drive Image and it works pretty well for me. Better than Norton Ghost and Acronis True Image. SF007 (talk) 02:19, 19 April 2009 (UTC)
- On running the HDD through SequoiaView, I've found a few things that I can do to save space on the main partition (relocating Steam to the TB array will save a hell of a lot of space and cause no inconvenience, for instance), so I'll just RAID 1 both sets. Thanks for the help. -- Consumed Crustacean (talk) 00:44, 19 April 2009 (UTC)