Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

Wikipedia:Reference desk/Archives/Computing/2015 May 18

From Wikipedia, the free encyclopedia
Computing desk
< May 17 << Apr | May | Jun >> May 19 >
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 18

[edit]

Javascript basics question (I just want to know if I understood right)

[edit]

Does dot (.) in Javascript equals GET? thanks, Ben-Yeudith (talk) 03:44, 18 May 2015 (UTC)[reply]

No. The dot is a property-accessor. A dot connects an object with a property, which can be another object or a method (function). For instance, to get the value of a property through its get() method: var language = object.get('lang');. -- [[User:Edokter]] {{talk}} 09:30, 18 May 2015 (UTC)[reply]

Websites that disable unregistered users from viewing - how does that work?

[edit]

Quora, Tumblr, and Experience Project seem to deny browsing accessibility to unregistered users. In other words, one needs to register an account, sometimes with personally identifiable information, in order to browse the network. Alternatively, one can view specific webpages, if one has the uniform resource locator. If an user is interested in more related questions on Quora, then that user is advised to create an account with his or her real name. On a technical level, how does that ability to deny browsing to unregistered users work? Is there a formal or technical name for this? Although I have learned basic HTML and CSS and Javascript, I find that I have a lot to learn in the world of computer programming. 140.254.136.178 (talk) 12:59, 18 May 2015 (UTC)[reply]

A registered user will typically log in, after which the server will store a HTTP cookie in their browser (which their browser sends back to the site every time it requests a page on that site). By checking to see if a visitor supplies a valid cookie, the site can limit what content is visible and to whom. They could chose to send anyone without the cookie to a login page, thus making the whole site inaccessible to unregistered visitors. But it the sites you describe want to hook in new visitors (especially people coming from search engines like Google and discussion sites like Reddit). So they've decided to give people arriving at the site, even without the cookie, access to just that page - but they still want to encourage people to register, so they don't want those visitors moving to subsequent pages on the site without registering or logging in. They can see if a browser was referred to the site externally by checking the HTTP referer field in the request the browser sends; people coming e.g. from Google will have a Google URL in that field; people moving around inside Quora will send a Quora URL. So they probably have logic that reads something like:
    if (request.cookie == none) and (request.referer.domain != "quora.com"):
        show_page (request.url)
    else:
        show_page (login_or_register_screen)
-- Finlay McWalterTalk 13:17, 18 May 2015 (UTC)[reply]
Since the server is really another computer, how does this computer/server thing recognize incoming data? Are data transmitted through wires? What about wireless Internet? Does a person have to set up an unmanned satellite into space in order to transmit its own messages from its own servers to other people's computers? 140.254.136.178 (talk) 13:32, 18 May 2015 (UTC)[reply]
That's right. But remember you'll have to connect your satellite with cables to every client machine (including laptops, tablets, smartphones etc.) :-P --CiaPan (talk) 14:18, 18 May 2015 (UTC)[reply]
If you are asking how webpages are fetched, then that's worthy of a new question (and quite possibly an entire article), but the basic answer is the webbrowser sends to the webserver one (or more) requests using HTTP. The HTTP requests are sent over TCP/IP. There are lower-level protocols under TCP/IP, but they are specific to how your device is connected to the internet. OSI model explains some of these. LongHairedFop (talk) 19:42, 18 May 2015 (UTC)[reply]
Access can be restricted by using server-side scripting like this
var sid = cookies.get("sessionid"); //  get the value of the "sessionid" cookie that the user's browser has sent
if (sid == null or !checkSessionValidity(sid)) // check that we have a sessionId, it hasn't expired (or is otherwise invalid), and extend the validity for 5 more minutes
{
   // session was invalid, or has expired, ask the user to login
   redirectBrowser("/login.cgi");
   // this will set a valid sessionid cookie
}
else
{
   var userId = extractUserIdFromSessionId(sid);
   // generate the content for the user, including any per-user customisations
   generateContent(userId);
}
Completing the rest of the code is left as an exercise for the interested reader. ---- LongHairedFop (talk) 19:51, 18 May 2015 (UTC)[reply]

Randomatic - early 70s computer

[edit]

In The Anderson Tapes (a 1971 film), the police use a computer called a "Randomatic" to call up details of suspects. A series of buttons are pressed, some clicking and whirring occurs, and a card with the details on is output. Was this a real machine? Were they police-specific or used for other purposes? Any other information gratefully received. DuncanHill (talk) 17:20, 18 May 2015 (UTC)[reply]

Here's a picture of it (from the movie). I think it was a real device, made by Randomatic Data Systems, Inc. (not affiliated with Sperry Rand) and covered by some of these patents. -- BenRG (talk) 17:58, 18 May 2015 (UTC)[reply]
[EC] If I remember correctly, the RANDOMATIC was being talked about (mostly to potential invesors) in the film industry in the early 70s, but it wasn't shown until the 1976 Los Angeles SMPTE convention. It was a system developed by The Intercraft Corporation in NYC and Randomatic Data Systems in Trenton. It was a card selector "computer" where bars were raised in selector trays to lift or not lift cards according to holes/notches in the cards. Instead of the usual editor's log book used in producing a film, the cards would contain info on locations. actors, camera, etc. so you can ask "show me all scenes with John Smith on soundstage three using camera B". Card lifting systems predated the RANDOMATIC, so perhaps this was an early prototype or maybe the special effects people just took the idea and made something that resembled it for the film. I will see if the film is available on netflix and watch it. I will be able to tell you more once I see the scenes in question. --Guy Macon (talk) 18:14, 18 May 2015 (UTC)[reply]
That picture doesn't look like any real-world card lifting system I have ever seen. I am pretty sure that it was something made by the special effects people just for the film, not a working system. --Guy Macon (talk) 18:20, 18 May 2015 (UTC)[reply]
Found an article about it: [ https://www.questia.com/magazine/1P3-1318941981/editing-a-feature-film-with-the-aid-of-the-new-intercraft-randomatic ] --Guy Macon (talk) 18:26, 18 May 2015 (UTC)[reply]
And note that they are using "random" here to mean "the cards can be place in the device in any random order, yet you can select the cards in any order you decide you want to access them", as opposed to in sequential order. This is the same way it is used in the term RAM, which is unfortunate, in both cases, because it seems to imply that you will ask for a card or bit of data from memory, and one will be randomly selected for you by the device. "Nonsequential access" would have been a much clearer term. StuRat (talk) 18:30, 18 May 2015 (UTC)[reply]
That would be content-addressable memory, not RAM. -- BenRG (talk) 19:20, 18 May 2015 (UTC)[reply]
The R in random-access memory, as I understand it, means that the speed of access is independent of sequence: you can retrieve the contents in random order as quickly as in sequence, unlike on tape/drum/disk. —Tamfang (talk) 20:16, 19 May 2015 (UTC)[reply]
I believe that's just a more formal way of saying the same thing, to prevent somebody from claiming that sequential access is random access, since they can, of course, retrieve a million records and toss out all but the last one, but this would be maybe a million times slower than just reading the last one immediately. StuRat (talk) 20:30, 19 May 2015 (UTC)[reply]
It's one of those terms that has evolved over time. In the early days of bulk storage, disk and drum drives were claimed to be random access - by comparison with tape drives that are decidedly sequential. The same thing has been true of main memory too - "bubble memory" was sequentially accessed, for example. Nowadays, we'd say that disk drives are not random-access devices...it's a matter of degree. Even RAM is not entirely randomly accessible because we reach it through layers of cache memory that make accessing blocks of consecutive addresses vastly more efficient than jumping around throughout the address space. These terms get re-invented and re-used as time goes by. (The term "Writeable CD-ROM" particularly amuses me). SteveBaker (talk) 03:47, 21 May 2015 (UTC)[reply]