Wikipedia:Reference desk/Archives/Computing/2015 April 13

Computing desk
< April 12 << Mar | April | May >> April 14 >
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 13

edit

Explaing bash command

edit

Why does

wget -qO- http://ipecho.net/plain ; echo 

work?

What is the - after the O? And what is the ; before the echo? Why

wget -qO http ... . 

does not work?

--Senteni (talk) 15:25, 13 April 2015 (UTC)[reply]

I think the ";" means that's the end of one command and the start of the next, and "echo" with nothing else would just produce a blank line. StuRat (talk) 15:31, 13 April 2015 (UTC)[reply]
Consult the wget manual. This command specifies the option -q, for quiet mode; and the option -O - for output to standard out. The flag syntax for wget allows the user to avoid redundant whitespace and compact this sequence into -qO-, although this obfuscates the intent. Finally, the semicolon terminates the command; the echo is a second command that prints a blank line after wget completes.
Nimur (talk) 15:32, 13 April 2015 (UTC)[reply]
OK, echo is clear now, just for better layout.
But, isn't the syntax -options-, like -qO- a break with the syntax of other commands that are in the form -options, like -pne? What's the point of breaking a common pattern just for this command? -qO would be more compact than -qO- too. --Senteni (talk) 15:41, 13 April 2015 (UTC)[reply]
Consult the wget manual. "-O" requires an argument:
'-O FILE'
'--output-document=FILE'
In this case, the special argument happens to be "-":
If '-' is used as FILE, documents will be printed to standard output, disabling
link conversion.  (Use './-' to print to a file literally named '-'.)
Nimur (talk) 15:58, 13 April 2015 (UTC)[reply]
In UNIX-like OSes, option processing is done by each individual program. It's a standard, but not universal convention that single-letter options start with a single dash (and can be piled reasonably - only the last one can have an argument), and that multi-letter options start with two dashes and use "=arg" for the argument. --Stephan Schulz (talk) 16:23, 13 April 2015 (UTC)[reply]
'-' for stdin/stdout is fairly common as well. Most, but not all, programs use the getopt library to process command-line options, which is why the grouping them works. If no filename was given to mean stdout, then there would have to be special magic to determine if the next option was a file name or not. For wget, it could work if it didn't start with a hyphen or a URL scheme, but that's brittle. LongHairedFop (talk) 10:46, 14 April 2015 (UTC)[reply]
The final point is that in this case, when selecting an output file you can say either
-O file
or
-Ofile
That is, the space between the O and its argument is optional.
(Some Unix/Linux programs consider that separating space to be mandatory, some consider it optional, a few prohibit it. Just another pointless inconsistency to drive the Unix-haters crazy, and that us Unix-lovers somehow don't mind so much...) —Steve Summit (talk) 11:28, 15 April 2015 (UTC)[reply]

Image embedding in mail sent from phones

edit

So, I've been wondering about how the various phone OSs/mail applications handle images in emails. I've always had Android phones, and I use the Gmail app on those to handle my mail. When I attach an image, it becomes a normal attachment, in a small thumbnail at the bottom of the mail where it should be. However, when I get mail from people using iPhones, the images are always embedded at full size in the middle of the email, regardless of whether I view them on my phone or on my laptop. Anybody know why the iOS system was designed to handle images in that rather annoying way? As a sort of follow-on question, I found that people on iPhones often can't even see there are images attached to mails, again, why on Earth is this? Just seems like iOS mail can't deal with images very well generally. Any insights? Fgf10 (talk) 20:01, 13 April 2015 (UTC)[reply]

Seems like a problem with lack of standardization. That is, each cell phone manufacturer and/or provider/network came up with their own method of attaching pics, but they are somewhat incompatible. StuRat (talk) 23:04, 13 April 2015 (UTC)[reply]
My WP:OR, as an iOS and mail.app user on OSX - both Apple mail applications try to go the extra mile, displaying certain types of images and documents full-size within the email when it they are attached, rather than forcing you to click and open another program. The fact that you receive apple-originating emails in the same manner indicates that other mail software allows for this behavior as well, even if it is not default. I believe this displaying of attachments is seen as an ease-of-use issue, and intended to save user time. However, because of this feature, the Mail apps pay attention to where the text email the attachment was made. This allows for an intended use of several lines of text, then an image, then more text, similar to what certain html emails accomplish. If you are getting images in the middle that shouldn't be, then the user sending the mail should learn how to attach at the bottom - this is especially important if they are using drag-and-drop to attach (I always drop attachments after the signature, if the attachment is done via menus, the attachment is placed at the current cursor position within the email). My opinion is that users who are unaware of the attachments on iphone probably just never properly learned the UI symbology - it is quite apparent; there's a little paperclip next to the email in the list/inbox view. Depending on the attachment, it may be automatically displayed within the email, or it may look like this [1]. Anyway, sorry I can't give much of a technical explanation, but that's how the user experience works for this long-time user. SemanticMantis (talk) 14:46, 14 April 2015 (UTC)[reply]
So you would call this a feature rather than a bug? How odd! I find it incredibly annoying when I get a full size image in the middle of a mail. Oh well, maybe I have the odd opinion here. Cheers anyway! Fgf10 (talk) 16:47, 14 April 2015 (UTC)[reply]
I don't care much one way or the other, and I don't think I've ever received an email with a large image in the middle - so I must admit in this case I think the problem is more in the people sending the emails, they do have the option do to it in a better way. When I get a .pdf or .doc attachment at the end of an email, I find it convenient to be able to scan the title/abstract at full size without having to open another program. I think Ben has it right though, the apple mail products seem to obfuscate/conflate the different types of MIME, at least in terms of not making a clear distinction at the UI level. SemanticMantis (talk) 18:29, 14 April 2015 (UTC) PS. of course it's a feature. That doesn't mean it's good or useful or even intentional, just that it is an aspect or property of the thing in question.[reply]
I have no experience with this, but the offending emails must be HTML emails with inline images (MIME multipart/related), while the style you prefer has the images as actual attachments (MIME multipart/mixed). Email attachment normally only refers to the latter. Both are well standardized, with the standards going back a couple of decades. Displaying inline HTML images as attachments would be like displaying images in a web page as attachments—possible, but maybe not a common feature of user agents. It has the problem that a lot of images in HTML documents are used for layout and would be useless on their own, so you'd have to filter them by size, or something, to find the interesting ones. An attachment is the correct standard way to send things that the recipient might want to detach and store separately.
Apparently, the iOS mail app doesn't support attachments. Maybe they could work around that by using the Share button in the Photos app, but even that might create an HTML inline image for all I know. The "copy and paste method" described in that article will definitely create inline images. -- BenRG (talk) 18:07, 14 April 2015 (UTC)[reply]