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
4,893,656
I have a function like this: ``` function run(arg) { if (!window.alreadyRun) init(); window.alreadyRun = true; /* more code */ } ``` You get the idea, I'm trying to figure out if it's the first time a function is called. Is there a better way to do this? Without using globals? Something like this: ``` ...
2011/02/04
[ "https://Stackoverflow.com/questions/4893656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465546/" ]
This will return a function, with a variable called `runCount` which will hold the number of times it was called. ``` var yourFunction = function() { var runCount = 0; return function() { console.log(runCount); runCount++; } } var a = yourFunction(); a(); // runCount: 0 a(); // runCou...
Here's just another way to do it. You can have the function modify itself. In the case below, `myfunction` gets changed to a new one. This *may* not be exactly what you're looking for but I think it's useful to at least post this so you can see alternative ways to do things (and also: self modifying code can just be co...
4,893,656
I have a function like this: ``` function run(arg) { if (!window.alreadyRun) init(); window.alreadyRun = true; /* more code */ } ``` You get the idea, I'm trying to figure out if it's the first time a function is called. Is there a better way to do this? Without using globals? Something like this: ``` ...
2011/02/04
[ "https://Stackoverflow.com/questions/4893656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465546/" ]
This will return a function, with a variable called `runCount` which will hold the number of times it was called. ``` var yourFunction = function() { var runCount = 0; return function() { console.log(runCount); runCount++; } } var a = yourFunction(); a(); // runCount: 0 a(); // runCou...
I think closures are completely overkill for this, and only complicates the code. What you're describing is known as a static variable in Object Oriented languages, and it can be mimicked quite easily in JS by attaching properties directly to the function. This is possible because functions are first-class objects in ...
4,893,656
I have a function like this: ``` function run(arg) { if (!window.alreadyRun) init(); window.alreadyRun = true; /* more code */ } ``` You get the idea, I'm trying to figure out if it's the first time a function is called. Is there a better way to do this? Without using globals? Something like this: ``` ...
2011/02/04
[ "https://Stackoverflow.com/questions/4893656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465546/" ]
The power of closures. ``` var f = (function(run) { return function() { if (!run) init(),run=true; // do code }; }(false)); ``` You can even use `if (!run) init() && run = true` and get `init` to return `false` if you want it to be called again on the next function call. We have a self exec...
Here's just another way to do it. You can have the function modify itself. In the case below, `myfunction` gets changed to a new one. This *may* not be exactly what you're looking for but I think it's useful to at least post this so you can see alternative ways to do things (and also: self modifying code can just be co...
4,893,656
I have a function like this: ``` function run(arg) { if (!window.alreadyRun) init(); window.alreadyRun = true; /* more code */ } ``` You get the idea, I'm trying to figure out if it's the first time a function is called. Is there a better way to do this? Without using globals? Something like this: ``` ...
2011/02/04
[ "https://Stackoverflow.com/questions/4893656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465546/" ]
The power of closures. ``` var f = (function(run) { return function() { if (!run) init(),run=true; // do code }; }(false)); ``` You can even use `if (!run) init() && run = true` and get `init` to return `false` if you want it to be called again on the next function call. We have a self exec...
I think closures are completely overkill for this, and only complicates the code. What you're describing is known as a static variable in Object Oriented languages, and it can be mimicked quite easily in JS by attaching properties directly to the function. This is possible because functions are first-class objects in ...
4,893,656
I have a function like this: ``` function run(arg) { if (!window.alreadyRun) init(); window.alreadyRun = true; /* more code */ } ``` You get the idea, I'm trying to figure out if it's the first time a function is called. Is there a better way to do this? Without using globals? Something like this: ``` ...
2011/02/04
[ "https://Stackoverflow.com/questions/4893656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465546/" ]
I think closures are completely overkill for this, and only complicates the code. What you're describing is known as a static variable in Object Oriented languages, and it can be mimicked quite easily in JS by attaching properties directly to the function. This is possible because functions are first-class objects in ...
Here's just another way to do it. You can have the function modify itself. In the case below, `myfunction` gets changed to a new one. This *may* not be exactly what you're looking for but I think it's useful to at least post this so you can see alternative ways to do things (and also: self modifying code can just be co...
32,142,570
I am using a function that is taking the "pointer to function" as variable but program fail with the following error: **error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. say '&EventCreatorBase::generateExceptionEvent'** class ...
2015/08/21
[ "https://Stackoverflow.com/questions/32142570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2144562/" ]
You cannot convert member-function pointer to function-pointer and by the way, your code is wrong. Should be like ``` event1.generateEvents(eventCounter, &EventCreatorBase::generateExceptionEvent); ``` But it's also doesn't work, since you cannot convert member-function pointer to function-pointer. The best way it t...
You have 2 problems here: a. Wrong syntax for function pointer argument - you are saying it is a regular function pointer, but you want it to be a class member pointer. You need to use class name (and that means, you'd need the class forward-declared) b. Compiler is saying exactly what needs to be fixed for the second...
70,306,705
Am trying to create a text input with multiline in a react native app, so that the user can add some notes. the issue am having is on inserting a bullet on the new line when a return key is pressed inside of that input box. Is there any technique to achieve this?
2021/12/10
[ "https://Stackoverflow.com/questions/70306705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16361805/" ]
I don't think its a bad idea at all, you can create an interface for mark all the requests you want to implement the PipelineX, and other for PipelineY. Ex: You have the RequestOne and RequestTwo classes that need to go through PipelineX, so you create and interface like IPipelineOne and mark the classes with it, t...
Not exactly response to your question, bit if you find yourself confused with the behavior registrations as their number grows, you can consider specifying them using the library I created for that purpose <https://github.com/ITIXO/MediatR.Extensions.AttributedBehaviors>
70,306,705
Am trying to create a text input with multiline in a react native app, so that the user can add some notes. the issue am having is on inserting a bullet on the new line when a return key is pressed inside of that input box. Is there any technique to achieve this?
2021/12/10
[ "https://Stackoverflow.com/questions/70306705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16361805/" ]
I don't think its a bad idea at all, you can create an interface for mark all the requests you want to implement the PipelineX, and other for PipelineY. Ex: You have the RequestOne and RequestTwo classes that need to go through PipelineX, so you create and interface like IPipelineOne and mark the classes with it, t...
You can construct multiple pipelines with different behaviors. Register pipeline behaviors: ```cs // pipeline 1's behaviors services.AddScoped(typeof(IPipelineBehavior<,>), typeof(FooBehavior<,>)); services.AddScoped(typeof(IPipelineBehavior<,>), typeof(BarBehavior<,>)); services.AddScoped(typeof(IPipelineBehavior<,>...
52,291,027
I have one gridview in which i'm binding a List of Website names like ``` www.google.com www.facebook.com www.gmail.com www.google.com www.facebook.com www.gmail.com ``` Now, I want to redirect to `www.google.com` when i click on this I used this one but its not working ``` <asp:HyperLink ID="HyperLink1" runat="...
2018/09/12
[ "https://Stackoverflow.com/questions/52291027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9744703/" ]
Just add the tags when you call the module, notice in the example of <https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/1.41.0> it shows tags there and in the docs it says "A map of tags to add to all resources" so you can add it to that map.
If you controlled the module, you could try to use `ignore_changes` clause in the `lifecycle` block. Something like ``` lifecycle { ignore_changes = [ "tags" ] } ``` It's going to be much trickier with a module that you don't control though.
52,291,027
I have one gridview in which i'm binding a List of Website names like ``` www.google.com www.facebook.com www.gmail.com www.google.com www.facebook.com www.gmail.com ``` Now, I want to redirect to `www.google.com` when i click on this I used this one but its not working ``` <asp:HyperLink ID="HyperLink1" runat="...
2018/09/12
[ "https://Stackoverflow.com/questions/52291027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9744703/" ]
Just add the tags when you call the module, notice in the example of <https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/1.41.0> it shows tags there and in the docs it says "A map of tags to add to all resources" so you can add it to that map.
So in the end we chose not to use terraform to deploy the cluster at all, instead we use `eksctl` the community based tool from Weaveworks. <https://eksctl.io/> It was recommended by an AWS solutions architect when we were at the AWS offices in London for some training. The config can be stored in source control if...
753,862
Find the centroid of the region lying between the graphs of the functions $y=\sin x$ and $y=\cos x$ over the interval $[0,\frac\pi4]$. I approached the question like this: 1. Find the $M$ $$M = \int\_0^{\tfrac\pi4}(\sin x-\cos x)\,dx = 1-\sqrt2$$ 2. Find the $M$ of $y$ $$M\_y = \int\_0^{\tfrac\pi4}x(\sin x-\cos x)\,d...
2014/04/14
[ "https://math.stackexchange.com/questions/753862", "https://math.stackexchange.com", "https://math.stackexchange.com/users/129955/" ]
See the picture below. ![enter image description here](https://i.stack.imgur.com/XwuAM.png) As you can see, $\cos x$ is above $\sin x$ or $\cos x>\sin x$ for $\left[0,\dfrac\pi4\right]$. Therefore $$ \begin{align} M&=\int\_0^\frac\pi4(\cos x-\sin x)\ dx=\sqrt{2}-1,\\\\ M\_y&=\int\_0^\frac\pi4x(\cos x-\sin x)\ dx=\fra...
As a reference. The centroid $(x\_c,y\_c)$ of a region bounded by $f(x)$ and $g(x)$ and with $x\in [a,b]$ is defined as $$ x\_c = \frac{1}{A} \int\_a^b x[f(x)-g(x)]dx $$ and $$ y\_c = \frac{1}{A} \int\_a^b x[f(x)-g(x)][f(x)+g(x)]/2dx $$ where $A$ is the area of the region... Reference: <http://en.wikipedia.org/wiki/Cen...
17,818,536
I hope receive my answer this time i wrote below code but don't know where is my mistake it seem correct i think this code should insert more than million records into oracle xe i wrote it by single insert statement when execute PreparedStatement one by one but it's run took 6 hours !!!!!! because i was forced us...
2013/07/23
[ "https://Stackoverflow.com/questions/17818536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743987/" ]
``` (sensor.getType() == Sensor.TYPE_ACCELEROMETER) ? 1 : 0; ``` means ``` int result; if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) result = 1; else result = 0; ```
If you are talking about the parenthesis, question mark, and colon, then... it goes like so ``` (Condition ? If_condition_is_true_do_this : otherwise_do_this); ``` Exactly like doing this: ``` if(Condition) If_condition_is_true_do_this else otherwise_do_this ``` And it is the same syntax in C#;
17,818,536
I hope receive my answer this time i wrote below code but don't know where is my mistake it seem correct i think this code should insert more than million records into oracle xe i wrote it by single insert statement when execute PreparedStatement one by one but it's run took 6 hours !!!!!! because i was forced us...
2013/07/23
[ "https://Stackoverflow.com/questions/17818536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743987/" ]
``` (sensor.getType() == Sensor.TYPE_ACCELEROMETER) ? 1 : 0; ``` means ``` int result; if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) result = 1; else result = 0; ```
This is Java, not C# but ternary operators exist there as well. About ternary operators, click [here](http://en.wikipedia.org/wiki/?%3a). What the (full) code (not your snippet) does here is to check the `sensor` variable for equality with class constant `Sensor.TYPE_ACCELEROMETER` and assign the missing variable o...
17,818,536
I hope receive my answer this time i wrote below code but don't know where is my mistake it seem correct i think this code should insert more than million records into oracle xe i wrote it by single insert statement when execute PreparedStatement one by one but it's run took 6 hours !!!!!! because i was forced us...
2013/07/23
[ "https://Stackoverflow.com/questions/17818536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743987/" ]
``` (sensor.getType() == Sensor.TYPE_ACCELEROMETER) ? 1 : 0; ``` means ``` int result; if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) result = 1; else result = 0; ```
I am not 100% sure as what you want to be explained, but it seems that you are not understand/knowing about the `ternary operator` in Java. It essentially means: ``` if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) { temp = 1; } else { temp = 0; } ``` Furthermore, I am unsure if this is correct Java code....
17,818,536
I hope receive my answer this time i wrote below code but don't know where is my mistake it seem correct i think this code should insert more than million records into oracle xe i wrote it by single insert statement when execute PreparedStatement one by one but it's run took 6 hours !!!!!! because i was forced us...
2013/07/23
[ "https://Stackoverflow.com/questions/17818536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743987/" ]
I am not 100% sure as what you want to be explained, but it seems that you are not understand/knowing about the `ternary operator` in Java. It essentially means: ``` if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) { temp = 1; } else { temp = 0; } ``` Furthermore, I am unsure if this is correct Java code....
If you are talking about the parenthesis, question mark, and colon, then... it goes like so ``` (Condition ? If_condition_is_true_do_this : otherwise_do_this); ``` Exactly like doing this: ``` if(Condition) If_condition_is_true_do_this else otherwise_do_this ``` And it is the same syntax in C#;
17,818,536
I hope receive my answer this time i wrote below code but don't know where is my mistake it seem correct i think this code should insert more than million records into oracle xe i wrote it by single insert statement when execute PreparedStatement one by one but it's run took 6 hours !!!!!! because i was forced us...
2013/07/23
[ "https://Stackoverflow.com/questions/17818536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743987/" ]
I am not 100% sure as what you want to be explained, but it seems that you are not understand/knowing about the `ternary operator` in Java. It essentially means: ``` if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) { temp = 1; } else { temp = 0; } ``` Furthermore, I am unsure if this is correct Java code....
This is Java, not C# but ternary operators exist there as well. About ternary operators, click [here](http://en.wikipedia.org/wiki/?%3a). What the (full) code (not your snippet) does here is to check the `sensor` variable for equality with class constant `Sensor.TYPE_ACCELEROMETER` and assign the missing variable o...
41,713,982
I am fairly new to Java and am having trouble understanding the differences between different collections. I have a list of 19 resources. Each resource is assigned a hex color. I want to get a random resource with its color and use that resource with my code. Once I am finished with the current resource, I want to remo...
2017/01/18
[ "https://Stackoverflow.com/questions/41713982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560768/" ]
What you could do, is store your resources into a `List`, then randomly permutes it thanks to [`Collections.shuffle(List<?> list)`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-) or [`shuffle(List<?> list, Random rnd)`](https://docs.oracle.com/javase/8/docs/api/java/util/C...
If you want to lookup (get) resource based on its hex use following ``` // Initialize Map<String, Resource> resourceMap = new HashMap<>(); resourceMap.put("hex1", hex1Resource); resourceMap.put("hex2", hex3Resource); resourceMap.put("hex3", hex3Resource); // Get specific Resource hex2Resource = resourceMap.get("hex2"...
41,713,982
I am fairly new to Java and am having trouble understanding the differences between different collections. I have a list of 19 resources. Each resource is assigned a hex color. I want to get a random resource with its color and use that resource with my code. Once I am finished with the current resource, I want to remo...
2017/01/18
[ "https://Stackoverflow.com/questions/41713982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560768/" ]
What you could do, is store your resources into a `List`, then randomly permutes it thanks to [`Collections.shuffle(List<?> list)`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-) or [`shuffle(List<?> list, Random rnd)`](https://docs.oracle.com/javase/8/docs/api/java/util/C...
The following should work. The steps are: 1. Create a list of Resource 2. Generate a random number and get the item 3. Do what you want to do with your random item 4. Remove it from list Example Code: ------------- ``` //1 List<Resource> resources= getList(); //2 Random generator = new Random(); Resource randomRes...
41,713,982
I am fairly new to Java and am having trouble understanding the differences between different collections. I have a list of 19 resources. Each resource is assigned a hex color. I want to get a random resource with its color and use that resource with my code. Once I am finished with the current resource, I want to remo...
2017/01/18
[ "https://Stackoverflow.com/questions/41713982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560768/" ]
What you could do, is store your resources into a `List`, then randomly permutes it thanks to [`Collections.shuffle(List<?> list)`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-) or [`shuffle(List<?> list, Random rnd)`](https://docs.oracle.com/javase/8/docs/api/java/util/C...
> > Blockquote > > > if u need random order better you can go for List object. ``` List<String> resourceMap = new CopyOnWriteArrayList<>(); resourceMap.add("hex1"); resourceMap.add("hex2"); resourceMap.add("hex3"); resourceMap.add("hex4"); Collections.shuffle(reso...
41,713,982
I am fairly new to Java and am having trouble understanding the differences between different collections. I have a list of 19 resources. Each resource is assigned a hex color. I want to get a random resource with its color and use that resource with my code. Once I am finished with the current resource, I want to remo...
2017/01/18
[ "https://Stackoverflow.com/questions/41713982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560768/" ]
If you want to lookup (get) resource based on its hex use following ``` // Initialize Map<String, Resource> resourceMap = new HashMap<>(); resourceMap.put("hex1", hex1Resource); resourceMap.put("hex2", hex3Resource); resourceMap.put("hex3", hex3Resource); // Get specific Resource hex2Resource = resourceMap.get("hex2"...
The following should work. The steps are: 1. Create a list of Resource 2. Generate a random number and get the item 3. Do what you want to do with your random item 4. Remove it from list Example Code: ------------- ``` //1 List<Resource> resources= getList(); //2 Random generator = new Random(); Resource randomRes...
41,713,982
I am fairly new to Java and am having trouble understanding the differences between different collections. I have a list of 19 resources. Each resource is assigned a hex color. I want to get a random resource with its color and use that resource with my code. Once I am finished with the current resource, I want to remo...
2017/01/18
[ "https://Stackoverflow.com/questions/41713982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560768/" ]
If you want to lookup (get) resource based on its hex use following ``` // Initialize Map<String, Resource> resourceMap = new HashMap<>(); resourceMap.put("hex1", hex1Resource); resourceMap.put("hex2", hex3Resource); resourceMap.put("hex3", hex3Resource); // Get specific Resource hex2Resource = resourceMap.get("hex2"...
> > Blockquote > > > if u need random order better you can go for List object. ``` List<String> resourceMap = new CopyOnWriteArrayList<>(); resourceMap.add("hex1"); resourceMap.add("hex2"); resourceMap.add("hex3"); resourceMap.add("hex4"); Collections.shuffle(reso...
247,836
I would like to know how to show a list of sharepoint in a page of asp.net c # by means of a datagridview and be able to modify it by adding a record to the list by means of a button. Beforehand thank you very much!! --- I thank you for your prompt reply Mohamed El-Qassas but I already did this, what I want now is t...
2018/08/27
[ "https://sharepoint.stackexchange.com/questions/247836", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/78158/" ]
First, the docs [specifically state](https://docs.microsoft.com/en-us/officeonlineserver/plan-office-online-server) that OOS is not to be installed on SQL server: "Don't install any other server applications on the server that's running Office Online Server. This includes Exchange Server, SharePoint Server, Skype for ...
Release the existing WOPI binding in SharePoint Management Shell and renew it with this script: ``` Remove-SPWOPIBinding -All:$true New-SPWOPIBinding -ServerName *YourOfficeOnlineServerNameHere* ```
247,836
I would like to know how to show a list of sharepoint in a page of asp.net c # by means of a datagridview and be able to modify it by adding a record to the list by means of a button. Beforehand thank you very much!! --- I thank you for your prompt reply Mohamed El-Qassas but I already did this, what I want now is t...
2018/08/27
[ "https://sharepoint.stackexchange.com/questions/247836", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/78158/" ]
First, the docs [specifically state](https://docs.microsoft.com/en-us/officeonlineserver/plan-office-online-server) that OOS is not to be installed on SQL server: "Don't install any other server applications on the server that's running Office Online Server. This includes Exchange Server, SharePoint Server, Skype for ...
Make sure all SharePoint Server 2016 web applications use claims-based authentication. Office Online rendering and editing won’t work on SharePoint Server 2016 web applications that use classic mode authentication. If you log on to SharePoint Server 2016 by using the System Account, you won’t be able to test the conn...
247,836
I would like to know how to show a list of sharepoint in a page of asp.net c # by means of a datagridview and be able to modify it by adding a record to the list by means of a button. Beforehand thank you very much!! --- I thank you for your prompt reply Mohamed El-Qassas but I already did this, what I want now is t...
2018/08/27
[ "https://sharepoint.stackexchange.com/questions/247836", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/78158/" ]
First, the docs [specifically state](https://docs.microsoft.com/en-us/officeonlineserver/plan-office-online-server) that OOS is not to be installed on SQL server: "Don't install any other server applications on the server that's running Office Online Server. This includes Exchange Server, SharePoint Server, Skype for ...
1. First try to check if the File is opening in the Office online server. 2. After integration with SharePoint, check if the SharePoint site is accessible from the office online server. (I had a similar problem that the site was not accessible on office online server as we were building a new farm and there were no DNS...
11,400,964
I'm running a timer like this: ``` private void InitializeTimer() { Timer myTimer = new Timer(); myTimer.Interval = 3000; myTimer.Enabled = true; myTimer.Tick += new EventHandler(TimerEventProcessor); myTimer.Start(); } ``` It will trigger an event every 3rd second...
2012/07/09
[ "https://Stackoverflow.com/questions/11400964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1273413/" ]
A Timer is fairly lightweight, though it does depend a bit on which type of timer you're using. Having a timer fire every 3 seconds is not likely to be a big deal, though if you're using a Windows Forms timer, make sure your Tick event handler is not doing any significant processing, as it happens in the UI thread. (Fo...
I think it would be as heavy as you make the `TimerEventProcessor` handler. While the `FileSystemWatcher` seem like it could be the answer, it is not always the case. My suggestion is that before processing this handler, you stop the timer and start it back up when you are done processing your code.
43,549,104
I am doing Salesforce trailhead from the link : <https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_webservices>. In this tutorial they've use `access_token` to call the `GET` request. **But they have not guided us how to get the** `access_token`, which is an important steps to ...
2017/04/21
[ "https://Stackoverflow.com/questions/43549104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I understood the concept now and thanks for sharing other links. `client_id, client_secret, username, password and grant_type` should be sent in a `HTTP POST` body not in header. ``` HttpRequest req = new HttpRequest(); req.setMethod('POST'); req.setHeader('Content-Type','application/x-www-form-urlencoded'); req.setE...
You might need to call api to get the access token. Here's my code in C# to get the access token async public static Task GetAccessTokenByUserNamePasswordAuthenticationFlowAsync(string username, string password, string token, string consumerKey, string consumerSecret) { ``` HttpClient authClient = new HttpC...
31,499
I am new to tensorflow and am learning the basics at the moment so please bear with me. My problem concerns strange non-convergent behaviour of neural networks when presented with the supposedly simple task of finding a regression function for a small training set consisting only of $m = 100$ data points $\{(x\_1, y\...
2018/05/10
[ "https://datascience.stackexchange.com/questions/31499", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/51931/" ]
Gradient descent (on which neural networks rely for learning) is sensitive to feature scaling; you should probably normalize the x-values to start with. In your particular shift-by-500 case, I'd guess that the optimal weights lie in a small range of near-zero numbers, and so the gradient descent has a hard time findin...
the input is simply not enough to correctly predict the output, the model can not learn the output conditional distribution P(y|x). Either you have to add more features to the Naive NN model, e.g concat the previous x to the current x to predict the current y or use RNN like models to model the problem as p(y\_t|...
1,003,846
I am trying to get excel 2013 to display the minimum for a structured table but only from rows that are dated today or after. The table is a standard structured table, and most of the formulas I have been using use the [@[column] designation for targeting. in the column called `date` I have hand typed dates, excel wi...
2015/11/22
[ "https://superuser.com/questions/1003846", "https://superuser.com", "https://superuser.com/users/156987/" ]
Here is a non-structured example that you can adapt to your needs. Say we have dates in column **A** from **A2** to **A24** and values in column **B** and we want the minimum value in column **B** for dates greater or equal to today's date. Use the *Array Formula*: ``` =MIN(IF(A2:A24>=TODAY(),B2:B24)) ``` For examp...
You can use the same formula as Gary's Student supplied using structured references: ``` =MIN(IF(Table1[Date]>=TODAY(),Table1[Value])) ``` Again, this is an array formula, and must be confirmed by holding down `ctrl+shift` while hitting `enter`
16,449,620
I have a small script ( using nouislider ) I wish to prepend the rangeThing values with $ sign as we are outputting prices. Code I have is: ``` $("#slider").noUiSlider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangeThing").text...
2013/05/08
[ "https://Stackoverflow.com/questions/16449620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501173/" ]
Do it in one line to see what's going on: * You are starting with a `+` * The third line has double `+` One line would be easier to read: ``` $("span.rangeThing").text("$" + values[0] + " - $" + values[1]); ```
The problem is that the unary plus in Javascript implcitly converts the operand to a number. This means that ``` + "$" ``` actually evaluates to `NaN`. Just place the `+` operator only between terms and things should go as you expect.
16,449,620
I have a small script ( using nouislider ) I wish to prepend the rangeThing values with $ sign as we are outputting prices. Code I have is: ``` $("#slider").noUiSlider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangeThing").text...
2013/05/08
[ "https://Stackoverflow.com/questions/16449620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501173/" ]
Do it in one line to see what's going on: * You are starting with a `+` * The third line has double `+` One line would be easier to read: ``` $("span.rangeThing").text("$" + values[0] + " - $" + values[1]); ```
In addition, here's how you can add the commas if you want... ``` function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } ``` To use it, j...
16,449,620
I have a small script ( using nouislider ) I wish to prepend the rangeThing values with $ sign as we are outputting prices. Code I have is: ``` $("#slider").noUiSlider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangeThing").text...
2013/05/08
[ "https://Stackoverflow.com/questions/16449620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501173/" ]
Do it in one line to see what's going on: * You are starting with a `+` * The third line has double `+` One line would be easier to read: ``` $("span.rangeThing").text("$" + values[0] + " - $" + values[1]); ```
Well, in your example there appears to be an extra `+` operator in the example you gave. As you see in the example you gave: ``` $("span.rangeThing").text( values[0] + " - " + values[1] ); ``` This will result in the string `"1 - 2"`, assuming values = [1, 2]. You should be able to simple add on t...
16,449,620
I have a small script ( using nouislider ) I wish to prepend the rangeThing values with $ sign as we are outputting prices. Code I have is: ``` $("#slider").noUiSlider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangeThing").text...
2013/05/08
[ "https://Stackoverflow.com/questions/16449620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501173/" ]
The problem is that the unary plus in Javascript implcitly converts the operand to a number. This means that ``` + "$" ``` actually evaluates to `NaN`. Just place the `+` operator only between terms and things should go as you expect.
In addition, here's how you can add the commas if you want... ``` function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } ``` To use it, j...
16,449,620
I have a small script ( using nouislider ) I wish to prepend the rangeThing values with $ sign as we are outputting prices. Code I have is: ``` $("#slider").noUiSlider({ range: [0, 1000000] ,start: [350000, 700000] ,handles: 2 ,step: 50000 ,slide: function(){ var values = $(this).val(); $("span.rangeThing").text...
2013/05/08
[ "https://Stackoverflow.com/questions/16449620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501173/" ]
The problem is that the unary plus in Javascript implcitly converts the operand to a number. This means that ``` + "$" ``` actually evaluates to `NaN`. Just place the `+` operator only between terms and things should go as you expect.
Well, in your example there appears to be an extra `+` operator in the example you gave. As you see in the example you gave: ``` $("span.rangeThing").text( values[0] + " - " + values[1] ); ``` This will result in the string `"1 - 2"`, assuming values = [1, 2]. You should be able to simple add on t...
3,228
I just got a question ([Hotel keycard switches on 5,000W load when placed in its holder. How does it do that?](https://electronics.stackexchange.com/q/92685/29792)) voted down. I know the question isn't a blockbuster, but the comments I got have already been helpful to me. So, I'm a bit confused. **What would be the ...
2013/12/04
[ "https://electronics.meta.stackexchange.com/questions/3228", "https://electronics.meta.stackexchange.com", "https://electronics.meta.stackexchange.com/users/29792/" ]
Proposed new close reason: > > Questions on the **repair** of consumer electronics, appliances, or other devices must involve specific troubleshooting steps and demonstrate a good understanding of the underlying design of the device being repaired. See also: [Is asking on how to fix a faulty circuit on topic?](https:...
Proposed new close reason (shorter version): > > "Questions on electronics repair must involve specific troubleshooting steps and demonstrate a good understanding of the underlying design of the device being repaired." > > >
30,866,367
I have one Jframe which includes two TextFields and I want to exchange two integer numbers after clicking on exchange button.
2015/06/16
[ "https://Stackoverflow.com/questions/30866367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015153/" ]
You can use this little function: ``` similar <- function(vec, val, bound = 3, index = F) { close.index <- which(abs(vec - val) <= bound) if (index) return(close.index) return(vec[close.index]) } x <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) similar(x, 5) # [1] 4 5 5 8...
Perhaps not the most elegant version, but does this do what you wanted to have? ``` x <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) vals <- unique(x) # print indices for (i in 1:length(vals)) print(which((x >= vals[i] - 3) & (x <= vals[i] + 3))) # print values for (i in 1:length(vals...
30,866,367
I have one Jframe which includes two TextFields and I want to exchange two integer numbers after clicking on exchange button.
2015/06/16
[ "https://Stackoverflow.com/questions/30866367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015153/" ]
You can use this little function: ``` similar <- function(vec, val, bound = 3, index = F) { close.index <- which(abs(vec - val) <= bound) if (index) return(close.index) return(vec[close.index]) } x <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) similar(x, 5) # [1] 4 5 5 8...
It might be helpful to create lists with the numbers as "keys": ``` data <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) uniques <- unique(data) myGroups <- lapply( uniques, function(n) Filter( function(x) abs(x - n) <= 3, data ) ) names(myGroups) <- uniques myIndices <...
30,866,367
I have one Jframe which includes two TextFields and I want to exchange two integer numbers after clicking on exchange button.
2015/06/16
[ "https://Stackoverflow.com/questions/30866367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015153/" ]
You can use this little function: ``` similar <- function(vec, val, bound = 3, index = F) { close.index <- which(abs(vec - val) <= bound) if (index) return(close.index) return(vec[close.index]) } x <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) similar(x, 5) # [1] 4 5 5 8...
Here is a short solution giving you all the group as a list: ``` x = c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) m = unique(x) setNames(apply(abs(outer(m,m,'-')), 2, function(u) m[u<=3]),m) #$`4` #[1] 4 5 #$`5` #[1] 4 5 8 #$`8` #[1] 5 8 #$`12` #[1] 12 13 15 #$`13` #[1] 12 13 15 ...
30,866,367
I have one Jframe which includes two TextFields and I want to exchange two integer numbers after clicking on exchange button.
2015/06/16
[ "https://Stackoverflow.com/questions/30866367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015153/" ]
Perhaps not the most elegant version, but does this do what you wanted to have? ``` x <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) vals <- unique(x) # print indices for (i in 1:length(vals)) print(which((x >= vals[i] - 3) & (x <= vals[i] + 3))) # print values for (i in 1:length(vals...
It might be helpful to create lists with the numbers as "keys": ``` data <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) uniques <- unique(data) myGroups <- lapply( uniques, function(n) Filter( function(x) abs(x - n) <= 3, data ) ) names(myGroups) <- uniques myIndices <...
30,866,367
I have one Jframe which includes two TextFields and I want to exchange two integer numbers after clicking on exchange button.
2015/06/16
[ "https://Stackoverflow.com/questions/30866367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015153/" ]
Here is a short solution giving you all the group as a list: ``` x = c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) m = unique(x) setNames(apply(abs(outer(m,m,'-')), 2, function(u) m[u<=3]),m) #$`4` #[1] 4 5 #$`5` #[1] 4 5 8 #$`8` #[1] 5 8 #$`12` #[1] 12 13 15 #$`13` #[1] 12 13 15 ...
It might be helpful to create lists with the numbers as "keys": ``` data <- c(4, 5, 5, 8, 12, 12, 12, 13, 15, 15, 18, 19, 20, 23, 37, 37, 37, 37, 37, 41) uniques <- unique(data) myGroups <- lapply( uniques, function(n) Filter( function(x) abs(x - n) <= 3, data ) ) names(myGroups) <- uniques myIndices <...
11,352,159
JSfiddle : [CODE](http://jsfiddle.net/abude/TKtKq/1/) I was trying to send the info with POST; then I added this code to disable the button after submitting one time: ``` $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); return true; }); ``` but **NOW**...
2012/07/05
[ "https://Stackoverflow.com/questions/11352159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436998/" ]
You are getting the event passed into that handler function. If you are submitting your form using an [`.ajax()`](http://jqapi.com/#p=jQuery.ajax) POST request (consider using [`.post()`](http://jqapi.com/#p=jQuery.post)), you would need to prevent the default behaviour (i.e. submitting the form). ``` $("form").on("su...
this resolved my problem : <https://stackoverflow.com/a/2830812/1436998> ``` $(document).ready(function(){ $("form").submit(function(){ setTimeout(function() { $('input').attr('disabled', 'disabled'); $('a').attr('disabled', 'disabled'); }, 50); }) }); ```
11,352,159
JSfiddle : [CODE](http://jsfiddle.net/abude/TKtKq/1/) I was trying to send the info with POST; then I added this code to disable the button after submitting one time: ``` $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); return true; }); ``` but **NOW**...
2012/07/05
[ "https://Stackoverflow.com/questions/11352159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436998/" ]
You are getting the event passed into that handler function. If you are submitting your form using an [`.ajax()`](http://jqapi.com/#p=jQuery.ajax) POST request (consider using [`.post()`](http://jqapi.com/#p=jQuery.post)), you would need to prevent the default behaviour (i.e. submitting the form). ``` $("form").on("su...
I have had issues with people who cannot resist double or triple or multiple clicking. This can can cause all sorts of problems for you. This is how I solved mutiple submit using Jquery. Feel free to copy it if it can help you. Copy and paste to test. Click like mad if you want. This form submits only once! ``` <%@LAN...
11,352,159
JSfiddle : [CODE](http://jsfiddle.net/abude/TKtKq/1/) I was trying to send the info with POST; then I added this code to disable the button after submitting one time: ``` $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); return true; }); ``` but **NOW**...
2012/07/05
[ "https://Stackoverflow.com/questions/11352159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436998/" ]
You are getting the event passed into that handler function. If you are submitting your form using an [`.ajax()`](http://jqapi.com/#p=jQuery.ajax) POST request (consider using [`.post()`](http://jqapi.com/#p=jQuery.post)), you would need to prevent the default behaviour (i.e. submitting the form). ``` $("form").on("su...
You can also use > > $("form").beforeSubmit(function(){ // function body here.... }); > > >
11,352,159
JSfiddle : [CODE](http://jsfiddle.net/abude/TKtKq/1/) I was trying to send the info with POST; then I added this code to disable the button after submitting one time: ``` $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); return true; }); ``` but **NOW**...
2012/07/05
[ "https://Stackoverflow.com/questions/11352159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436998/" ]
this resolved my problem : <https://stackoverflow.com/a/2830812/1436998> ``` $(document).ready(function(){ $("form").submit(function(){ setTimeout(function() { $('input').attr('disabled', 'disabled'); $('a').attr('disabled', 'disabled'); }, 50); }) }); ```
I have had issues with people who cannot resist double or triple or multiple clicking. This can can cause all sorts of problems for you. This is how I solved mutiple submit using Jquery. Feel free to copy it if it can help you. Copy and paste to test. Click like mad if you want. This form submits only once! ``` <%@LAN...
11,352,159
JSfiddle : [CODE](http://jsfiddle.net/abude/TKtKq/1/) I was trying to send the info with POST; then I added this code to disable the button after submitting one time: ``` $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); return true; }); ``` but **NOW**...
2012/07/05
[ "https://Stackoverflow.com/questions/11352159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436998/" ]
this resolved my problem : <https://stackoverflow.com/a/2830812/1436998> ``` $(document).ready(function(){ $("form").submit(function(){ setTimeout(function() { $('input').attr('disabled', 'disabled'); $('a').attr('disabled', 'disabled'); }, 50); }) }); ```
You can also use > > $("form").beforeSubmit(function(){ // function body here.... }); > > >
34,548,304
I'm using jquery .load() to show a php file that basically fetch data from a table. Inside the while loop, I have a variable which checks my user's ranks, however, on every .load() this variable seem to become unavailable and everything in the if statement containing that variable, disappears. Now I am aware of this: ...
2015/12/31
[ "https://Stackoverflow.com/questions/34548304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5255543/" ]
``` class TreinamentosFragment extends Fragment{ public onItemClick(Item item){ List fragments = getParentFragment().getChildFragmentManager().getFragments(); for(Fragment fragment : fragments ){ if(fragment instanceof TreinamentosFragment &&TreinamentosFragment.TIPO_CONCLUIDO .equalIgnore...
You need to use the Singleton data classes. <https://en.wikipedia.org/wiki/Singleton_pattern> You have 2 adapters then you need two Singleton Data classes.. When you delete item from Fragment-A then add that deleted item in Frag-B`s Singleton Data instance. As Fragment-B resume/visible the just reload data from Frag-...
50,568,389
I'm writing VBA codes to read spreadsheet contents and write to a TXT file. Some of the cells has multi-line text. They are displayed as multi-line in the spreadsheet. However, when the VBA code read the cell and write to the TXT file, they appear on the same line. This also happens when I copy the cell and past it i...
2018/05/28
[ "https://Stackoverflow.com/questions/50568389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9749834/" ]
This finds factorial of number inputted from command line: ``` # Get N from the command line import sys N = int(sys.argv[1]) for i in range(1, N): N *= i print(N) # if input is 4, it outputs 24. ```
You inquire `N` from sys.argv and then overwrite it within your loop. That's one problem. Next: range(a,b) will create integers from a to b-1 (assuming stepsize is 1). So `range(1,4)` will create `[1,2,3]`. Your code does the following: It changes N to 1\*4, then to 2\*4, then to 3\*4 (which is 12, not 16). If you w...
50,568,389
I'm writing VBA codes to read spreadsheet contents and write to a TXT file. Some of the cells has multi-line text. They are displayed as multi-line in the spreadsheet. However, when the VBA code read the cell and write to the TXT file, they appear on the same line. This also happens when I copy the cell and past it i...
2018/05/28
[ "https://Stackoverflow.com/questions/50568389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9749834/" ]
A few things are wrong with your program. 1. It overwrites the input by using `N` as your loop variable. 2. The loop's `range` does not depend on the input. 3. The multiplied value is always `4` instead of being incremented from `1` to `N` in your loop. Here is the correct way to implement the factorial: ``` # Get N...
This finds factorial of number inputted from command line: ``` # Get N from the command line import sys N = int(sys.argv[1]) for i in range(1, N): N *= i print(N) # if input is 4, it outputs 24. ```
50,568,389
I'm writing VBA codes to read spreadsheet contents and write to a TXT file. Some of the cells has multi-line text. They are displayed as multi-line in the spreadsheet. However, when the VBA code read the cell and write to the TXT file, they appear on the same line. This also happens when I copy the cell and past it i...
2018/05/28
[ "https://Stackoverflow.com/questions/50568389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9749834/" ]
A few things are wrong with your program. 1. It overwrites the input by using `N` as your loop variable. 2. The loop's `range` does not depend on the input. 3. The multiplied value is always `4` instead of being incremented from `1` to `N` in your loop. Here is the correct way to implement the factorial: ``` # Get N...
You inquire `N` from sys.argv and then overwrite it within your loop. That's one problem. Next: range(a,b) will create integers from a to b-1 (assuming stepsize is 1). So `range(1,4)` will create `[1,2,3]`. Your code does the following: It changes N to 1\*4, then to 2\*4, then to 3\*4 (which is 12, not 16). If you w...
50,568,389
I'm writing VBA codes to read spreadsheet contents and write to a TXT file. Some of the cells has multi-line text. They are displayed as multi-line in the spreadsheet. However, when the VBA code read the cell and write to the TXT file, they appear on the same line. This also happens when I copy the cell and past it i...
2018/05/28
[ "https://Stackoverflow.com/questions/50568389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9749834/" ]
I recommend use math lib: <https://docs.python.org/3/library/math.html> (cf math.factorial(x)) ``` # Get N from the command line from math import factorial import sys N = factorial(int(sys.argv[1])) ```
You inquire `N` from sys.argv and then overwrite it within your loop. That's one problem. Next: range(a,b) will create integers from a to b-1 (assuming stepsize is 1). So `range(1,4)` will create `[1,2,3]`. Your code does the following: It changes N to 1\*4, then to 2\*4, then to 3\*4 (which is 12, not 16). If you w...
50,568,389
I'm writing VBA codes to read spreadsheet contents and write to a TXT file. Some of the cells has multi-line text. They are displayed as multi-line in the spreadsheet. However, when the VBA code read the cell and write to the TXT file, they appear on the same line. This also happens when I copy the cell and past it i...
2018/05/28
[ "https://Stackoverflow.com/questions/50568389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9749834/" ]
A few things are wrong with your program. 1. It overwrites the input by using `N` as your loop variable. 2. The loop's `range` does not depend on the input. 3. The multiplied value is always `4` instead of being incremented from `1` to `N` in your loop. Here is the correct way to implement the factorial: ``` # Get N...
I recommend use math lib: <https://docs.python.org/3/library/math.html> (cf math.factorial(x)) ``` # Get N from the command line from math import factorial import sys N = factorial(int(sys.argv[1])) ```
17,625,306
I try to crosscompile some c++11 source with mingw on linux for windows. The code uses std::thread. When i compile i always get some errors: ``` $ ../mingw/cross/bin/i686-w64-mingw32-g++ -std=c++11 -I include/ test.cpp -lstdthread -otest In file included from test.cpp:4:0: ... error: 'thread' in namespace 'std' does...
2013/07/12
[ "https://Stackoverflow.com/questions/17625306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/916672/" ]
Basically MinGW does not support threads on windows see the following link: <http://www.cplusplus.com/forum/windows/82461/> Specifically \_GLIBCXX\_HAS\_GTHREADS is not defined and the class thread in the header thread requires it. (It is built on gthreads). You should try and use boost::thread for a win/linux compa...
Most probably you might have forgot to include thread header `#include <thread>`
17,625,306
I try to crosscompile some c++11 source with mingw on linux for windows. The code uses std::thread. When i compile i always get some errors: ``` $ ../mingw/cross/bin/i686-w64-mingw32-g++ -std=c++11 -I include/ test.cpp -lstdthread -otest In file included from test.cpp:4:0: ... error: 'thread' in namespace 'std' does...
2013/07/12
[ "https://Stackoverflow.com/questions/17625306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/916672/" ]
There is already a native implementation of std::thread and sync primitives, that works with any C++11 version of MinGW: <https://github.com/meganz/mingw-std-threads>
Most probably you might have forgot to include thread header `#include <thread>`
17,625,306
I try to crosscompile some c++11 source with mingw on linux for windows. The code uses std::thread. When i compile i always get some errors: ``` $ ../mingw/cross/bin/i686-w64-mingw32-g++ -std=c++11 -I include/ test.cpp -lstdthread -otest In file included from test.cpp:4:0: ... error: 'thread' in namespace 'std' does...
2013/07/12
[ "https://Stackoverflow.com/questions/17625306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/916672/" ]
There is already a native implementation of std::thread and sync primitives, that works with any C++11 version of MinGW: <https://github.com/meganz/mingw-std-threads>
Basically MinGW does not support threads on windows see the following link: <http://www.cplusplus.com/forum/windows/82461/> Specifically \_GLIBCXX\_HAS\_GTHREADS is not defined and the class thread in the header thread requires it. (It is built on gthreads). You should try and use boost::thread for a win/linux compa...
20,092,016
Is there any reason why the next tuple is greater then the list? ``` >>> t = ( 1, 2, 3 ) >>> l = [ 1, 2, 3 ] >>> t > l True >>> t < l False ```
2013/11/20
[ "https://Stackoverflow.com/questions/20092016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749288/" ]
In Python 2, any tuple is always compared as greater than any list - that's just the way it is defined in the language. In Python 3, this is fixed, so that comparing tuples and lists gives `TypeError: unorderable types: tuple() > list()`.
No there is no good reason for this, and it is confusing, which is why it doesn't work like that in Python 3.
106,891
Is there a common way for all the laptops' hardware, like screen, touchpad, and keyboard, that can be followed in order to use them with a desktop PC? What I need to do, to use screen, touchpad, and keyboard of my old laptop with my desktop PC? Would be fine if I disassemble my laptop, then I remove the screen connect...
2014/04/17
[ "https://electronics.stackexchange.com/questions/106891", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/37296/" ]
A laptop screen is usually an LCD screen with an LVDS connection (or two depending on resolution.) This is a differential parallel data bus with data pairs and a clock pair. The protocol is not too complicated, but you won't be soldering directly to a desktop compatible video connector without an interface board. LVDS ...
Laptop keyboards and touchpads typically come in three flavors. Direct interfaces (Raw keyboard matrix and raw resistive or capacitive touchpad matrixes), PS/2 (Older), and USB (Newer). Both the PS/2 and USB types require you to find the pinout, and then can be wired to a USB cable. Some might run on 3.3v or lower inst...
106,891
Is there a common way for all the laptops' hardware, like screen, touchpad, and keyboard, that can be followed in order to use them with a desktop PC? What I need to do, to use screen, touchpad, and keyboard of my old laptop with my desktop PC? Would be fine if I disassemble my laptop, then I remove the screen connect...
2014/04/17
[ "https://electronics.stackexchange.com/questions/106891", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/37296/" ]
A laptop screen is usually an LCD screen with an LVDS connection (or two depending on resolution.) This is a differential parallel data bus with data pairs and a clock pair. The protocol is not too complicated, but you won't be soldering directly to a desktop compatible video connector without an interface board. LVDS ...
Laptop screen will be most complicated part, because LCD controller is built into graphics cards in most cases, and **you can't extract parts responsible for driving LCD from laptop**. That makes connecting Laptop LCD to VGA complicated. This information may be outdated, it applies to laptops that were manufactured fe...
9,771,435
I was going through the sample example of `MapKit` and `CoreLocation` framework. I found these two structs (`MKCoordinateSpan` and `CLLocationCoordinate2D`) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings. Thanks!
2012/03/19
[ "https://Stackoverflow.com/questions/9771435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1276493/" ]
`MKCoordinateSpan` defines a *span*, i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map. `CLLocationCoordinate2D` defines a single point in the latitude and longitude coordinate system. For example: ``` |<---- deltaLat ---->| ...
`MKCoordinateSpan` is interpreted as *delta values*, whereas `CLLocationCoordinate2D` is interpreted as a *point*. For example, let's say you want to define a circular region, you would define a center point, and the radius around it. In `MapKit`, you define a *rectangular region* by `MKCoordinateRegion`. The center ...
69,170,741
I'm running cron that is checking price each 30 seconds and will return me a value of asset. If the price will be different than previous price, i would like to log it.. I'm testing this because this will be very usable for me in the future ideas... `price` variable is holding the price. My goal is to do some action wh...
2021/09/14
[ "https://Stackoverflow.com/questions/69170741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16051625/" ]
You are re-declaring and assigning previousPrice = null; every 30 seconds. Can't give you specifics without seeing the surrounding code but what you generally want is a global variable like currentPrice, initialised to 0 when the app first runs. something like this should work: ``` // initialise a global variable with...
Alright, so have you tried previous\_price = current\_price after having previous\_price set to some price currently, run it, and then after console.log if it is different or something, then it gets set to current price, and then it will change after every internal? This should work.
8,243,627
Please consider: ``` Clear[x] expr = Sum[x^i, {i, 15}]^30; CoefficientList[expr, x]; // Timing Coefficient[Expand@expr, x, 234]; // Timing Coefficient[expr, x, 234]; // Timing ``` ``` {0.047, Null} ``` ``` {0.047, Null} ``` ``` {4.93, Null} ``` Help states: > > `Coefficient` works whether or not expr is explic...
2011/11/23
[ "https://Stackoverflow.com/questions/8243627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618728/" ]
Here is a hack which may enable your code to be fast, but I don't guarantee it to always work correctly: ``` ClearAll[withFastCoefficient]; SetAttributes[withFastCoefficient, HoldFirst]; withFastCoefficient[code_] := Block[{Binomial}, Binomial[x_, y_] := 10 /; ! FreeQ[Stack[_][[-6]], Coefficient]; code] ...
``` expr = Sum[x^i, {i, 15}]^30; scoeff[ex_, var_, n_] /; PolynomialQ[ex, var] := ex + O[var]^(n + 1) /. Verbatim[SeriesData][_, 0, c_List, nmin_, nmax_, 1] :> If[nmax - nmin != Length[c], 0, c[[-1]]]; Timing[scoeff[expr, x, 234]] ``` seems quite fast, too.
8,243,627
Please consider: ``` Clear[x] expr = Sum[x^i, {i, 15}]^30; CoefficientList[expr, x]; // Timing Coefficient[Expand@expr, x, 234]; // Timing Coefficient[expr, x, 234]; // Timing ``` ``` {0.047, Null} ``` ``` {0.047, Null} ``` ``` {4.93, Null} ``` Help states: > > `Coefficient` works whether or not expr is explic...
2011/11/23
[ "https://Stackoverflow.com/questions/8243627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618728/" ]
Here is a hack which may enable your code to be fast, but I don't guarantee it to always work correctly: ``` ClearAll[withFastCoefficient]; SetAttributes[withFastCoefficient, HoldFirst]; withFastCoefficient[code_] := Block[{Binomial}, Binomial[x_, y_] := 10 /; ! FreeQ[Stack[_][[-6]], Coefficient]; code] ...
After some experimentation following Rolf Mertig's answer, this appears to be the fastest method on the type of expression such as `Sum[x^i, {i, 15}]^30`: ``` SeriesCoefficient[expr, {x, 0, 234}] ```
8,243,627
Please consider: ``` Clear[x] expr = Sum[x^i, {i, 15}]^30; CoefficientList[expr, x]; // Timing Coefficient[Expand@expr, x, 234]; // Timing Coefficient[expr, x, 234]; // Timing ``` ``` {0.047, Null} ``` ``` {0.047, Null} ``` ``` {4.93, Null} ``` Help states: > > `Coefficient` works whether or not expr is explic...
2011/11/23
[ "https://Stackoverflow.com/questions/8243627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618728/" ]
`Coefficient` will not expand unless it deems it absolutely necessary to do so. This does indeed avoid memory explosions. I believe it has been this way since version 3 (I think I was working on it around 1995 or so). It can also be faster to avoid expansion. Here is a simple example. ``` In[28]:= expr = Sum[x^i + y^...
``` expr = Sum[x^i, {i, 15}]^30; scoeff[ex_, var_, n_] /; PolynomialQ[ex, var] := ex + O[var]^(n + 1) /. Verbatim[SeriesData][_, 0, c_List, nmin_, nmax_, 1] :> If[nmax - nmin != Length[c], 0, c[[-1]]]; Timing[scoeff[expr, x, 234]] ``` seems quite fast, too.
8,243,627
Please consider: ``` Clear[x] expr = Sum[x^i, {i, 15}]^30; CoefficientList[expr, x]; // Timing Coefficient[Expand@expr, x, 234]; // Timing Coefficient[expr, x, 234]; // Timing ``` ``` {0.047, Null} ``` ``` {0.047, Null} ``` ``` {4.93, Null} ``` Help states: > > `Coefficient` works whether or not expr is explic...
2011/11/23
[ "https://Stackoverflow.com/questions/8243627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618728/" ]
`Coefficient` will not expand unless it deems it absolutely necessary to do so. This does indeed avoid memory explosions. I believe it has been this way since version 3 (I think I was working on it around 1995 or so). It can also be faster to avoid expansion. Here is a simple example. ``` In[28]:= expr = Sum[x^i + y^...
After some experimentation following Rolf Mertig's answer, this appears to be the fastest method on the type of expression such as `Sum[x^i, {i, 15}]^30`: ``` SeriesCoefficient[expr, {x, 0, 234}] ```
8,243,627
Please consider: ``` Clear[x] expr = Sum[x^i, {i, 15}]^30; CoefficientList[expr, x]; // Timing Coefficient[Expand@expr, x, 234]; // Timing Coefficient[expr, x, 234]; // Timing ``` ``` {0.047, Null} ``` ``` {0.047, Null} ``` ``` {4.93, Null} ``` Help states: > > `Coefficient` works whether or not expr is explic...
2011/11/23
[ "https://Stackoverflow.com/questions/8243627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618728/" ]
``` expr = Sum[x^i, {i, 15}]^30; scoeff[ex_, var_, n_] /; PolynomialQ[ex, var] := ex + O[var]^(n + 1) /. Verbatim[SeriesData][_, 0, c_List, nmin_, nmax_, 1] :> If[nmax - nmin != Length[c], 0, c[[-1]]]; Timing[scoeff[expr, x, 234]] ``` seems quite fast, too.
After some experimentation following Rolf Mertig's answer, this appears to be the fastest method on the type of expression such as `Sum[x^i, {i, 15}]^30`: ``` SeriesCoefficient[expr, {x, 0, 234}] ```
3,660,815
Consider the family of functions $E=\{u\_n:n \in \mathbb{N}\}$, where $u\_n(x)=e^{-n||x||}$, $x \in \overline{B(0,1)} \subseteq \mathbb{R}^m$. I'm asked to study the equicontinuity of $E$ on the closed ball $\overline{B(0,1)}$. This is my attempt: First, we notice that the family is bounded with respect to the sup n...
2020/05/05
[ "https://math.stackexchange.com/questions/3660815", "https://math.stackexchange.com", "https://math.stackexchange.com/users/704265/" ]
It is correct. Alternatively, we can explicitly show that your family is not equicontinuous at $0$. We claim that for $\varepsilon = \frac12$ there is no $\delta > 0$ such that for all $x \in \overline{B}(0,1)$ we have $$\|x\| < \delta \implies |1-u\_n(x)| < \frac12$$ for all $n \in \Bbb{N}$. Indeed, let $0 < \delta ...
I think you can argue directly: let $\delta>0.$ Then, choose any $0\neq x\in B\_{\delta}(0)$. Since $f\_n(x)\to 0$, there is an integer $n$ such that such that $d(f\_n(0),f\_n(x\_n))=d(1,f\_n(x))>1/2$ so $\{f\_n\}\_n$ is not equicontinuous at $0$ and so cannot be equicontinuous.
28,179,385
Using Rails 3 Asset Pipeline, I am importing mixins using ``` @import "mixins.css.scss"; ``` in to a main SCSS file. Then utilize via ``` @include big_box(34px); ``` The problem is that when I make changes to the mixin in the separate file, the changes to take effect until I go into the main SCSS file, do any cha...
2015/01/27
[ "https://Stackoverflow.com/questions/28179385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3288341/" ]
This isn't default behavior. However, I wonder if the problem is in how you're specifying the import. Is the filename of the mixin actually, `mixins.css.scss`? If so, I recommend trying the partial-like naming convention that may actually be SCSS's preferred way: rename the file to `_mixins.css.scss` and in your mani...
@Eric is correct, just a few notes for clarity.... * Rename imported Sass with an underscore: \_mixins.css.scss * @import *without* the underscore and without the *file extension* * Note, you *can* include paths... E.g. ``` For path/to/_buttons.css.scss @import 'path/to/buttons' Rails will bust that cache wheneve...
197,870
I am currently taking a class on analog electronics and this is one of the problems that came up: [![enter image description here](https://i.stack.imgur.com/B1Pqp.png)](https://i.stack.imgur.com/B1Pqp.png) ``` V 1 = 15V V 1 = 15V, Ueb = Ube = 0.6V, Uce(sat) = 0.2V, β =200, VT = 25mV, R2 = 39Ω, R4 = 4.7kΩ, R5 = 47...
2015/10/29
[ "https://electronics.stackexchange.com/questions/197870", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/88513/" ]
Both the question and configuration seems to be ..broken, somehow, but making a few assumptions/changes, i'll try to illustrate how i would go about solving a similar task. I'm guessing that my assumed configuration is not the intended one, but i can't see any obvious alternative. So: Assuming all transistors are NPN ...
Are you sure that you provided all information on this circuit? As far as I can see, this device only produces some leakage current. There is no chance for a current flow. Either Q3 will do something, nor Q1. The only possible current might flow in Q2 form the Emitter to the base but there's still no way to continu...
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
You can simply sort the collection by a custom function: ```php use Illuminate\Support\Collection; $data = collect([ ["id" => 1, "name" => "Bogan, Weissnat and Jenkins"], ["id" => 4, "name" => "Grady-Barrows"], ["id" => 7, "name" => "Howe and Sons"], ["id" => 3, "name" => "Macejkovic-Altenwerth"], ]);...
This is how I did solve it. ``` public function moveOtherToTop($collection, $key, $item) { return $collection->reject(function ($value) use ($item){ return $value[$key] == $item; })->prepend($collection->filter(function ($value) use ($item) { return $value[$key] == $item; })[$item]); } ```...
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
``` $activeId = 3; // Your active item id $collection = $collection ->sortBy('id') ->sortBy(fn($item) => $item->id !== $activeId); ``` This will sort your collection by id and move a specific item to the top. *(PHP7.4+ for arrow function)*
This is how I did solve it. ``` public function moveOtherToTop($collection, $key, $item) { return $collection->reject(function ($value) use ($item){ return $value[$key] == $item; })->prepend($collection->filter(function ($value) use ($item) { return $value[$key] == $item; })[$item]); } ```...
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
You can simply sort the collection by a custom function: ```php use Illuminate\Support\Collection; $data = collect([ ["id" => 1, "name" => "Bogan, Weissnat and Jenkins"], ["id" => 4, "name" => "Grady-Barrows"], ["id" => 7, "name" => "Howe and Sons"], ["id" => 3, "name" => "Macejkovic-Altenwerth"], ]);...
I run this in Laravel 5.8 ``` use Illuminate\Support\Collection; function moveItemToTopCollection(Collection $collection, String $key, $value) :Collection { $item_to_first = null; // Search element to top foreach ($collection as $item) { if ($item->$key == $value){ $item_to_first = $i...
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
You can simply sort the collection by a custom function: ```php use Illuminate\Support\Collection; $data = collect([ ["id" => 1, "name" => "Bogan, Weissnat and Jenkins"], ["id" => 4, "name" => "Grady-Barrows"], ["id" => 7, "name" => "Howe and Sons"], ["id" => 3, "name" => "Macejkovic-Altenwerth"], ]);...
You can use the [prioritize](https://github.com/spatie/laravel-collection-macros#prioritize) method from the great [spatie/laravel-collection-macros](https://github.com/spatie/laravel-collection-macros) package.
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
``` $activeId = 3; // Your active item id $collection = $collection ->sortBy('id') ->sortBy(fn($item) => $item->id !== $activeId); ``` This will sort your collection by id and move a specific item to the top. *(PHP7.4+ for arrow function)*
I run this in Laravel 5.8 ``` use Illuminate\Support\Collection; function moveItemToTopCollection(Collection $collection, String $key, $value) :Collection { $item_to_first = null; // Search element to top foreach ($collection as $item) { if ($item->$key == $value){ $item_to_first = $i...
68,194,376
This is just in case someone else has the same question and like me did not find a suitable answer to solve it. I had a collection that had to be filtered so the active item comes first on the collections when a certain value was passed. ``` Illuminate\Database\Eloquent\Collection { 0 => array:2 [ "id" => 1...
2021/06/30
[ "https://Stackoverflow.com/questions/68194376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924107/" ]
``` $activeId = 3; // Your active item id $collection = $collection ->sortBy('id') ->sortBy(fn($item) => $item->id !== $activeId); ``` This will sort your collection by id and move a specific item to the top. *(PHP7.4+ for arrow function)*
You can use the [prioritize](https://github.com/spatie/laravel-collection-macros#prioritize) method from the great [spatie/laravel-collection-macros](https://github.com/spatie/laravel-collection-macros) package.
39,549,945
I recently bought and integrated HTTPS on my website, on which I use to develop other websites on subdomains. HTTPS is working perfectly on both www and non-www website, as it was registered. I used following command to automatically redirect to https from all the subpages: ``` RewriteCond %{HTTPS} !=on RewriteRule ^...
2016/09/17
[ "https://Stackoverflow.com/questions/39549945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214537/" ]
Your sorting seems fine. The way you are printing is the issue. Is this what you want? ``` public class Main { public static Comparable[][] findCommonElements(Comparable[][] collections){ for(int i = 0; i < collections.length; i++){ Arrays.sort(collections[i]); } return co...
You've almost done it, you can fix your code by debugging. Here is an approach with java8 streams ``` char[][] arr = { { 'Z', 'C', 'D' }, { 'B', 'F', 'E' }, { 'D', 'Z', 'A' } }; char[][] sorted = IntStream.range(0, arr.length).mapToObj(i -> arr[i]).peek(x -> Arrays.sort(x)).toArray(char[][]::new); for (ch...
2,898,414
I have a web page, normal no fuzz or weird stuff. And I want to trap that page inside an html frame when a user clicks on a given link. The thing is i don't want to reload the page. Some kind of dynamic DOM trickery seems the way to go, but to no avail in my tests. If anyone has any ideas it would be great! Thanks
2010/05/24
[ "https://Stackoverflow.com/questions/2898414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349068/" ]
adding scroll="no" to the body of my iframe target page worked for me. In total, here's the additional cruft I've added to my iframe for various browsers, perhaps this will help someone else: iFrame source HTML: ``` <body style="overflow:hidden;" scroll="no"> ``` iFrame tag on page: ``` <iframe width="280" height=...
Try setting the `BODY` tag of the IFRAME content to `<BODY scroll="no">` and add the following CSS the content's page: ``` html { overflow:hidden; } ```
2,898,414
I have a web page, normal no fuzz or weird stuff. And I want to trap that page inside an html frame when a user clicks on a given link. The thing is i don't want to reload the page. Some kind of dynamic DOM trickery seems the way to go, but to no avail in my tests. If anyone has any ideas it would be great! Thanks
2010/05/24
[ "https://Stackoverflow.com/questions/2898414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349068/" ]
Try setting the `BODY` tag of the IFRAME content to `<BODY scroll="no">` and add the following CSS the content's page: ``` html { overflow:hidden; } ```
By using jQuery from parent page ``` <script type="text/javascript"> $('#iframeid').contents().find('body').css('overflow', 'hidden'); $('#iframeid').contents().find('body').attr('scrolling', 'No'); </script> ``` Use this, it should work.
2,898,414
I have a web page, normal no fuzz or weird stuff. And I want to trap that page inside an html frame when a user clicks on a given link. The thing is i don't want to reload the page. Some kind of dynamic DOM trickery seems the way to go, but to no avail in my tests. If anyone has any ideas it would be great! Thanks
2010/05/24
[ "https://Stackoverflow.com/questions/2898414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349068/" ]
adding scroll="no" to the body of my iframe target page worked for me. In total, here's the additional cruft I've added to my iframe for various browsers, perhaps this will help someone else: iFrame source HTML: ``` <body style="overflow:hidden;" scroll="no"> ``` iFrame tag on page: ``` <iframe width="280" height=...
By using jQuery from parent page ``` <script type="text/javascript"> $('#iframeid').contents().find('body').css('overflow', 'hidden'); $('#iframeid').contents().find('body').attr('scrolling', 'No'); </script> ``` Use this, it should work.
46,486,945
I have the wordpress custom post type "books", as well as a taxonomy called "genres". I need to import this data to my mobile app. so using /wp-json/wp/v2/books, the data for one of books looks like this: [![enter image description here](https://i.stack.imgur.com/BtFvQ.png)](https://i.stack.imgur.com/BtFvQ.png) How...
2017/09/29
[ "https://Stackoverflow.com/questions/46486945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8412007/" ]
after some more hours i found what i had to modify. in /wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php ... i had to change the following line ``` $data[ $base ] = $terms ? array_values( wp_list_pluck( $terms, 'term_id' ) ) : array(); ``` to ``` $data[ $base ] = $terms ? array_values( wp_list...
You need to check whether your custom post type taxonomy is set to show in the REST API. In the code that creates the custom post type/taxonomy you'll need to check if the array option `show_in_rest` is set to `true`. If not, you'll need to add it eg. ``` // hook into the init action and call create_book_taxonomies w...
1,348,141
I tried added @required true to a property, but the table generated by CF9 ORM is still Nullable. Any way to make a column a non-nullable column? Thanks.
2009/08/28
[ "https://Stackoverflow.com/questions/1348141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35634/" ]
You need to use ["optional":"forbidden"](http://mql.freebaseapps.com/ch03.html#id2955245) directive: ``` [{ "type": "/people/person", "date_of_birth": { "value": null, "optional": "forbidden" }, "name": null, "id": null }]​ ``` (I added `"id":null` so that the [Query Editor](http://tinyurl.com...
If you need to deal with lots of results, the undocumented envelope parameter "page" provides more flexibility than "cursor", allowing you to move forward, back, or access a page at random, as opposed to just going forward like you can with the cursor. The "optional": "forbidden" clause is the key to lots of useful qu...
272,575
I am looking to clone several servers periodically as part of a backup scheme. Is it possible to clone a server that is in use using clonezilla or other foss product? One of these servers is running an sql database, I'm not sure if this would add an additional variable to this situation.
2011/04/19
[ "https://superuser.com/questions/272575", "https://superuser.com", "https://superuser.com/users/40719/" ]
Tricky as there will be issues with open databases and other files. The VMware Converter can *in theory* clone running machines but in my experience this is a bit hit and miss. Beyond that you are looking at specific apps and procedures as Journeyman Geek hints - and these can be a bit pricey. If the servers can be shu...
With windows, there's one thing you absolutely need to have in a backup solution where you don't want to shutdown a system- volume shadow copy. Windows backup on windows 7 (which 2008 r2 is based on) supports it natively - so i'd probably go for the native backup solution on that. For the windows 2003 system, any dece...
947,454
**Update:** I have edited the Wikipedia page, so that the mistake no longer appears. On the [Wikipedia article](http://en.wikipedia.org/wiki/Finite_difference#Relation_with_derivatives) for "Finite difference" there is the claim > > Assuming that $f$ is continuously differentiable, [we have] $$ > \frac{f(x+h) - f(...
2014/09/26
[ "https://math.stackexchange.com/questions/947454", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76333/" ]
You are right. In the first case, for $$\frac{f(x+h)-f(x)}{h} - f'(x)$$ you only have an $o(1)$ bound. A function like $f(x) = x\cdot\lvert x\rvert^\alpha$ for $0 < \alpha < 1$ is continuously differentiable on all of $\mathbb{R}$, but at $0$ the difference quotient converges only of the order $\lvert h\rvert^{\alpha...
Always go to Taylor's theorem, which says that if $f(x)$ is differentiable, then $f(x+h)=f(x)+f'(x)h+o(h)$. Similarly if $f$ is $n$ times differentiable, you have: $$f(x+h)=f(x)+f'(x)h+\cdots+\frac{f^{(n)}(x)}{n!}h^n+o(h^n).$$ Going to the $n=1$ example, notice that even if if is *not* twice differentiable, the th...
19,345
I am a math professor teaching an Intro ODEs course, and most of my students are going into engineering. As such, I like to give them lots of examples of how our material is applied. We are coming up on the Laplace Transform and I'm looking for a relatively simple example from Control Theory. I was thinking of perhap...
2018/02/09
[ "https://engineering.stackexchange.com/questions/19345", "https://engineering.stackexchange.com", "https://engineering.stackexchange.com/users/14880/" ]
Consider $s$ as a derivative operator. Therefore, $$\frac{Y}{X}=\frac{s+2}{s^2+0.5s+3}$$ looks like $$\frac{Y}{X}=\frac{\frac{d}{dt}.+2}{\frac{d^2}{dt}.+0.5\frac{d}{dt}.+3}$$ $$(\frac{d^2}{dt}.+0.5\frac{d}{dt}.+3) y=(\frac{d}{dt}.+2)x$$ $$(\frac{d^2}{dt}y+0.5\frac{d}{dt}y+3y) =(\frac{d}{dt}x+2 x)$$ For linear syst...
For your approach you need to know the exact ODE of the system. However when designing a controller for a system that can be approximated as LTI you do not necessary need a fully parameterized and identified ODE model. You can either use some PID tuning algorithm or, maybe more related to your question, measure the fre...
19,345
I am a math professor teaching an Intro ODEs course, and most of my students are going into engineering. As such, I like to give them lots of examples of how our material is applied. We are coming up on the Laplace Transform and I'm looking for a relatively simple example from Control Theory. I was thinking of perhap...
2018/02/09
[ "https://engineering.stackexchange.com/questions/19345", "https://engineering.stackexchange.com", "https://engineering.stackexchange.com/users/14880/" ]
What's the response (to an arbitrary load) of a viscoelastic assembly consisting of a damper (with damping constant $\eta\_1$) connected in series with a spring (with spring constant $k\_2$) and another damper ($\eta\_2$) that are connected in parallel? In other words, the assembly looks like this: [![viscoelastic as...
For your approach you need to know the exact ODE of the system. However when designing a controller for a system that can be approximated as LTI you do not necessary need a fully parameterized and identified ODE model. You can either use some PID tuning algorithm or, maybe more related to your question, measure the fre...
49,078,873
In a project I'm trying to use the WebUSB API available in Chrome to print using a Zebra LP2844 printer. I succeeded on OSX without issues and eventually on Ubuntu and on ChromeOS thanks to [this post](https://stackoverflow.com/questions/47695160/failed-to-claim-interface-0-device-or-resource-busy) that talked about u...
2018/03/02
[ "https://Stackoverflow.com/questions/49078873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3587452/" ]
After a few tests on other windows machines, I managed to make everything work using [Zadig](http://zadig.akeo.ie/) software to replace the windows installed driver with WinUSB. The key was restarting the computer after replacing the drivers. The custom driver I developed also works, but Zadig's program makes things ...
maybe you could do a quick test with my WebUSB tester here: <https://larsgk.github.io/webusb-tester/> it should show you which interfaces are claimed by the system (If this is the reason why it fails).
50,037,589
I have a GooglePlace model with a field to store the address\_components being returned by Google Places API. model.py ``` address_components = ArrayField(JSONField(), null=True, blank=True) ``` I am trying to store the data like this ``` address_components = [component for component in google_place_details.get("a...
2018/04/26
[ "https://Stackoverflow.com/questions/50037589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5647272/" ]
You don't need to wrap the JSON data in an `ArrayField`. You can store your `address_components` list directly into a `JSONField`.
This is a known bug <https://code.djangoproject.com/ticket/28291>. I have refactored my model to JSONField() From : `address_components = ArrayField(JSONField(), null=True, blank=True)` To : `address_components = JSONField(null=True, blank=True)`
15,405,390
I am using an Jquery for building a mobile app, I want to display a small popup box with a lot of text.The `popup is 30% of the screen` and I want the text would be `scrollable` with mobile small scrollerbar. this is my popup window: ``` <div id="popup" class= "DivWithScroll"> <div class="txt"> <p id="tex...
2013/03/14
[ "https://Stackoverflow.com/questions/15405390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2072331/" ]
1. If you are working on windows like me, just go to C:\Users\Owner.m2\repository and delete all the files in it. Make sure to keep your eclipse close. 2. Open eclipse and right click on your project, then click on Maven and then in Update Project. A dialog window appears, make sure to have selected ‘clean projects’ an...
Sounds like you may need to add the sl4j dependency in your pom file. See here: [Failed to load class "org.slf4j.impl.StaticLoggerBinder"](https://stackoverflow.com/questions/7951610/failed-to-load-class-org-slf4j-impl-staticloggerbinder) Here is the depenedency from the dependency finder in CQ5.5: ``` <dependency> ...
15,405,390
I am using an Jquery for building a mobile app, I want to display a small popup box with a lot of text.The `popup is 30% of the screen` and I want the text would be `scrollable` with mobile small scrollerbar. this is my popup window: ``` <div id="popup" class= "DivWithScroll"> <div class="txt"> <p id="tex...
2013/03/14
[ "https://Stackoverflow.com/questions/15405390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2072331/" ]
You do not really have to delete everything from .m2\repository directory. Just the directories for 'problematic libraries', in your example YOUR\_MAVEN\_REPO.m2\repository\org\apache\maven\plugins\maven-compiler-plugin and delete 2.3.2 folder. Then right click on the project in Eclipse and Maven->Update Project. You...
Sounds like you may need to add the sl4j dependency in your pom file. See here: [Failed to load class "org.slf4j.impl.StaticLoggerBinder"](https://stackoverflow.com/questions/7951610/failed-to-load-class-org-slf4j-impl-staticloggerbinder) Here is the depenedency from the dependency finder in CQ5.5: ``` <dependency> ...
15,405,390
I am using an Jquery for building a mobile app, I want to display a small popup box with a lot of text.The `popup is 30% of the screen` and I want the text would be `scrollable` with mobile small scrollerbar. this is my popup window: ``` <div id="popup" class= "DivWithScroll"> <div class="txt"> <p id="tex...
2013/03/14
[ "https://Stackoverflow.com/questions/15405390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2072331/" ]
1. If you are working on windows like me, just go to C:\Users\Owner.m2\repository and delete all the files in it. Make sure to keep your eclipse close. 2. Open eclipse and right click on your project, then click on Maven and then in Update Project. A dialog window appears, make sure to have selected ‘clean projects’ an...
Thank you all for you help and guidance. I got the error myself. I am in a proxy network and was required to set user id and password in settings.xml file of apache maven.
15,405,390
I am using an Jquery for building a mobile app, I want to display a small popup box with a lot of text.The `popup is 30% of the screen` and I want the text would be `scrollable` with mobile small scrollerbar. this is my popup window: ``` <div id="popup" class= "DivWithScroll"> <div class="txt"> <p id="tex...
2013/03/14
[ "https://Stackoverflow.com/questions/15405390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2072331/" ]
1. If you are working on windows like me, just go to C:\Users\Owner.m2\repository and delete all the files in it. Make sure to keep your eclipse close. 2. Open eclipse and right click on your project, then click on Maven and then in Update Project. A dialog window appears, make sure to have selected ‘clean projects’ an...
You do not really have to delete everything from .m2\repository directory. Just the directories for 'problematic libraries', in your example YOUR\_MAVEN\_REPO.m2\repository\org\apache\maven\plugins\maven-compiler-plugin and delete 2.3.2 folder. Then right click on the project in Eclipse and Maven->Update Project. You...
15,405,390
I am using an Jquery for building a mobile app, I want to display a small popup box with a lot of text.The `popup is 30% of the screen` and I want the text would be `scrollable` with mobile small scrollerbar. this is my popup window: ``` <div id="popup" class= "DivWithScroll"> <div class="txt"> <p id="tex...
2013/03/14
[ "https://Stackoverflow.com/questions/15405390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2072331/" ]
You do not really have to delete everything from .m2\repository directory. Just the directories for 'problematic libraries', in your example YOUR\_MAVEN\_REPO.m2\repository\org\apache\maven\plugins\maven-compiler-plugin and delete 2.3.2 folder. Then right click on the project in Eclipse and Maven->Update Project. You...
Thank you all for you help and guidance. I got the error myself. I am in a proxy network and was required to set user id and password in settings.xml file of apache maven.
437,389
I want to be able to check just a few things on a remote host from within nagios - cpu, memory etc, so, I am looking to install NRPE on the machine. NRPE wants to install Samba along with many other services, which I completely understand. Is there a way to just install a subset of NRPE commands so I don't need to in...
2012/10/11
[ "https://serverfault.com/questions/437389", "https://serverfault.com", "https://serverfault.com/users/126689/" ]
Try installing nagios-plugins-basic and nagios-nrpe-server. Make sure apt is configured to install only dependencies and not recommended or suggested packages.
This would depend on how Ubuntu packages the NRPE components. If it's one big package, and it declares things like Samba as required dependencies, you're out of luck unless you roll your own package (which is not terribly hard - you could unpack the one Ubuntu provides and remove the components/dependency declarations ...
437,389
I want to be able to check just a few things on a remote host from within nagios - cpu, memory etc, so, I am looking to install NRPE on the machine. NRPE wants to install Samba along with many other services, which I completely understand. Is there a way to just install a subset of NRPE commands so I don't need to in...
2012/10/11
[ "https://serverfault.com/questions/437389", "https://serverfault.com", "https://serverfault.com/users/126689/" ]
you could try this: ``` aptitude install -vv --show-deps --without-recommends nagios-nrpe-server ``` it will show you the package dependencies but wont install them.
This would depend on how Ubuntu packages the NRPE components. If it's one big package, and it declares things like Samba as required dependencies, you're out of luck unless you roll your own package (which is not terribly hard - you could unpack the one Ubuntu provides and remove the components/dependency declarations ...
437,389
I want to be able to check just a few things on a remote host from within nagios - cpu, memory etc, so, I am looking to install NRPE on the machine. NRPE wants to install Samba along with many other services, which I completely understand. Is there a way to just install a subset of NRPE commands so I don't need to in...
2012/10/11
[ "https://serverfault.com/questions/437389", "https://serverfault.com", "https://serverfault.com/users/126689/" ]
Try installing nagios-plugins-basic and nagios-nrpe-server. Make sure apt is configured to install only dependencies and not recommended or suggested packages.
you could try this: ``` aptitude install -vv --show-deps --without-recommends nagios-nrpe-server ``` it will show you the package dependencies but wont install them.
521,326
I have a line in `rc.local` to run a simple bash script upon boot. The operating system is Raspbian Stretch 4.14 on a Raspberry Pi 3B+, with a 'Witty Pi 2' power management board (UUGear). ``` bash /home/pi/Desktop/mount_and_run.bash & ``` The bash script does not seem to run, and `syslog` suggests the error may be ...
2019/05/27
[ "https://unix.stackexchange.com/questions/521326", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/182069/" ]
The issue is not about finding the script, the issue is that you rely on `$HOME` having a value in an environment which may not have defined this variable (the environment `rc.local` runs in). `$HOME` usually only has a value after login (and in some other documented places, such as in cron jobs). You rely on `$HOME` ...
Everything listed in `rc.local` is run by `root`. For some reason, it seems that the `HOME` variable is not set when running `rc.local` (which would lead to `/root/`, and I believe you want your regular users home under `/home/user/`). To fix this, replace `$HOME` in your script with the full path, i.e. `/home/user/`...
9,247,382
on the call back after the ajax call in qm150\_submit $.post .... I want to call a second function called 'send\_email' (which also has a callback called 'success\_callback' I am getting an error here ``` function () {send_email(fromName,fromEmail,toEmail,subject,message,success_callback) }; ``` error: Uncaught Syn...
2012/02/12
[ "https://Stackoverflow.com/questions/9247382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1131225/" ]
The unexpected token is the `(` after `function`. First of all, you're declaring an anonymous function without ever calling it. Secondly, an anonymous function declaration cannot be a statement (or in other words, a function statement must have a name), which is why the `(` is unexpected (javascript expects a function...
If you check your code with JSLint you will get this error: > > Function statements cannot be placed in blocks. Use a function expression or move the statement to the top of the outer function. > > > You have to wrap the anonymous function like this: `(function{})();` Fixed code: ``` function qm150_submit($titl...
52,036,632
I am working on beacon project to find out bluetooth's uuid,address,name,major,minor,rssi etc..I am getting all those values..But the problem is I have to push these data to php myadmin server, i have used volley library for database and php files for server..I will post my code of the activity and php files as well......
2018/08/27
[ "https://Stackoverflow.com/questions/52036632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Change: ``` private String url = "http://localhost/blue/testing.php"; ``` To, ``` private String url = "http://your_ip_address/blue/testing.php"; ``` Something like: 50.65.76.198 ``` Ex: private String url = "http://50.65.76.198/blue/testing.php"; ``` Hopefully it should work.
Change: ``` private String url = "http://localhost/blue/testing.php"; ``` To: ``` private String url = "http://ip/blue/testing.php"; ``` Get your ip address using ipconfig command in command prompt. See the image for clarification. [![Ip Address](https://i.stack.imgur.com/gMLUe.png)](https://i.stack.imgur.com/gM...
52,036,632
I am working on beacon project to find out bluetooth's uuid,address,name,major,minor,rssi etc..I am getting all those values..But the problem is I have to push these data to php myadmin server, i have used volley library for database and php files for server..I will post my code of the activity and php files as well......
2018/08/27
[ "https://Stackoverflow.com/questions/52036632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Change: ``` private String url = "http://localhost/blue/testing.php"; ``` To, ``` private String url = "http://your_ip_address/blue/testing.php"; ``` Something like: 50.65.76.198 ``` Ex: private String url = "http://50.65.76.198/blue/testing.php"; ``` Hopefully it should work.
You will have to add port on which you server running like 8080 along with ip address as below ``` private String url = "http://your_ip_address:port/blue/testing.php"; ``` Something like: 50.65.76.198:8080 Ex: `private String url = "http://50.65.76.198:8080/blue/testing.php";`
52,036,632
I am working on beacon project to find out bluetooth's uuid,address,name,major,minor,rssi etc..I am getting all those values..But the problem is I have to push these data to php myadmin server, i have used volley library for database and php files for server..I will post my code of the activity and php files as well......
2018/08/27
[ "https://Stackoverflow.com/questions/52036632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had the same situation. If you run your php server on a pc, you can find your pc's ip address with ifconfig. I usually find it as eg 192.168.43.1, so when I run android in simulator, I use URL as <http://192.168.43.1/xxx.php> Even though simulator runs on same pc, "localhost" will not work. This also works when I tes...
Change: ``` private String url = "http://localhost/blue/testing.php"; ``` To: ``` private String url = "http://ip/blue/testing.php"; ``` Get your ip address using ipconfig command in command prompt. See the image for clarification. [![Ip Address](https://i.stack.imgur.com/gMLUe.png)](https://i.stack.imgur.com/gM...
52,036,632
I am working on beacon project to find out bluetooth's uuid,address,name,major,minor,rssi etc..I am getting all those values..But the problem is I have to push these data to php myadmin server, i have used volley library for database and php files for server..I will post my code of the activity and php files as well......
2018/08/27
[ "https://Stackoverflow.com/questions/52036632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had the same situation. If you run your php server on a pc, you can find your pc's ip address with ifconfig. I usually find it as eg 192.168.43.1, so when I run android in simulator, I use URL as <http://192.168.43.1/xxx.php> Even though simulator runs on same pc, "localhost" will not work. This also works when I tes...
You will have to add port on which you server running like 8080 along with ip address as below ``` private String url = "http://your_ip_address:port/blue/testing.php"; ``` Something like: 50.65.76.198:8080 Ex: `private String url = "http://50.65.76.198:8080/blue/testing.php";`
67,929
does anybody know a way to save a PCI Geomatica landsat file (PCIDSK, \*.pix) as a Geotiff without loss of layers?? The Transferring layer function of Orthoengine does not work. With the export map function I can only save a three layer Geotiff. With Arcmap it is the same thing. What about R and QGis?
2013/08/06
[ "https://gis.stackexchange.com/questions/67929", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/19179/" ]
You can use GDAL's [gdal\_translate](http://www.gdal.org/gdal_translate.html) command-line utility to translate all raster bands to a GeoTIFF: ``` gdal_translate my_raster.pix my_raster.tif ```
Found the answer by myself via the manual I of PCI Geomatica: To translate a PCIDSK file as a GeoTIFF file: 1. In the Maps tree, select the RGB layer from the \*.pix file. The file is active in the Maps tree. 2. From the File menu, click Utility and then click Translate. The Translate (Export) File dialog box opens.....
5,453,487
Example my current URL is ``` http://domain.com/category/health-beauty/?session={%22session_key%22%3A%22df1eca3f79e122bd915651e5-1325102496%22%2C%22uid%22%3A%221325102496%22%2C%22expires%22%3A0%2C%22secret%22%3A%229eb858d1fc7dda2b37be912282a41382%22%2C%22base_domain%22%3A%22domain.com%22%2C%22access_token%22%3A%221939...
2011/03/28
[ "https://Stackoverflow.com/questions/5453487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/106111/" ]
The following will strip out the query string from the url and refresh the page ``` if(window.location.indexOf('?') > -1) { window.location = window.location.substr(0, window.location.indexOf('?')); } ``` Also if you want to do this in php ``` $uri = $_SERVER['REQUEST_URI']; if(strpos($uri, '?') !== false) { he...
Do you want to keep the session variable? If not you can just use the header function: ``` header('http://domain.com/category/health-beauty/'); ```