qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
60,736
In *The Originals*, Klaus has got a miracle baby daughter who: * is a daughter of an original hybrid and a werewolf. * can heal vampires from lethal werewolf bite (power of original hybrid). * can create hybrids. A werewolf in transition must drink the blood of the baby (power of human doppelganger blood). What exact...
2014/07/06
[ "https://scifi.stackexchange.com/questions/60736", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/931/" ]
Hope is a pure blood hybrid meaning she was born with doppelganger blood unlike Klaus. After Klaus drained it from Elena, he was able to sire hybrids. Hope started siring hybrids from in the womb, meaning she's on a whole different level than Klaus. Normally, you can either be a vampire **or** a witch, never both, beca...
I think that she is a heretic but different from the ones in The Vampire Diaries because she is more powerful. She is a combination of an original hybrid and a witch from a very powerful bloodline. Personally I think her werewolf gene may never be triggered because she may end up losing her other abilities and magic -...
21,486,174
I have another problem with my program which is using JFrame. I am making a "cash machine" program, which asks user about his first name, last name, current account state and the withdrawal amount. I want to have two classes that implements two different tasks the program does. Class Card should ask user about all the ...
2014/01/31
[ "https://Stackoverflow.com/questions/21486174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2536652/" ]
Added the following to my crontab and now everything is working as intended. ``` PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games ```
The question is... "why use sudo?" you need a service restart which is a root operation. Edit the /etc/crontab and add the line like this: ``` 0 0 * * * root /usr/local/bin/cloak.sh 1 15 7 * * * root /usr/local/bin/cloak.sh 0 ``` and it should it work.
34,443,842
``` $arr_type=array( "1"=>"A", "2"=>"B", "3"=>"C", "4"=>"D", "5"=>"E", "6"=>"F", "7"=>"G", "8"=>"H" ); ``` how to change key name and level change? `$arr_type['1']['name'] = A;` `$arr_type['2']['name'] = B;`
2015/12/23
[ "https://Stackoverflow.com/questions/34443842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5446540/" ]
``` $new_arr = array(); foreach($arr_type as $k => $v){ $new_arr[$k]['name'] = $v; } ``` --- Since this got chosen, I'm also adding @Mark Baker's [comment](https://stackoverflow.com/questions/34443842/how-to-add-key-name-to-array/34443862#comment56629570_34443842) using [array\_walk](http://php.net/manual/en/fu...
In case one wants to keep the original array unchanged, this solution would also work: ``` $result = array_map(function ($value) { return ['name' => $value]; }, $arr_type); ```
22,627,306
After successful payment, it is redirecting me at success URL but I am not getting response from IPN. Below is the `notifypage.aspx.cs` page code: ``` protected void Page_Load(object sender, EventArgs e) { //Post back to either sandbox or live string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/websc...
2014/03/25
[ "https://Stackoverflow.com/questions/22627306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2322961/" ]
You should test working of your `IPN Listner` here <https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNTesting/>
Paypal `IPN` response calls only server domains, if you trying it on local host it will not call your notify url page.
15,936
I have a collection of checkmated chess positions, in FEN/EPD format. Most of the time, each of these positions contains some *useless* pieces, that I really want to remove, in the aim of getting cleaner schemes. Then, I'm searching for a batch possibility to check if my whole chess collection is checkmate or not. Ide...
2016/11/25
[ "https://chess.stackexchange.com/questions/15936", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/11807/" ]
I don't know if any such tool exists. If you want to program yourself you need to watch out for: **Change of mating theme**: If you remove pieces you might get new/different mates, e.g. in: ``` 6rk/5Npp/8/8/8/8/2K5/7R b - - 0 1 ``` if you remove the white knight and the black pawn on h7 you have a new mate, whi...
If I understand you correctly, you want to automatically simplify the mating sequence (final position minus a couple of moves) basically keeping the same mating pattern. I think doing this automatically will be very difficult because if you remove pieces all kind of things can happen: * additional sidelines (loss of ...
31,693,341
I have a `API` which returns the `json response`. When I call the `API` from `Fiddler` it gives me the `json reponse` as shown below: [![enter image description here](https://i.stack.imgur.com/F0u84.png)](https://i.stack.imgur.com/F0u84.png) **JSON Response:** [![enter image description here](https://i.stack.imgur.co...
2015/07/29
[ "https://Stackoverflow.com/questions/31693341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1047280/" ]
Adapted from [this answer](https://stackoverflow.com/a/692369/1364007) to ["*.Net HttpWebRequest.GetResponse() raises exception when http status code 400 (bad request) is returned*"](https://stackoverflow.com/q/692342/1364007) by [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet): ``` try { using (WebRes...
Slightly changing SilentTremor's answer. Combining the using statements makes the code a little bit shorter. ``` catch (WebException ex) { HttpWebResponse httpResponse = (HttpWebResponse)ex.Response; using (WebResponse response = ex.Response) using (Stream data = response.GetResp...
3,043,403
Consider the set $C=\{x \in \mathbb{R}^4 \mid x^TAx \geq 1\}$ where $A \in \mathbb{R}^{4 \times 4}$ is a symmetric matrix with two distinct positive eigenvalues and other eigenvalues of $A$ are nonpositive. Show $C$ is not empty? My try: $A$ is symmetric, so it can be written as $A=u \Lambda u^T$. Hence, $$ x^TAx=...
2018/12/17
[ "https://math.stackexchange.com/questions/3043403", "https://math.stackexchange.com", "https://math.stackexchange.com/users/608029/" ]
You can't simply assume that the non-positive eigenvalues of $A$ are zero. Note that to show that $C$ is non-empty, you only need to show that there is at least one vector in $C$. Let $\lambda$ be the one of the positive eigenvalues of $A$, and let $v$ be a corresponding eigenvector with unit norm. If $x = \alpha ...
Let $x \in R^4$ be the eigenvector corresponding to one of the positive eigenvalues $\lambda\_1$. Then $x^TAx = \lambda\_1 x^Tx > 0$. Now all you have to do is multiply $x$ by a normalizing scalar to get some $y \in R^4$ and you have $y^TAy = 1 \Rightarrow y \in C$.
29,689,529
I am trying to make a multithreaded program that pulls numerous threads of data from a server held by another company. Currently once a thread has pulled the data it then uses OdbcDataReader to read that data. But ultimately, what I would like to do is pass that data off to another different thread, which will use the ...
2015/04/17
[ "https://Stackoverflow.com/questions/29689529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2352648/" ]
It looks like you're implementing the Producer/Consumer pattern. One solid solution is to use a [BlockingCollection](https://msdn.microsoft.com/en-us/library/dd267312%28v=vs.110%29.aspx). Your current thread can post the data read from the reader to the blocking collection, and a separate thread can read from the bloc...
Have you tried using an Asynchronous Reader? Reference: <https://msdn.microsoft.com/en-us/library/system.data.odbc.odbccommand.executereaderasync%28v=vs.110%29.aspx>
29,689,529
I am trying to make a multithreaded program that pulls numerous threads of data from a server held by another company. Currently once a thread has pulled the data it then uses OdbcDataReader to read that data. But ultimately, what I would like to do is pass that data off to another different thread, which will use the ...
2015/04/17
[ "https://Stackoverflow.com/questions/29689529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2352648/" ]
It looks like you're implementing the Producer/Consumer pattern. One solid solution is to use a [BlockingCollection](https://msdn.microsoft.com/en-us/library/dd267312%28v=vs.110%29.aspx). Your current thread can post the data read from the reader to the blocking collection, and a separate thread can read from the bloc...
Always do thread-safe programming. Now by giving thread-safe collections, Microsoft has made it even easier for developers. See : [MSDN- Thread-Safe Collections](https://msdn.microsoft.com/en-us/library/dd997305%28v=vs.110%29.aspx) For eaxample, One thread can keep adding data to the collection, it could be `Concur...
42,120,144
I have a table and two arrays. One array calculates the min and the other array calculates the max. Calculations are done per row. This means the first cell of the min array calculates the min cell of the first row of the table, and so on. I want to conditionally format the table according to the calculated values in ...
2017/02/08
[ "https://Stackoverflow.com/questions/42120144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7535999/" ]
Try replacing this line: ``` mvn -Dclass=\"launch-in-engine $1 $2\" ``` With this : ``` mvn "-Dclass=\"launch-in-engine $1 $2\"" ``` The reason I think this may solve your problem is that you are (I think) hoping to pass the whole `-Dclass` as a single argument, but there are unescaped and unquoted spaces inside...
There were 2 issues 1. Using -x printed debug information which lead me to believe that that extra ' were being inserted 2. I was used to running the *mvn command as mvn -Dclass="launch-in-engine MyClass id=20"*. The quotes were to pass the entire string which consist of variuos instructions to the mvn plugin. So I as...
66,366,005
The following C++20 program: ``` #include <utility> #include <cstddef> template<typename... Args> class C { template<size_t... I> static void call( std::index_sequence<I...> = std::index_sequence_for<Args...>{} ) {} }; int main() { C<long int>::call(); } ``` fails to compile with error messag...
2021/02/25
[ "https://Stackoverflow.com/questions/66366005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1131467/" ]
In general template argument deduction + default function arguments cause a lot of trouble. To simply fix it you can go with this: ``` #include <utility> #include <cstddef> template<typename... Args> class C { public: static void call() { call_impl(std::index_sequence_for<Args...>{}); } private: ...
In C++20 you can also write a templated lambda to do exactly that without creating a new function: ``` //... static void call() { return [&]<size_t... Is>(std::index_sequence<Is...>) { /* your code goes here... */ }( std::index_sequence_for<Args...>{} ); } ```
56,148,313
Hey guys I am having trouble creating a certain type of shape in C# that is meant to look like this with the two triangle patterns ``` ***** **** *** ** * * ** *** **** ***** ``` I have managed to create one inverted right triangle pattern but I cant seem to figure out how to create a right triangle star pattern be...
2019/05/15
[ "https://Stackoverflow.com/questions/56148313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11503673/" ]
This is a pretty simple homework question - hope you enjoy this solution: ``` using System; class Program { const Int32 maxTriangleSize = 5; static void Main(string[] args) { for (Int32 i = maxTriangleSize - 1; i >= 0; i--) { Console.WriteLine(new String('*', i + 1)); } f...
You already know how to print all the lines from widest to narrowest. You just want to do the the same, but backwards - start narrow, and print wide: ``` for (i = val; i >= 1; i--) ``` How to use this is up to you. I would put the inner part of the loop in a function, so main would become: ``` for (i = 1; i <= val;...
56,148,313
Hey guys I am having trouble creating a certain type of shape in C# that is meant to look like this with the two triangle patterns ``` ***** **** *** ** * * ** *** **** ***** ``` I have managed to create one inverted right triangle pattern but I cant seem to figure out how to create a right triangle star pattern be...
2019/05/15
[ "https://Stackoverflow.com/questions/56148313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11503673/" ]
You already know how to print all the lines from widest to narrowest. You just want to do the the same, but backwards - start narrow, and print wide: ``` for (i = val; i >= 1; i--) ``` How to use this is up to you. I would put the inner part of the loop in a function, so main would become: ``` for (i = 1; i <= val;...
You didn't specify any REQUIREMENTS. Where does it say you can't use just a bunch of WriteLine() calls? ``` Console.WriteLine("*****"); Console.WriteLine("****"); Console.WriteLine("***"); Console.WriteLine("**"); Console.WriteLine("*"); Console.WriteLine("*"); Console.WriteLine("**"); Console.WriteLine("***"); Consol...
56,148,313
Hey guys I am having trouble creating a certain type of shape in C# that is meant to look like this with the two triangle patterns ``` ***** **** *** ** * * ** *** **** ***** ``` I have managed to create one inverted right triangle pattern but I cant seem to figure out how to create a right triangle star pattern be...
2019/05/15
[ "https://Stackoverflow.com/questions/56148313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11503673/" ]
You already know how to print all the lines from widest to narrowest. You just want to do the the same, but backwards - start narrow, and print wide: ``` for (i = val; i >= 1; i--) ``` How to use this is up to you. I would put the inner part of the loop in a function, so main would become: ``` for (i = 1; i <= val;...
As the number of stars per row are decreasing by a constant count, you can print them together. You can start with incrementing the numbers and then use another loop decrementing the counter. I've tested the below code and it seems to work fine. ``` static void Main(string[] args) { int val = 5; ...
56,148,313
Hey guys I am having trouble creating a certain type of shape in C# that is meant to look like this with the two triangle patterns ``` ***** **** *** ** * * ** *** **** ***** ``` I have managed to create one inverted right triangle pattern but I cant seem to figure out how to create a right triangle star pattern be...
2019/05/15
[ "https://Stackoverflow.com/questions/56148313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11503673/" ]
This is a pretty simple homework question - hope you enjoy this solution: ``` using System; class Program { const Int32 maxTriangleSize = 5; static void Main(string[] args) { for (Int32 i = maxTriangleSize - 1; i >= 0; i--) { Console.WriteLine(new String('*', i + 1)); } f...
You didn't specify any REQUIREMENTS. Where does it say you can't use just a bunch of WriteLine() calls? ``` Console.WriteLine("*****"); Console.WriteLine("****"); Console.WriteLine("***"); Console.WriteLine("**"); Console.WriteLine("*"); Console.WriteLine("*"); Console.WriteLine("**"); Console.WriteLine("***"); Consol...
56,148,313
Hey guys I am having trouble creating a certain type of shape in C# that is meant to look like this with the two triangle patterns ``` ***** **** *** ** * * ** *** **** ***** ``` I have managed to create one inverted right triangle pattern but I cant seem to figure out how to create a right triangle star pattern be...
2019/05/15
[ "https://Stackoverflow.com/questions/56148313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11503673/" ]
This is a pretty simple homework question - hope you enjoy this solution: ``` using System; class Program { const Int32 maxTriangleSize = 5; static void Main(string[] args) { for (Int32 i = maxTriangleSize - 1; i >= 0; i--) { Console.WriteLine(new String('*', i + 1)); } f...
As the number of stars per row are decreasing by a constant count, you can print them together. You can start with incrementing the numbers and then use another loop decrementing the counter. I've tested the below code and it seems to work fine. ``` static void Main(string[] args) { int val = 5; ...
40,331,320
First of all, what I want to do: Sending Photos with Socket from my Raspberry Pi to my laptop. **Client:** ``` #!/usr/bin/python import socket import cv2 import numpy as np import pickle #Upload image img = cv2.imread('/path/to/image', 0) #Turn image into numpy-array arr = np.asarray(img) #Receiver ip ip = "XXX.X...
2016/10/30
[ "https://Stackoverflow.com/questions/40331320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4585383/" ]
You don't need OpenCV and NumPy for this. Instead, simply send the bytes of the file directly. If you have Python 3.5 you can even use `socket.sendfile()`. For more detail see: [Sending a file over TCP sockets in Python](https://stackoverflow.com/questions/27241804/sending-a-file-over-tcp-sockets-in-python)
I dont know how many decimal places you need but you could encode your numpy array values in UTF16 BE and then decode after socket send with ``` def retrieve_and_decode_data(): try: data,addr = s.recvfrom(4096) ...
7,735,338
I am trying to get send json from my javascript (using jquery post) to compojure. I am sure there is something simple that I am doing wrong. My javascript file (in it's entirety) looks like: ``` $(document).ready(function() { $.post("/", "foo", function(){}); }); ``` my clojure server looks like: ``` (ns spend...
2011/10/12
[ "https://Stackoverflow.com/questions/7735338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416711/" ]
``` $(document).ready(function() { $.post("/", {foo:"foo"}, function(){}); }) ``` on the clojure side you can receive the POST variable by the name of `foo`
I think your app definition looks a bit odd. You're calling (handler/site main-routes), then using its value as the form for the threading macro. Other route definitions I've seen look like ``` (def app (-> main-routes wrap-base-url)) ```
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
As this is annoyingly so common, there are various converters available - e.g. [this site](http://www.asiteaboutnothing.net/c_decode-url.html). You can use these to decode the URL - so it will convert this: ``` http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoo...
You should use it like this ``` wget "http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar"` ``` Just replace every space with `%20` . Or Better copy your original link and paste it in Chromium Browser address bar. It will automatically format it for you. Now copy it fr...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
You should use it like this ``` wget "http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar"` ``` Just replace every space with `%20` . Or Better copy your original link and paste it in Chromium Browser address bar. It will automatically format it for you. Now copy it fr...
You only need to put quotes around the url and done: ``` wget "http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar" Warning: wildcards not supported in HTTP. --2014-03-02 20:40:20-- http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar Re...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
You should use it like this ``` wget "http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar"` ``` Just replace every space with `%20` . Or Better copy your original link and paste it in Chromium Browser address bar. It will automatically format it for you. Now copy it fr...
Wget expects the URL to have the following format: ``` [protocol://]host/path ``` The *protocol* is optional. In absence of *protocol*, Wget assumes HTTP. Wget accepts percent-encoded URLs just fine, but the delimiters between *protocol*, *host* and *path* cannot be percent-encoded. This is also why Wget changed t...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
You should use it like this ``` wget "http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar"` ``` Just replace every space with `%20` . Or Better copy your original link and paste it in Chromium Browser address bar. It will automatically format it for you. Now copy it fr...
I ended up writing a python script for it. ``` from os import listdir, rename from urllib.parse import unquote # py2: from urllib import unquote os.chdir('/mydir/') for filename in listdir('.'): rename(filename, unquote(filename)) ```
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
As this is annoyingly so common, there are various converters available - e.g. [this site](http://www.asiteaboutnothing.net/c_decode-url.html). You can use these to decode the URL - so it will convert this: ``` http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoo...
You only need to put quotes around the url and done: ``` wget "http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar" Warning: wildcards not supported in HTTP. --2014-03-02 20:40:20-- http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar Re...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
As this is annoyingly so common, there are various converters available - e.g. [this site](http://www.asiteaboutnothing.net/c_decode-url.html). You can use these to decode the URL - so it will convert this: ``` http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoo...
Wget expects the URL to have the following format: ``` [protocol://]host/path ``` The *protocol* is optional. In absence of *protocol*, Wget assumes HTTP. Wget accepts percent-encoded URLs just fine, but the delimiters between *protocol*, *host* and *path* cannot be percent-encoded. This is also why Wget changed t...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
As this is annoyingly so common, there are various converters available - e.g. [this site](http://www.asiteaboutnothing.net/c_decode-url.html). You can use these to decode the URL - so it will convert this: ``` http%3A%2F%2Fdl.minitoons.ir%2Flongs%2FKhumba%20(2013)%20%5BEN%5D%20%5BBR-Rip%20720p%5D%20-%20%5Bwww.minitoo...
I ended up writing a python script for it. ``` from os import listdir, rename from urllib.parse import unquote # py2: from urllib import unquote os.chdir('/mydir/') for filename in listdir('.'): rename(filename, unquote(filename)) ```
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
Wget expects the URL to have the following format: ``` [protocol://]host/path ``` The *protocol* is optional. In absence of *protocol*, Wget assumes HTTP. Wget accepts percent-encoded URLs just fine, but the delimiters between *protocol*, *host* and *path* cannot be percent-encoded. This is also why Wget changed t...
You only need to put quotes around the url and done: ``` wget "http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar" Warning: wildcards not supported in HTTP. --2014-03-02 20:40:20-- http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar Re...
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
You only need to put quotes around the url and done: ``` wget "http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar" Warning: wildcards not supported in HTTP. --2014-03-02 20:40:20-- http://dl.minitoons.ir/longs/Khumba%20(2013)%20[EN]%20[BR-Rip%20720p]%20-%20[www.minitoons.ir].rar Re...
I ended up writing a python script for it. ``` from os import listdir, rename from urllib.parse import unquote # py2: from urllib import unquote os.chdir('/mydir/') for filename in listdir('.'): rename(filename, unquote(filename)) ```
428,513
I have a URL like this: ``` http://dl.minitoons.ir/longs/Khumba (2013) [EN] [BR-Rip 720p] - [www.minitoons.ir].rar ``` I want to download this URL using `wget`. If I pass it directly to `wget`, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded...
2014/03/02
[ "https://askubuntu.com/questions/428513", "https://askubuntu.com", "https://askubuntu.com/users/24838/" ]
Wget expects the URL to have the following format: ``` [protocol://]host/path ``` The *protocol* is optional. In absence of *protocol*, Wget assumes HTTP. Wget accepts percent-encoded URLs just fine, but the delimiters between *protocol*, *host* and *path* cannot be percent-encoded. This is also why Wget changed t...
I ended up writing a python script for it. ``` from os import listdir, rename from urllib.parse import unquote # py2: from urllib import unquote os.chdir('/mydir/') for filename in listdir('.'): rename(filename, unquote(filename)) ```
735,572
When we configure log shipping do we have to open a firewall from the destination server to the source server too?
2009/04/09
[ "https://Stackoverflow.com/questions/735572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87810/" ]
It depends on whether or not the two instances of SQL Server taking part in the log shipped configuration are: * On the same server (Then No) * Behind different firewalls within the same domain/network (Then Yes)
Log shipping contains four separate job by Sql server Agent. 1.Getting back up in primary server 2.Shipping logs to secondary server 3.Restoring logs in secondary server 4.Monitoring the log shipping process (Optional) in steps 2 and 3, you need have a shared folder in network if your primary and secondary servers are...
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
Don't use a list. ----------------- A list can do fast inserts and removals of items only at its end. You'd use `pop(-1)` and `append`, and you'd end up with a stack. Instead, use `collections.deque`, which is designed for efficient addition and removal at both ends. Working on the "front" of a deque uses the `poplef...
You can use insert method of python list object. ``` l = [1, 2, 3] #lets insert 10 at biggining, which means at index 0 l.insert(0, 10) print(l) # this will print [10, 1, 2, 3] ```
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
``` L = [1, 2, 3] L.pop() # returns 3, L is now [1, 2] L.append(4) # returns None, L is now [1, 2, 4] L.insert(0, 5) # returns None, L is now [5, 1, 2, 4] L.remove(2) # return None, L is now [5, 1, 4] del(L[0]) # return None, L is now [1, 4] L.pop(0) # return 1, L is now [4] ```
You can use insert method of python list object. ``` l = [1, 2, 3] #lets insert 10 at biggining, which means at index 0 l.insert(0, 10) print(l) # this will print [10, 1, 2, 3] ```
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
I ran some benchmarks for you. Here are the results. TL;DR You probably want to use a `deque`. Otherwise, `insert` / `append`, or `pop` / `del` are fine. ### Adding to the end ``` from collections import deque import perfplot # Add to end def use_append(n): "adds to end" a = [1,2,3,4,5,6,7,8,9,10]*n a....
You can use insert method of python list object. ``` l = [1, 2, 3] #lets insert 10 at biggining, which means at index 0 l.insert(0, 10) print(l) # this will print [10, 1, 2, 3] ```
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
Don't use a list. ----------------- A list can do fast inserts and removals of items only at its end. You'd use `pop(-1)` and `append`, and you'd end up with a stack. Instead, use `collections.deque`, which is designed for efficient addition and removal at both ends. Working on the "front" of a deque uses the `poplef...
``` L = [1, 2, 3] L.pop() # returns 3, L is now [1, 2] L.append(4) # returns None, L is now [1, 2, 4] L.insert(0, 5) # returns None, L is now [5, 1, 2, 4] L.remove(2) # return None, L is now [5, 1, 4] del(L[0]) # return None, L is now [1, 4] L.pop(0) # return 1, L is now [4] ```
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
Don't use a list. ----------------- A list can do fast inserts and removals of items only at its end. You'd use `pop(-1)` and `append`, and you'd end up with a stack. Instead, use `collections.deque`, which is designed for efficient addition and removal at both ends. Working on the "front" of a deque uses the `poplef...
I ran some benchmarks for you. Here are the results. TL;DR You probably want to use a `deque`. Otherwise, `insert` / `append`, or `pop` / `del` are fine. ### Adding to the end ``` from collections import deque import perfplot # Add to end def use_append(n): "adds to end" a = [1,2,3,4,5,6,7,8,9,10]*n a....
62,146,307
In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to fast execution.
2020/06/02
[ "https://Stackoverflow.com/questions/62146307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430676/" ]
``` L = [1, 2, 3] L.pop() # returns 3, L is now [1, 2] L.append(4) # returns None, L is now [1, 2, 4] L.insert(0, 5) # returns None, L is now [5, 1, 2, 4] L.remove(2) # return None, L is now [5, 1, 4] del(L[0]) # return None, L is now [1, 4] L.pop(0) # return 1, L is now [4] ```
I ran some benchmarks for you. Here are the results. TL;DR You probably want to use a `deque`. Otherwise, `insert` / `append`, or `pop` / `del` are fine. ### Adding to the end ``` from collections import deque import perfplot # Add to end def use_append(n): "adds to end" a = [1,2,3,4,5,6,7,8,9,10]*n a....
38,002,933
I am working on small chat application which is working fine when the app is visible to user. A service class which get and send data using post every 5 second when aap is visible to user and works fine. But when app.is closed and service works in background for few minutes fine. After few minutes i.e. apprx 3 minutes ...
2016/06/23
[ "https://Stackoverflow.com/questions/38002933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4569103/" ]
I don’t know about your data, I have similar experiences, however I have used `read.csv()` function to read data. If the data field contain "NA" fields, then the numeric fields may be read as character fields. Hence you have to convert the column to numeric fields. What you can do is check the structure of your data ...
Without a known dataset, you can plot a histogram with density lines, of "Average..01" using ``` hist(dataset$Average..01, prob = TRUE) lines(density(dataset$Average..01)) ```
3,156,416
I need some help building an Query. I have a table "Orders" with 3 fields (IDorder, IDcostumer and amount) and i'm trying to create an List where i add one row for each costumer with the total of amount. Can someone help me building this query?
2010/07/01
[ "https://Stackoverflow.com/questions/3156416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/365383/" ]
Try the following: ``` SELECT IDCustomer, SUM(amount) FROM Orders GROUP BY IDCustomer ```
``` SELECT sum(amount), IDcostumer FROM Orders GROUP BY IDcostumer ```
3,156,416
I need some help building an Query. I have a table "Orders" with 3 fields (IDorder, IDcostumer and amount) and i'm trying to create an List where i add one row for each costumer with the total of amount. Can someone help me building this query?
2010/07/01
[ "https://Stackoverflow.com/questions/3156416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/365383/" ]
Try the following: ``` SELECT IDCustomer, SUM(amount) FROM Orders GROUP BY IDCustomer ```
Thanks for the answer. With your query i've tried to joined another table and converted it to LINQ with linqer. The final code was: `from c in contexto.Costumers join s in contexto.Sales on c.IDcostumer equals s.IDCostumer group new {c, s} by new { c.IDcostumer, c.name } into g select new { IDcostumer = (Int32?)g.K...
1,940,067
> > Find a polynomial of the specified degree that satisfies the given > conditions. > > Degree $4$; zeros $-1$, $0$, $3$, $1/3$ ; coefficient of $x^3$ is $7$ > > > My answer is... $$ P(x)=3x^4 - 7x^3 - 7x^2 + 3x. $$ When I entered this answer into the software (MindTap) for my class it was marked incorrect. ...
2016/09/24
[ "https://math.stackexchange.com/questions/1940067", "https://math.stackexchange.com", "https://math.stackexchange.com/users/372006/" ]
$\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]...
The answer was found in the comments to be $$P(x)=-3x^4+7x^3+7x^2-3x$$
58,019,512
I am running a react app and a json server with docker-compose. Usually I connect to the json server from my react app by the following: ``` fetch('localhost:8080/classes') .then(response => response.json()) .then(classes => this.setState({classlist:classes})); ``` Here is my docker-compose file: ``` vers...
2019/09/19
[ "https://Stackoverflow.com/questions/58019512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9244932/" ]
Remember that the React application always runs in some user's browser; it has no idea that Docker is involved, and can't reach or use any of the Docker-related networking setup. > > on my local machine I use [...] 192.168.99.100:8080 to see the json server > > > Then that's what you need in your React applicatio...
You have two solutions: 1. use CORS on Express server see <https://www.npmjs.com/package/cors> 2. set up proxy/reverse proxy using NGINX
35,197,106
I have two tables ``` Incomes: [Id] [AmountOfMoneyEarnt] [Date] [AccountId] ``` and ``` Spendings [Id] [AmountOfMoneySpent] [Date] [AccountId] ``` I would like to create a LINQ query in C# to get the Sum of total Incomes and sum of total spendings, but I'd like to be queried in one roundtrip. Obviously I want to...
2016/02/04
[ "https://Stackoverflow.com/questions/35197106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1891995/" ]
In order to do that in one roundtrip, you can use LINQ [Concat](https://msdn.microsoft.com/en-us/library/bb351755(v=vs.110).aspx) operator which is the equivalent of the SQL `UNION ALL` on a common anonymous type projection including account Id and the amount (positive for incomes and negative for spendings), group the...
If the tables aren't related at all and you want to select a sclar value: ``` var totalIncomesAndSpendings = new { TotalIncomes = db.Incomes.Sum(x => x.AmountOfMoneyEarnt), TotalSpendings = db.Spendings.Sum(x => x.AmountOfMoneySpent) }; var result = new { TotalIncomes = totalIncomesAndSpendings.TotalInc...
16,178
According to Wikipedia's page on [Israel and weapons of mass destructioni](https://en.wikipedia.org/wiki/Israel_and_weapons_of_mass_destruction): > > Israel is widely believed to possess weapons of mass destruction, and to be one of four nuclear-armed countries not recognized as a Nuclear Weapons State by the Nuclear...
2013/05/08
[ "https://skeptics.stackexchange.com/questions/16178", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/11740/" ]
It's officially unknown. ------------------------ Here is what is known to be true for sure (those, and only those, are the facts): * Israel has two atomic reactors, [one in Soreq](http://iaec.gov.il/English/Soreq/Pages/default.aspx), near the city of Yavne, and [one in the Negev](http://iaec.gov.il/English/NRCN/Page...
[Article in The Times of Israel](http://www.timesofisrael.com/only-the-nuclear-option-can-work-against-iran-former-idf-chief-says/) well, if a senior IDFAF officer states it, I'd seriously consider it to be true :) (never mind the standard anti Semitic rants in the comments section to the article) Now, Israel has al...
16,178
According to Wikipedia's page on [Israel and weapons of mass destructioni](https://en.wikipedia.org/wiki/Israel_and_weapons_of_mass_destruction): > > Israel is widely believed to possess weapons of mass destruction, and to be one of four nuclear-armed countries not recognized as a Nuclear Weapons State by the Nuclear...
2013/05/08
[ "https://skeptics.stackexchange.com/questions/16178", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/11740/" ]
**Yes, Israel has been known to have nuclear capability since the late 1960s.** As recently declassified documents show, they've reached secret agreement with US administration, which'd turn the blind eye. On the other hand Israel would maintain it's policy of deliberate ambiguity. [National Security Archive Electro...
[Article in The Times of Israel](http://www.timesofisrael.com/only-the-nuclear-option-can-work-against-iran-former-idf-chief-says/) well, if a senior IDFAF officer states it, I'd seriously consider it to be true :) (never mind the standard anti Semitic rants in the comments section to the article) Now, Israel has al...
16,178
According to Wikipedia's page on [Israel and weapons of mass destructioni](https://en.wikipedia.org/wiki/Israel_and_weapons_of_mass_destruction): > > Israel is widely believed to possess weapons of mass destruction, and to be one of four nuclear-armed countries not recognized as a Nuclear Weapons State by the Nuclear...
2013/05/08
[ "https://skeptics.stackexchange.com/questions/16178", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/11740/" ]
**Yes, Israel has been known to have nuclear capability since the late 1960s.** As recently declassified documents show, they've reached secret agreement with US administration, which'd turn the blind eye. On the other hand Israel would maintain it's policy of deliberate ambiguity. [National Security Archive Electro...
It's officially unknown. ------------------------ Here is what is known to be true for sure (those, and only those, are the facts): * Israel has two atomic reactors, [one in Soreq](http://iaec.gov.il/English/Soreq/Pages/default.aspx), near the city of Yavne, and [one in the Negev](http://iaec.gov.il/English/NRCN/Page...
28,598,485
I'm downloading daily 600MB netcdf-4 files that have this structure: ``` netcdf myfile { dimensions: time_counter = 18 ; depth = 50 ; latitude = 361 ; longitude = 601 ; variables: salinity temp, etc ``` I'm looking for a better way to convert the time\_counter di...
2015/02/19
[ "https://Stackoverflow.com/questions/28598485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594049/" ]
Your answers are very insightful. I'm not really looking a way to improve this ncdump-sed-ncgen method, I know that dumping a netcdf file that is 600MB uses almost 5 times more space in a text file (CDL representation). To then modify some header text and generate the netcdf file again, doesn't feels very efficient. ...
The shell pipeline can only be marginally improved by making the sed step only modify the beginning of the file and pass everything else through, but the expression you have is very cheap to process and will not make a dent in the time spent. The core problem is likely that you're spending a lot of time in `ncdump` fo...
28,598,485
I'm downloading daily 600MB netcdf-4 files that have this structure: ``` netcdf myfile { dimensions: time_counter = 18 ; depth = 50 ; latitude = 361 ; longitude = 601 ; variables: salinity temp, etc ``` I'm looking for a better way to convert the time\_counter di...
2015/02/19
[ "https://Stackoverflow.com/questions/28598485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594049/" ]
Your answers are very insightful. I'm not really looking a way to improve this ncdump-sed-ncgen method, I know that dumping a netcdf file that is 600MB uses almost 5 times more space in a text file (CDL representation). To then modify some header text and generate the netcdf file again, doesn't feels very efficient. ...
You can use the [`xarray`](http://xarray.pydata.org/) python package's [`xr.to_netdf()`](http://xarray.pydata.org/en/stable/generated/xarray.Dataset.to_netcdf.html#xarray.Dataset.to_netcdf) method, then optimise memory usage via using [`Dask`](https://dask.pydata.org/en/latest/). You just need to pass names of the dim...
45,940,789
I have a Word add-in that has a WPF window that is launched from a Ribbon button. The WPF window is used for capturing pictures from webcam. It has two windows: Live and Snap. It also has three buttons: Start (shows live video in Live), Capture (copies the current frame of Live into Snap) and Close (closes the form). I...
2017/08/29
[ "https://Stackoverflow.com/questions/45940789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8302795/" ]
This probably doesn't answer your question but a bit of a warning from working with Excel (same goes for Word or anything else using COM) Any COM objects your using from Word need to be handled carefully. COM does reference counting, so each time an object is used there is a +1 to a counter in the background essential...
Can't you create the `Bitmap` the same way as before and then call your `ImageSourceForBitmap` method?: ``` private void FinalFrame_NewFrame(object sender, NewFrameEventArgs eventArgs) { this.Dispatcher.BeginInvoke(new Action(() => { Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone() pboLive.Sourc...
44,251,938
I am using the data from the example shown here: <http://pandas.pydata.org/pandas-docs/stable/groupby.html>. Go to the subheading: New syntax to window and resample operations At the command prompt, the new syntax works as shown in the pandas documentation. But I want to add a new column with the expanded data to the ...
2017/05/30
[ "https://Stackoverflow.com/questions/44251938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7057751/" ]
You need to use your Spotify app credentials (Client ID and Client Secret) from www.developer.spotify.com, assign it to a variable and use that as your object. ``` import spotipy from spotipy.oauth2 import SpotifyClientCredentials cid ="Your-client-ID" secret = "Your-client-secret" client_credentials_manager = Spot...
It seems that Spotify Web API has been updated recently and requires authorization for all kinds of requests. Use [authorized requests](http://spotipy.readthedocs.io/en/latest/#authorized-requests) would solve this problem.
56,533,003
I have some text files which contains execution on windows scheduler jobs, I am trying to read a specific value from these files and send email, For example: `File_1.txt` has below lines and if the rejected count is greater than `0000000000` then we should get notified. ``` RECORDS READ: 0000000042 RECORDS SK...
2019/06/10
[ "https://Stackoverflow.com/questions/56533003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7318287/" ]
To expand on @cfraser's answer, a common pattern for HoCs which inject internal props is to type your HoC ``` // these will be injected by the HoC interface SomeInternalProps { someProp: any } function hoc<P>(Wrapped: React.Component<P & SomeInternalProps>): React.Component<Omit<P, keyof SomeInternalProps>> ``` i...
You should read about ts generics. For example, let's say a component has external props like `type OwnProps = { a: string }`, and the HOC injects `type InjectedProps = { b: boolean }`. This means the final props for the component will be `type Props = OwnProps & InjectedProps`. But, if you do: ``` const Component =...
51,521,972
``` this.http.post('http://localhost:1337/upload', formData, httpOptions) .subscribe( res => { console.log(res) }) ``` The code above is working just fine, however, I don't know how to read the response. This is the response I get: `[ { "_id": "5b588e82dfba462415d68d67", "name": "portal.jpg", "h...
2018/07/25
[ "https://Stackoverflow.com/questions/51521972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712312/" ]
In your component `.ts` file have a variable named `uploadUrl` and assign it as, ``` this.http.post('http://localhost:1337/upload', formData, httpOptions) .subscribe( res => { this.uploadUrl = res[0].url; }) ``` Hope this helps!
It seems like you're sending back an array, so probably: ``` .subscribe( (res: any)=> { res[0].url ``` Of course this would get the first value of the response, either send no array and just the object or loop through the response if more than one object and retrieve the urls. Also, you could add a type to your ...
51,521,972
``` this.http.post('http://localhost:1337/upload', formData, httpOptions) .subscribe( res => { console.log(res) }) ``` The code above is working just fine, however, I don't know how to read the response. This is the response I get: `[ { "_id": "5b588e82dfba462415d68d67", "name": "portal.jpg", "h...
2018/07/25
[ "https://Stackoverflow.com/questions/51521972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712312/" ]
In your component `.ts` file have a variable named `uploadUrl` and assign it as, ``` this.http.post('http://localhost:1337/upload', formData, httpOptions) .subscribe( res => { this.uploadUrl = res[0].url; }) ``` Hope this helps!
`myurl = res[0]["url"]` should work. Try `console.log(res[0])` to understand why we need `res[0]`. It uses the same syntax behind `arr = [0, 1, 2, 3] console.log(arr[2]) // 2` Make sure to define `myurl` before `this.http.post`.
59,839,127
When a single application is executed multiple times in parallel, will statically-declared variables in that program be allocated on a single thread or duplicated among mutliple threads?
2020/01/21
[ "https://Stackoverflow.com/questions/59839127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12668430/" ]
I think it has to do with the fact the `JSONObject` is like a map which has key-value pairs, while AssertJ expects Java bean-style objects to check if a property exists. I understood this from the document at <https://joel-costigliola.github.io/assertj/core/api/org/assertj/core/api/AbstractObjectAssert.html#hasFieldOrP...
Fist, you need to traverse the keysets (nodes) using the `map` class, then verify if the keyset contains the particular node you are looking for. ``` Map<String, Object> read = JsonPath.read(JSONObject, "$"); assertThat(read.keySet()).contains("name"); ```
59,839,127
When a single application is executed multiple times in parallel, will statically-declared variables in that program be allocated on a single thread or duplicated among mutliple threads?
2020/01/21
[ "https://Stackoverflow.com/questions/59839127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12668430/" ]
I think it has to do with the fact the `JSONObject` is like a map which has key-value pairs, while AssertJ expects Java bean-style objects to check if a property exists. I understood this from the document at <https://joel-costigliola.github.io/assertj/core/api/org/assertj/core/api/AbstractObjectAssert.html#hasFieldOrP...
If you use SpringBoot you can use [the custom impl. for Assertj](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/json/BasicJsonTester.html) ``` private final BasicJsonTester json = new BasicJsonTester(getClass()); @Test void testIfHasPropertyName() { final JSONObj...
59,839,127
When a single application is executed multiple times in parallel, will statically-declared variables in that program be allocated on a single thread or duplicated among mutliple threads?
2020/01/21
[ "https://Stackoverflow.com/questions/59839127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12668430/" ]
If you want to do any serious assertions on JSON object, I would recommend JsonUnit <https://github.com/lukas-krecan/JsonUnit>
Fist, you need to traverse the keysets (nodes) using the `map` class, then verify if the keyset contains the particular node you are looking for. ``` Map<String, Object> read = JsonPath.read(JSONObject, "$"); assertThat(read.keySet()).contains("name"); ```
59,839,127
When a single application is executed multiple times in parallel, will statically-declared variables in that program be allocated on a single thread or duplicated among mutliple threads?
2020/01/21
[ "https://Stackoverflow.com/questions/59839127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12668430/" ]
If you want to do any serious assertions on JSON object, I would recommend JsonUnit <https://github.com/lukas-krecan/JsonUnit>
If you use SpringBoot you can use [the custom impl. for Assertj](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/json/BasicJsonTester.html) ``` private final BasicJsonTester json = new BasicJsonTester(getClass()); @Test void testIfHasPropertyName() { final JSONObj...
59,839,127
When a single application is executed multiple times in parallel, will statically-declared variables in that program be allocated on a single thread or duplicated among mutliple threads?
2020/01/21
[ "https://Stackoverflow.com/questions/59839127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12668430/" ]
If you use SpringBoot you can use [the custom impl. for Assertj](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/json/BasicJsonTester.html) ``` private final BasicJsonTester json = new BasicJsonTester(getClass()); @Test void testIfHasPropertyName() { final JSONObj...
Fist, you need to traverse the keysets (nodes) using the `map` class, then verify if the keyset contains the particular node you are looking for. ``` Map<String, Object> read = JsonPath.read(JSONObject, "$"); assertThat(read.keySet()).contains("name"); ```
68,040,355
I have following inheritance between Image and ProfileImage & ThumbnailStaticImage classes in Django : ``` class Image(models.Model): uuid = models.CharField(max_length=12, default="") extension = models.CharField(max_length=6, default=None) filename = models.CharField(max_length=20, default=None) ...
2021/06/18
[ "https://Stackoverflow.com/questions/68040355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5342009/" ]
Let assume you have parent model name Reporter and Child model name Article. Now you want to access Reporter from Article model. here is an example: ``` class Reporter(models.Model): #this is our parent model first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = m...
When using django model inheritance where the parent model is *not* set to `abstract=True` you can access the parent using `{lowercase parent model name}_ptr` attribute attached to the child model. ``` class Image(models.Model): uuid = models.CharField(max_length=12, default="") extension = models.CharField(...
10,814,828
How do I get the value of multiple keys from redis using a sorted set? ``` zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores ``` This will have two users in it. How can I retrieve the users with key 'David' and 'Linda' in one query?
2012/05/30
[ "https://Stackoverflow.com/questions/10814828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763285/" ]
There are multiple ways to do it without introducing a new command in Redis. For instance, you can fill a temporary set with the names you are interested in, then calculate the intersection between the temporary set and the zset: ``` multi sadd tmp David Linda ... and more ... zinterstore res 2 tmp Users weights ...
You cannot get this with one command. The closest you can do to get it in one response: ``` MULTI ZSCORE Users David ZSCORE Users Linda EXEC ``` **EDIT**: Alternatively, you can maintain a parallel hash with users' scores, and query it with ``` HMGET UserScores David Linda ```
10,814,828
How do I get the value of multiple keys from redis using a sorted set? ``` zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores ``` This will have two users in it. How can I retrieve the users with key 'David' and 'Linda' in one query?
2012/05/30
[ "https://Stackoverflow.com/questions/10814828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763285/" ]
One uses a sorted set because you want to deal with items that are sorted. What you are asking for is to not use a sorted set as a sorted set. If you don't care about sort order, then perhaps a sorted set is not what you are looking for. You already can retrieve multiple keys, but not arbitrary ones. If your primary g...
You cannot get this with one command. The closest you can do to get it in one response: ``` MULTI ZSCORE Users David ZSCORE Users Linda EXEC ``` **EDIT**: Alternatively, you can maintain a parallel hash with users' scores, and query it with ``` HMGET UserScores David Linda ```
10,814,828
How do I get the value of multiple keys from redis using a sorted set? ``` zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores ``` This will have two users in it. How can I retrieve the users with key 'David' and 'Linda' in one query?
2012/05/30
[ "https://Stackoverflow.com/questions/10814828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763285/" ]
You can use Redis MGET ``` redis> MGET key1 key2 nonexisting 1) "Hello" 2) "World" 3) (nil) ``` More here <http://redis.io/commands/mget>
You cannot get this with one command. The closest you can do to get it in one response: ``` MULTI ZSCORE Users David ZSCORE Users Linda EXEC ``` **EDIT**: Alternatively, you can maintain a parallel hash with users' scores, and query it with ``` HMGET UserScores David Linda ```
10,814,828
How do I get the value of multiple keys from redis using a sorted set? ``` zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores ``` This will have two users in it. How can I retrieve the users with key 'David' and 'Linda' in one query?
2012/05/30
[ "https://Stackoverflow.com/questions/10814828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763285/" ]
There are multiple ways to do it without introducing a new command in Redis. For instance, you can fill a temporary set with the names you are interested in, then calculate the intersection between the temporary set and the zset: ``` multi sadd tmp David Linda ... and more ... zinterstore res 2 tmp Users weights ...
One uses a sorted set because you want to deal with items that are sorted. What you are asking for is to not use a sorted set as a sorted set. If you don't care about sort order, then perhaps a sorted set is not what you are looking for. You already can retrieve multiple keys, but not arbitrary ones. If your primary g...
10,814,828
How do I get the value of multiple keys from redis using a sorted set? ``` zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores ``` This will have two users in it. How can I retrieve the users with key 'David' and 'Linda' in one query?
2012/05/30
[ "https://Stackoverflow.com/questions/10814828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763285/" ]
You can use Redis MGET ``` redis> MGET key1 key2 nonexisting 1) "Hello" 2) "World" 3) (nil) ``` More here <http://redis.io/commands/mget>
One uses a sorted set because you want to deal with items that are sorted. What you are asking for is to not use a sorted set as a sorted set. If you don't care about sort order, then perhaps a sorted set is not what you are looking for. You already can retrieve multiple keys, but not arbitrary ones. If your primary g...
14,327,343
I have an App that downloads a PDF file and stores it with MODE\_PRIVATE (for security purposes) on the Internal Memory of the App: ``` FileOutputStream fos = getApplicationContext().openFileOutput(LOCAL_FILE_NAME, Context.MODE_PRIVATE); InputStream inputStream = entity.getContent(); byte[] buffer = new byte[1024]; i...
2013/01/14
[ "https://Stackoverflow.com/questions/14327343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1110312/" ]
> > How can I open and display the downloaded PDF file? > > > Create a `ContentProvider` to serve the PDF file, then use an `ACTION_VIEW` `Intent` with the `Uri` to your `ContentProvider` to open it in the user's chosen PDF viewer. [This sample project](https://github.com/commonsguy/cw-omnibus/tree/master/Content...
To make a file from internal storage available to other apps the cleanest approach is to use a content provider. Luckily, Android comes with [FileProvider](http://developer.android.com/reference/android/support/v4/content/FileProvider.html) – an implementation that might just serve your needs. You don't need to impleme...
228,651
When I try to execute a command, I will encounter the following error by commandline **mmap() failed: [12] Cannot allocate memory**
2018/06/05
[ "https://magento.stackexchange.com/questions/228651", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/64038/" ]
Try this and add dmemory\_limit: ``` php -dmemory_limit=5G bin/magento setup:static-content:deploy ```
Try this: `php bin/magento -dmemory_limit=2G {{your command}}`. `-dmemory_limit=2G` this will extend memory for command execution.
33,878,016
Might be repeated somewhere but i've looked at every perl array referencing / dereferencing example i've been able to find and tried running 10+ different combos of this string to get my desired output. Such as @$array[i], @{$array[i]}, @{@$array[i]} etc. So I have an array of array references. I built this by creatin...
2015/11/23
[ "https://Stackoverflow.com/questions/33878016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333134/" ]
As others have mentioned, you're getting confused as to when you should use the $ and @ symbols. (To be fair, it's not always obvious in Perl.) The Perl reference tutorial link glenn gave is the best resource. Maybe some examples will help: ``` use strict; use warnings; my @important_years = (1066, 1492, 1776); my @r...
Thanks to glenn jackman and ThisSuitIsBlackNot I was able to figure it out. The issue is that the reference I was doing above was more or less correct but there was an error later in my code, the reference I went with was, ``` my $arrayRef = @redArray[$i]; my @redVal = @{$arrayRef}; ```
16,929,340
I downloaded visual studios 2012 express for windows so I can use the windows 8 direct2d effects. I tried to follow the starting project on msdn it says include the d2d1.h and d2d1\_1.h headers first line of code says ``` DX::ThrowIfFailed( D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, ...
2013/06/04
[ "https://Stackoverflow.com/questions/16929340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2446289/" ]
You need to install the Directx SDK to get those headers. [Directx SDK @ microsoft.com](http://www.microsoft.com/en-us/download/details.aspx?id=6812)
You should install the Windows 8 SDK if you want to use DirectX component(including direct3d, direct2d, directwrite, xaudio2 ...), you have many choices here 1. Install Visual Studio 2012, it includes the Windows 8 SDK by default, but I am doubt if the express version has the SDK, you can try the 90 days trial Ultimat...
3,180,604
I am self-studying probability and my textbook have the following question: Given a stick[1,....,n] with n units, we break the stick at some random point and take the largest piece for ourselves. What will be the expected size of our piece? This seems to be a pretty classic expectation problem and I've read many solu...
2019/04/09
[ "https://math.stackexchange.com/questions/3180604", "https://math.stackexchange.com", "https://math.stackexchange.com/users/618708/" ]
Convexity does not play a role here: distance to a closed set is always (Lipschitz) continuous: [here](https://math.stackexchange.com/questions/944659/distance-to-a-closed-set-is-continuous). Together with the fact that minimum of two continuous function is continuous (see [here](https://math.stackexchange.com/question...
Convexity is not needed. The function $x \to d(x,\partial H)$ is a continuous function and minimum of two continuous functions is continuous. So the only question is what happens when a sequence $\{x\_n\}$ in $H$ converges to a point $x$ not in $H$. Clearly, $x \in \overset {-}H$ so $x$ must be on the boundary. It foll...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
It depends how you booked it. If you worked with the airline to specifically create an intended *stopover* at B for your use as a tourist... and that was part of your ticketing and contract... they need to get you to B. (Stopover meaning an integral part of the travel plan agreed to with the airline.) However if B ...
Im not sure but if you clearly asked them , that you want to go A to C by passing B then they clearly cannot offer you new route without having B but if you asked flights to A to C then you cannot.
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
I'm elevating one of my comments on another answer to a full answer, because I think it's relevant... You are attempting to carry out a variation on "hidden city ticketing," and many of the same caveats will apply to you. You are trying to gain the benefit of a connection with a long layover in B while entering into ...
Im not sure but if you clearly asked them , that you want to go A to C by passing B then they clearly cannot offer you new route without having B but if you asked flights to A to C then you cannot.
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
You can ask that they route you the same way, but you can not insist. Your contract with the airline is to be transported from A to C, period. The fact that you choose the flight through B is not part of the contractual obligations. When your itinerary is changed is such a fashion your choices are pretty much get a fu...
It depends how you booked it. If you worked with the airline to specifically create an intended *stopover* at B for your use as a tourist... and that was part of your ticketing and contract... they need to get you to B. (Stopover meaning an integral part of the travel plan agreed to with the airline.) However if B ...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
**In my experience, following a major schedule change, most airlines will happily permit you to readjust your itinerary as you see fit, for free, regardless of the original fare rules.** For instance, that may include travelling earlier or later, the insertion or removal of a stop or layover, rerouting via different p...
Im not sure but if you clearly asked them , that you want to go A to C by passing B then they clearly cannot offer you new route without having B but if you asked flights to A to C then you cannot.
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
You can ask that they route you the same way, but you can not insist. Your contract with the airline is to be transported from A to C, period. The fact that you choose the flight through B is not part of the contractual obligations. When your itinerary is changed is such a fashion your choices are pretty much get a fu...
Im not sure but if you clearly asked them , that you want to go A to C by passing B then they clearly cannot offer you new route without having B but if you asked flights to A to C then you cannot.
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
I'm elevating one of my comments on another answer to a full answer, because I think it's relevant... You are attempting to carry out a variation on "hidden city ticketing," and many of the same caveats will apply to you. You are trying to gain the benefit of a connection with a long layover in B while entering into ...
It depends how you booked it. If you worked with the airline to specifically create an intended *stopover* at B for your use as a tourist... and that was part of your ticketing and contract... they need to get you to B. (Stopover meaning an integral part of the travel plan agreed to with the airline.) However if B ...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
You *can* insist all you want but that does *not* mean they will. However not insisting is guaranteed not to give your results you want. So in order to have a chance of getting what you want, you must insist. To do so nicely and politely can get results. Sometimes the person answering you cannot help but it is possible...
It depends how you booked it. If you worked with the airline to specifically create an intended *stopover* at B for your use as a tourist... and that was part of your ticketing and contract... they need to get you to B. (Stopover meaning an integral part of the travel plan agreed to with the airline.) However if B ...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
**In my experience, following a major schedule change, most airlines will happily permit you to readjust your itinerary as you see fit, for free, regardless of the original fare rules.** For instance, that may include travelling earlier or later, the insertion or removal of a stop or layover, rerouting via different p...
It depends how you booked it. If you worked with the airline to specifically create an intended *stopover* at B for your use as a tourist... and that was part of your ticketing and contract... they need to get you to B. (Stopover meaning an integral part of the travel plan agreed to with the airline.) However if B ...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
You can ask that they route you the same way, but you can not insist. Your contract with the airline is to be transported from A to C, period. The fact that you choose the flight through B is not part of the contractual obligations. When your itinerary is changed is such a fashion your choices are pretty much get a fu...
You *can* insist all you want but that does *not* mean they will. However not insisting is guaranteed not to give your results you want. So in order to have a chance of getting what you want, you must insist. To do so nicely and politely can get results. Sometimes the person answering you cannot help but it is possible...
101,539
I booked a ticket containing two segments A-B-C, where I have planned a 23-hour layover at B specifically for visiting the city. However, for some reason, the flight A-B has been cancelled and the airline is attempting to reroute me to A-D-C. However, omitting B would ruin my travel plans. Do I have the right to rejec...
2017/09/05
[ "https://travel.stackexchange.com/questions/101539", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/39474/" ]
I'm elevating one of my comments on another answer to a full answer, because I think it's relevant... You are attempting to carry out a variation on "hidden city ticketing," and many of the same caveats will apply to you. You are trying to gain the benefit of a connection with a long layover in B while entering into ...
**In my experience, following a major schedule change, most airlines will happily permit you to readjust your itinerary as you see fit, for free, regardless of the original fare rules.** For instance, that may include travelling earlier or later, the insertion or removal of a stop or layover, rerouting via different p...
49,892,639
I have the following part. I already tried to do it, but so far without any success. ```css .container { width: 600px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justify-content: space-between; min-heigh...
2018/04/18
[ "https://Stackoverflow.com/questions/49892639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1414645/" ]
Since you're using *Flexbox*, you can play around with the `flex` *values* of both *flex-items* of the `.item` element, e.g.: ```css .container { width: 600px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justif...
You can define a width for that label-text. ```css .container { width: 600px; } .label-text { width: 150px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justify-content: space-between; min-height: 60...
49,892,639
I have the following part. I already tried to do it, but so far without any success. ```css .container { width: 600px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justify-content: space-between; min-heigh...
2018/04/18
[ "https://Stackoverflow.com/questions/49892639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1414645/" ]
Here is jQuery example with check **label-text** max width in all items and apply width to all **label-text**. ```js var width =0 jQuery('.item').each(function() { if(width <= jQuery(this).children(".label-text").outerWidth()) { width = jQuery(this).children(".label-text").outerWidth(); } }); ...
You can define a width for that label-text. ```css .container { width: 600px; } .label-text { width: 150px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justify-content: space-between; min-height: 60...
49,892,639
I have the following part. I already tried to do it, but so far without any success. ```css .container { width: 600px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justify-content: space-between; min-heigh...
2018/04/18
[ "https://Stackoverflow.com/questions/49892639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1414645/" ]
Since you're using *Flexbox*, you can play around with the `flex` *values* of both *flex-items* of the `.item` element, e.g.: ```css .container { width: 600px; } .row { margin-bottom: 10px; } .item { width: 100%; border: 1px solid silver; margin-bottom: 0; display: flex; justif...
Here is jQuery example with check **label-text** max width in all items and apply width to all **label-text**. ```js var width =0 jQuery('.item').each(function() { if(width <= jQuery(this).children(".label-text").outerWidth()) { width = jQuery(this).children(".label-text").outerWidth(); } }); ...
32,972,768
I am using Polymer 1.0 and looking to create a tabbed layout where I can swipe between each tab I have. I have found a [swipe-pages](http://theseamau5.github.io/swipe-pages/components/swipe-pages/demo.html) component, but the dependencies on the site state that it needs `"polymer": "Polymer/polymer#^0.4.0"` which does ...
2015/10/06
[ "https://Stackoverflow.com/questions/32972768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/722167/" ]
There is a Polymer 1.0 version. See <https://github.com/slogger/swipe-pages>.
I'm very new in web development but I made an swipeable-pages element for Polymer 1.0 that works with dynamic pages like dom-repeat! <https://github.com/emersonbottero/swipeable-pages>. P.S.: I know the question is old but people may still need it. P.S.2: Improvements are welcome to the code :D.
68,272,531
I have written these lines to fill in the null values in the *zip code* column. It is supposed to fill in the *zip code* column based on the value of the *location* column. When I execute it, it keeps running indefinitely and doesn't give me the desired result. Can someone please tell me what I am doing wrong? Or what...
2021/07/06
[ "https://Stackoverflow.com/questions/68272531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15446375/" ]
The query is technically correct, but it may be slow because there are many rows with the same location, and it's joining with all of them, resulting in a large cross product. You can improve it by joining with a subquery that reduces them to one row per location. ``` UPDATE nycaccidents2020 AS a JOIN ( SELECT DIS...
The query will join all Rows, so it would be ebetter id you had an id filed so you could make a.id < b.id, like when you try to find doubles. But you can try, this wiuld select only one row from all rows with a zip code for a specific location and so would join only once instead as you query does with all existing row...
64,985,199
Say I have a list like `a = ["dog", "cat", "house", "mouse", "goose"]`. If I want to start a for loop at `a[3]` and end it at `a[2]`, how can I do that? `a[3:2]` of course returns an empty list, so I can't iterate on that. Is there a more pythonic way to do that than iterating over`a[3:]+a[:3]`? To be clear, what I wa...
2020/11/24
[ "https://Stackoverflow.com/questions/64985199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12607108/" ]
You can do something like that: ``` a = ["dog", "cat", "house", "mouse", "goose"] print(a[3:2:-1]) ``` And the output will be: ``` ['mouse'] ``` Obviously if you want to include the index `2` you have to write `a[3:1:-1]` (the final index it's not included as always) --- **UPDATE:** after you have updated the ...
When you slice a list like that (using a[3:-1]), the last item is non-inclusive. Therefore, if you elements want up to **but not including the last element**, then -1 should work for you. if you want up to but not including the last 2 elements, then -2 would work here. e.g, for: ``` a = ["dog", "cat", "house", "mouse...
74,156,649
im having problem with multiple usage of splice() method. ``` string= "test" splitted = string.split(''); splitted.splice(1,0,"ww"); console.log(splitted); ``` so when i use like this output is `(5) ['t', 'ww', 'e', 's', 't']` so all good. but lets assume that i want to use this method multiple times with a differen...
2022/10/21
[ "https://Stackoverflow.com/questions/74156649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5622259/" ]
Splice mutates the original object and returns the removed values. so calling it multiple times on the variable `splitted` does the trick you desire. ```js string= "test" splitted = string.split(''); splitted.splice(1,0,"ww") splitted.splice(2,0,"ss") splitted.splice(3,0,"dd") console.log(splitted); ```
If you want to do multiple operations you have to call splice multiple times. Either you code it to be called multiple times or you use an array and loop to call it multiple times. ```js const string = "test" const splitted = string.split(''); const updates = [ [1, 0, "ww"], [2, 0, "ss"], [3, 0, "dd"] ]; updat...
74,156,649
im having problem with multiple usage of splice() method. ``` string= "test" splitted = string.split(''); splitted.splice(1,0,"ww"); console.log(splitted); ``` so when i use like this output is `(5) ['t', 'ww', 'e', 's', 't']` so all good. but lets assume that i want to use this method multiple times with a differen...
2022/10/21
[ "https://Stackoverflow.com/questions/74156649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5622259/" ]
Splice mutates the original object and returns the removed values. so calling it multiple times on the variable `splitted` does the trick you desire. ```js string= "test" splitted = string.split(''); splitted.splice(1,0,"ww") splitted.splice(2,0,"ss") splitted.splice(3,0,"dd") console.log(splitted); ```
you can make a function if you want to make the content of that slice dynamically. and make the changes as parameter ``` function split(start, deleteCount , input) { string= "test" splitted = string.split(''); splitted.splice(start, deleteCount , input); console.log(splitted) } split(1,0,'ww') spl...
74,156,649
im having problem with multiple usage of splice() method. ``` string= "test" splitted = string.split(''); splitted.splice(1,0,"ww"); console.log(splitted); ``` so when i use like this output is `(5) ['t', 'ww', 'e', 's', 't']` so all good. but lets assume that i want to use this method multiple times with a differen...
2022/10/21
[ "https://Stackoverflow.com/questions/74156649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5622259/" ]
If you want to do multiple operations you have to call splice multiple times. Either you code it to be called multiple times or you use an array and loop to call it multiple times. ```js const string = "test" const splitted = string.split(''); const updates = [ [1, 0, "ww"], [2, 0, "ss"], [3, 0, "dd"] ]; updat...
you can make a function if you want to make the content of that slice dynamically. and make the changes as parameter ``` function split(start, deleteCount , input) { string= "test" splitted = string.split(''); splitted.splice(start, deleteCount , input); console.log(splitted) } split(1,0,'ww') spl...
22,781,214
i just want to sum a column and show in footer but problem is that column sum is depend on other column value. Example in my grid i have two column one for price and second for currency code ``` Price CurrencyCode 100 Eur 54 GBP 65 GBP 89 USD 41 EUR ``` i wanted to sum a price acc...
2014/04/01
[ "https://Stackoverflow.com/questions/22781214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849657/" ]
``` var sumEur = yourtable.compute("sum(Price)",CurrencyCode='GBP'); var sumGBP = yourtable.compute("sum(Price)",CurrencyCode='EUR'); var sumUSD = yourtable.compute("sum(Price)",CurrencyCode='USD'); ```
You'll have to generate this text in your code behind. You can use the DataBound event of the grid if you want access to the data, although I would probably calculate this from the datasource directly. Using linq you can easily get sums like: ``` var sumEur = datasource.Where(i => i.CurrencyCode == "EUR").Sum(i => i.P...
34,705,482
I want to replicate template in angularjs. like when I click on add button it add new form, when I click on remove button it remove form. When I submit button it send data to backend, but it is giving error `TypeError: Cannot read property 'field1' of undefined`, why It is not able to take `$scope.field.field1` value...
2016/01/10
[ "https://Stackoverflow.com/questions/34705482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4645982/" ]
You can do in in template by foreign key `{{ student.student_courseid.course_location }}` And not nessery to create `student_id`, Django automaticly add `pk`. I don't know, what kind of logic you want, but I think for courses and students, you need to create `models.ManyToManyField`.
On click of a particular student, it must show the information(course details also) so I guess, this will work. ``` {{student.student_courseid.course_loation}} in your html page. ``` Hope this should work, because by default.
55,321,348
I created a repository on GitHub that has a few files of java I wrote. I am trying to run the repository through my terminal. I am wondering what commands I need to enter in the terminal as well as what I need to write in the run file within the repository. Here is a link to the repository: <https://github.com/mowteam/...
2019/03/24
[ "https://Stackoverflow.com/questions/55321348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9916031/" ]
What you put in that file depends on what you want it to do. I'm not a Java expert, but the current file looks at least semi-reasonable. You're compiling your code, running it, then removing the compiled version. Your error isn't entirely clear (please include the entire, exact error message next time), but I suspect...
Before running from the terminal, SSH or HTTPS mapping is to be done. With this, connection between the local desktop/machine/server from where you are trying to access the Git repository and GIT will be established. 1. Generate the SSH key on local machine from where you are trying to access the repository 2. Under y...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
`getElementsByClassName()` returns a collection (like an array). So you would actually have to do ``` document.getElementsByClassName('Button')[1].checked = false; ``` But you can't be sure that your `Button2` is the second element in the array if you have more elements with class `Button`.
`getElementsByClassName` returns a node list (which is like an array) not an element. If you want to do something to every element in the node list, then you have to loop over it and do the thing on each item in the list. ``` var node_list = document.getElementsByClassName('Button'); for (var i = 0; i < node_list.len...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
you must iterate over the class elements ! ``` var elements=document.getElementsByClassName('Button'); Array.prototype.forEach.call(elements, function(element) { element.checked = false; }); ```
`getElementsByClassName` returns a node list (which is like an array) not an element. If you want to do something to every element in the node list, then you have to loop over it and do the thing on each item in the list. ``` var node_list = document.getElementsByClassName('Button'); for (var i = 0; i < node_list.len...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
`getElementsByClassName()` returns a collection (like an array). So you would actually have to do ``` document.getElementsByClassName('Button')[1].checked = false; ``` But you can't be sure that your `Button2` is the second element in the array if you have more elements with class `Button`.
`document.getElementsByClassName` returns an nodelist (kind of like an array of these elements)of elements of that class name. So you should cycle through it and change the checked status of each element. For a generic approach (you can have as many check boxes as you like), use this code. ``` var allButtons = docume...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
you must iterate over the class elements ! ``` var elements=document.getElementsByClassName('Button'); Array.prototype.forEach.call(elements, function(element) { element.checked = false; }); ```
`document.getElementsByClassName` returns an nodelist (kind of like an array of these elements)of elements of that class name. So you should cycle through it and change the checked status of each element. For a generic approach (you can have as many check boxes as you like), use this code. ``` var allButtons = docume...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
`getElementsByClassName()` returns a collection (like an array). So you would actually have to do ``` document.getElementsByClassName('Button')[1].checked = false; ``` But you can't be sure that your `Button2` is the second element in the array if you have more elements with class `Button`.
you must iterate over the class elements ! ``` var elements=document.getElementsByClassName('Button'); Array.prototype.forEach.call(elements, function(element) { element.checked = false; }); ```
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
`getElementsByClassName()` returns a collection (like an array). So you would actually have to do ``` document.getElementsByClassName('Button')[1].checked = false; ``` But you can't be sure that your `Button2` is the second element in the array if you have more elements with class `Button`.
You are calling `document.getElementsByClassName('Button').checked = false;` when it should be `document.getElementsByClassName('Button')[1].checked = false;` `getElementsByClassName()` returns an array ```js function unCheck(){ document.getElementsByClassName('Button')[1].checked = false; } ``` ```html <input ...
28,394,934
Here are my 2 radios buttons : ``` <input type="radio" name="sex" id="Button1" class="Button"/> <input type="radio" name="sex" id="Button2" class="Button"/> ``` When I call a function that countains : ``` document.getElementById('Button2').checked = false; ``` It unchecks the Button2. But I want to uncheck it...
2015/02/08
[ "https://Stackoverflow.com/questions/28394934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543175/" ]
you must iterate over the class elements ! ``` var elements=document.getElementsByClassName('Button'); Array.prototype.forEach.call(elements, function(element) { element.checked = false; }); ```
You are calling `document.getElementsByClassName('Button').checked = false;` when it should be `document.getElementsByClassName('Button')[1].checked = false;` `getElementsByClassName()` returns an array ```js function unCheck(){ document.getElementsByClassName('Button')[1].checked = false; } ``` ```html <input ...
51,790,756
I'm not entirely sure how to ask this question. I know there's an answer out there somewhere but I can't for the life of me figure out / remember the terminology for what I'm trying to achieve. I have profile cards written in HTML, all with the class name "card". Within each card are two numbers. I want to be able to ...
2018/08/10
[ "https://Stackoverflow.com/questions/51790756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9819286/" ]
I think you're probably looking for [`Element#querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector), which lets you find an element *within* another element. (There's also [`Element#querySelectorAll`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll) to find a ...
Perhaps something like this can get you started. Note the offsets are a bit arbitrary, and I'm sure you have your own styling: ```js for (const e of document.getElementsByClassName("card")) { const target = +(e.querySelector(".cardTarget").innerText); const current = +(e.querySelector(".cardCurrent").innerText);...
17,834,790
I have recently installed MariaDB on Fedora 19 in VirtualBox on Windows 7. When I run: ``` MariaDB [(none)]> SELECT user, host, password FROM mysql.user; ``` I get: ``` +------+----------------------+-------------------------------------------+ | user | host | password ...
2013/07/24
[ "https://Stackoverflow.com/questions/17834790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1063287/" ]
Very old question but.. > > `ERROR 1045 (28000): Access denied for user 'nusr'@'localhost' (using password: YES)` > > > I am guessing this is because it is referring to 'nusr'@'localhost' instead of 'nusr'@'my.hostname'. > > > YES. > > Why is 'localhost' the default host used when trying to connect to MariaDB...
You must create properly user on system Fedora 19: ``` [root@localhost ~]# useradd nusr [root@localhost ~]# passwd nusr Changing password for user fedora. New UNIX password:# set password Retype new UNIX password:# confirm passwd: all authentication tokens updated successfully. [root@localhost ~]# exit # logout ```...
17,834,790
I have recently installed MariaDB on Fedora 19 in VirtualBox on Windows 7. When I run: ``` MariaDB [(none)]> SELECT user, host, password FROM mysql.user; ``` I get: ``` +------+----------------------+-------------------------------------------+ | user | host | password ...
2013/07/24
[ "https://Stackoverflow.com/questions/17834790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1063287/" ]
The MariaDB server (also MySQL) treats `localhost` in a special way. Where other software treat it like an alias of the loopback address `127.0.0.1`, MariaDB will interpret it as a UNIX domain socket connection to the server. By default this socket file is located in `/var/lib/mysql/mysql.sock`. To connect via the net...
You must create properly user on system Fedora 19: ``` [root@localhost ~]# useradd nusr [root@localhost ~]# passwd nusr Changing password for user fedora. New UNIX password:# set password Retype new UNIX password:# confirm passwd: all authentication tokens updated successfully. [root@localhost ~]# exit # logout ```...
17,834,790
I have recently installed MariaDB on Fedora 19 in VirtualBox on Windows 7. When I run: ``` MariaDB [(none)]> SELECT user, host, password FROM mysql.user; ``` I get: ``` +------+----------------------+-------------------------------------------+ | user | host | password ...
2013/07/24
[ "https://Stackoverflow.com/questions/17834790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1063287/" ]
Very old question but.. > > `ERROR 1045 (28000): Access denied for user 'nusr'@'localhost' (using password: YES)` > > > I am guessing this is because it is referring to 'nusr'@'localhost' instead of 'nusr'@'my.hostname'. > > > YES. > > Why is 'localhost' the default host used when trying to connect to MariaDB...
The MariaDB server (also MySQL) treats `localhost` in a special way. Where other software treat it like an alias of the loopback address `127.0.0.1`, MariaDB will interpret it as a UNIX domain socket connection to the server. By default this socket file is located in `/var/lib/mysql/mysql.sock`. To connect via the net...