Wikipedia:Reference desk/Archives/Computing/2017 March 3

Computing desk
< March 2 << Feb | March | Apr >> March 4 >
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 3

edit

AJAX - A begginers question

edit

Is it accurate to say that AJAX is called "XML HTTP-request object" (XHRO) because we request XML data in an HTTP-rquest object or "packet" ?

Or is the "object" is what we get in return (the XML data itself) ?

Thanks, 77.180.130.37 (talk) 01:21, 3 March 2017 (UTC)[reply]

A security system should work even when its operation is known - what is the name for this principle?

edit

There is a principle in security, cryptography, and information tech in general that a well-designed system will be secure even when all components of its operation are known. That is, no secrecy regarding the mechanics of a system's operation is required to make it secure. This principle is especially pronounced, it seems, in encryption technology.

My question: what is the name for this principle?

(First time I have used *the reference desk* this, please let me know of any procedures I forgot or violated. Thank you!) — Preceding unsigned comment added by 2601:98A:4000:693A:117F:F15C:2FF1:30E0 (talk) 03:43, 3 March 2017 (UTC)[reply]

A few more minutes of searching revealed the answer: Kerckhoffs's principle. Apologies for I do not know how to remove/archive/etc this question, but it is solved. — Preceding unsigned comment added by 2601:98A:4000:693A:117F:F15C:2FF1:30E0 (talk) 03:51, 3 March 2017 (UTC)[reply]

Editing the last posting to make that a link and add "Resolved". --76.71.6.254 (talk) 05:06, 3 March 2017 (UTC)[reply]
  Resolved

scripting

edit

I've noticed a strange thing:
when I do this in gawk (simplified example):

#!/bin/gawk -f
BEGIN{
  cmd="seq 1 1e4|sort -gr | head -20"
  system(cmd)
  close(cmd)
  exit
}

then sort prints

write failed: standard output: Broken pipe
sort: write error

This doesn't happen when I run an identical command directly from the shell (bash and sh). I get the reason for the error: head reads its 20 lines, prints them, exits, sort sees a broken pipe and complains. Why doesn't that happen in bash or sh, though? Moreso as gawk internally uses the system(3) call which uses sh. Most importantly, how do I get rid of the message without completely discarding sort's stderr? Asmrulz (talk) 07:10, 3 March 2017 (UTC)[reply]

PS putting an explicit sh -c "..." in front of the command doesn't help and neither does adding an empty cat (I thought it might) Asmrulz (talk) 07:10, 3 March 2017 (UTC)[reply]

After looking into the source RPM for gawk and doing some experimenting, I find that this happens because
  1. In order to avoid "broken pipe" messages from gawk itself, gawk ignores SIGPIPE, and
  2. if the C function system() is invoked from a process that is ignoring SIGPIPE, the processes that it starts will produce "broken pipe" messages when they otherwise wouldn't.
At least, this is true on my Linux system. For example, this little C program:
   #include <signal.h>
   #include <stdlib.h>
   
   int main()
   {
       int r;
       system("yes A | sed 3q");
       signal(SIGPIPE, SIG_IGN); /* Ignore SIGPIPE */
       system("yes B | sed 3q");
       signal(SIGPIPE, SIG_DFL); /* Default handling of SIGPIPE */
       system("yes C | sed 3q");
   
       return 0;
   }
produces the output:
   A
   A
   A
   B
   B
   B
   yes: standard output: Broken pipe
   C
   C
   C
Why does system() cause this effect? I don't know. It doesn't happen on the UNIX system I have access to. How to stop it happening, within the code invoked by system()? I don't know that either.
Hope this helps anyway. --76.71.6.254 (talk) 09:23, 3 March 2017 (UTC)[reply]
thanks so much! I wasn't aware of SIGPIPE. that the sort process would have SIGPIPE set to SIG_IGN makes sense because signals are inherited. what apparently happens is that when writing to the pipe fails, write(2) returns -1 and errno is set to EPIPE. the default SIGPIPE behavior seems to be to silently terminate, but with the signal set to SIG_IGN, processing continues. sort then apparently goes on to check the return value of write() and exits, but not before manually printing an error message with error(). I had this idea: cmd="seq 1 1e4|(trap '' PIPE ; sort -gr ) | head -20" but this doesn't work either, because apparently according to POSIX, "Signals that were ignored on entry to a non-interactive shell cannot be trapped or reset". there really doesn't seem to be a way of getting rid of the message short of patching either gawk or sort, or writing a wrapper. oh well, at least it now makes sense. thanks again! Asmrulz (talk) 12:54, 3 March 2017 (UTC)[reply]
Ah, that makes sense. Thanks for putting together the remaining pieces. By the way, you didn't want your "trap" command to ignore the signal, but rather to catch it, so it wouldn't be ignored inside sort. But as you explained, POSIX specifies that it won't be trapped, so that won't work. --76.71.6.254 (talk) 22:56, 3 March 2017 (UTC)[reply]
And the original script does work under Cygwin with no errors, listing numbers fro 10000 down to 9981. Graeme Bartlett (talk) 01:47, 4 March 2017 (UTC)[reply]
odd Asmrulz (talk) 09:11, 4 March 2017 (UTC)[reply]

Disabling the Firefox infobar popup

edit

Anyone know how to block Firefox from displaying infobars? As of the last update, my Firefox on Win10 is showing a nag to connect my phone to my Firefox account every time I start Firefox. This is actually spam rather than the useful messages which have appeared in the infobar up til now, and I'd quite like it to go away. A quick Google revealed a suggestion to flip a switch in about:config, but it doesn't seem to exist anymore. --87.18.123.67 (talk) 10:43, 3 March 2017 (UTC)[reply]

Try going to about:addons and uninstall any infobars/toolbars and other addons you don't like. If that doesn't work you may need a virus/malware scanner. Jahoe (talk) 12:25, 3 March 2017 (UTC)[reply]
Sorry, my above answer is not correct, as your infobar probably comes from using Firefox Sync. Stop using that may help, but is probably not what you want. Jahoe (talk) 12:51, 3 March 2017 (UTC)[reply]
I've noticed the exact same thing, and yes, I've confirmed it only happens in browsers using ff sync. I'll post here when I figure out how to stop it. They're likely to start getting a flood of complaints about it soon, and might fix it with an update. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 15:00, 3 March 2017 (UTC)[reply]