Wikipedia:Reference desk/Archives/Computing/2017 May 11

From Wikipedia, the free encyclopedia
Computing desk
< May 10 << Apr | May | Jun >> May 12 >
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 11[edit]

Regexp, query language[edit]

Are regexps actually a kind of query language?--Hofhof (talk) 13:08, 11 May 2017 (UTC)[reply]

No. Query languages grab structured data, whereas regular expressions simply do pattern matching. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 13:11, 11 May 2017 (UTC)[reply]
Who defines "query language"? I think it's fair to call some implementations of regular expression a query language, in that the caller submits a regular expression to query for string-matches on a string, which is essentially a strictly-ordered database of sequential characters.
Regular expressions are diverse and exist in many incarnations. For example, I just pulled out my copy of Java Examples in a Nutshell, and was reminded of "je3.nio.BGrep" - a complete implementation of a "better" grep (or, byte-wise grep, or "block grep" if you prefer)... In this incarnation, the authors have implemented a regular-expression syntax similar to Perl5 regular expression language, but suitable for application to byte buffers.
Isn't it fun to remind ourselves of the plurality of definitions used for common terminology used in computer science?
Nimur (talk) 16:07, 11 May 2017 (UTC)[reply]
Is a hamburger a sandwich? There are arguments to be made on both sides, and indeed it can be fun. But in my experience, the crux of these taxonomy and ontology questions is ultimately "why does it matter for you?" While pure intellectual curiosity is fine and good, for such a nebulous concept, having a context or use-case is often what allows us to select better answers from a pool of competing perspectives. SemanticMantis (talk) 16:42, 11 May 2017 (UTC)[reply]
That's an important question. I was asked the same question by a reCAPTCHA, showing several pictures of sandwiches, hamburgers, among other stuff. I'm happy there was no picture of a hot dog, or a Doner kebab. BTW, for the algorithm, hamburgers were sandwiches.Clipname (talk) 17:00, 11 May 2017 (UTC)[reply]
Ha! And that's a good example. We may need to consider a hamburger to be a type of sandwich for reCaptcha purposes, but a restaurant may choose to group their hamburgers in a separate category on their menu. Neither one is right (or wrong), but it does help to know who is asking about the categories, and why they want to know. SemanticMantis (talk) 19:30, 11 May 2017 (UTC)[reply]
See also http://xkcd.com/1835/ (and its mouseover text). --76.71.6.254 (talk) 22:14, 11 May 2017 (UTC)[reply]
Seven more years of the sammy debate and 3-4 more years of bacon obsession... <goes looking for a way to fall into a coma> ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 22:22, 11 May 2017 (UTC)[reply]
  • If the taxonomy helps, use it. If it gets in the way, don't. It's really that simple. So if you want to take away the concept of taxonomy and change the OP's question to "Are regexps roughly capable of doing the same things, and possessed of roughly the same limitations as SQL?" then the answer is still "No." If anyone disagrees, just show me how to do a table join with regular expressions, or how to multiply two numbers using them, and I'll buy you a beer and pester you with every regexp question I have from now on. ;) ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 19:59, 11 May 2017 (UTC)[reply]
Absolutely, taxonomy should be applied for a reason or use, and not without! A submarine sandwich is a type of sandwich, but that doesn't mean it has *all* the properties of some given sandwich. Some sandwiches have different traits and aspects, like pickles, or onions, or lettuce. But not every sandwich has to have lettuce. I'm not sure that table joining is an essential feature, a sine qua non of "query language". I don't see anything like that in the article. But maybe it is? SemanticMantis (talk) 01:28, 12 May 2017 (UTC)[reply]
<shrugs> I just picked a feature which I've seen in every query language I've ever used (all dialects of SQL, so maybe I'm not the best one to make that call). I suppose, if you defined a query language as something that ran on a database, and defined a database as any collection of data (such that it would include a text file), you could argue that a properly implemented regular expression could do enough to make it qualify, but personally, I'm of the opinion that once you start using definitions you made up to make determinations about the definitions of other things, you're pretty much just engaged in the mental equivalent of this (warning: mildly NSFW). ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 02:14, 12 May 2017 (UTC)[reply]
But, are you sincerely asking this question ("can a regular expression processor implement a SQL-style table join")? ... Because, it has an answer and you probably aren't going to like it.
Have a look at, for example, Programming Commands in GNU sed, and using back-references and sub-expressions... So, you could do a table-join, if you were willing to program it. It would be horrible and it would be esoteric, but it could be done. Even the manual says "use of these commands indicates that you are probably better off programming in something like awk or Perl..." If you couldn't do a table join directly in sed regular expression syntax - even though, for the record, you could - you could still use sed regular expressions to parse a string that implements a turing tape machine that runs a virtualized SQL relational database processing program.
Not only can sed run a calculator, it can play tetris. ... Using regular expressions.
So, ... yes? But, please direct your regular expression questions to the authors of those programs?
For the extreme programmers who want to port sedtris to iPad, you'll need to reshebang to the appropriate interpreter:
sed s/\\/usr\\/bin\\/env./\\/usr\\/local\\/bin\\//g sedtris.sh > sedtris-pad.sh
I got it working on mine... you may experience difficulties, but there is hope if you know where to look...

Nimur (talk) 02:15, 12 May 2017 (UTC)[reply]
Sed isn't regular expressions. It's essentially a collection of compiled functions that uses regular expressions at a basic level. A regular expression is a string, like ^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$. The "language" of regular expressions changes between implementations (for example, a regex that worked for me last week in VBA doesn't work in Notepad++'s Find & Replace dialog, which permits regex's). However I'll grant that Sed absolutely does blur the lines, functioning like a query language on a text file. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 03:30, 12 May 2017 (UTC)[reply]

Is there any site that generate a TOTTALY random IPV4 IP, check if there is a site with that ip and then, if true, enter this site?[edit]

Is there any site that generate a TOTTALY random IPV4 IP, check if there is a site with that ip and then, if true, enter this site?
PS:Assuming the ip is not a site, it would try again to generate some valid site, until it generate a valid one.177.92.128.26 (talk) 19:04, 11 May 2017 (UTC)[reply]

Not to my knowledge, but I promise you there's plenty of h4k3r 4pps that do that. Try a google search. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 20:12, 11 May 2017 (UTC)[reply]
Watch this video for a guy giving a talk about some very pertinent infosec research he did for fun. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 04:55, 12 May 2017 (UTC)[reply]

Why would anyone watch video on a phone?[edit]

I saw words similar to these in a magazine article online, but I can't find it again. it doesn't matter. The fact is that around fifteen years ago someone said it when it first became possible to do this. I started looking for the history of watching videos on phones on Wikipedia and realized there wasn't an article that had the information.— Vchimpanzee • talk • contributions • 19:17, 11 May 2017 (UTC)[reply]

Mobile_content is probably the closest article to what you're looking for, but it's very thin on history. ApLundell (talk) 20:34, 11 May 2017 (UTC)[reply]
So if I were to find the information, that's where I would add it?— Vchimpanzee • talk • contributions • 21:28, 11 May 2017 (UTC)[reply]
That's close to a Q I still ask: "Given the choice, why would anyone prefer to watch video on a tiny screen over a large one ?". Sure, if your eyes are right by the screen as in VR, that makes sense, but when the screen only occupies a tiny portion of your field of view, it seems like a distinctly inferior viewing experience, to me. StuRat (talk) 02:49, 12 May 2017 (UTC) [reply]
Clearly, you have not had to renew your driver's license since the rise of smartphones. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 03:17, 12 May 2017 (UTC)[reply]

System reset of one device in a virtual machine of another device[edit]

To deal with the coming laptop ban, I was wondering if it is possible to just bring the system image of a laptop using a portable drive to the US, and then do a system reset using that system image on another device. This won't work in the usual way, but if you can emulate the device at home in a virtual machine, you should be able to emulate doing the system reset, so that you end up with an emulated version of your laptop. Count Iblis (talk) 21:32, 11 May 2017 (UTC)[reply]

You'd need to consider the conditions of whatever hypothetical ban you're talking about. Since the only existing ban is on laptops in carry on luggage, and the possible expansion would just be to include more countries in the same ban, there is a far simpler existing solution i.e. just checking on the laptop which many people are already doing. (On budget airlines this may not be free, but your proposal isn't free in a number of ways either. Some people have questioned the wisdom of forcing laptops onto checked-in luggage especially considering possible lithium-ion battery issues, but this is generally in the form of saying the ban is silly rather than proposing to extend it to a complete ban on laptops on commercial airlines.) This doesn't help people who want to use the laptop on the flight, but nor does your proposal.

More generally, yes you can run a properly constructed system image on a VM or another computer; with modern Windows you probably don't even have to do much other than allow Windows to fix itself. There is no need to manually do a system reset or anything of that sort. (With Windows 7 you may need to be very careful when making the image or have a system rescue disc read.) Whether this will be allowed under whatever hypothetical laptop ban you're talking about, will depend on the conditions and reasons for this ban.

In any case for many people the simpler solution is to just save any data they need either to the cloud or portable storage or both. Unless there are specialised apps they need, they can then simply continue their work on another computer without needing to find one with either a VM or which will allow them to boot up their own image. Heck with the move to subscription services and cloud apps, it's not uncommon they can use their apps on the other computer if allowed to anyway. (Depending on latency issues and how this affects the app etc, it may also be possible to use apps on their laptop or whatever when it's in another country anyway.)

Nil Einne (talk) 01:37, 12 May 2017 (UTC)[reply]

P.S. Your question seems to clearly refer to using the system image after your flight. Considering the importance of laptops and tablets on the airline for some customers, some airlines affected by the existing ban are already loaning such devices to customers. [1] The devices could also potentially use such a system image to either boot or run in a VM, but the complexity of this (on both ends*) means it's (I'm pretty sure) rarely or never done. Instead the airlines are trying to ensure these loaner devices have whatever important apps the customer may want, and the customer just has to make sure their brought all their data. *=, Remember someone needs to make the system image then someone needs to get it working. These aren't really that difficult, but they are beyond the capabilities of most people. And they do take time particularly the former. Nil Einne (talk) 01:37, 12 May 2017 (UTC)[reply]