Wikipedia:Reference desk/Archives/Computing/2008 April 15

From Wikipedia, the free encyclopedia
Computing desk
< April 14 << Mar | April | May >> April 16 >
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 15[edit]

Unistalling Skype[edit]

I have been trying to re install Skype but I keep getting a message "the older version of Skype 3.6 cannot be removed. I have done the Add/Remove bit through the control panel and Skype no longer appears there, I have gone through the Documents & Settings / Application Data folder and removed all references there and I have searched for registry entries through Regseeker and removed all through there but the message keeps coming up. Any ideas, thanks. —Preceding unsigned comment added by Michaelerrington (talkcontribs) 09:40, 15 April 2008 (UTC)[reply]

Do you still have the Older version of Skype? If so, re-install it, then re-boot the pc in 'safe mode' and run the add/remove bit again. That should shift it. Incidentally, have you checked through the *.ini files, the config files and so on? Remove all references to Skype in these, and you might avoid the need to re-install Samilong (talk) 09:30, 16 April 2008 (UTC)[reply]

Simple method to get the filename out of a URL?[edit]

Hi all, I'm trying to work out a simple method that you can pass a URL and it will return the file name of the file. So, if you pass it "http://www.example.org/example/file.txt" it will return "file.txt."

Java would be best, but anything would be helpful. I assume I need a regular expression, but my knowledge of regex is very limited.

Thanks! — Alice 16:10, 15 April 2008 (UTC)

import java.net.*;
static String get_file(String url_string)
  throws MalformedURLException
{
        String filename = new URL(url_string).getPath();
        int slash = filename.lastIndexOf('/');
        if (slash >= 0)
            filename = filename.substring(slash + 1);
        return filename;
}
You want to look for everything after the last slash? To be pedantic, there's nothing in a URL that you can assume will always correspond to a filename. So, figuring out in English what you want to accomplish is probably where the real effort belongs on this problem. Translating that into code should be fairly trivial. Friday (talk) 16:41, 15 April 2008 (UTC)[reply]
The URI spec breaks it up into well-defined chunks. --Sean 16:48, 15 April 2008 (UTC)[reply]
But thanks to the rewrite engine, you can never really be sure (from outside the server, at least) what file will actually be invoked from any given URI. I think that's one thing that Friday was cautioning about.
Atlant (talk) 16:57, 15 April 2008 (UTC)[reply]
There's nothing that says there even has to be a file name. The server is free to handle that string any way it likes. For example : There's no filename in a TinyUrl.com url. There's just a unique ID that the server interprets. APL (talk) 17:00, 15 April 2008 (UTC)[reply]
You could probably use java.net.HttpUrlConnection to first do a GET request and check the 'Content-Disposition' HTTP header for a file name. If that fails you could, as in your example, try to infer a file name from the last path segment. The mime type identified by the 'Content-Type' HTTP header of your GET request might also be useful if you need to come up with some kind of file type/extension to make your file manager happy. If you are simply looking for something to help you parse the URL's path portion, you might take a look at the java.io.File class. --Prestidigitator (talk) 18:16, 15 April 2008 (UTC)[reply]

C#: remove \x00[edit]

<noob> I've just started using C#, and can't find a way to remove a null byte from the end of a string. My application is supposed to accept incoming files via Bluetooth (OBEX), and they for some reason get saved with a null byte after the filename. (Which I always thought isn't allowed by the filesystem.) TrimEnd(new char[] { '\0' }) doesn't work. (I'm really new to C#.) </noob> --grawity talk / PGP 17:21, 15 April 2008 (UTC) P.S. Prepare for a flood of C#-related questions.[reply]

In C, strings are null-terminated. I'm sure this has something to do with the strings you're receiving. I don't know the first thing about C-octothorpe. -- Coneslayer (talk) 17:28, 15 April 2008 (UTC)[reply]
Yes, but the null should be used only as a terminator, and not displayed to the user. Anyway, I've noticed that it's actually 0xFFFD, not null - something with the InTheHand library (which I use for Bluetooth). --grawity talk / PGP 17:57, 15 April 2008 (UTC)[reply]
0xFFFD is Unicode's way of representing a character that could not be translated into Unicode. Clearly some function that you're using is making a wrong assumption about what character set it is reading (like whether it's Unicode or single-byte characters). That's all I can say. --Anonymous, 23:14 UTC, link added 23:37, April 16, 2008.

Security of BitTorrent[edit]

Hi. How secure – data-wise – is BitTorrent? If I'm downloading a Linux distro CD set, can some seeders modify and inject rootkits or the like in the pieces they host? ›mysid () 18:24, 15 April 2008 (UTC)[reply]

Downloading an OS via torrent sounds to me like an exceptionally bad idea. Darn right you could be getting something with a rootkit in it. Why not download directly from a domain you can trust, rather than a bunch of peers? You want to be able to trust your operating system. Really you do. I guess if you REALLY need to do this, at least make sure you are getting the torrent file itself from a trusted source, and verify checksums obtained from an official distribution site to give you some assurance that the files haven't been tampered with. --Prestidigitator (talk) 18:52, 15 April 2008 (UTC)[reply]
If you get a torrent from an official site, you can generally be assured that it's likely to be legitimate. Lots of distros have torrent (i.e. http://torrent.ubuntu.com/). x42bn6 Talk Mess 19:22, 15 April 2008 (UTC)[reply]
"Why not download directly from a domain you can trust, rather than a bunch of peers?" Easy. The project that creates the disk images is a not-for-profit, and they appreciate anything you can do to reduce the load on their servers. Especially since you, and everyone else, are probably downloading multiple CDs worth of stuff. APL (talk) 20:27, 15 April 2008 (UTC)[reply]
Many free software projects publish checksums of their packages on the official site. For example, halfway down the [OpenSUSE download page] there is a link to md5sums of the ISO disk images. The idea is that you can download the distribution off P2P or a local mirror site, then compute the checksum using a utility program such as md5sum and check the result against the checksums on the official site. If the checksums match, then you can be confident that what you got is the official distribution package and that it's safe to run it. 84.239.133.86 (talk) 20:00, 15 April 2008 (UTC)[reply]
I think the answer to the question of whether seeders could inject things is probably "no"—it would definitely throw off the seeder hashes and there'd be very little chance of it all working correctly. Modifying an individual torrent chunk would register as something very wrong to a tracker, I am fairly sure, and it'd be a very difficult thing to pull off in any case (since you wouldn't be sure what chunks would be requested at what time). (Of course, the original distro could be modified from the beginning, but that isn't what I took your question to be.) --Captain Ref Desk (talk) 20:12, 15 April 2008 (UTC)[reply]
You're talking about taking a .torrent file from a trusted source, and injecting bad data chunks into it by seeding tainted data? This is not realistically possible. To do this you would need to first crack the [[SHA hash functions|SHA1 hash.] It's relatively safe to say that this can't be done.
Note that it is possible to turn off hash checking on some torrent clients, but that's apparently just intended for debugging purposes and no one should actually be running like that. Even if only because bittorrent's somewhat large packets occasionally get mangled, particularly by home routers.

In any case if you wanted to feel even safer you could check against the checksums that are usually published by the creators of the disk images. APL (talk) 20:27, 15 April 2008 (UTC)[reply]

Thanks for all the answers. ›mysid () 05:27, 16 April 2008 (UTC)[reply]

I'm pretty sure torrents come with a hash check built into them, so if someone attempted to modify the data being transfered the torrent client would notice the data doesn't match the hash and dispose of it. So as long as you got your torrent from a legit source the file should be safe, especially if its a Linux iso that you got from that distibutions official website. TheGreatZorko (talk) 08:08, 17 April 2008 (UTC)[reply]