Wikipedia:Reference desk/Archives/Computing/2011 March 27

From Wikipedia, the free encyclopedia
Computing desk
< March 26 << Feb | March | Apr >> March 28 >
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.


March 27[edit]

Email clients supporting binary MIME[edit]

Are there any email clients supporting binary MIME#Content-Transfer-Encoding encoding method? Such email application could store email attachments in message bodies as efficiently as storing them outside as files in filesystem. -Yyy (talk) 08:21, 27 March 2011 (UTC)[reply]

Variable-sized tuple class in C# or other such language[edit]

I recently had need of a C# class representing ordered pairs of any generic type, so I wrote the following:

public class Pair<T, U>
{
  private T first;
  private U second;
  public Pair(T first, U second)
  {
    this.first=first;
    this.second=second;
  }
  public T First
  { get { return first; } }
  public U Second
  { get { return second; } }
}

Now this works OK, but I came to think: sooner or later I will probably need ordered triples, ordered quadruplets, and so on. It is of course very easy to write a class such as the above for all of them, but it would be easier still if I could do something like this (not legal C#):

Tuple<3><string, int, bool> tuple = new Tuple<3><string, int, bool>("Hello world!", 6858, true);

with me having to only write one definition of the class Tuple. Is such a thing even possible in C# or any other C-based object oriented language? JIP | Talk 17:43, 27 March 2011 (UTC)[reply]

Python already has tuples built in, that can be of any length you need and contain any value you want. More generally, what you're after is a variadic constructor. We can do that in Python trivially; it's trivial because Python passes the actual parameters of a function to that function as a tuple. Here's an example:
python vararg constructor
#!/usr/bin/python
class Mytuple:
    def __init__(self, *args):
        self.store=args

    def __len__(self):
        return len(self.store)

    def __str__(self):
        val = "Mytuple:"
        for x in self.store:
            val += str(x)+" "
        return val

    def __getitem__(self,index):
        return self.store[index]
        
a = Mytuple("Hello world!", 6858, True)
print a[1]
-- Finlay McWalterTalk 18:24, 27 March 2011 (UTC)[reply]
That looks otherwise like what I'm after, except that what I was thinking of would have compile-time static typing, i.e. the number of items in the tuple and their types would be fixed at compile-time, and trying to misuse them would cause a compile error. Given enough time, I could be able to simulate something like the above Python sample in C# or Java or a similar language, but it would require run-time type checking. JIP | Talk 18:54, 27 March 2011 (UTC)[reply]
I think you can do it statically in C++ using compile time template metaprogramming; I don't think Java's or C#'s generics mechanism will help because, as you say, they operate at runtime. -- Finlay McWalterTalk 19:28, 27 March 2011 (UTC)[reply]
In C++ you can overload templates on argument count, so you can declare tuple<>, tuple<A>, tuple<A,B>, tuple<A,B,C>, up to the maximum length you think you'll ever need. The new C++0x standard has template varargs, and I believe that can be used to declare a truly arbitrary-length tuple template. But either way, you should not write your own tuple template; you should use boost::tuple. -- BenRG (talk) 04:23, 28 March 2011 (UTC)[reply]
You could always do Pair<A,Pair<B,Pair<C,D>>>. It's the traditional way to do it in ML-like languages (though I should point out that it looks much uglier ported to C# like this, since C# lacks infix type constructors and type-based pattern matching). Paul (Stansifer) 23:31, 28 March 2011 (UTC)[reply]
In C++ you can do it with template metaprogramming as Finlay McWalter says. I guess you'd have a projection function that take an integer parameter since the template obviously couldn't generate first, second, third, fourth, fifth, .... In Haskell you could use a phantom type encoding a tuple size, as an index to a type constructor for tuples (see here) and use Template Haskell to generate such types automatically. You could also look into dependently typed languages. They let you use term-level values as part of type constructors, so "tuple 5" could be the type of 5-tuples, but you can also encode much more complicated invariants as types. This paper explains a little of what they are about. WP's article generic programming needs a lot of work but has some further info and references. 75.57.242.120 (talk) 17:20, 29 March 2011 (UTC)[reply]

How do I read iPhone app code?[edit]

How do I read iPhone app code? I've heard that it exists on the phone only as binary and as such cannot be read, but even if this is true there must be a way to convert back. Some decompiler of some sort?Elatanatari (talk) 18:53, 27 March 2011 (UTC)[reply]

IOS apps are distributed as .ipa format files, which are just .zip files. Inside those is a Payload directory which contains the app's assets and its binaries. The binaries are Mach-O fat binary format. These files themselves are unencrypted, but I can't tell whether their code sections (the chunks of the file containing the actual code) are encrypted or merely cryptographically signed. If they're encrypted, you're really out of luck. If they're just signed, the OS-X disassembler otool will (reportedly) disassemble them (as will an appropriately targetted build of GNU's objdump). Even then you'd be left with a ARM architecture assembly language file, not anything like the Objective-C sources from which the program was originally compiled. There are decompilers that try to reconstruct an Objective-C source from such an asm dump (e.g. boomerang). In general, reverse engineered source isn't very nice to read, but can be understood with perseverance. Again I stress: I don't know whether the code sections are encrypted. -- Finlay McWalterTalk 20:03, 27 March 2011 (UTC)[reply]
It's not possible to encrypt code and allow the user to run it, without providing the user with the ability to decrypt it. However, compiled code is basically incomprehensible, and decompilation is of limited use, since making code readable in the first place requires great effort, and most of that is wiped out by the compilation process. Paul (Stansifer) 07:29, 28 March 2011 (UTC)[reply]
Strictly speaking, only the CPU needs to decode the binary to execute it; this can be done with a key stored in a on-CPU ROM. However, unless the CPU has enough on-CPU RAM to hold the decoded image, then a computer bus analyser can recover the decoded binary. There several CPUs that come with a small PROM on their die. The PROM can be marked as inaccessible to external bus accesses. CS Miller (talk) 10:12, 28 March 2011 (UTC)[reply]
Sounds like this is a mountain I'd do better going around than climbing. Thanks!141.211.250.151 (talk) 22:24, 28 March 2011 (UTC)[reply]
Sometimes executable are "encrypted" in such a way as to confound decompilers. Never heard of this being done for C code, though. C code confounds decompilers pretty well on it's own. APL (talk) 22:27, 28 March 2011 (UTC)[reply]
In the interest of precision, I'd like to emphasize those scare quotes by stating that that process is security through obscurity, not encryption. Paul (Stansifer) 23:33, 28 March 2011 (UTC)[reply]

Gtalk vs. Google Talk[edit]

Is Gtalk the same as Google Talk? I presume it is as http://en.wikipedia.org/wiki/Gtalk redirects to http://en.wikipedia.org/wiki/Google_Talk, and googling Gtalk mostly leads to pages titled Google Talk. But where does the name Gtalk come from? I see Gtalk (or GTalk, gtalk or gTalk) used much more often than Google Talk. --Mortense (talk) 19:24, 27 March 2011 (UTC)[reply]

I think so. It's in the same style as Gmail, and there appears to be only one protocol involved. Shadowjams (talk) 21:30, 27 March 2011 (UTC)[reply]
I think its the same situation as Gmail vs Google Mail, where Google was forced to give up one name because it was already trademarked in certain regions and continues to use it everywhere else. The products are the exact same and its just a matter of names that avoid trademark infringement. — Preceding unsigned comment added by Roberto75780 (talkcontribs) 03:25, 28 March 2011 (UTC)[reply]

Samsung Wave Apps[edit]

Can the Samsung Wave run unsigned apps, a la Android or jailbroken iPhone? --Melab±1 19:59, 27 March 2011 (UTC)[reply]



Intel PC Camera[edit]

I want to connect my Intel PC webcam type CS120 to a PC running Vista but lack the necessary driver. On the web I have found only driver sources that demand payment, installation of a scanning program, and/or registration with e-mail address. Is there any free source of the driver? Cuddlyable3 (talk) 20:06, 27 March 2011 (UTC)[reply]

You can always get a fake email address, for free, just long enough to satisfy their silly requirement. Gmail is one option. StuRat (talk) 23:08, 27 March 2011 (UTC)[reply]
Ummm, tricky. That particular webcam seems pretty old, so old that the Intel Support Download centre doesn't list it (or any other webcam). Resorting to Google, I tried a few sites and got dead links. Beware that some sites have a prominent "Download now" link that is actually a banner ad to another site; the dead download link is much less prominent. I've never encountered a driver download site that demands payment or installation of more software, although I have had to sign-up before (use a disposable web mail address for this, if you don't already). To be honest though, it might be easier and better to buy a new webcam - they range from £5 to £30 or more from many suppliers. Astronaut (talk) 23:55, 27 March 2011 (UTC)[reply]
Have you tried running the driver software in Compatibility Mode? Right click the setup, go to properties and go to compatibility. Then select whatever OS you want to pretend it to be. General Rommel (talk) 09:07, 29 March 2011 (UTC)[reply]

HP software in Chinese[edit]

I have recently purchased a HP Officejet 4500 printer with the installation CD installing only in Chinese. Regardless, I installed the programs. Furthermore, I just scanned a postcard and it created the PDF file in a folder listed in Chinese. How do I switch the program to English? Is this a software issue? --Blue387 (talk) 20:43, 27 March 2011 (UTC)[reply]

Either take it back to the store where you bought it and demand they supply you with an English language install disk (shouldn't be too hard to do this in New York). Alternatively visit http://www8.hp.com/us/en/support-drivers.html and download a new driver and all the bloatware you want - sorry, every HP driver I've ever had came with gigabytes of unnecessary bloat. Astronaut (talk) 23:21, 27 March 2011 (UTC)[reply]

The ever growing tentacles of Google[edit]

While I like "good" Google, I do not like "evil" Google. Despite their "Don't be evil" motto, I do not like the "bait and switch" privacy policy, where at first they bait you in by offering goodies without any personal information demands, but then switch to demanding personal information so that they can take over the world use us as targeted advertising fodder. Another example is gathering people's wifi details "by mistake", sure. Its like the Stasi, where they put their information together to have a file on everyone.

Supposing I wanted to boycot all of Google and its sub-companies under different names, what should I avoid please? What could I use instead? Thanks 2.97.210.137 (talk) 22:23, 27 March 2011 (UTC)[reply]

See Internet privacy#External links. -- Wavelength (talk) 22:49, 27 March 2011 (UTC)[reply]

You are in luck my freind, because boycotting Google is much easier than boycotting Microsoft. Just keep using its rival Empire's software from Microsoft, Yahoo, Apple etcetera. — Preceding unsigned comment added by Roberto75780 (talkcontribs) 03:23, 28 March 2011 (UTC)[reply]

Microsoft, Yahoo, and Apple are not obviously better than Google. I think they're worse. Perhaps Yahoo isn't worse, but only because it has less power. -- BenRG (talk) 03:55, 28 March 2011 (UTC)[reply]
Lumping Microsoft, Apple and Google together implies you are thinking of product lock-in. The OP seems concerned about privacy, which is a different kettle of fish. I would not advise trying to answer the question "how can I avoid dealing with any company which is slightly morally transgressive?", since (quite apart from cynicism about everybody being awful) it's a somewhat subjective question. 81.131.30.20 (talk) 07:46, 28 March 2011 (UTC)[reply]
Though potentially embarrassing and vaguely intrusive, the objective of targeted advertising is to tell you about things you might like, which doesn't seem all that evil a goal. I'm not aware of the Stasi offering people cheap consumer goods and holidays. 213.122.12.61 (talk) 08:53, 28 March 2011 (UTC)[reply]
The Soviets certainly offered consumer goods to party officials (in foriegn currency shops) and holidays to model workers. Presumably that applied to East Germany too. The Nazis definately did the former, from stolen Jewish property, but I think their plans for holidays in that giant hotel on the the Baltic coast that they built got cancelled due to the war. 92.15.14.99 (talk) 12:39, 28 March 2011 (UTC)[reply]
(responding to 213.*) I feel the same way—ads for products/services I might want to buy are better than ads for products/services I would never buy. I like to know which companies are throwing away the most money on advertising, so that I can patronize different companies. I can't exercise that market pressure unless the thing being advertised is something that I might theoretically buy. What is bad is intrusive advertising. I wonder if people associate the phrase "targeted advertising" with intrusive advertising. It kind of sounds like there's a target painted on you and advertisers throw rotten apples at it. Google, of course, made its fortune from ads that were better targeted and less intrusive than the competition's.
I've never understood this concern over "reading" mail to find advertising keywords. If you use GMail then all of your mail is stored on Google servers, at least temporarily, and there's no way to prove they don't keep a permanent copy. Exactly the same is true if you replace GMail and Google by any other company's email service. And it's probably true of every intermediate router between your email server and that of the person who sent the mail. What difference does "scanning for keywords" make when they already have the entire text? Scanning the text yields only such information about you as was already present in the text. If you really care about privacy, then encrypt your emails. Don't just change email providers, since that merely changes the name of the company that gets to read your mail. -- BenRG (talk) 21:36, 28 March 2011 (UTC)[reply]
E-mail is an inherently insecure method of communication: see Email#Privacy_concerns. If you wish to send sensitive information through e-mail, you should use some sort of E-mail encryption such as Pretty Good Privacy which utilizes Public key cryptography to encrypt messages. Do not rely on the perceived benevolence of a certain company to safeguard your sensitive data. Even if a company isn't currently misusing your data, company management will change with time, and companies may be sold or taken over, in which case all bets about your personal information are off. Buddy431 (talk) 00:07, 29 March 2011 (UTC)[reply]
Ben, if I mention Coca-Cola in my email and get served a Coke ad, Cokecorp gets billed for the ad even if they don't know who received it. If I mention Fanta (another Cokecorp brand) and get served a Fanta ad, Cokecorp gets billed for that. By comparing the two advertising bills Cokecorp learns something about the relative proportion of Coke vs Fanta drinkers among gmail users. That means every time I email somebody who uses gmail, I'm participating in a Cokecorp marketing survey against my wishes. If I don't like Coke and don't want to be in their survey, it's irrelevant from that perspective whether the survey is anonymous or not. (Coke is just an example; I don't actually have particularly big problems with that company). Let's say I've sent you a 1000 character email. The standard definition of confidentiality in information security going back to Shannon 1949 is something like: a communication system maintains confidentiality if an adversary can't tell with better probability than guessing, whether a given message is meaningful (i.e. it is drawn from some known non-uniform probability distribution) or it is meaningless (drawn from the uniform distribution on 1000-character messages). Leaking statistical information about the contents of messages (i.e. the size of the ad bill yields a prior probability that the message mentions Coke) as gmail does means gmail fails confidentiality according to that definition. And of course the amount of marketing info collected from gmail scanning is far more extensive than this simplistic example. 75.57.242.120 (talk) 19:02, 29 March 2011 (UTC)[reply]
These ads are pay-per-click, so if you don't click on them, no money is transferred. Furthermore, this kind of (extremely low-quality) information is available anyways. Even Duck Duck Go may store searches in a "non-personally-identifiable way". If they do that, then probably everyone does. If you don't want to participate in data aggregation, the only thing you can do is get off the Internet. Paul (Stansifer) 05:54, 30 March 2011 (UTC)[reply]
(Wikipedia is another good example of a place that publicizes aggregate figures. In addition, if you're really that concerned about any information leaking, you would have created an account so that you don't reveal your IP address (and therefore your location)... Paul (Stansifer) 14:36, 30 March 2011 (UTC))[reply]
If the advertisers are told the click-through rates (which I think they are), that reveals the number of views. Wikipedia should not be disclosing page view stats of non-logged-in users, an invasive practice that has been bugging me for a while and that affects my own wikipedia browsing habits and my whole concept of how Wikipedia should work. If someone is editing the encyclopedia they're disclosing a certain amount of info on purpose, and we could interpret logging in (even without editing) as active Wikipedia participation that also opts into some kind of aggregated info gathering, but for passive readers we should be aiming for privacy equivalent to that provided by printed encyclopedias. If you read articles from Encyclopedia Britannica at the library and put the volumes back on the shelf, there is no disclosure of any sort, aggregated or otherwise. That IMO is what reading Wikipedia should be like. (Note: this discussion sort of resembles one I had with BenRG here a few weeks ago, so I don't want to keep railing about it here at refdesk: NOTFORUM and all that). 75.57.242.120 (talk) 17:11, 30 March 2011 (UTC)[reply]

Are there any companies which use a different name but are in fact owned by Google? I thought Yahoo was, but the comments above suggest not. YouTube is. Android is I believe Googleware. Any others please? Thanks 92.15.14.99 (talk) 11:16, 28 March 2011 (UTC)[reply]

In addition to products with "Google" in the name, Google subsidiaries and affiliated projects include: YouTube, Blogger, Orkut, DoubleClick, On2 Technologies, Picnik, Aardvark, AdMob, Android, Keyhole, Inc., and GeoEye. Presumably there are others as well. Yahoo however is not affiliated with Google. Dragons flight (talk) 12:06, 28 March 2011 (UTC)[reply]
But none of that matters, because you should judge companies by their business practices, not by whether they are affiliated with a company named "Google". -- BenRG (talk) 21:36, 28 March 2011 (UTC)[reply]
It's incredibly difficult but you might start by using AdBlock to block Google analytics from tracking your web browsing. They have beacons almost everywhere. A lot of web sites also won't function without Google API's or for some reason transclude jquery from a google site, but maybe you could avoid most of the google pings by setting up a static caching proxy. You also have to stop email communication with anyone who uses gmail, and you have to ask them directly whether they use gmail since lots of folks forward addresses at other domains to their gmail accounts so you can't tell just by looking at the address. You have to stay indoors all the time to avoid being photographed by the Google Street View van, and so forth. 75.57.242.120 (talk) 17:30, 29 March 2011 (UTC)[reply]