Wikipedia:Reference desk/Archives/Computing/2011 May 20

Computing desk
< May 19 << Apr | May | Jun >> May 21 >
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.


May 20

edit

16Gb Optical Multimode Fiber

edit

Good Morning, Wikipedia!

  I'm now looking for OM fiber which will carry 16Gb Fibre Channel for atleast 50 meters. Are OM3 and/or OM4 capable of these speeeds?

  Thanks as always. Rocketshiporion 01:25, 20 May 2011 (UTC)[reply]

You should ask your networking hardware manufacturer, as it may depend strongly on the implementation details, but at 50m I would expect either OM3 or OM4 to be physically capable of carrying 16 Gbps. Dragons flight (talk) 01:49, 20 May 2011 (UTC)[reply]
The cable I'm looking at is the Hewlett-Packard 50m PremierFlex OM3+ LC/LC Optical Cable (BK843A). None of the resellers' salespeople can answer the question, and HP Technical Support referred me back to the above webpage. Rocketshiporion 04:58, 21 May 2011 (UTC)[reply]

secure website (https) on a public network

edit
  Resolved

If you are on a secure website (https) on a public network, is it secure? That is, no one can see or capture what you type? Bubba73 You talkin' to me? 03:32, 20 May 2011 (UTC)[reply]

It means what you send over HTTPS (what you input and submit) is theoretically protected. It does not mean what you type is protected. ¦ Reisio (talk) 05:17, 20 May 2011 (UTC)[reply]
So, if I am on a public network, connect to an HTTPS site, I am where no one can see me, can someone (e.g. the owner of the network) intercept passwords, credit card numbers, etc? Bubba73 You talkin' to me? 05:27, 20 May 2011 (UTC)[reply]
The person who controls the computer can plant software to record everything you do on it. If SSL is used properly then information should be protected between when it leaves the source computer and when it arrives at the destination computer, but unless you control the source computer there is no way to be sure there isn't something malicious being done to spy on you there. Dragons flight (talk) 05:55, 20 May 2011 (UTC)[reply]
Yes, I'm talking about using my laptop on a public network somewhere (usually wireless). I have confidence that my computer is OK. So it is securely encoded before it leaves my laptop. Bubba73 You talkin' to me? 06:19, 20 May 2011 (UTC)[reply]
Yes; you are safe from attack. If you don't particularly trust the website to properly secure all its information over a connection (and I sure as hell don't: Facebook and Twitter, I'm talking about you [1]), I recommend installing NoScript and turning on HTTPS enforcement[2]. The only other way someone can get your information is if the certificate companies themselves have a breach (which has happened at times... it's a long story), but that's more likely a problem of governments spying on you, which they could do from anywhere. Magog the Ogre (talk) 06:38, 20 May 2011 (UTC)[reply]

C++ make error

edit

I'm a FORTRAN programmer trying to compile C++, so please have patience with me. This is a sample program provided on CD with the book "Teach Yourself Game Programming in 24 Hours", by Michael Morrison (author). I click on the build.bat file provided, and get the following error:

C:\Borland\BCPP\Chap02\Skeleton> make -f Skeleton.mak
Skeleton.mak:8: *** missing separator.  Stop.

Here's the Skeleton.mak file:

 APP      = Skeleton
 EXEFILE  = $(APP).exe
 OBJFILES = $(APP).obj 
 RESFILES = $(APP).res
 LIBFILES =
 DEFFILE  =

 .AUTODEPEND
 BCC32   = bcc3
 ILINK32 = ilink32
 BRC32   = brc32

 CFLAGS  = -c -tWM- -w -w-par -w-inl -W -a1 -Od
 LFLAGS  = -aa -V4.0 -c -x -Gn
 RFLAGS  = -X -R 
 STDOBJS = c0w32.obj
 STDLIBS = import32.lib cw32.lib

 $(EXEFILE) : $(OBJFILES) $(RESFILES)
  $(ILINK32) $(LFLAGS) $(OBJFILES) $(STDOBJS), $(EXEFILE), , \
  $(LIBFILES) $(STDLIBS), $(DEFFILE), $(RESFILES)

 clean:
  del *.obj *.res *.tds *.map

Line 8 appears to be ".AUTODEPEND". Is there a missing separator at or around that line ? What kind of separator are they talking about ? I tried deleting that line, at which point it complained about a missing separator at line 19. I can provide any additional code or info needed to help debug this. Any help would be much appreciated. StuRat (talk) 08:34, 20 May 2011 (UTC)[reply]

"Missing separator" is the make-file error message when you use spaces, instead of tabs. You must use tabs, not spaces - this is a detail of Makefiles. If you think you typed a tab, check to be absolutely sure that your text-editor is not "auto-converting" tabs to spaces, for example. Here's the GNU Make error-reference. I don't know whether Borland uses its own version of Make. (To be honest, I strongly dis-recommend Borland's C++ compiler. Use GCC, or if you intend to use Windows-tools only, download the free version of Microsoft Visual Studio, available free from Microsoft. Any book which is advocating Borland tools is very outdated. For perspective: you're using Borland 3, which barely supports 32-bit processors). If you plan to work in this environment, you should expect serious compatibility problems with any operating system newer than Windows 3.1. Nimur (talk) 16:39, 20 May 2011 (UTC)[reply]
I tried adding tabs everywhere there are spaces, and that didn't help. I'm actually using Borland 5.5.1. The Skeleton.mak file came on the CD, I didn't type it in. Perhaps the issue is using a 3.2 make file with version 5.5.1 of the Borland compiler ? StuRat (talk) 17:44, 20 May 2011 (UTC)[reply]
Well, unfortunately Borland's toolchain is entirely defunct; and you're already in possession of a reference-textbook describing how to use it, so I think at this point my ideas are exhausted. As I hinted above, you should use a reasonable toolchain, unless you enjoy fighting with antiquated and proprietary software. There is absolutely no reason to use that tool: it is not free (you paid for it as part of your book fee!); it is not open-source software; it is not supported by any commercial company; it is not used by any open-source community; and it is known to have compatibility issues with modern systems. Free, open-source replacements are available; zero-cost proprietary replacements are available; and for-fee software with support service is also available. I strongly recommend you use the gcc toolchain. Nimur (talk) 18:49, 20 May 2011 (UTC)[reply]
I'm willing to try GCC. How do I download it ? When I do web searches I get pointed to FTP mirror sites containing many sub-folders with random names: [3]. Is G++ the same as C++ ? Do I want the ".tar.gz" or ".tar.bz2" version ? I have no idea how to download from there. Is there a site with a proper download manager ? StuRat (talk) 19:09, 20 May 2011 (UTC)[reply]
Start by reading our article on GCC. Then, download Minimalist GNU/GCC for Windows ("mingw" or "mingw32"): here's the Getting Started guide and installation instructions, and here's a direct link to the executable installer for it.
If you want a GCC development environment, skip those steps and download Dev-C++, which will install both a C++ text-editor and the mingw/gcc compiler.
g++ is a short-name for the C++ compiler provided as part of gcc. Officially, "GCC" stands for "GNU Compiler Collection." When you run the command gcc, the compiler will auto-detect what language it should use (C, C++, Pascal, FORTRAN, or any of the dozens of other languages GCC can compile). When you run the command g++ you are instructing GCC that your code is "C++" (with caveats), and that it should not try to auto-detect the language. Nimur (talk) 20:43, 20 May 2011 (UTC)[reply]
GCC is traditionally a Unix-world tool and the primary releases are source code only. You need to search for "gcc windows" or something. You'd want either MinGW or Cygwin. You might find the MinGW distribution easier to use, but I'm not sure since I've only ever used Cygwin. Or you might prefer an IDE like Code::Blocks, which comes with a bundled MinGW toolchain. Or you could use Visual C++ 2010 Express. Or you could stick with Borland 5.5.1 (which is freeware, contrary to what Nimur said). It is probably fine, and there are obvious advantages to sticking with the toolchain that's bundled with the book—although the fact that the Makefile bundled with the book doesn't work with the toolchain that's bundled with the book makes me wonder.
A more important question is whether you should use this book. The computer sections of bookstores are littered with overlong, poorly bound, badly written teach-yourself books, of which this appears to be a typical example. And nobody writes Windows games using Windows GDI, which is what this book seems to use. I think you would be better off with free online tutorials, such as the ones at http://www.sdltutorials.com/ (SDL) or http://nehe.gamedev.net/ (OpenGL). Most of these tutorials use C++. If you ditch the book then you should ditch Borland C++ also. -- BenRG (talk) 20:42, 20 May 2011 (UTC)[reply]
Ditto, on BenRG's comments. NeHe is very popular, and libSDL is excellent for game designers and also for general-purpose multimedia programming. (Re-reading my post, I did not make this clear: I recommended ditching the environment, but meant the not just the toolchain. Also toss out any of its cruft libraries and outdated source-code provided by this book, and probably the book itself, in favor of modern, standard, and preferably free-software). Nimur (talk) 20:58, 20 May 2011 (UTC)[reply]

UPDATE:

1) I've installed both MinGW and Cygwin. Both compiled, but only MinGW ran successfully by popping up a window. Cygwin just hanged. Any idea why there would be a difference ?

2) Now for the next problem. While that very basic test program compiles, when I try to compile a program that does anything useful, I get tons of errors, mostly of the "undefined reference" variety. Since the author included the executables, we can assume that the code itself is good. So, there must be some systemic incompatibility between that code and the compiler or environment. Any idea what ?

3) I was planning on including the errors, but, for some reason, cut and paste seems to be disabled in the MinGW shell window (I can't highlight text). I'd hate to have to type in all those error messages by hand. Any idea how I can fix this ? StuRat (talk) 16:36, 21 May 2011 (UTC)[reply]

"Undefined symbol" is a linker error. The most common linker errors are either: (a) you did not specify the location of a required library; or, (b) you specified the correct location of an incompatible library.
If you used the make script you posted before, your "STDLIBS" (standard libraries, import32.lib cw32.lib) were provided by Borland, so they are probably incompatible with code compiled using gcc.
If you are using other libraries, and still receiving undefined symbol errors, check your linker arguments. The library path is specified by the gcc linker command line arguments):
-L ..\path\to\those\libraries\ -limport32.lib -lcw32.lib
(capital L for the directory, lowercase l for the library file-names). Even if properly linked, the Borland libraries will probably fail anyway, for two reasons: first, those libraries are binary format compiled by Borland (they are part of the Borland suite), and are probably incompatible with any other compiled code (due to symbol-name conventions and function/call-stack conventions). Unless you enjoy mangling binary objects, you probably can't fix this problem. Secondly (but more fixable), gcc ld requires a filename of the format libUsefulTool.a, which you specify using the command argument -lUsefulTool.
You probably will not be able to link Borland libraries while you are using another toolchain. If your source-code heavily depends on those libraries, you may be out of luck and must replace or rewrite the code. This is ultimately the reason that BenRG and myself both recommended ditching the entire book - its sample source code is nonportable. Nimur (talk) 16:00, 22 May 2011 (UTC)[reply]
OK, I am convinced. I will most likely ditch the book, Borland, and, for that matter, all of C++, and stick with FORTRAN, where I've never run into such intractable problems. StuRat (talk) 05:08, 23 May 2011 (UTC)[reply]

USB to MIDI

edit

I've got a keyboard (of the musical variety) that I want to connect up to my computer so I can play virtual instruments. I also have a Proteus sound module that I want to play using the keyboard but at the moment I can't.

The keyboard is a pretty standard Yamaha PSR E413 that I bought last year and it has a USB port on the back. In the old days things were so simple - get a cable with a 5 pin DIN on both ends and away you go. This new-fangled USB thing has complicated things considerably. My sound module only has DIN sockets and while I can connect the keyboard to my computer using an ordinary USB cable, the drivers are very proprietary and won't work on my machine.

It appears that there are cables around that connect USB to MIDI but they are the wrong way round for what I am trying to do - these connect DIN sockets on a keyboard to USB on a computer. The USB plug is a USB A type and the socket on the keybaord is a USB B type. Would it work if I got a USB A/USB adapter and connected it to one of those cables? I am guessing the answer is probably not.

Is there some kind of magic box I can buy that takes a USB input and converts the signals to something more generic (getting round the drivers issue) and then connects to the computer?

For the sound module, is there some kind of magic box that will take USB MIDI signals and output them to DIN plugs/sockets?

I think the latter would be more useful. My computer doesn't have DIN sockets but I know you can buy devices that do the reverse of what I want, converting MIDI to USB.

Going from DIN to USB seems like a backward step for me! Am I going to have to buy an old keyboard so I can get one that has DIN sockets? I would have thought there would be some kind of standard for implementing MIDI via USB. —Preceding unsigned comment added by GaryReggae talk:GaryReggae|talk]] • contribs) 11:55, 20 May 2011 (UTC)[reply]

If you can't even successfully connect the keyboard to your computer with the "very proprietary" drivers then I suspect you're out of luck. Presumably the protocol it's using over the USB connection is also proprietary, and I don't think there's much chance of being able to translate it to standard MIDI messages by any sort of "magic box". If you really can't get the keyboard to talk to the computer (have you googled for updated versions of the drivers/ versions appropriate to the computer?) then I really think you will have to bite the bullet and get another kb with "proper" MIDI DIN sockets. Since you already have the sound module then you could just get a MIDI controller kb, i.e. one with no sounds of its own. For example, googling for "midi controller" have me this 88-key keyboard] for £132 (about US$214) - if you can make do with 4 or 5 octaves then it would be a lot less (as most of the cost is in the key mechanisms), or have a look on eBay etc. Good luck! AndrewWTaylor (talk) 16:00, 20 May 2011 (UTC)[reply]
Thanks. On further research into this, it appears that most keyboards do have DIN MIDI sockets and the keyboard I have got is unusual in only having a USB socket. So yes, it appears that I will have to get a new keyboard that does have DIN sockets. I will have another go at getting it to work but otherwise I only have five octaves at the moment so I will look for a basic keyboard. Thanks again! GaryReggae (talk) 23:03, 20 May 2011 (UTC)[reply]

Tablets that will fit in the pocket of my lab coat

edit

Dear Wikipedians:

I would like to buy a tablet that will fit in the pocket of my lab coat so that when I go see patients I will have the power of many medical books with me. Unfortunately the iPad is too big and won't fit. Is there any tablet that will fit the pocket of my lab coat?

Thanks,

142.76.1.62 (talk) 15:25, 20 May 2011 (UTC)[reply]

iPhone. The iPhone is not usually called a "tablet," but the word "tablet" is not usually applied to iPad, either. The iPad is officially called an "iPad." As an owner of a device, you can call it whatever you like. I call my iPads "nimur." (We have a serious crisis of identity in my home). Nimur (talk) 15:43, 20 May 2011 (UTC)[reply]
The clairvoyance interface being down for its Friday afternoon nap, I suppose we might ask to be informed as to the dimensions of the pocket of your lab coat. (And come to that, what's the point of a medical man or woman without a briefcase of exotic drugs, spatulas, ear & eye peering apparatus, &c. Can't the tablet be stored with these.) --Tagishsimon (talk) 15:49, 20 May 2011 (UTC)[reply]
Funnily enough iPad says "This article is about the line of tablet computers designed and marketed by Apple Inc." and "The iPad (pronounced /ˈaɪpæd/ eye-pad) is a line of tablet computers designed" and has 33 instances of the word tablet including in the title of a number of refs. Comparison of tablet PCs and Tablet computer both feature the iPad, in the later case as the lead image... Apple may not like to call their devices tablets the same as not liking to call their computers "personal computers", it doesn't stop the rest of the world applying standard terms to similar devices. Incidentally "Comparison of tablet PCs" may be of use to the OP although it only has one 5" tablet, the Dell Streak. I'm quite sure there are more then that but it it's a useful starting point. Of course if a 5" tablet is still too big, a smart phone may really be the best bet. Edit: There is evidentally a 4" tablet [4] although it's basically a smartphone without the phone components. Nil Einne (talk) 16:44, 20 May 2011 (UTC)[reply]
Incredible that our article uses such terminology. Now, I am not technically an authoritative or official source of information about iPads; but then again, neither is the Wikipedia article; it is editable by anyone. The authoritative website, of course, is http://apple.com/ipad - and there is absolutely no discussion of "tablet" anywhere on there. In fact, previously, the page included the text "It's not a tablet, it's iPad 2." I prefer to describe iPad as a vector processing supercomputer with touch interface. Nimur (talk) 18:40, 20 May 2011 (UTC) [reply]
If you allow them to do so, pretty much every company would describe their product as "totally unique" and insist that it can't possibly be classified with any of it's competitors (for another example, Dove (toiletries) insists that their product isn't soap, but is a "beauty bar": [5]). It's our job to wade through that marketing BS and describe things as they really are. StuRat (talk) 18:57, 20 May 2011 (UTC)[reply]
As I said above, you can call any device anything you like. The ultimate question here is what the original poster is looking for: a "small tablet" is not often called a "tablet," because "tablet" is weakly defined. So, if they're looking for a "small, mobile, touch-screen information processing and viewing device," rather than a "tablet," but they have decided that an iPad is too large, an iPhone or an iPod Touch may be a suitable replacement. Nimur (talk) 19:11, 20 May 2011 (UTC) [reply]
Depending on the size of your pockets, a nice 7in tablet might be just what you need. The Galaxy Tab fits comfortably into some pockets. APL (talk) 23:57, 21 May 2011 (UTC)[reply]

Thank you all for contributing. I went to the store today and found out that the new Blackberry Playbook is both powerful and fits in my lab coat. Therefore I have purchased it. 70.31.153.88 (talk) 00:26, 22 May 2011 (UTC)[reply]

  Resolved

GRUB legacy and multiple Linux partitions

edit

Hi, I would like to use GRUB legacy to alternately boot multiple Linux partitions.

/dev/sda1 - First  Linux installation, GRUB package is installed, GRUB code in MBR points here
/dev/sda2 - Second Linux installation, GRUB package is installed, but grub-install was not run
/dev/sda3 - Third  Linux installation, GRUB package is installed, but grub-install was not run

All three partitions contain a /boot/grub/menu.lst. The menu.lst in /dev/sda1 currently contains default 2 as well as two additional entries after the automagic kernels list. These two entries consist of a root(hd0,1) resp. root(hd0,2) and a configfile /boot/grub/menu.lst. That way, it currently boots /dev/sda2 unless something else is selected manually.

What I'd like to do is make it toggle between /dev/sda2 and /dev/sda3 on each reboot, but all my experiments using default saved and various combinations of savedefault n failed. Also, commands like grub-reboot-once or scripting echo "savedefault --default=n --once"|grub --batch fail; either it always boots item #0 or the item specified as default in the menu.lst on /dev/sda1. I also tried mounting and chrooting into sda1 and running the grub commands from there; that didn't work either.

So what is the proper way to make the box boot sda2 on the first reboot, sda3 on the second, sda2 again on the third, etc? -- 188.99.196.147 (talk) 21:03, 20 May 2011 (UTC)[reply]

You could just have a shell script alter menu.lst on bootup (depending on conditions, if you like). ¦ Reisio (talk) 17:59, 21 May 2011 (UTC)[reply]
As Agent Smith said: Tell me, Mr. Anderson... what good is a phone call... if you're unable to speak? - A script would only run after the other partition booted; if something causes the boot to fail, there's no way of falling back to the other partition. -- 88.67.158.241 (talk) 21:23, 21 May 2011 (UTC)[reply]
No way besides selecting the other one from the GRUB screen at bootup. (OK actually there are a number of other ways, but let's be dramatic.) ¦ Reisio (talk) 04:02, 23 May 2011 (UTC)[reply]
Okay, let me clarify: The script you suggested provides no automated fallback. User interaction is required - and that's what I'm trying to avoid. -- 78.43.60.13 (talk) 08:46, 23 May 2011 (UTC)[reply]

Managed Extensions for C++ arrays

edit

For my sins, I'm having to do some fairly simple coding using Managed Extensions for C++. It's not proving too painful so far, but I've hit a bit of a sticky point regarding multidimensional arrays. In the old days, I could do something like:

void oldFunction(int*);

void mainFunction()
{
    int aiWorkingData[10][10];
    
    aiWorkingData[5][2] = 7;

    oldFunc(aiWorkingData[5]);
}

But, now, it seems as though I have to do:

System::Void newFunction(int []);


System::Void mainFunction()
{
    int aiWorkingData __gc[,];
    int aiTemp __gc[];
    int i;

    aiWorkingData = new int __gc[10,10];
    aiTemp = new int__gc[10];

    aiWorkingData[5,2] = 8;
    
    for (i = 0; i < 10; i++)
    {
        aiTemp[i] = aiWorkingData[5,i];
    }
    newFunction(aiTemp);
    for (i = 0; i < 10; i++)
    {
        aiWorkingData[5,i] = aiTemp[i];
    }
}

I'm sure I'm doing something wrong, but it's not obvious what I should be doing instead. Any help would be most appreciated. Tevildo (talk) 21:18, 20 May 2011 (UTC)[reply]

Is it just me, or has the background to the page suddenly changed to a shade of pink? If so, where do I complain about it? Tevildo (talk) 21:22, 20 May 2011 (UTC)[reply]
Is today deprecated-Microsoft-platforms day? What in the world are you doing with Managed C++ that you can't do with CLI/C++ in .NET? ME was EOL`ed some five years ago; you should have upgraded to CLI by 2006. Unless you have a very good reason for using deprecated build-tools and deprecated language extensions (such as, "I am a software archaeologist creating a museum exhibit of a C++ development shop during the Bush II era,") you're asking for trouble. Nimur (talk) 21:45, 20 May 2011 (UTC) [reply]
A valid point, of course - I'm adding some functionality to an old piece of code which it would take too much time to rewrite from scratch (and I'm not really a programmer in the first place, as you may be able to deduce). But it needs to be working for Monday - I can do it using the loops if I have to, I was just wondering if there's a more elegant method. Tevildo (talk) 21:51, 20 May 2011 (UTC)[reply]
Multidimensional arrays are specified in C++ with a fixed ABI (according to ISO C++), but some compilers don't trust the standard (because so many other compilers don't use the standard). So technically, your earlier code is an unsafe operation and doesn't guarantee portability. (You can't guarantee that the one-dimensional array accesses the data sequentially, because you don't really know how the 2-D array is laid out in memory). VC++'s probably giving you a compiler error for that reason. Official Microsoft array documentation does not specify a multidimensional array layout ABI; so, you should use your second method. "Unelegant," but also unambiguous. Nimur (talk) 22:42, 20 May 2011 (UTC)[reply]
Thanks for the info. And Bush I would be more accurate - most of the stuff downstairs is still in VB3. Tevildo (talk) 23:22, 20 May 2011 (UTC)[reply]
Nimur, nothing that you just said makes any sense. C arrays are stored in row-major order with no row/column headers or other overhead. This layout is used by absolutely every C and C++ compiler that has ever existed. Tevildo's C code is legal and unambiguous (aside from array elements other than [5][2] being left undefined).
Tevildo, I've never used Managed C++, but it must support arrays of arrays (as distinguished from multidimensional arrays). I can only guess the syntax, but perhaps it's this:
                    int aiWorkingData __gc[] __gc[] = new int __gc[] __gc[10];

                    for (i = 0; i < 10; i++)
                        aiWorkingData[i] = new int __gc[10];

                    aiWorkingData[5][2] = 7;

                    newFunction(aiWorkingData[5]);
-- BenRG (talk) 12:05, 21 May 2011 (UTC)[reply]
BenRG, your sample code will initialize a one-dimensional array of pointers to other arrays allocated on the heap, which is not identical to a row-major order. In other words, there's zero guarantee that your individual sub-arrays are anywhere near each other: in your line:
   aiWorkingData[i] = new int __gc[10];   // aiWorkingData[i] now contains a pointer to a new array
...they are laid out in memory whereever new allocated them. In addition, in Managed C++, you have paid a memory overhead because you have duplicated the array metadata and also store an additional array of pointers to one-dimensional arrays. That is functional but it is not identical to the original code. This was my whole point above.
As a closing note, do not store pointers (or anything you allocated with "new") to an "int" - use an array of the appropriate pointer type. If your target machine runs a 64-bit managed C++ engine, and your code was compiled for a 32-bit target, you have just corrupted memory. Nimur (talk) 15:09, 22 May 2011 (UTC)[reply]
Okay, I think I've figured out the confusion. You assumed that oldFunction might access the whole 10×10 array, not just row 5. I assumed that it would access only row 5. The OP made the same assumption I did, judging by the second code snippet. My array-of-arrays code wasn't meant to simulate a C array, just to solve what I think is the OP's problem.
My code doesn't store a pointer into an int, unless I guessed the syntax wrong. The result of storing a pointer into an int would be a compile-time error, not memory corruption.
"Multidimensional arrays are specified in C++ with a fixed ABI (according to ISO C++), but some compilers don't trust the standard (because so many other compilers don't use the standard)" is wrong any way I read it. It's wrong if it refers to C arrays because the memory layout of C arrays is specified and universally observed. It's wrong if it refers to any other array type because their memory layout isn't specified. ISO C++ doesn't define an ABI.
"So technically, your earlier code is an unsafe operation and doesn't guarantee portability" is wrong if oldFunction only accesses row 5. But as far as I can tell from N1124, accessing data outside row 5 with an expression like p[10] (where int* p = aiWorkingData[5]) does invoke undefined behavior, even though the standard guarantees that &p[10] == &aiWorkingData[6][0]. -- BenRG (talk) 20:17, 22 May 2011 (UTC)[reply]

App security

edit

Hi, I am very cautious about what software I load onto my (Windows) PC for all the obvious reasons. I would only ever install software from well established companies that I'm 100% confident about. I would never install anything from an unknown or dubious source and let it have free rein over my PC. So, I'm curious now about how the current craze for downloading apps to "smartphones", tablets etc. works (I don't own any of those devices). As far as I can gather, many of these apps seem to be small "thow away" or "fun" programs, often not written by known or reputable companies, but by some unknown individual or individuals of unknown credentials. Are people downloading these apps more risk-tolerant than me, or is there some stronger in-built protection in the relevant operating systems, compared to Windows, that limits the access that apps have, and prevents them doing damage, spying on one, etc.? 86.176.213.179 (talk) 23:54, 20 May 2011 (UTC)[reply]

Well the only sort of 'security' is provided by Apple in the form of the App Store. People at Apple test it to make sure there are no malicious code on it. I'm not sure about the other stores however. General Rommel (talk) 00:25, 21 May 2011 (UTC)[reply]
That must be quite hard to do, I would have thought, in all but the most tiny apps. My experience, admittedly from another era, is that it is incredibly hard to understand what other people's programs are doing just by looking at the source (which is what I assume the testers must do, since any sort of post-installation delayed activation, as well as probably all sorts of other checks on location, usage patterns etc., could presumably defeat a tester who simply ran the program). And that's even when the programs are written relatively straightforwardly without any attempt to deceive. If someone was deliberately trying to obfuscate the code to conceal bad things, well, I'm not sure if I would trust a tester to spot that. Maybe they have better techniques than I'm imagining... 86.176.213.179 (talk) 01:42, 21 May 2011 (UTC)[reply]
I'm going to call [citation needed] on General Rommel's claim that "People at Apple test it to make sure there are no malicious code on it". I am under the impression that somebody launches the app and plays with it for like a minute to see whether it crashes, and if it passes this "test" then it can get launched. If there are user reports after-the-fact that it's malicious, it would get taken down at that time. Comet Tuttle (talk) 16:41, 23 May 2011 (UTC)[reply]
Android provides a fine-grained security model (although it's not that fine grained). When you install an app, it shows the permissions the app needs, and you can refuse to install. Android apps are mostly compiled to Dalvik bytecodes which are JITted and run in an individual sandbox environment (which makes it difficult for a bad app to mess with other apps or the system). So it's somewhat safer downloading and running a random app than it would be downloading and installing a random Windows program (but that's a low benchmark). In practice I fear most people don't read (or understand) the permissions they're granting, and I wonder what proportion of users do due diligence in checking the provenance of the app and the actual reputation of its makers. -- Finlay McWalterTalk 01:02, 21 May 2011 (UTC)[reply]