I am making tools with js API named vLine, but it is basic quesion of javascript so I post here.  I want to attache chat system on sample code. What I have adde tis between ///chat function  but   this.prototype.onMessage_    shows error like  Uncaught TypeError: Cannot set property 'onMessage_' of undefined    I have made a few javascript programings though,I am not good at this. So I think I didnt understand ,something very basic javascript object oriented.  please help me.  &lt;script&gt; var vlineClient = (function(){   if('{{vlineData.serviceId}}' == 'YOUR_SERVICE_ID' || '{{vlineData.serviceId}}' == 'YOUR_SERVICE_ID'){     alert('Please make sure you have created a vLine service and that you have properly set the $serviceID and $apiSecret variables in classes/Vline.php file.');           }       var client, vlinesession,           authToken = '{{ vlineData.authToken }}',           serviceId = '{{ vlineData.serviceId }}',           profile = {"displayName": '{{ vlineData.displayName }}', "id": '{{ vlineData.id }}'};      // Create vLine client       window.vlineClient = this.client_ = vline.Client.create({"serviceId": serviceId, "ui": true});     // Add login event handler   this.client_.on('login', onLogin);     this.client_.login(serviceId, profile, authToken).done(this.init_,this);     // Do login     **/////chat function**      this.prototype.onMessage_ = function(event) {         var msg = event.message,         sender = msg.getSender();          console.log('get message');         this.showAlert(sender.getDisplayName(),                      sender.getThumbnailUrl(),                      msg.getBody());     };        this.client_.on('recv:im', this.onMessage_, this);    **/////chat function**              function onLogin(event) {     vlinesession = event.target;     // Find and init call buttons and init them     $(".callbutton").each(function(index, element) {        initCallButton($(this));      });   }    // add event handlers for call button   function initCallButton(button) {     var userId = button.attr('data-userid');      // fetch person object associated with username     vlinesession.getPerson(userId).done(function(person) {       // update button state with presence       function onPresenceChange() {         if(person.getPresenceState() == 'online'){             button.removeClass().addClass('active');         }else{             button.removeClass().addClass('disabled');         }         button.attr('data-presence', person.getPresenceState());       }        // set current presence       onPresenceChange();        // handle presence changes       person.on('change:presenceState', onPresenceChange);          // start a call when button is clicked       button.click(function() {               if (person.getId() == vlinesession.getLocalPersonId()) {             alert('You cannot call yourself. Login as another user in an incognito window');             return;               }           if(button.hasClass('active'))                             **/////chat function**                             person.postMessage("Hello there");                             console.log("send message");                              **////chat function**             person.startMedia();       });     });    }    return client; })();      $(window).unload(function() {   vlineClient.logout(); });
I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test();  I remember a lot discussion I had with people a while back (I'm not exactly sure what I'm doing) but as I understand it, there's no concept of a class. It's just an object, and instances of those objects are clones of the original, right? But what is the exact purpose of this &quot;.prototype&quot; property in JavaScript? How does it relate to instantiating objects? Update: correct way var obj = new Object(); // not a functional object obj.prototype.test = function() { alert('Hello?'); }; // this is wrong!  function MyObject() {} // a first class functional object MyObject.prototype.test = function() { alert('OK'); } // OK  Also these  really helped a lot.
When I wake the laptop from the sleep I need to get the VPN state as I left it (turned on). Can't find the setting of autoconnect in VPN settings... Need some easy way to ask the system to autoconnect the VPN when the internet is available.  Edit based on comments:  Ubuntu 18.04 has no option to Always connect to VPN when using using this connection. Rotating clears selected tags Changing the orientation of your device within the tag selection view while asking a question removes all selected tags and clears the textbox.     Steps to reproduce:     Ask a question (does not happen when editing) Edit tags Enter some text in the box  Select a tag from the suggestion list Repeat the previous two steps as many times as you care to Rotate the device (source / target orientation doesn't matter, just need to change it) All selected tags and text typed in the textbox are gone and must be re-entered   I've reproduced this using version 1.0.63 of the SE app on two devices:     HTC One E8 m2ss (the Hong Kong version) rooted and running stock 5.0.2 ATT Galaxy S3 i747, rooted and sim unlocked, running Slimkat 4.4.2.build.4.1.official ROM on Android 4.4.2 When on the road as a tourist, I often do not carry a reflector of flash. Now I am at a location with very strong sunlight and I want to take a photo of a companion in front of a nice scenery or building, the classic "we have been here" photo.  With very strong sunlight however, specially at a slight angle, I either get it into the person's eyes and they squint like crazy, or they are in the shade and their whole face is black.  Please note that I do not have aspirations to take a professional photo in such circumstances, but at least something acceptable.  Is there an easy trick to deal with that? Can I use lens brand X on interchangeable lens camera brand Y? Suppose $s$ is a complex number with $\Re(s) \in (0,1]$ and $\{a_n\}$ is a complex sequence converging to $a \neq 0$. Must the Dirichlet series $$\sum_{n=1}^\infty\frac{a_n}{n^s}$$ diverge? Should you use a plural verb if you refer to a fraction? I am looking for an example such that in a pre-Hilbert space $H$ we have for a subspace $U$ that  (i) $\bar{U} \oplus U^\perp \neq H$  (ii) $ \bar{U} \neq U^{\perp \perp}$  Since finite and closed subspaces will probably not do it, I am not good at inventing nice examples. Does anybody here have a few at hand? The new software center in Ubuntu 16.04 shows no application data found This is the error I get when I open the software center. I've tried rebooting and running sudo apt-get update but I see no improvement. It worked earlier but I don't know what went wrong since then. I'm using Ubuntu 16.04 final release on a Dell Inspiron 15R. Any advice will be appreciated. Thanks in advance.  EDIT: The problem magically solved itself without me doing anything special (or maybe inadvertently doing something, I don't know). So I'd still like to get to the root of this. What does InitializeComponent() do, and how does it work in WPF? What does InitializeComponent() do, and how does it work in WPF?  In general first, but I would especially be interested to know the gory details of order of construction, and what happens when there are Attached Properties. Responsive Web Design - what should happen when the mobile device is rotated? Currently, the standard behaviour for viewing web pages on a mobile is that:   If viewed in portrait the text is smaller because the width of the device is small and the whole page width needs to fit into view. If viewed in landscape the view 'zooms in' as the width is now wider so that the text is larger and more readable, but with less content on screen as a result.   So, this brings a dilemma. When creating a responsive website what should happen on device rotation? (Not on initial page load, I am referring to what should happen once the site is loaded and you decide to then rotate the screen)   When rotated from portrait to landscape should you:   a) Re-detect the device widths and map the contents according to the new dimensions (thereby retaining the same font / images sizes as when viewing portrait). b) Keep the same dimensions and on rotation just bring the content to fit the window (thereby zooming in the content to make it more readable for viewers if the portrait orientation text is too small).          &ndash; Wireframes created with   Bear in mind that with a traditional web-page viewed in the mobile you have the option of pinch-to-zoom the text, so if it's too small you can zoom in. With a responsive site this isn't an option because the site will fit the dimensions so there is nothing to zoom into.  (I guess there is a third option too - use responsive fonts so that the font sizes change according to the screen width. But that's probably a different question altogether). Note: This question is specifically about installed, desktop software. There is  specifically about free cloud-based software and services.  What free programs should every GIS user have installed?  I'm not necessarily referring to ESRI extensions or open-source products, but others that increase your productivity and ability to handle GIS tasks.  For example:    for writing code snippets or editing XMLs.  or  for quick graphic editing. I use  daily and I think it's worth mentioning. It's not GIS-specific, but it's a great tool, especially if used independently and on multiple projects where purchasing time-management software isn't reasonable. While it's not focused on GIS development,  has proven to be very useful in terms of increasing productivity and monitoring system resources. I have created a GIS "sidebar" on my desktop that holds all of my development tools, as well as links to the online resources I used the most. It's nice to be able to use one location, rather than many (e.g. taskbar, bookmarks in browser, search engine). Let $A$ be a nonempty and bounded below, and define $B= \{b\in \mathbb{R}: b$ is a lower bound for $A\}$. Show sup$B$ = inf$A$.   So far I have: Let $A$ be nonempty and bounded below. This implies $\exists l \in A, \forall a \in A, l\leq a$ and $l =$ inf$A$. Let $B = \{b\in \mathbb{R}: b$ is a lower bound for $A\}$ and let $M=$ sup$B$. This implies $\exists b\in B, \forall b \in B, b\leq M$. By definition of $B$, we know inf$A \in B$. Since $b\leq$ sup$B$, with sup$B$ the largest element in $B$, we have inf$A \leq M =$ sup$B$, so inf$A \leq$ sup$B$.  I realize I have to prove that sup$B \leq$ inf$A$ to get that sup$B$=inf$A$. I am having trouble doing so.   Part B: Use (a) to explain why there is no need to assert that greatest lower bounds exist as part of the Axiom of Completeness. Does a logistic regression maximizing likelihood necessarily also maximize AUC over linear models? Why does node not evaluate Math.tan(Math.PI/2) to Infinity but Chrome V8 does? Can I rephrase the sentence "Can you explain this word to me?" into "Can you explain me this word." How do I restart the SSH service? Line integration in complex analysis How to prove that if A, B, C are submodules of M module then $$ A \cap (B+C) = (A\cap B)+C \iff C \subseteq A $$  Any help would be appreciated! Keyboard Layout indicator doesn't display current layout in Ubuntu 18.04 (empty drop down box) I see an empty drop down box where the language code of the  should be.  To reproduce the bug: Lock screen or log out and log in again.    I also get the same behavior on the lock screen at the time when I try to log in with my password:    After I tried the workaround (below) the language code on the login screen disappeared as soon as I typed the first character of my password.  Workaround (not permanent): Switching with keyboard (Super+space) or mouse.  System info: Ubuntu 18.04.1 LTS, GNOME 3.28.2.    Please  if also affects you. Create model from XYZ data points