In a modern SPFx Web Part, how do I check if a URL exists? I am creating a Web Part that shows a video that might or might not be in another Document Library.  If the video exist, I should display it.  If it doesn’t, I should display another video.  How can I create a _videoExixts function in typescript?  In javascript I would do something like this:  function _videoExixts(url) {     var http = new XMLHttpRequest();     http.open('HEAD', url, false);     http.send();     return http.status!=404; }
How to check if list item already exist when adding it with how to check Title( Country) if exists in the list. if exists it is necessary to do the update if not it is necessary to add it ?  function AddListItem() {      var listTitle = "Test";     //Get the current client context       context = SP.ClientContext.get_current();     var airportList = context.get_web().get_lists().getByTitle(listTitle);          //Create a new record       var listItemCreationInformation = new SP.ListItemCreationInformation();     var listItem = airportList.addItem(listItemCreationInformation);      //Set the values      var country= $("#Country").val();     var client= $("#Client").val();     // var nb1 = $("#nb1").val();      // var nb2 = $("#nb2").val();       // var nb3 = $("#nb3").val();      // var nb4 = $("#nb4").val();       // // var nb5 = $("#nb5").val();        listItem.set_item('Country', Country);     listItem.set_item('Client', Client);     listItem.update();     context.load(listItem);     context.executeQueryAsync(AddListItemSucceeded, AddListItemFailed); } function AddListItemSucceeded() { } function AddListItemFailed(sender, args) {     alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }
I am a beginner in learning selenium Webdriver. I am not able to understand how page object and factory models works and how it can be beneficial?    Kindly help me explain it with detailed explanation. I once already asked a very similar question; . But this is some what different.  I have the following code;  \documentclass{standalone} \usepackage{graphics} \usepackage{tikz,pgfplots} \pgfplotsset{compat=1.6} \begin{document} \begin{tikzpicture}  \begin{axis}[% width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.0004, ymax=0.0012, ylabel={$\phi_{\mathrm{i}}(t)$}, ymajorgrids, yminorgrids, name=plot1]  \end{axis}  \begin{axis}[% width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.2, ymax=1.2, ylabel={$h(t)$}, ymajorgrids, yminorgrids, name=plot2, at=(plot1.right of north east), anchor=left of north west]  \end{axis}  \begin{axis}[% width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.0004, ymax=0.0012, ylabel={$\phi_{\mathrm{o}}(t)$}, ymajorgrids, yminorgrids, name=plot4, at=(plot1.below south west), anchor=above north west]  \end{axis}  \begin{axis}[% width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=2000, ymax=12000, ylabel={$p_{\mathrm{i}}(t)$}, ymajorgrids, yminorgrids, name=plot5, at=(plot4.right of north east), anchor=left of north west]  \end{axis}  \end{tikzpicture} \end{document}   This creates the following plot:    I think there is to few vertical/horizontal spacing between the plots. I want to increase this. Currently I use x- yshift, this gives the following result:  \documentclass{standalone} \usepackage{graphics} \usepackage{tikz,pgfplots} \pgfplotsset{compat=1.6} \begin{document} \begin{tikzpicture}  \begin{axis}[% width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.0004, ymax=0.0012, ylabel={$\phi_{\mathrm{i}}(t)$}, ymajorgrids, yminorgrids, name=plot1]  \end{axis}  \begin{axis}[% xshift=1cm, width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.2, ymax=1.2, ylabel={$h(t)$}, ymajorgrids, yminorgrids, name=plot2, at=(plot1.right of north east), anchor=left of north west]  \end{axis}  \begin{axis}[% yshift=-1cm, width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=0.0004, ymax=0.0012, ylabel={$\phi_{\mathrm{o}}(t)$}, ymajorgrids, yminorgrids, name=plot4, at=(plot1.below south west), anchor=above north west]  \end{axis}  \begin{axis}[% xshift=1cm, width=3cm, height=3cm, scale only axis, every x tick label/.append style={font=\scriptsize\color{gray!80!black}}, xmin=0, xmax=20000, xlabel={$t$}, xmajorgrids, xminorgrids, every y tick label/.append style={font=\scriptsize\color{gray!80!black}}, ymin=2000, ymax=12000, ylabel={$p_{\mathrm{i}}(t)$}, ymajorgrids, yminorgrids, name=plot5, at=(plot4.right of north east), anchor=left of north west]  \end{axis}  \end{tikzpicture} \end{document}     I want to know if there is a more consistent manner to do this. How can I run Maniac Mansion through ScummVM? Day of the Tentacle Remastered Edition includes Maniac Mansion as a .  The game appears to be exactly the same as the old DOS release (albeit, the enhanced version).  If possible, how can I run this game through ScummVM?  Pointing ScummVM at my installed game doesn't work.  What do I need to do to play this version of Maniac Mansion? #!/bin/bash  SUBJECT="WARNING CPU USAGE HIGH" TO=gmail id MESSAGE=/tmp/messages echo "#######################" &gt; $MESSAGE echo "CPU statistics as follows.." &gt;&gt; $MESSAGE mpstat &gt;&gt; $MESSAGE echo "#######################" &gt;&gt; $MESSAGE CPU_USAGE=$(top -b -n1 | awk '/^Cpu/ {print $2}' | cut -d. -f1) [ $CPU_USAGE -gt 85 ] &amp;&amp; mail -s "$SUBJECT" "$TO" &lt; $MESSAGE`   ./cpu.sh: line 11: [: -gt: unary operator expected What might be the reason Given a set $\{1,2,3,4\}$, how is the following relation $R$ antisymmetric?  $$R = \{(1, 2), (2, 3), (3, 4)\}$$  Note: Antisymmetric is the idea that if $(a,b)$ is in $R$ and $(b,a)$ is in $R$, then $a = b$. In my textbook  it says the above is antisymmetric which isn't the case as whenever $(a,b)$ is in $R$, $(b,a)$ is not. Why can rm remove read-only files? I would like to know how to find a set of coordinates on a small circle some distance from another point.   For example, lets say A = (39.73, -104.98) #Denver  B = (39.83, -106.06) #point approximately 50 nautical miles away from A along the great circle track to C  C = (40.75, -111.88) #Salt Lake City, approximately 323 nautical miles away from A  How do I get the set of orange coordinates when I don't know the angle but I do know the cross track distance?  For concreteness, lets say the outer points near B have a cross track distance of +- 30 nautical miles and the inner points have a cross track of +- 15nm.  And the points near C have a cross track of +- 25 nm.  Also I have an initial bearing from A to C of -1.34 #radians I am using MiKTeX 2.9 on Windows 7.   I'm getting the error: "can't write on pdf file."  The pdf doesn't reflect what I wrote.  What did I do wrong?  My input:  \documentclass[12pt]{article} \usepackage{epsf} \usepackage{amssymb} \usepackage{graphicx} \usepackage{setspace} \usepackage{amsmath} \usepackage{rotate} \usepackage{endnotes} %\usepackage{harvard} \usepackage{vmargin} \usepackage[nolists,noheads,tablesfirst,nomarkers]{endfloat} \usepackage{natbib} \bibliographystyle{apsr}  \oddsidemargin=1.0in\evensidemargin=0.in \textheight=8.5in\textwidth=6.6 in \baselineskip=18pt \parskip=6pt  \begin{document}  % added, was missing  TEXT  \newpage \baselineskip=12pt \doublespacing  \bibliographystyle{apsa} \bibliography{Dissertation_Proposal}   \end{document} Is it possible to query the content of the Time-based Workflow Queue from an Apex unit test to assess that a specific Workflow Rule has been executed and added a new item to the queue? I didn't see anything alike in the documentation, but wish it could be possible to improve testing and stability overtime.  Thanks Fastest way to move Collection from Sharded MongoDB Cluster to a another Sharded MongoDB Cluster I have to move a MongoDB Collection (Size: 1TB+) from Sharded MongoDB Cluster to another[5 shards on both clusters]. During this operation, it is assumed that the accompanying program will be offline, so no need to worry about inconsistent data, but I need to minimize the downtime.  I've tried testing it with mongodump and mongorestore, but looks like that is taking ages to finish.  Please share your experiences for such kind of scenarios.  Note: Cluster has only one collection, so I am open at cluster level sync as well. Is there any decent speech recognition software for Linux? The short version of the question: I am looking for a speech recognition software that runs on Linux and has decent accuracy and usability. Any license and price is fine. It should not be restricted to voice commands, as I want to be able to dictate text.  More details: I have unsatisfyingly tried the following:       (e.g., )  (used to run  on Linux but was discontinued years ago)      (built on the Kaldi speech recognition toolkit)    +  +  +   : only accepts voice commands  All the above-mentioned native Linux solutions have both poor accuracy and usability (or some don't allow free-text dictation but only voice commands). By poor accuracy, I mean an accuracy significantly below the one the speech recognition software I mentioned below for other platforms have. As for Wine + Dragon NaturallySpeaking, in my experience it keeps crashing, and I don't seem to be the only one to have such issues unfortunately. On Microsoft Windows I use Dragon NaturallySpeaking, on Apple Mac OS X I use Apple Dictation and DragonDictate, on Android I use Google speech recognition, and on iOS I use the built-in Apple speech recognition. Baidu Research released  the  for its speech recognition library using  implemented with Torch. Benchmarks from  are encouraging as shown in the table below, but I am not aware of any good wrapper around to make it usable without quite some coding (and a large training data set):      System Clean (94) Noisy (82) Combined (176)     Apple Dictation 14.24 43.76 26.73   Bing Speech 11.73 36.12 22.05   Google API 6.64 30.47 16.72   wit.ai 7.94 35.06 19.41   Deep Speech 6.56 19.06 11.85     Table 4: Results (%WER) for 3 systems evaluated on the original audio. All systems are scored only on the utterances with predictions given by all systems. The number in the parentheses next to each dataset, e.g. Clean (94), is the number of utterances scored.  There exist some very alpha open-source projects:   (part of Mozilla's Vaani project:   ())  Vox, a system to control a Linux system using Dragon NaturallySpeaking:  +     (to be released by Google, mentioned at Interspeech 2018)  I am also aware of this  as well as this .  I am aware of  , which allows speech recognition via Dragonfly on one computer to send events to another, but it has some latency cost:  I am also aware of these two talks exploring Linux option for speech recognition:   (David Williams-King)  (Tavis Rudd) Why is torque not measured in Joules? Recently, I was doing my homework and I found out that Torque can be calculated using $\tau = rF$. This means the units of torque are Newton meters. Work &amp; Energy are also measured in Newton meters which are Joules.  However, torque isn't a measure of energy. I am really confused as why it isn't measured in Joules. How to move windows that open up offscreen? I have a dual monitor setup, and I recently played around with the positioning settings, and some of my single window applications do the favour of preserving where they were last closed, and opening in the same position later. Unfortunately, that now places them out of the viewable area of my screens!  Is there some way to force a particular window into the viewable area? Every Finite Group is Isomorphic to a Subgroup of $A_n$ How can timelapse sequences be shot without in-camera support? How can timelapse sequences be shot without having in-camera support for it?  Which third-party tools are recommended? Show images related to features in QGIS? Say for example, if there's a point data with old trees, then when you use the identify tool, you can see the photograph of the tree  Or even one level further, the labels displaying these images right away without any clicking needed  I believe the term is file streaming? How do I get a Realtek RTL8723BE wireless card to work? I have installed Ubuntu 15.04 on my laptop with RTL8723BE Wi-fi card. But it is always disconnecting from network. I have tried echo "options rtl8723be fwlps=N ips=N" | sudo tee /etc/modprobe.d/rtl8723be.conf but that didn't helped. What can I do to prevent the wifi from disconnecting? If I upgrade to kernel 4.X, will it help?  ~$ lspci -knn | grep Net -A2  09:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723]     Subsystem: Hewlett-Packard Company Device [103c:2231]     Kernel driver in use: rtl8723be   ~$ rfkill list 0: hci0: Bluetooth     Soft blocked: yes     Hard blocked: no 1: phy0: Wireless LAN     Soft blocked: no     Hard blocked: no   ~$ ifconfig &amp;&amp; iwconfig &amp;&amp; route -n &amp;&amp; ping -c 1 google.com eth0      Link encap:Ethernet  HWaddr 38:63:bb:cd:4a:7e             UP BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:3 errors:0 dropped:0 overruns:0 frame:0           TX packets:53 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:752 (752.0 B)  TX bytes:8445 (8.4 KB)  lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:3870 errors:0 dropped:0 overruns:0 frame:0           TX packets:3870 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:314613 (314.6 KB)  TX bytes:314613 (314.6 KB)  wlan0     Link encap:Ethernet  HWaddr c0:38:96:6d:c4:83             inet addr:192.168.1.205  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::c238:96ff:fe6d:c483/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:15240 errors:0 dropped:0 overruns:0 frame:0           TX packets:14627 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:14410285 (14.4 MB)  TX bytes:2192744 (2.1 MB)  eth0      no wireless extensions.  wlan0     IEEE 802.11bgn  ESSID:"DIR-615"             Mode:Managed  Frequency:2.437 GHz  Access Point: 00:90:4C:08:00:0D              Bit Rate=150 Mb/s   Tx-Power=20 dBm              Retry short limit:7   RTS thr=2347 B   Fragment thr:off           Power Management:off           Link Quality=70/70  Signal level=-22 dBm             Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0           Tx excessive retries:0  Invalid misc:186   Missed beacon:0  lo        no wireless extensions.  Kernel IP routing table Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 0.0.0.0         192.168.1.1     0.0.0.0         UG    400    0        0 wlan0 169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0 PING google.com.Dlink (172.26.136.19) 56(84) bytes of data. 64 bytes from 19.136.26.172.in-addr.arpa (172.26.136.19): icmp_seq=1 ttl=249 time=102 ms  --- google.com.Dlink ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 102.547/102.547/102.547/0.000 ms Take the following two lines of code:  for (int i = 0; i &lt; some_vector.size(); i++) {     //do stuff }   And this:  for (some_iterator = some_vector.begin(); some_iterator != some_vector.end();     some_iterator++) {     //do stuff }   I'm told that the second way is preferred. Why exactly is this? I know that there is a simple way to shutdown the computer in command prompt, but is it possible to do system updates and then shutdown the computer in command prompt?   For example, when Vista needs to install updates, it will let me install them and shut down by clicking the Shut Down button (while relegating the normal shut down button into the menu). So is there a command to do this in command prompt? In my lecture, the lecturer said:      Let $K$ be the key generation algorithm. Given a security parameter represented in unary, $1^k$, $K(1^k)$ will output a keypair $(pk; sk)$, known as the public key and the private (or secret) key, respectively.    My question is: When I want to implement the cryptosystem, how should I represent this $1^k$?  When I implement the key generation procedure, do I literally require callers to pass me a string of $k$ one-bits that the procedure will never use?  And, if so, why is it there in the first place?