qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
160,048
Take a graph with `VertexWeight`s and/or `EdgeWeight`s like ``` g = Graph[{1, 2, 3}, {1 <-> 2, 2 <-> 3, 3 <-> 1}, EdgeWeight -> {1 <-> 2 -> "edge1", 2 <-> 3 -> "edge2", 3 <-> 1 -> "edge3"}, VertexWeight -> {1 -> "vertex1", 2 -> "vertex2", 3 -> "vertex3"}, VertexLabels -> "VertexWeight", EdgeLabels -> "EdgeWeight"]...
2017/11/16
[ "https://mathematica.stackexchange.com/questions/160048", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/4597/" ]
The kernel crashes due to [stack overflow](https://en.wikipedia.org/wiki/Stack_overflow). It is not safe to recurse too deeply. Increasing [`$RecursionLimit`](http://reference.wolfram.com/language/ref/$RecursionLimit.html) to values that are too great (and actually recursing that deep) risks a crash. (So yes, in a way...
A general answer from the computer science perspective: Stack depth limits are common and exist for virtually all programming environments. As Nicolas pointed out, tail recursion is a technique for recursion which does not take up any stack space because the context of the current call (i.e. the variables in that func...
17,681,804
I am using CSV Import Pro to import products into my store using OpenCart. The other day I was importing products which was going fine. Then after an import the extension keeps giving me this fatal error. I've tried contacting support for damn near 5 days and I haven't gotten much from them. I really need to get thi...
2013/07/16
[ "https://Stackoverflow.com/questions/17681804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2371362/" ]
`this` should be used like `jQuery(this)`. Use: ``` $('.content').mouseenter(function() { $( ".content" ).each(function (i) { if ( this.style.color != "#F7F7F7" ) { this.style.color = "#F7F7F7"; this.style.opacity = "0.5"; } }); jQuery(this).addClass('full'); }); ```
You are setting inline styles with javascript. These will always overrule class styles.
35,143,944
I have "channels" in my Android application being represented by an integer in a MySQL db on my server. Basically there are five zones in the application each with five sub channels. The "zones" increment the integer by multiples of 1 while the sub channels increment by 100. (i.e. zone 1, sub-channel 3 equates to int "...
2016/02/02
[ "https://Stackoverflow.com/questions/35143944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4722559/" ]
You haven't allocated any space for `input` to point to. I saw your earlier version had a `malloc`; you can use that, or just a `char` array. Did you mean to use `data`? Because you're not, yet. `fgets` reads at most one line at a time, so you need to put your reads in a loop. You appear to be converting the string ...
do not use strtol, use atoi instead. and use a loop to read the lines. just a quick answer: ``` int count = 0; while( fgets (input, 64, fp) != NULL ) { count++; } fseek(fp, 0, SEEK_SET); int* arr = new int[count]; count = 0; while( fgets (input, 64, fp) != NULL ) { int a =atoi(input); arr[count++] = a; } ```
71,306,107
**UPDATE** Busy with an optimization on battery storage, I face an issue while trying to optimize the model based on loops of 36 hours, for example, running for a full year of data. By doing this, I reinitialize the variable that matters at each step and therefore compromising the model. How to extract the last val...
2022/03/01
[ "https://Stackoverflow.com/questions/71306107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18099078/" ]
There are examples of how to INVOKE AWS Services from a Spring BOOT app. Here are a few that show use of the **AWS SDK for Java V2**: 1. [Creating your first AWS Java web application](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/usecases/creating_first_project) 2. [Creating a dynamic web applicatio...
You can use the [AWS SDK for Java](https://aws.amazon.com/sdk-for-java/) to make API calls to AWS services. You can find code examples in the link above. Setting up your Kendra client will look something like this: ``` String accessKey = "YOUR_ACCESS_KEY"; String secretKey = "YOUR_SECRET_KEY"; BasicAWSCredentials aws...
18,618,459
I'm tearing my hair out trying to do what should be a really simple adjustment to a macro. copy and paste doesn't seem to work. I get a property not supported error. All I am trying to do is copy all cell contents from the original activesheet in the originating workbook (which will be sName) and paste it to the new ...
2013/09/04
[ "https://Stackoverflow.com/questions/18618459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2747573/" ]
You could do something like this: ``` Sub Copy() Workbooks("Book1").Worksheets("Sheet1").Cells.Copy Workbooks("Book2").Worksheets("Sheet1").Range("A1").Select Workbooks("Book2").Worksheets("Sheet1").Paste End Sub ``` FYI, if you record macros in Excel while doing the operations you'd like to code, you ca...
Would you consider copying the worksheet as a whole? Here's a basic example, you'll have to customize your workbook organization and naming requirements. ``` Sub CopyWkst() Dim wksCopyMe As Worksheet Set wksCopyMe = ThisWorkbook.Worksheets("Sheet1") wksCopyMe.Copy After:=ThisWorkbook.Sheets(Worksheets.Co...
1,345,506
I absolutely loved [Dive Into Python](http://www.diveintopython.net/) when I picked up Python. In fact, "tutorials" such as Dive Into Python work really well for me; short brief syntax explanations, and plenty of examples to get things going. I learn really well via examples. I have programming experience in Java, S...
2009/08/28
[ "https://Stackoverflow.com/questions/1345506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118644/" ]
Install an open source unix operating system. Use it. Tweak it. You'll be sitting on a mountain of C code organized into projects of all sizes, all easily available as source. if you don't make an effort to stay in the *user* category, you're bound to make incremental inroads into C and keep the learning process 100% p...
If you really want an online tutorial you can try <http://einstein.drexel.edu/courses/Comp_Phys/General/C_basics/>. It covers the basics and also points out some general C conventions. That said, K&R is the Bible and if you are serious about learning C then it is almost mandatory reading.
26,043,411
I am trying to modify an Android app to suit my need. The original app has page 1 to display list of notes, and page 2 displays the detailed note. What I'm trying to achieve is instead of having only 1 textbox in the detailed note page, I want it to have several textboxes, and persist it as well. Here is how I though...
2014/09/25
[ "https://Stackoverflow.com/questions/26043411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2804102/" ]
`update-java-alternatives -l` will list all the java versions installed via the alternatives system. For instance on one of my systems it will display the version and the path: ``` java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64 java-7-oracle 1069 /usr/lib/jvm/java-7-oracle ``` If you want the o...
Go to the installation folder of the oracle Java, and then open the `bin` folder. Now open a terminal "here" and type `java -version` alternativelly, paste the entire path to that bin folder in the command line followed by `java -version` i.e. `/path/to/bin/java -version`
1,580,758
I'm using Eclipse to develop a Java program, and figured I'd add an option to my program to parse stdin if there are no arguments. (otherwise it parses a file) I am having problems if I execute `"somecommand | java -jar myjar.jar"` and went to debug... then realized I don't know how to start a process in Eclipse like ...
2009/10/16
[ "https://Stackoverflow.com/questions/1580758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44330/" ]
Run your app, with the pipe, on the command line but add JVM args for remote debugging, like this: ``` -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 ``` `suspend=y` will tell the JVM to not actually run the program until the debugger is attached. Next, go into the Eclipse debug launch confi...
If I'm interpreting your question right, I believe you just want to know how to send input across standard in and debug through it in eclipse. If it's simple input, you can actually manually enter System.in data via the eclipse Console window while the program is running. Just start typing in the console window, and p...
2,931,234
I am trying to get the value of first td in each tr when a users clicks "click". The result below will output aa ,ee or ii. I was thinking about using closest('tr').. but it always output "Object object". Not sure what to do on this one. My html is ``` <table> <tr> <td>aa</td> <td>bb</td> <t...
2010/05/28
[ "https://Stackoverflow.com/questions/2931234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/401147/" ]
``` $(this).parent().siblings(":first").text() ``` `parent` gives you the `<td>` around the link, `siblings` gives all the `<td>` tags in that `<tr>`, `:first` gives the first matched element in the set. `text()` gives the contents of the tag.
``` $(".hit").click(function(){ var values = []; var table = $(this).closest("table"); table.find("tr").each(function() { values.push($(this).find("td:first").html()); }); alert(values); }); ``` You should avoid `$(".hit")` it's really inefficient. Try using event delegation instead.
39,673,700
I think much explanation is not required, why below calculation gives result as 1? ``` int a = 2147483647; int b = 2147483647; int c = a * b; long d = a * b; double e = a * b; System.out.println(c); //1 System.out.println(d); //1 System.out.println(e); //1.0 ```
2016/09/24
[ "https://Stackoverflow.com/questions/39673700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4117061/" ]
2147483647 \* 2147483647 = 4611686014132420609 Which in Hexa = ‭3FFFFFFF 00000001‬, after truncation only 00000001 remains which represents 1.
First of all, the reason that the three attempts all give the same answer is that they are all performing 32 bit multiplications and the multiplication overflows, resulting in "loss of information". The overflow / loss of information happens *before* the value of the RHS1 expression is assigned to the variable on the L...
46,526,736
Why does the following code not print "Hello, World!"? ``` using System; namespace Test { public class Program { public static void Main(string[] args) { var a = new A(); var b = new B(a); b.Evnt += val => Console.WriteLine(val); a.Do(); ...
2017/10/02
[ "https://Stackoverflow.com/questions/46526736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4586004/" ]
It fails for the same reason this code prints "2": ``` int x = 2; int y = x; Action a = () => Console.WriteLine(y); x = 3; a(); ``` Here, your event handler is the value of `a.Evnt` *at the time of assignment* -- whatever `a` has for `Evnt` at the time when you pass `a` into `B`'s constructor, that's what `B` gets...
Because lambda evaluates and captures on call, otherwise += attaches once and then called on ref (without evaluation)
34,279,946
I am trying to declare an array of `Set<String>` so I do not have to manage each sets separately. But things go wrong: ``` ArrayList<Set<String>> categories=new LinkedHashSet<>(); ``` Here, Java says that type `Set<String>` is erroneous and then reports an error. If this is wrong, then how can I make an array...
2015/12/15
[ "https://Stackoverflow.com/questions/34279946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1042952/" ]
You are initialising an ArrayList with LinkedHashSet object and hence the error: ``` ArrayList<Set<String>> categories=new LinkedHashSet<>(); ``` change it to ``` ArrayList<Set<String>> categories=new ArrayList<>(); ``` you need to use HashSet when you create a Set to be added into the list. Something like th...
You can do something like: ``` List<HashSet> list =new ArrayList<HashSet>(); HashSet<String> hs =new HashSet<String>(); hs.add(value1); hs.add(value2); list.add(hs); ``` You can use for or while loop to add values to set(hs) and then add the set to list.
9,693,161
Here's the situation. I have an NSTimer in Appdelegate.m that performs a method that checks the users location and logs him out if he is out of a region. When that happens I want to load the login view controller. However, with the following lines of code, I am able to see the VC but if I click on a textfield to type, ...
2012/03/13
[ "https://Stackoverflow.com/questions/9693161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/981512/" ]
Both audiophilic and Flaviu 's approaches are ok. But both of you are missing one extra line of code. I found out that you have to allocate and init the UIWindow object first. I dont know why but initializing the object solved the problems. ``` self.window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds...
This is the code I use when I want to change views: ``` #import "LoginViewController.h" LoginViewController *screen = [[LoginViewController alloc] initWithNibName:nil bundle:nil]; screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:screen animated:YES]; //or [self.win...
60,290,836
I'm pretty new to React, I'm trying to return a JSX from a method, code as follows: ```js import React, { useReducer } from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import * as serviceWorker from './serviceWorker'; const formatName = (user) => { return user.firstName + ' ' + user.last...
2020/02/18
[ "https://Stackoverflow.com/questions/60290836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8720421/" ]
`getGreeting` should return a JSX and not an object try this: ``` const greeting = ( <h1>Hello {formatName(user)}</h1> ); const forbidden = ( <h1>Hello stranger!</h1> ); const getGreeting = (user) => { if (user) { return greeting } else { return forbidden } } ```
In JavaScript, when you write: `return {greeting}` ...what you are saying is "return an object, with a property named 'greeting', which is set to value of the variable `greeting`" The last part of that, where the value is set, is an ES6 shortcut, essentially replacing `{ "greeting": greeting }` with `{greeting}` for...
47,015,853
I define `arr = []` before anything else. Why do I get an error when my class references it? ``` arr = [] class BST: key = 0 left = None right = None height = 0 index = 0 def __init__(self): height = 0 def __str__(self): return str(self.key) def populate(self): print("populating") ...
2017/10/30
[ "https://Stackoverflow.com/questions/47015853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172232/" ]
Your concern is valid. Reading suitable [reference documentation for `std::thread`](http://en.cppreference.com/w/cpp/thread/thread/%7Ethread) tells us that on destruction: > > If `*this` has an associated thread (`joinable() == true`), `std::terminate()` is called. > > > So destroying `t` without either detachin...
Yes it is a reason of concern. The code will not work as intended. You can either do ``` t.join () ``` This should be written if you want your main function to wait till execution of the threaded func. is completed. Or ``` t.detach () ``` This should be called if you want the threaded func. to run independently,...
38,794,206
Suppose I have a Matrix class and I'd like to initialize my Matrix objects in two ways: ``` Matrix a = {1,2,3} // for a row vector ``` and ``` Matrix b = {{1,2,3},{4,5,6},{7,8,9}} // for a matrix ``` As a result, I implemented two copy constructors as below ``` class Matrix { private: size_t rows, cols; ...
2016/08/05
[ "https://Stackoverflow.com/questions/38794206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3970363/" ]
Well, here's a very dirty trick: ``` #include <iostream> #include <initializer_list> struct Matrix { template<class = void> Matrix(std::initializer_list<double>) { std::cout << "vector\n"; } Matrix(std::initializer_list<std::initializer_list<double>>) { std::cout << "matrix\n"; } }; int main() { Matrix a = ...
Why not just create one constructor that takes a matrix, create a private function copy and inside copy you check for a row\_vector. ``` private void Matrix::copy(const Matrix &matrix) { if (matrix.rows == 1) { //row vector stuff here } else if (matrix.cols == 1) { //col vector stuff here ...
40,079,575
[![I want to do](https://i.stack.imgur.com/bBdj7.png)](https://i.stack.imgur.com/bBdj7.png) I want to put button like above picture. But I have below image. I can't success this. Search a lot of but can't find it. [![result of code](https://i.stack.imgur.com/XYJoz.png)](https://i.stack.imgur.com/XYJoz.png) LinearLay...
2016/10/17
[ "https://Stackoverflow.com/questions/40079575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6249798/" ]
remove `android:paddingLeft="40dp` from **LinearLayout** Tag
Just remove below code from your "LinearLayout" ``` android:paddingLeft="40dp" ``` This is adding extra padding to your parent layout. Below will be your final code. ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match...
1,988,503
An Excel table consists of two columns (e.g., A1:B5): ``` 0 10 1 20 3 30 2 20 1 59 ``` I need to get the minimal value in column B for which the corresponding value in column A is greater than zero. In the above example it should be 20. I tried using various combinations of INDEX(), MIN(), IF(), ROW(), array formula...
2010/01/01
[ "https://Stackoverflow.com/questions/1988503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/241914/" ]
Grsm almost had it if you enter the following formula in C1 as an array (Ctrl+Shift+End) ``` =MIN(IF(A1:A5>0,B1:B5)) ``` That should do the trick.
You need to do it in 2 stages * First use the MIN function to find the minimum * Then take that answer and use the LOOKUP function to select the row and column that you need.
3,529,386
For our application, we need to get all the US interstate highway exits along with their Geocodes. Can you please explain how to get these using Google Maps API or Google Local search or otherwise? So far I have no clue as to how to proceed. I greatly appreciate if you can point me in right direction. I am looking fo...
2010/08/20
[ "https://Stackoverflow.com/questions/3529386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186148/" ]
You might be able to extract the data you need from [openstreetmap](http://www.openstreetmap.org). I shortly looked at the API they are providing, but it seems rather difficult to extract the data, although not impossible.
You can easily buy this data from Esri and it is very accurate stuff: <http://www.esri.com/products/index.html#data_panel> I also recommend checking on <https://gis.stackexchange.com/>, as someone there might know a free resource.
86,125
I have a laser and a container of water. Putting the laser beam into the water at a certain angle makes all of the laser beam reflected and none of it refracted, so no laser gets above the water. I wanted to take a photo with the lights off of such an experiment, but the results are extremely poor. Here is a photo of ...
2017/01/09
[ "https://photo.stackexchange.com/questions/86125", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/59835/" ]
> > How to shoot a photo of such experiment with lights off so that the actual laser beam is visible? > > > The thing about a laser beam is that all the light is traveling in the same direction, so none of it is leaving the beam and heading toward your camera. If you shine a laser pointer at the wall, for example,...
I followed the advice in the accepted answer and added some iron powder into the water, so that the laser can reflect more hitting the impurities. The result is fine considering the very low quality camera and very low power laser I am using: [![Laser](https://i.stack.imgur.com/Rldmf.jpg)](https://i.stack.imgur.com/Rl...
30,267,223
While this seems simple at first glance, I'm having trouble getting what I want. I have many DIVs on a page with the same class which I use to find their text contents: ``` var Name = $(".class").text(); ``` While this works, it returns all of the text from all DIVs on the page at once such as ``` Name1Name2Name3...
2015/05/15
[ "https://Stackoverflow.com/questions/30267223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1763917/" ]
So read the text from the current div with `this` ``` $(".class").on("click", function() { console.log($(this).text()); }); ```
I believe you need to use the `event.target` property to find the element that you actually clicked on. Assuming your DIV that contains Name1, Name2, etc. has the id `outerElement`: ``` $("#outerElement").on("click", function(e) { var Name = $(e.target).text(); }); ``` More info here: <https://api.jquery.com/cat...
36,776,784
I am trying to capitalize the first character of a `std::string`, using the same method [mentioned here](https://stackoverflow.com/questions/8530529/convert-first-letter-in-string-to-uppercase). For example for the following program ``` #include <cctype> #include <iostream> #include <string> int main() { std::str...
2016/04/21
[ "https://Stackoverflow.com/questions/36776784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2296458/" ]
The warning is correct as far the types go; the type of `std::toupper` as defined in the standard is: ``` int toupper( int ch ); ``` Mostly because it's a remnant from the dark C ages (the `cctype` header is a hint at that). However, this is just a part of the story. There's *another* `toupper` residing in the `loc...
[`std::toupper`](http://en.cppreference.com/w/c/string/byte/toupper) comes from the C standard, not C++, and has an annoying interface in that it takes and returns an `int` not a `char`. Using `static_cast<char>(std::toupper(name[0]))` will suit you.
33,401,522
Hi I am trying to make this program work without using reverse or sort functions in python 3. It is simply supposed to check for palindromes. The problem I am running into is that I get an index out of range everytime I run it. Is there a way to work around this? ``` def is_palindrome(word): if len(word) <= 1: ...
2015/10/28
[ "https://Stackoverflow.com/questions/33401522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4914525/" ]
`right += 1` should be `right -= 1`.
You can write it a bit more succinctly. ``` >>> def is_palin(w): ... return len(w) <= 1 or (w[0] == w[-1] and is_palin(w[1:-1])) ... >>> is_palin("xax") True >>> is_palin("xaax") True >>> is_palin("xaab") False ```
1,028,578
I'm running a headless device that I want to connect to wifi(it's currently on ethernet), so I'm using `nmcli`. I scan for connections with the following: ``` sudo nmcli dev wifi rescan sudo nmcli dev wifi list ``` and the WiFi network I want is at 95% strength. So, I connect with: ``` sudo nmcli dev wifi connect "...
2018/04/27
[ "https://askubuntu.com/questions/1028578", "https://askubuntu.com", "https://askubuntu.com/users/711310/" ]
this one fixed the issue for me - <https://unix.stackexchange.com/a/519620/407616> add this ``` [device] wifi.scan-rand-mac-address=no ``` to `/etc/NetworkManager/NetworkManager.conf` then run ``` sudo systemctl restart NetworkManager ``` then you can connect to the ssid by ``` sudo nmcli dev wif...
I solved my problem by just turn your system in sleep mode then again turn it on this solve my problem without restart
22,295,665
How much is the overhead of smart pointers compared to normal pointers in C++11? In other words, is my code going to be slower if I use smart pointers, and if so, how much slower? Specifically, I'm asking about the C++11 `std::shared_ptr` and `std::unique_ptr`. *Obviously, the stuff pushed down the stack is going to ...
2014/03/10
[ "https://Stackoverflow.com/questions/22295665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/202919/" ]
As with all code performance, the only really reliable means to obtain hard information is to **measure** and/or **inspect** machine code. That said, simple reasoning says that * You can expect some overhead in debug builds, since e.g. `operator->` must be executed as a function call so that you can step into it (thi...
Chandler Carruth has a few surprising "discoveries" on `unique_ptr` in his 2019 Cppcon talk. ([Youtube](https://youtu.be/rHIkrotSwcc?t=1063)). I can't explain it quite as well. I hope I understood the two main points right: * Code without `unique_ptr` will (often incorrectly) not handle cases where owership is not pa...
5,184,923
I just generated a class using the xsd.exe (See [previous question](https://stackoverflow.com/questions/5183550/design-strongly-typed-object-from-xml)) and then I tried to use it to deserialize my XML file. My XML files start like this: ``` <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type='text/xsl' href=...
2011/03/03
[ "https://Stackoverflow.com/questions/5184923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/490326/" ]
Yes. Any headers can be ignored. You should kill the page exit() right after you redirect the user.
Well, if you output data and your users ignore the header redirect (non-standard browser) - yes.
10,980,435
I got a "normal" ascx-Page which contains HTML-Parts as well as code behind. These elements should all be shown in normal conditions (works). Now I want to be able to set a request-parameter which causes the page zu render differently. Then it sends the information on that page not human-readable but for a machine: `...
2012/06/11
[ "https://Stackoverflow.com/questions/10980435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680026/" ]
Try adding [`Response.End()`](http://msdn.microsoft.com/en-us/library/system.web.httpresponse.end.aspx) > > Sends all currently buffered output to the client, stops execution of the page, and raises the EndRequest event. > > > Also, as @Richard said, add ``` context.Response.ContentType = "application/json"; `...
It is [recommended to avoid calling `Response.End()`](https://stackoverflow.com/a/3917180/429091) even if it results in the correct behavior. This is because that method is provided for backwards compatibility with old ASP and was not designed to support performance. To prevent further processing, it throws a [`ThreadA...
66,246
Correlation does not imply causation. Causation does imply correlation but not necessarily linear correlation. ... So does correlation imply high-order causation? If A and B are correlated, is it always possible to find `K={K1 K2 ... Kn}` variables such that ``` A~K1, K1~K2, ...,Kn-1~Kn and Kn~B ``` where ~ denotes...
2013/08/01
[ "https://stats.stackexchange.com/questions/66246", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/21852/" ]
You can simply have an omitted variable which has a causal impact on A and a causal impact on B. In that case, you will have a correlation between A and B but no "high-order causation". This issue is known in econometrics as the omitted variable bias. It is discussed in most econometrics textbooks. See for instance Cam...
No. For example, we can find a correlation between global average temperature and the world population of pirates ("Arrrgh!"), but nobody would suggest there is any sort of causality involved: ![enter image description here](https://i.stack.imgur.com/diPTb.gif) **Edit:** Okay, the pirates vs global temperatures exa...
109,793
Recently, one of the main file servers at our company failed. It was using a 4 disk RAID array, but apparently 3 of the disks died, and all the data on the server has been lost. Speaking to the sys admin, he says that he has been warning the upper management about the backup situation for months. He had been trying to...
2010/02/04
[ "https://serverfault.com/questions/109793", "https://serverfault.com", "https://serverfault.com/users/7018/" ]
Unfortunately, companies skimping on backups is all too common. Most never change until they get burned and lose everything. BUT If you are employed to be the sysadmin you have to work with the tools that you have including your brain. No matter what management or anyone else says on good days, when the poop hits the...
Did the same situation happen with the RAID array? As soon as one disk dies, you are in a situation where one more means data loss.. you better replace that drive immediately. If I was in the sys admin's shoes, the instant the first drive went: 1. Email manager with formal request to replace the drive, reminding tha...
1,747,421
Let $(a\_n)$ be a sequence of non-negative numbers such that $a\_1 > 0$ and $\sum a\_n$ diverges. Let $S\_n = \sum\_{k=1}^n a\_k$. Prove that, for all $n \geq 2$, $$\frac{a\_n}{S\_n^2} \leq \frac{1}{S\_{n-1}}-\frac{1}{S\_n}$$ How would I start this proof? I've just been staring at it and am very stuck. All i know so f...
2016/04/18
[ "https://math.stackexchange.com/questions/1747421", "https://math.stackexchange.com", "https://math.stackexchange.com/users/266268/" ]
Since $a\_n$ is nonnegative, $S\_n$ is non-decreasing. Thus $S\_{n-1} \leqslant S\_n \implies 1/S\_n \leqslant 1/S\_{n-1},$ and $$\frac{a\_n}{S\_n^2} = \frac{S\_n - S\_{n-1}}{S\_n^2}\leqslant \frac{S\_n - S\_{n-1}}{S\_{n-1}S\_n} = \frac1{S\_{n-1}} - \frac1{S\_n}.$$ Hence, with $a\_1 > 0$ we have $$\begin{align}\sum\...
You have $S\_n^2(1/S\_n-1/S\_{n-1})\ge a\_n$, or $S\_n/S\_{n-1}(S\_n-S\_{n-1}) \ge a\_n$. Ultimately, $S\_n/S\_{n-1}a\_n \ge a\_n$ or $S\_n \ge S\_{n-1}$, which is true, since $S\_n-S\_{n-1} = a\_n > 0$. Hope this helps.
55,696,544
If you make a new Flutter project and include the dependencies and then replace your main.dart file you should be where I am on this question. --- I left the original load: with Future.delayed but it doesn't seem to matter. I know partially what my problem is but am unable to come up with a better solution. 1) I do...
2019/04/15
[ "https://Stackoverflow.com/questions/55696544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/891041/" ]
Calling `A100` as written, you need to pass in `INTIM` and accept the return value ``` INTIM = A100(INTIM); ``` But... The initiqal state of `INTIM` is never used, so you could ``` INTIM = A100(); ``` and change `A100` to look more like ``` bool A100() { int choice; cout << " Repugnis turns a paler...\n 1. O...
> > Do I need to pass them [the boolean results] to the functions? > > > Often, but not always, it is my preference to pass them by reference, and yes, it can get to be a big chain thru many functions. sigh. But your question is "Do you **need** to pass them ...". The answer is No. Because a) you have tagge...
1,103,361
I have installed Windows 10 via the free install that was offered last year. I had no issues and everything worked until around April this year after an update. I start the computer, log in and everything works for a while and then for some reason I can not open the Start menu with either mouse or keyboard. I can ope...
2016/07/21
[ "https://superuser.com/questions/1103361", "https://superuser.com", "https://superuser.com/users/619571/" ]
Give this a go. Opens new tabs to the left or right of the current tab with default or customisable shortcuts in Chrome. <https://nextab.co> <https://chrome.google.com/webstore/detail/nextab/okknollmafgigeimghbepomindhjnabj>
While all of these options works. What I find most helpful and simple are these two extensions: NextTab: Open a new tab to the right with Alt + T, and a new tab to the left with Shift + Alt + T -https://chrome.google.com/webstore/detail/nextab/okknollmafgigeimghbepomindhjnabj/related Open tab next to current: Replace...
7,141,343
Does anyone know a database that I can export, I need world countries information including: country code, culture (ex. en\_US), flag image and currency. I'm tried to google it, but haven't found anything.
2011/08/21
[ "https://Stackoverflow.com/questions/7141343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/329200/" ]
Here I collected countries with their flags, cities with their photos and other various information inside MySQL database: <https://github.com/turalus/openDB>
Inversely to @JamWaffles, I can't supply icons, but I can provide you with a decent list of country/currency codes. I found the info on [PayPal XDevelopers site](https://www.x.com/community/home) about a year ago, but I can't find the exact page. Sample: ``` 'USD' => array( 'title' => 'U.S. Dollar', 'symbol_left...
24,440,712
I'm running front-end tests using nightwatch.js using the Chrome Driver. I need to test that image uploading works properly, presumably through the provided file input since there are callbacks that run on a successful post. I'm aware that this can be done using sendKeys method of the Selenium Web Driver. How can yo...
2014/06/26
[ "https://Stackoverflow.com/questions/24440712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755844/" ]
Use client.setValue function to set the absolute path of your image. Here is the working example in my project. client.setValue('#editPictures .modal-body input[type="file"]', '/Users/testing/pictures/CAM00003.jpg');
this worked for me. `.setValue('input[type="file"]', require('path').resolve('/home/My-PC/Desktop/img.png'))` Only thing maybe others running into might the different versions of firefox where it didn't work 2 yrs back for a co-worker.
34,413
I am getting a `NoClassDefFoundError` when I run my Java application. What is typically the cause of this?
2008/08/29
[ "https://Stackoverflow.com/questions/34413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3535/" ]
This is the [best solution](https://en.wikipedia.org/wiki/Classpath_%28Java%29#Setting_the_path_to_execute_Java_programs) I found so far. Suppose we have a package called `org.mypackage` containing the classes: * HelloWorld (main class) * SupportClass * UtilClass and the files defining this package are stored physic...
I had this error but could not figure out the solution based on this thread but solved it myself. For my problem I was compiling this code: ``` package valentines; import java.math.BigInteger; import java.util.ArrayList; public class StudentSolver { public static ArrayList<Boolean> solve(ArrayList<ArrayList<Big...
239,006
I want to prove that the source code I am using is the same as the open-sourced version, which is publicly available. My idea was to publish a hash of the open-sourced version and compare it to the hash of the deployed server at boot. However, because the open-sourced hash is available pre-deployment, it is possible fo...
2020/09/30
[ "https://security.stackexchange.com/questions/239006", "https://security.stackexchange.com", "https://security.stackexchange.com/users/243476/" ]
This is essentially an impossible task. --------------------------------------- If you have read Ken Thompson's "[Reflections on Trusting Trust](https://www.cs.cmu.edu/%7Erdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf)", then you already know everything I am about to say. If not, please keep reading: ...
If I understand you question correctly, what you are asking is impossible because a server acts like a kind of "black box", and normal users have no way to inspect what is really going on. You don't simply have to prove that you have something, or that you know something: you would actually need to prove that you *use...
60,796,646
When trying to list down all tables names in a database having a specific name format, the following query works fine : ``` show tables like '*case*'; ``` while the following does not ``` show tables like '%case%'; ``` On the other hand, when comparing the actual data inside string columns its the vice-versa cas...
2020/03/22
[ "https://Stackoverflow.com/questions/60796646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5069746/" ]
This is the difference between regular expressions and like patterns. `LIKE` is built into the SQL language. It has two wildcards: * `%` represents any number of characters including zero. * `_` represents exactly one character. Regular expressions are much more flexible for matching almost any pattern in a string. ...
HiveQL attempts to mimic the SQL, but it does not strictly follow its standards. The usage of the wildcards are not pertinent to the `LIKE` clause, but to the statement itself. [`SHOW`](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Show) statements validate the wildcards based ...
18,783,625
I have a class which i can read but not write because of the company policy. I have following structures in my project. ``` public class Name // can not touch this class OR modify it { public string FirstName { get; set; } public string LastName { get; set; } public string GetNames() { ...
2013/09/13
[ "https://Stackoverflow.com/questions/18783625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/927002/" ]
If you cannot change the signature of the method, your callers would need to do some casting. This is not optimal, but you can still do it: ``` public class NameWithEmail : Name { public string EMail {get;set;} } ... public Name LoadName() { ... return new NameWithEmail(); // OK because NameWithEmail exten...
Try this: ``` public class Name // can not touch this class OR modify it { public string FirstName { get; set; } public string LastName { get; set; } public string GetNames() { return FirstName + " " + LastName; } } public class Na...
3,656,644
I noticed that sometimes I get errors in my R scripts when I forget checking whether the dataframe I'm working on is actually empty (has zero rows). For example, when I used apply like this `apply(X=DF,MARGIN=1,FUN=function(row) !any(vec[ row[["start"]]:row[["end"]] ]))` and `DF` happened to be empty, I got an error...
2010/09/07
[ "https://Stackoverflow.com/questions/3656644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/377031/" ]
This has absolutely nothing to do with `apply`. The function you are applying does not work when the data.frame is empty. ``` > myFUN <- function(row) !any(vec[ row[["start"]]:row[["end"]] ]) > myFUN(DF[1,]) # non-empty data.frame [1] FALSE > myFUN(data.frame()[1,]) # empty data.frame Error in row[["start"]]:row[["e...
I would use mapply instead: ``` kk <- data.frame( start = integer(0), end = integer(0) ) kkk <- data.frame( start = 1, end = 3 ) vect <- rnorm( 100 ) > 0 with(kk, mapply( function(x, y) !any( vect[x]:vect[y] ), start, end ) ) with(kkk, mapply( function(x, y) !any( vect[x]:vect[y] ), start, end ) ) ```
6,094,401
I am writing a shell script. The tutorial that I am reading have the first line like this : `#!/usr/bin/env bash/` but it isn't working for me. (`error : no such directory`) How can I find out which bash I am using and where is it located? Appreciate for any advice and help. **Thanks a lot. It works now**. **solu...
2011/05/23
[ "https://Stackoverflow.com/questions/6094401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/744721/" ]
If you remove the `/` from `bash/`, it should work.
Remove the extra character(s) you have at the end of lines. No slash is required and `dos2unix yourscript` will remove the unwanted CRs. ``` #!/usr/bin/env bash ```
2,410,994
The quartic form $$(x^2 + y^2 + z^2)^2 - 3 ( x^3 y + y^3 z + z^3 x)$$ is non-negative for all real $x$, $y$, $z$, as one can check (with some effort). A theorem of Hilbert implies that there exist quadratic forms $Q\_1$, $Q\_2$, $Q\_3$ so that $$(x^2 + y^2 + z^2)^2 - 3( x^3 y + y^3 z + z^3 x) = Q\_1^2 + Q\_2^2 + Q...
2017/08/30
[ "https://math.stackexchange.com/questions/2410994", "https://math.stackexchange.com", "https://math.stackexchange.com/users/168051/" ]
We are given a trivariate quartic form $$ f (x, y, z) := (x^2 + y^2 + z^2)^2 - 3 ( x^3 y + y^3 z + z^3 x) $$ which can be rewritten as the sum of $9$ monomials $$f (x, y, z) = x^4 + y^4 + z^4 + 2 x^2 y^2 + 2 x^2 z^2 + 2 y^2 z^2 - 3 x^3 y - 3 y^3 z - 3 z^3 x $$ and we would like to write it as the sum of squares (SO...
Using [Macaulay2](https://faculty.math.illinois.edu/Macaulay2) (version 1.16) with package [SumsOfSquares](https://sums-of-squares.github.io/sos): ``` i1 : needsPackage( "SumsOfSquares" ); i2 : R = QQ[x,y,z]; i3 : f = (x^2 + y^2 + z^2)^2 - 3*( x^3 * y + y^3 * z + z^3 * x); i4 : sosPoly solveSOS f 1 2 ...
1,108,428
How can I convert an Excel date (in a number format) to a proper date in Python?
2009/07/10
[ "https://Stackoverflow.com/questions/1108428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5363/" ]
Please refer to this link: [Reading date as a string not float from excel using python xlrd](https://stackoverflow.com/questions/13962837/reading-date-as-a-string-not-float-from-excel-using-python-xlrd) it worked for me: in shot this the link has: ``` import datetime, xlrd book = xlrd.open_workbook("myfile.xls") s...
Since there's a chance that your excel files are coming from different computers/people; there's a chance that the formatting is messy; so be extra cautious. I just imported data from 50 odd excels where the dates were **entered** in `DD/MM/YYYY` or `DD-MM-YYYY`, but most of the Excel files **stored** them as `MM/DD/Y...
10,584,370
I've read about the jQuery.ajax method and believe this should be what I need -- but so far can't get it to work. I created a test mysql database with a table called "users", added rows to that table for "name" and "location", and then made sure I could save data to it using the command line, which I could. Then I mad...
2012/05/14
[ "https://Stackoverflow.com/questions/10584370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1392641/" ]
In this example, $\_POST['submit'] is not set because you are no sending the form as usual, you are rsendin data with ajax and there isn't any variable called "submit". This may work better: ``` if ((isset($_POST['name'])) && (isset($_POST['location']))) { // Form has been submitted. $name = trim(mysql_prep($_POS...
Since you aren't submitting via a traditional form, but using ajax, I suspect submit isn't part of the post. Check that by putting in the following else clause to your code. If you're hitting that die statement, then remove the if test ``` if (isset($_POST['submit'])) { // Form has been submitted. $name = trim(mys...
13,703,596
I have been trying to get H264 encoding to work with input captured by the camera on an Android tablet using the new low-level [MediaCodec](http://developer.android.com/reference/android/media/MediaCodec.html). I have gone through some difficulties with this, since the MediaCodecAPI is poorly documented, but I've gotte...
2012/12/04
[ "https://Stackoverflow.com/questions/13703596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726156/" ]
I think it's more efficient to swap the values in place. ``` int wh4 = input.length/6; //wh4 = width*height/4 byte tmp; for (int i=wh4*4; i<wh4*5; i++) { tmp = input[i]; input[i] = input[i+wh4]; input[i+wh4] = tmp; } ``` Maybe even b...
With ImageFormat.NV21 set on camera and COLOR\_FormatYUV420Planar for encoder , similar blue shadow is seen to overlap in my case. As I understand the above swap function cannot be used in my case, any suggestions on an algorithm that can be used for this? ps: Its a complete black screen at decoder when the camera pre...
934,236
That question may appear strange. But every time I made PHP projects in the past, I encountered this sort of bad experience: Scripts cancel running after 10 seconds. This results in very bad database inconsistencies (bad example for an deleting loop: User is about to delete an photo album. Album object gets deleted f...
2009/06/01
[ "https://Stackoverflow.com/questions/934236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62553/" ]
Instead of studivz (the German Facebook clone), you could look at the actual Facebook which is entirely PHP. Or Digg. Or many Yahoo sites. Or many, many others. ignore\_user\_abort is probably what you're looking for, but you could also add another layer in terms of scheduled maintenance jobs. They basically run on a ...
For these large loops like deleting photo albums or sending 1000's of emails your looking for ignore\_user\_abort and set\_time\_limit. Something like this: ``` ignore_user_abort(true); //users leaves webpage will not kill script set_time_limit(0); //script can take as long as it wants for(i=0;i<10000;i++) costly_...
24,438,010
I'm having trouble exporting an app for Ad Hoc Distribution on Xcode 6 beta 2: ![Failed to locate or generate matching signing assets](https://i.stack.imgur.com/tnX54.png) When exporting my project for ad hoc development on Xcode 6, I receive this alert. I've tried exporting it on Xcode 5 and had no problems at all s...
2014/06/26
[ "https://Stackoverflow.com/questions/24438010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2052961/" ]
**I resolved it following the next steps:** 1)in your apple developer account: Create a new Production Certificate Choose the App Store and Ad Hoc Option 2)in your apple developer account: Create a new provisioning profile with you current bundle id and the certificate created in the step one 3)in your xcode: * Se...
Step1:-Login to your apple developer account Step2:-Choose Certificates Step3:-Delete if there are more than one distribution certificates Step4:-Then retry archiving ( if error still exist, revoke all certificates and create new distribution certificate and edit your provision profiles.)
15,725,445
I am trying to learn angularjs, and have hit a block in trying to databind to an array returned from a Rest API. I have a simple azure api returning an array of person objects. Service url is <http://testv1.cloudapp.net/test.svc/persons>. My controller code looks like: ``` angular.module("ToDoApp", ["ngResource"]);...
2013/03/31
[ "https://Stackoverflow.com/questions/15725445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2175791/" ]
Just wanted to cross-post my adaptation of a solution Aleksander gave on another stackoverflow question: <https://stackoverflow.com/a/16387288/626810>: ``` methodName: {method:'GET', url: "/some/location/returning/array", transformResponse: function (data) {return {list: angular.fromJson(data)} }} ``` So when I call...
Use isArray param, if you have nested objects: ``` angular.module('privilegeService', ['ngResource']). factory('Privilege', function ($resource) { return $resource('api/users/:userId/privileges', {userId: '@id'}, {'query': {method:'GET', isArray:false}}); }); ``` Than...
5,615
I have been going to karate for many years and have had a bit of experience teaching our students, mostly in a 1-on-1 setting (I'm not the teacher, I just help out here and there when required). Recently, we have had a few new students join, one of whom particularly has trouble staying still and paying attention (he's...
2015/11/06
[ "https://martialarts.stackexchange.com/questions/5615", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/6136/" ]
**Quick Summary as this post is long:** It is easier to keep focus when learning something if you aren't just trying to repeat it, but fully conceptualizing the mechanics, reasoning, and technique of a thing. Having the student realize the benefit of improved understanding and the downside of lack was also a huge help ...
Teaching children is very different from teaching adults. Kids have shorter attention spans than adults, and they also have greater difficulty with delayed gratification. It's important to tailor teaching to the audience. For kids, designing a game to work on particular skills is very effective. The kids can focus on...
3,463,919
I'm trying to fetch some data from a column whose DATA\_TYPE=NUMBER(1,0) with this piece of code: ``` import cx_Oracle conn = cx_Oracle.connect(usr, pwd, url) cursor = conn.cursor() cursor.execute("SELECT DELETED FROM SERVICEORDER WHERE ORDERID='TEST'") print(cursor.fetchone()[0]) ``` which complains thus: ``` Trac...
2010/08/12
[ "https://Stackoverflow.com/questions/3463919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/321731/" ]
These types of errors went away when I upgraded to cx\_Oracle 5.1. If the RPM doesn't install (like it happened for me on Red Hat 5.5) then you can usually rpm2cpio the file, take the cx\_Oracle.so and put it into your python site-packages directory.
I had the same error. Commit helped me: ``` conn = cx_Oracle.connect(...) ... cursor.execute() conn.commit() ```
29,773,981
i.e. `$(".class")[0].data().num;` I ask because a console.log says data() is an undefined function. ``` <div class="class" data-num="1"></div> <div class="class" data-num="2"></div> <div class="class" data-num="3"></div> ```
2015/04/21
[ "https://Stackoverflow.com/questions/29773981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4681615/" ]
Another way of stopping the handler with the use of `WeakReference` to the fragment: ``` static final class UpdateUIRunnable implements Runnable { final WeakReference<RouteGuideFragment> weakRefToParent; final Handler handler; public UpdateUIRunnable(RouteGuideFragment fragment, Handler handl...
Someone posted another question similar and the problem is due to a bug in the `ChildFragmentManager`. Basically, the `ChildFragmentManager` ends up with a broken internal state when it is detached from the `Activity`. Have a look at the [original answer here](https://stackoverflow.com/questions/15207305/getting-the-er...
21,734,131
I have an array of javascript objects that represent users, like so: ``` [ { userName: "Michael", city: "Boston" }, { userName: "Thomas", state: "California", phone: "555-5555" }, { userName: "Kathrine", phone: "444-4444" } ] ``` Some of the objects contain some properties but not others....
2014/02/12
[ "https://Stackoverflow.com/questions/21734131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3183431/" ]
``` var list = [ { userName: "Michael", city: "Boston" }, { userName: "Thomas", state: "California", phone: "555-5555" }, { userName: "Kathrine", phone: "444-4444" } ]; for(var i = 0; i < list.length; i++){ if(list[i].state === undefined) list[i].state = ""; if(list[i].phone...
vanilla js ```js let A = [ { userName: "Michael", city: "Boston", }, { userName: "Thomas", state: "California", phone: "555-5555", }, { userName: "Kathrine", phone: "444-4444", }, ]; // set-difference const diff = (a,b) => new Set([...a].filter((x) => !b.has(x))); // all keys ...
16,882,196
I try to move my project to cloudbees CI. The android SDK is provided by cloudbees. it's located at path /opt/android/android-sdk-linux But unfortunately, I got the following stack trace with maven-android-plugin 3.6.0: ``` message : Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-p...
2013/06/02
[ "https://Stackoverflow.com/questions/16882196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925165/" ]
``` int take = 3; int skip = 2; string s = "ABCDEFGHIJKL"; var newstr = String.Join("", s.Where((c,i) => i % (skip + take) < take)); ``` --- **EDIT** Here are my test results.... ``` int take = 3; int skip = 2; string s = String.Join("",Enumerable.Repeat("0123456789", 200)); var t1 = Measure(10000, () => { var ...
Amidst so many good looking answer, mine might not be so sophisticated but I thought I would post it anyways. Simple logic. ``` var take = 3; var skip = 2; StringBuilder source = new StringBuilder("ABCDEFGHIJKL"); StringBuilder result = new StringBuilder(); while (source.Length > 0) { if (source.Leng...
8,482,059
I want to compile this source code in Windows (It just an example): ``` start: NOP NOP ``` When I compile it with NASM or FASM, output file length is 2 bytes. But when I compile it with GNU assembler (as) the output file length is 292 bytes! How to compile an assembly file to a raw binary (like DOS .com) format wit...
2011/12/12
[ "https://Stackoverflow.com/questions/8482059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/309798/" ]
**`ld --oformat binary`** For quick and dirty tests you can do: ``` as -o a.o a.S ld --oformat binary -o a.out a.o hd a.out ``` Gives: ``` 00000000 90 90 |..| 00000002 ``` Unfortunately this gives a warning: ``` ld: warning: cannot find entry symbol _start; defaultin...
``` org 100h nop nop ``` You can use [fasm](https://flatassembler.net/download.php) to compile: ``` fasm yourcode.asm targetfilename.com ```
32,088,019
I want my frame to have 3 panels that will look like that [![enter image description here](https://i.stack.imgur.com/y53Nq.png)](https://i.stack.imgur.com/y53Nq.png) I'm a total newbie at `JPanel` and i cant organize it, so if someone can help i'd appreciate it
2015/08/19
[ "https://Stackoverflow.com/questions/32088019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5235859/" ]
Start by having a look at [Laying Out Components Within a Container](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html). While you could use a `GridBagLayout`, you could simply use a series of compound containers using `BorderLayouts` For example... ``` JPanel left = new JPanel(new BorderLayout()); lef...
You must use a [`LayoutManager`](http://docs.oracle.com/javase/7/docs/api/java/awt/LayoutManager.html). There's plenty of information about SWING and layout manager on the net. Check * [A visual guide to LayoutMangers](https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) * [Using Layout Mangers](http...
31,909,427
Why is it considered "best practice" in java to use `Logger` with `static` as: ``` public static final Logger LOGGER = LoggerFactory.getLogger(....) ``` I can't figure the reson why. If I use one logger instance and pass it by constructor, it shouldn't affect performance. Can anybody explain why? Is it better then...
2015/08/09
[ "https://Stackoverflow.com/questions/31909427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1815451/" ]
I'm arguing that you can achieve the same results with using **setter injection** and **Dependency Injection Container**. You can still have very simple logging, it just isn't static and therefore can be configured and changed in the DI Container, without configuring some global static state of some global static fact...
That's because doing logging properly is very difficult. [Consider the single responsibility principle](https://en.wikipedia.org/wiki/Single_responsibility_principle): > > In object-oriented programming, the single responsibility principle states that every class should have responsibility over a single part of the f...
40,949,342
When pushing images to Amazon ECR, if the tag already exists within the repo the old image remains within the registry but goes in an untagged state. So if i docker push `image/haha:1.0.0` the second time i do this (provided that something changes) the first image gets untagged from `AWS ECR`. Is there a way to safel...
2016/12/03
[ "https://Stackoverflow.com/questions/40949342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314407/" ]
Now, that ECR support lifecycle policies (<https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html>) you can use it to delete the untagged images automatically. > > Setting up a lifecycle policy preview using the console > > > Open the Amazon ECS console at <https://console.aws.amazon.com/ecs/...
Setting a Lifecycle policy is definitely the best way of managing this. That being said - if you do have a bunch of images that you want to delete keep in mind that the max for batch-delete-images is 100. So you need to do this is for the number of untagged images is greater than 100: ``` IMAGES_TO_DELETE=$( aws ecr l...
48,477,427
I've got a problem with the infamous "Too many redirects" error on my website since I put an SSL certificate on with certbot. I've been looking for hours here to find a solution to my problem, tried different solutions but none of them worked in my case. Some background informations about the server : Debian 9 with A...
2018/01/27
[ "https://Stackoverflow.com/questions/48477427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9276847/" ]
I use CloudFlare and it suddenly stopped working with this error. I changed my CloudFlare SSL setting from flexible to full and that resolved the problem I was having.
I had the same issue. Had to add to my `/etc/apache2/sites-available/example.com-le-ssl.conf` `RequestHeader set X-Forwarded-Proto https` Hope this helps someone.
33,770,964
I just recently started learning MEAN stack so forgive me if this seems like a really dumb question. My problem is as follows: On the client side (controller.js) I have, ``` $http({ method : 'POST', url : '/root', // set the headers so angular passing info as form data (not request payload) headers :...
2015/11/18
[ "https://Stackoverflow.com/questions/33770964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Nevermind, I figured it out. Seems like I needed a break from coding. ``` headers : { 'Content-Type': 'application/x-www-form-urlencoded' } ``` to ``` headers : { 'Content-Type': 'application/json' } ``` fixed the problem.
I've tried with "params" instead of "data" and worked ok, and doesn't matter if headers are "application/x-www-form-urlencoded" or "application/json" But using "application/json" works with request.query.param1 on node.
1,920,163
I have a small question in JavaScript. Here is a declaration: ``` function answerToLifeUniverseAndEverything() { return 42; } var myLife = answerToLifeUniverseAndEverything(); ``` If I do `console.log(myLife)`, it will print `42`, as I am just invoking the same instance of function resulting in `42` as the answ...
2009/12/17
[ "https://Stackoverflow.com/questions/1920163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57847/" ]
When you do `var myLife = answerToLifeUniverseAndEverything();`, myLife is simply holding the return value from the function call - in this case, 42. `myLife` knows nothing about your function in that case, because the function was already called, returned, and *then* it assigned the resulting value (42) to the new var...
I think i've described the behaviour of `new` elsewhere. Basically when you do `new f()` the JS engine creates an object and passes that as `this`, then uses that object if the return value of `f()` is not an object. eg. ``` o = new f(); ``` is equivalent (approximately) to ``` temp = {}; temp2 = f.call(temp); o =...
65,732,119
```json "scripts": { "release": "npm run release| tee output1.txt", "build":"npm run build | tee output.txt" }, ``` Then I used: ``` npm run release ``` Output:Killed Please help I pass two test cases one is remaining
2021/01/15
[ "https://Stackoverflow.com/questions/65732119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15010797/" ]
This is what you are expecting. ``` "scripts": { "release": "npm -v && node -v", "build":"node index.js" } ``` run below commands and you can get the output as expected. ``` npm run release| tee output1.txt npm run build | tee output.txt ```
This is a perfect case for [post scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts#pre--post-scripts): ``` "scripts": { "release": "do something", "postrelease": "tee output1.txt", "build": "do something different", "postbuild": "tee output.txt" }, ```
5,658
Consider these YAML tasks which are based on two different parts of some locally-executed Ansible playbook [I read here](https://www.tricksofthetrades.net/2017/10/02/ansible-local-playbooks/): ``` - name: Update the apt package-index cache i.e. apt-get update apt: update_cache=yes - name: Ensure aptitude is install...
2018/12/09
[ "https://devops.stackexchange.com/questions/5658", "https://devops.stackexchange.com", "https://devops.stackexchange.com/users/-1/" ]
I would highly recommend looking at this [tutorial](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-18-04) by digital ocean. How to install and configure Ansible on Ubuntu. Although this tutorial is not a book, I had a similar situation with the ansible docs and trying ...
I used the O'Reilly Ansible book: "Ansible: Up and Running, 2nd Edition" to learn Ansible and found it well-paced and helpful. It suggests using Vagrant to work with a virtual machine (VM) on your normal desktop/laptop to practise what you've learned, an approach I find very helpful - including now, since this is also ...
132,075
I want to create a list of random integers in the range [0, 9], that sums up to 100 in Excel, using VBA. The list should be printed in a single column. The routine I've written is as follows: ```vbs Sub RandomList() Dim arr(100) As Integer Dim i As Integer i = 0 Do arr(i) = Int(10 * Rnd()) ...
2016/06/15
[ "https://codereview.stackexchange.com/questions/132075", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/109032/" ]
The procedure is doing a number of completely unrelated things that should be separated: * Populating an array with random integers * Dumping an array of random integers onto a worksheet Make the procedure a `Function`, and rename it to something that starts with a verb, something that *tells the reader what it does*...
I think it's pretty good. An alternate way of handling some of that would be ``` Option Explicit Public Sub RandomList() Columns(1).Clear Dim myNumbers(100) As Long Dim i As Long Dim j As Long Dim k as Long i = 0 k = 0 Do j = Int(10 * Rnd()) 'If j = 0 Then j = 1 optional...
46,056,121
I am having trouble with understanding `%in%`. In Hadley Wickham's Book "R for data science" in section 5.2.2 it says, "A useful short-hand for this problem is `x %in% y`. This will select every row where x is one of the values in y." Then this example is given: ``` nov_dec <- filter(flights, month %in% c(11, 12)) `...
2017/09/05
[ "https://Stackoverflow.com/questions/46056121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5024631/" ]
> > It appears that it should be selecting every row where y is one of the values in x(?) So in the example, all the cases where 11 and 12 appear in "month." > > > If you don't understand the behavior from looking at the example, try it out yourself. For example, you could do this: ``` > c(1,2,3) %in% c(2,4,6) [1...
this explicitly means: are value from x also in y The best way to understand is a exemple : ``` x <- 1:10 # numbers from 1 to 10 y <- (1:5)*2 # pair numbers between 2 and 10 y %in% x # all pair numbers between 2 and 10 are in numbers from 1 to 10 x %in% y #only pair numbers are return as True ```
40,084,287
As shown in image, I have added the same fragment 5 times in activity by performing on click operation on **ADD FRAGMENT** button: ![](https://i.stack.imgur.com/OZ2Xzm.png) Now I want to get all user entered data from those 5 edittext on click of GET DATA button. Is this possible? (Both buttons is in Main Activity)
2016/10/17
[ "https://Stackoverflow.com/questions/40084287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5629657/" ]
My team colleague found a way which allows you to run migrations on build artefacts without sources. Following command replace `migrate.exe` for us: ``` dotnet exec --runtimeconfig ./HOST.runtimeconfig.json --depsfile ./HOST.deps.json Microsoft.EntityFrameworkCore.Design.dll --assembly ./DB_CONTEXT_DLL.dll ...
Seems not possible run `dotnet ef database update` only with the DLL, and if you use the docker, the actual version of runtime `microsoft/dotnet:1.1.0-preview1-runtime` do not have the sdk installed (with the `dotnet ef database update` command). One option to update database without use `dotnet ef database update` is...
518,985
My laptop diagnostic shows several pre-fails and has other issues so I am urgently shopping for a new laptop, my second using Ubuntu. I need a laptop with good graphics capabilities and have come across a couple with the Nvidia GeForce 840M graphics card. In other words, I do not have a problem now and am hoping to avo...
2014/09/02
[ "https://askubuntu.com/questions/518985", "https://askubuntu.com", "https://askubuntu.com/users/88517/" ]
I had a very similar problem and spent several days trying to get my card working. I have an ASUS X550LN which has an Intel Graphics Driver on the CPU and a dedicated NVIDIA GEFORCE GT 840M. First, installing the nvidia-340 drivers would cause Unity and Gnome to fail when launching. I could drop to a shell `Ctrl + Al...
Well, I had the same problem on my Z50-70. I tried many solutions including the ones described here. And I discovered something that worked much better for me than these two. First add the apt-repository: `sudo add-apt-repository ppa:xorg-edgers/ppa`. Then update package database `sudo apt-get update`. And then inst...
228,759
Unlike everyone elses problems! Mine crashes after I've logged on; at the part that says: "Mojang". I had mods installed but have since removed them completely and it still isn't working. Below I've attached the minecraft crash report: ``` ---- Minecraft Crash Report ---- // My bad. Time: 7/20/15 9:27 PM Descripti...
2015/07/20
[ "https://gaming.stackexchange.com/questions/228759", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/119026/" ]
Try upgrading your Java to a newer version, because the crash report indicates an older version. (Possibly an error for the indication, because it is possible to misindicate Java 8 as Java 1.40)
Go to Options > Video Settings. Make sure both VBOs and VSync are turned on. I see from your crash report VBOs are on, but VSync isn't there. I assume you don't have it on.
129,185
What word would mean "a grand, symbolic action" more specifically, taken in an attempt to prove a point? For example, I am trying to figure out the word that would fill in the following sentence using the above definition: > > "Charlie gave every last dime he had to charity, just to prove that he didn't care abou...
2013/09/28
[ "https://english.stackexchange.com/questions/129185", "https://english.stackexchange.com", "https://english.stackexchange.com/users/19688/" ]
> > The gift of the signet ring to Mordecai by Ashuerus was [an impressive **gesture**](http://books.google.co.uk/books?id=zMVbuD633XEC&pg=PA329&dq=%22an+impressive+gesture%22&hl=en&sa=X&ei=TjpHUuOvK6KK4wS_44HgCA&ved=0CEcQ6AEwBDgU#v=onepage&q=%22an%20impressive%20gesture%22&f=false) of the honor in which he was held. ...
Here, we can reach for a French "coup de something" term. A brilliantly successful action, or something of that sort, is a *coup d’[éclat](http://en.wiktionary.org/wiki/%C3%A9clat)*. If we fit this into > > "Charlie gave every last dime he had to charity, just to prove that he didn't care about material possessions...
10,021,927
I have a 10GB file with 200 million lines. I need to get unique lines of this file. My code: ``` while(<>) { chomp; $tmp{$_}=1; } #print... ``` I only have 2GB memory. How can I solve this problem?
2012/04/05
[ "https://Stackoverflow.com/questions/10021927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314230/" ]
If you don't care about time/IO constraints, nor disk constraints (e.g. you have 10 more GB space), you can do the following dumb algorithm: 1) Read the file (which sounds like it has 50 character lines). While scanning it, remember the longest line length `$L`. 2) Analyze the first 3 characters (if you know char #1 ...
If you have more processor and have at least 15GB free space and your storage fast enough, you could try this out. This will process it in paralel. ``` split --lines=100000 -d 4 -d input.file find . -name "x*" -print|xargs -n 1 -P10 -I SPLITTED_FILE sort -u SPLITTED_FILE>unique.SPLITTED_FILE cat unique.*>output.file r...
503,617
So I recovered a text file from an old hdd, but I failed to completely recover all of the data. The data that wasn't correctly recovered has returned as null bytes. How can I remove every line from the file that contains these bytes? Example of corrupt data ``` xE3 xAF xE2 xBF NUL xBD ``` and a ton more... I know ...
2019/02/28
[ "https://unix.stackexchange.com/questions/503617", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/339364/" ]
To remove lines that contain byte 0 or bytes 128 to 255, you can use: ``` perl -ne 'print unless /[\0\200-\377]/' ``` Or with GNU `grep` built with PCRE support: ``` LC_ALL=C grep -vaP '[\0\200-\377]' ``` See also the `strings` command to extract what looks like printable text from data. To just remove those byt...
Yes. You can do it like this: `sed -e '/\x00/d' [filename] > [new_filename]` If you want to edit the file in-place: `sed -i '/\x00/d' [filename]` You can also, combine the two, change the original file and keep a backup copy: `sed -i~ '/\x00/d' [filename]` That will delete any line of the file that...
21,506,505
Here is the link to the documentation on GitHub: <https://github.com/Unitech/pm2#startup-script-generation--pm2-startup> It is setup to work with Ubuntu/CentOS/Redhat. I need it to work with my Dreamhost VPS which is a Debian machine. Can someone advise me on how I might tweak the init script to make it work on a Deb...
2014/02/02
[ "https://Stackoverflow.com/questions/21506505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1766637/" ]
Try ubuntu solution. Since ubuntu is a debian fork, it should work there.
You can just add a cronjob like: ``` @reboot cd /path/to/app && pm2 start app.js ``` Remember to install the cron in the user that will run the daemon, **NOT ROOT**. If you user can't install the cron, just install the cron where you prefer and add the parameter `-u` to specify the daemon runner user.
3,505,128
The latter makes perfect sense to me, but what's the skinny with the former? I researched but couldn't understand the drift. TIA
2020/01/11
[ "https://math.stackexchange.com/questions/3505128", "https://math.stackexchange.com", "https://math.stackexchange.com/users/740977/" ]
Consider the Number line marked with integers. Now, Paste the integer $60$ over $0$ and wrap around the entire number line over the circle formed as above. Now, we see that when we count on the above number line constructed by the above procedure, the integer $-1$ coincides with the integer $59$. This is called **Modu...
Welcome to Maths SX! I suppose you're asking why $-1\bmod 60\equiv 59$? This is is because $59+1\equiv 0\bmod 60$, so in the ring $\;\mathbf Z/60\mathbf Z$, the opposite of the congruence class of $1$ is the congruence class of $59$, by definition of the opposite of an element (i.e. its additive inverse).
32,132,333
I tried various methods fro internet to pass spinner selected item to other class and display in text view Below is my code. Whenever I open my app,It crashes. Your suggestions are greatly appreciated. Thanks in Advance. This is my first class BuddyActivity ``` @Override public void onCreate(Bundle savedInstanceStat...
2015/08/21
[ "https://Stackoverflow.com/questions/32132333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4975774/" ]
Use this peice of code in your BuddyActivity: ``` Intent i = new Intent(BuddyActivity.this,search_project.class); String selectedItem = transportSpinner.getSelectedItem().toString(); i.putExtra("transportSpinnerValue", selectedItem); startActivity(i); ``` And use this peice of code in your second class: ``` Intent ...
Class.1.java ``` but.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Spinner transportSpinner = (Spinner) findViewById(R.id.spinnerSection); Intent i = new Intent(BuddyActivity.this,search_project.class); i.putExtra("transportSpinnerValue", transp...
22,043,480
I'm using java 1.6. I have a set of items, and each item has a name and a set of components. each component also has a name. ``` Set<Item> Class Item String name Set<Component> Class Component String name ``` I'm now tasked with writing a method with input: item name + component name, and output: does ...
2014/02/26
[ "https://Stackoverflow.com/questions/22043480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1884155/" ]
If you can change your Item class you can do it like that: ``` class Item { String name; Map<String, Component> components; } ``` In the map above key is the name of component. Than change your code to: ``` public boolean hasItemComponentPair(String itemName, String componentName) { for(Item item : ge...
Override the equals and hashCode method in your Item and Component classes like following: ``` // Item.java import java.util.Set; public class Item { private String name; private Set<Component> components; public Item(String name) { this.name = name; } @Override public int hashCode() { retur...
44,708,248
Despite the conventions of R, data collection and entry is for me most easily done in vertical columns. Therefore, I have a question about efficiently converting to horizontal rows with the gather() function in the tidyverse library. I find myself using gather() over and over which seems inefficient. Is there a more ef...
2017/06/22
[ "https://Stackoverflow.com/questions/44708248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8201326/" ]
if I get the question right, you could do that by first gathering everything together, and then "spreading" on mass and heart rate: ``` library(forcats) library(dplyr) mass_levs <- names(vertical.data)[grep("mass", names(vertical.data))] hearth_levs <- names(vertical.data)[grep("heart", names(vertical.data...
Though already answered, I have a different solution in which you save a list of the gather parameters you would like to run, and then run the gather\_() command for each set of parameters in the list. ``` # Create a list of gather parameters # Format is key, value, columns_to_gather gather.list <- list(c("age", "mass...
2,693,883
I'd like to write a python function that has a dynamically created docstring. In essence for a function `func()` I want `func.__doc__` to be a descriptor that calls a custom `__get__` function create the docstring on request. Then `help(func)` should return the dynamically generated docstring. The context here is to w...
2010/04/22
[ "https://Stackoverflow.com/questions/2693883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/323631/" ]
You can't do what you're looking to do, in the way you want to do it. From your description it seems like you could do something like this: ``` for tool in find_tools(): def __tool(*arg): validate_args(tool, args) return execute_tool(tool, args) __tool.__name__ = tool.name __tool.__doc__ =...
*(Python 3 solution)* You could make use of Python's duck typing to implement a dynamic string: ``` import time def fn(): pass class mydoc( str ): def expandtabs( self, *args, **kwargs ): return "this is a dynamic strting created on {}".format( time.asctime() ).expandtabs( *args, **kwargs ) fn.__do...
753,687
I have a model that has an ordering field under its Meta class. When I perform a query and get back a QuerySet for the model it is in the order specified. However if I have instances of this model that are in a list and execute the sort method on the list the order is different from the one I want. Is there a way to so...
2009/04/15
[ "https://Stackoverflow.com/questions/753687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84952/" ]
Not automatically, but with a bit of work, yes. You need to define a comparator function (or **cmp** method on the model class) that can compare two model instances according to the relevant attribute. For instance: ``` class Dated(models.Model): ... created = models.DateTimeField(default=datetime.now) class Me...
Building on Carl's answer, you could easily add the ability to use all the ordering fields and even detect the ones that are in reverse order. ``` class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) birthday = date = models.DateField() class Met...
54,823,669
I get this JSON from my server. But to work with this JSON i need to Add Square Brackets to the MH Object. How can i do that. I tried `.map` but i dont get it to work for me. Is there any better solution. Or is `.map`to use there. If yes can you show me a hint how to do that. Or is there a better solution? ``` { "...
2019/02/22
[ "https://Stackoverflow.com/questions/54823669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10743267/" ]
It's not really "adding square brackets", it's wrapping the "MH" object in an array. Anyway, here's a `.map` statement that will do it for you (without mutating the original data, hence the `Object.assign` shenanigans): ``` data.PAD = data.PAD.map((padObj) => Object.assign({}, padObj, {MH: [padObj.MH]})); ``` Basic...
If you want to add an array of strings (adding brackets only around the strings) then the above may work, however if you are trying to make the property an array what you need to do is cast the JSON Property as a list in the class as per: ``` public class AddressElements implements Serializable { @JsonProperty("S...
30,855,864
I am trying to build a springboot project I built with Spring Tools Suite. I get the following error when I execute `$mvn spring-boot:run` ``` Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata...
2015/06/15
[ "https://Stackoverflow.com/questions/30855864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5013168/" ]
Typos are a possible reason for this error. Be sure to check you wrote `spring-boot` and not e.g. `springboot` or `sprint-boot` or `springbok` or whatever. Also check the ordering : use `spring-boot:run` and not `run:spring-boot`.
In my case I got this error after updating my spring boot in pom.xml and running it in Eclipse. The source of the error is that the run configuration was set to offline, thus it couldn't download plugins on run.
13,603,215
How do I use a loop to name variables? For example, if I wanted to have a variable `double_1 = 2`, `double_2 = 4` all the the way to `double_12 = 24`, how would I write it? I get the feeling it would be something like this: ``` for x in range(1, 13): double_x = x * 2 # I want the x in double_x to count up, e...
2012/11/28
[ "https://Stackoverflow.com/questions/13603215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1859481/" ]
expanding my comment: "use a dict. it is exactly why they were created" using defaultdict: ``` >>> from collections import defaultdict >>> d = defaultdict(int) ``` using normal dict: ``` >>> d = {} ``` the rest: ``` >>> for x in range(1, 13): d['double_%02d' % x] = x * 2 >>> for key, value in sorted(d.item...
As already mentioned, you should use a dict. Here's a nice easy way to create one that meets your requirements. ``` >>> {k:k*2 for k in range(1,13)} {1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12, 7: 14, 8: 16, 9: 18, 10: 20, 11: 22, 12: 24} ```
198,182
I am creating an application that visually displays world regions, e.g. to place markers within an administrative region. Does a dataset exist with geometrical or geographical (long/lat) descriptions of the world's current country borders (and possibly other administrative divisions)? Ideally the dataset would be in a...
2013/05/15
[ "https://softwareengineering.stackexchange.com/questions/198182", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/65587/" ]
<http://gadm.org/> seems to have exactly what you want (and more). > > ### GADM database of Global Administrative Areas > > > GADM is a spatial database of the location of the world's administrative areas (or adminstrative boundaries) for use in GIS and similar software. Administrative areas in this database are co...
Just earned the "popular question" bagde for this question. Therefore, maybe for someone helps the next. I'm currently using free 1:110 mil. shapefiles from <http://www.naturalearthdata.com>. From their site: > > Natural Earth was built through a collaboration of many volunteers and > is supported by NACIS (North ...
14,421,846
I'm working on a search feature to search for model numbers and I'm trying to get MySQL to show me results similar to what I'm asking for but LIKE %$var% doesn't do it. Example (we'll call table, "tbl\_models"): ``` id model +-------+--------------------+ | 1 | DV6233SE | | 2 | Stud...
2013/01/20
[ "https://Stackoverflow.com/questions/14421846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1992593/" ]
Based on the answer provided by SaurabhV (thanks again!), I was able to create a function which takes a string and replaces each letter with an underscore in sequence. I hope this can help someone else down the road also! ``` function get_combination($string) { // Pa = Pass, Pos = Character Position, Len = String ...
You can use `PHP` function as described above,or maybe `SOUNDEX` can help you. Look at [this](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_soundex).
17,084,708
In an example of android code given in a book regarding action bar, the sample given is as the following: ``` MenuItem menu1 = menu.add(0, 0, 0, "Item 1"); { menu1.setIcon(R.drawable.ic_launcher); menu1.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } ``` How is using curly braces after a semi-colon possible?...
2013/06/13
[ "https://Stackoverflow.com/questions/17084708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2277257/" ]
They are completely optional in this case and have no side-effect at all. In your example it sole serves to purpose of making the code more readable by intending the property assignment which belong to the control. You could as well do it without the braces. But if you'd use a tool to reformat your code, the indentatio...
It's called anonymous code blocks, they are supposed to `restrict the variable scope`.
258,959
Many times I heard people say that "beat up someone". But on the internet, I can only found this definition which does not seem matching with the word beat up in the above sentence "beat-up:`(of a thing) worn out by overuse; in a state of disrepair.`" <https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&...
2015/07/13
[ "https://english.stackexchange.com/questions/258959", "https://english.stackexchange.com", "https://english.stackexchange.com/users/105551/" ]
The particle "up" in "beat up" is a *telicity marker*. [***Telicity***](https://en.wikipedia.org/wiki/Telicity) is a property of the verb that can be simply rendered as *completed-ness* of the action expressed by it. The book [*Particle verbs in English*](http://www.amazon.co.uk/gp/search?index=books&linkCode=qs&key...
Aside from the already present answers (and expanding on StoneyB's answer) this could originate from the fact that English is a Germanic language. There are many similarities between English and German and one of them is what in German is known as a "separable verb". First you need a "separable prefix". An example is ...
18,104,600
I can set action on click for html button. But I need to set action only on FIRST click. Is there any way to do this? The button is radio in form. Some javascript maybe? What's important - the radio button still might be changed. But action has to be done only once. This doesn't work ``` function myfunction(i){ oFo...
2013/08/07
[ "https://Stackoverflow.com/questions/18104600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2125442/" ]
The cleanest solution is probably to use [removeEventListener](https://developer.mozilla.org/fr/docs/DOM/element.removeEventListener) to... remove the event listener : ``` var myButton = document.getElementById('someId'); var handler = function(){ // doSomething myButton.removeEventListener('click',handler); } m...
To resolve this problem I have used jQuery.on as well as jQuery.off - see my code on jsfiddle! ``` $(document).ready(function() { var button = $('#my-button'); function onClick() { alert('clicked'); button.off('click', onClick); }; button.on('click', onClick); }); ``` <http://jsfidd...
16,869,043
Here's a C/C++ for loop: ``` int i; for (i = myVar; i != someCondition(); i++) doSomething(); // i is now myVar plus the number of iterations until someCondition ``` I recently had to use a loop like this. I needed to keep the value of `i` because I wanted to know what `i` was when the return value of `someConditi...
2013/06/01
[ "https://Stackoverflow.com/questions/16869043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313273/" ]
What you need is, ``` for( ; myVar != someCondition(); myVar++) doSomething(); ``` But you statement about the following loop being incorrect is wrong, ``` for (myVar; myVar != someCondition(); myVar++) doSomething(); ``` The above code will also work fine in C.
I feel that a `while` loop more closely resembles your intentions. Indeed, you are doing something `while` `someCondition()` is `true`, and increasing `myVar` is a side effect. ``` while(myvar != someCondition()) { doSomething(); myVar++; } ``` To be clear: the statements are equivalent. I am just advocating for ...
50,865,661
I'm using Stripe Checkout in my React App. Somehow I'm not passing the properties to my onToken function correctly as I'm getting not defined errors. I eventually need to send a bunch of props, but for now just trying to get it to work correctly. ``` import axios from 'axios' import React from 'react' import StripeCh...
2018/06/14
[ "https://Stackoverflow.com/questions/50865661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5153877/" ]
`isset()` is a function in PHP that will return true if the variable, in this case, $var has been assigned a value. If the variable has been created but nothing assigned, has the value of null or undefined, it will return false. basically, `isset($var)` says is this variable safe to use or not. Update ====== To expla...
Basically a variable that is not declared, not assigned, or NULL is not set. To prove the comparison table you can test it with `isset()` ``` if (isset($var)) { echo "it is set."; } ```
90,112
Is Double-Encoding still a security vulnerability on IIS6 as it was in IIS4/5?
2009/12/02
[ "https://serverfault.com/questions/90112", "https://serverfault.com", "https://serverfault.com/users/22918/" ]
The answer is yes and no, Strictly speaking, on the MS-API level, The issue has been rectified. Of course, if your application deals with encoding and requests paths that may not be contingent upon the URI provided - You're vulnerable and you're going to want to provide filtering AFTER any applicable encoding has been ...
If you are talking about [this kind of web application attack](http://www.owasp.org/index.php/Double_Encoding), then this is really most often due to a problem in the web application's code and not the web server behaviour. This particular issue is a problem on any and all web servers.
1,040,547
What is the range of $$\large\frac{1}{e^{x^2}+3}$$ I know that the answer is $\dfrac{1}{4}\ge h(x)\gt0$, but how do I show it ![Grpah of h(x)](https://i.stack.imgur.com/y1dlo.png)
2014/11/27
[ "https://math.stackexchange.com/questions/1040547", "https://math.stackexchange.com", "https://math.stackexchange.com/users/173503/" ]
* $x^2$ has a range of $[0,\infty)$. * So $e^{x^2}$ has a range of $[1,\infty)$ (knowing that $\exp$ is increasing tells us this). * So $e^{x^2}+3$ has a range of $[4,\infty)$. * So $\frac{1}{e^{x^2}+3}$ has a range of $(0,1/4]$ (knowing that the reciprocal function is decreasing and continuous on $[4,\infty)$ te...
$e^{x^2}\geq1 $ for $x\geq0$ . So, $e^{x^2} + 3 \geq 4$. If $y \geq4 $, then $1/y \leq 1/4$.
19,441,921
I'm writing a nodejs cli utility (NPM module intended to be installed globally) that will need to store some user-supplied values. What is the best way to store these values on a system? For example, should I create my own config file under say: `/etc/{my-utility-name}/conf.json` and have this directory+file initializ...
2013/10/18
[ "https://Stackoverflow.com/questions/19441921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/480807/" ]
I found that the yeoman project has a package for this called [configstore](https://github.com/yeoman/configstore). I tried it out and the API is incredibly simple and easy to use and abstracts out any need to worry about OS compatibility. Getting and setting configs is as easy as: ```js const Configstore = require('...
I wrote the **cli-config** API to manage NodeJS app configuration including: * Package defaults * Local user config * Command line options * App overrides Visit <https://github.com/tohagan/cli-config> for more details. ### Example 1: Combines configuration options from package file `defaults.config` then `~/.<appn...
629
On my Ubuntu UNR install, for some reason, I'm only able to switch the input language if I press `Shift` and then `Alt`. This is quite the opposite of what usually works -- on Windows and other Ubuntu/other Linux systems -- where I press `Alt` and then add `Shift`. Anyone know why this is?
2010/08/01
[ "https://askubuntu.com/questions/629", "https://askubuntu.com", "https://askubuntu.com/users/199/" ]
Unfortunately, there are a number of long-standing bugs in handling switching between keyboard layout. I, for one, had problem with those in 9.10. For me they were fixed in 10.04. (FYI, [this](https://bugs.edge.launchpad.net/gdm/+bug/460328) is the bug that bit me.) Perhaps and upgrade to 10.04, which is a stable one a...
In my case it seems to be doing this whenever I set any `Shift` keys to toggle or cancel Caps Lock under the `Miscellaneous compatibility options` in the Keyboard Preferences (Keyboard Layout Options).
1,893,780
I have e table like this : ``` A B 1 1.5 1 1.5 2 2.3 2 2.3 2 2.3 3 1.5 3 1.5 ``` how could i make the sum of column B, grouped by in 1.5, 2.3 and 1.5. in few words, I want to group by first and then make the sum(), but in one select. in this table, if you group by A column the result is: ``` A B 1 1.5 2 2.3 3 1.5 ...
2009/12/12
[ "https://Stackoverflow.com/questions/1893780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98655/" ]
``` select A, sum(B) from table group by A ``` Should do the trick.
``` SELECT SUM(B) FROM (SELECT DISTINCT A, B FROM tbl) PLEASE ```
52,076,149
I was trying to link my MySQL table to my java project and I wanted to reciprocate my MySQL table on my java frame. I have written this code so far. ``` try{ Class.forName(cn); Connection con = (Connection) DriverManager.getConnection(url, u, p); Statement stmt = (Statement) con.createStatement(); Str...
2018/08/29
[ "https://Stackoverflow.com/questions/52076149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10285186/" ]
I think if you are learning Java programming with Swing and a database here are couple of ideas: 1. Try to do the application in stages. 2. To start with code the GUI portion only with some dummy data (not the database data; you are not connected to the database yet). 3. At this point you are able to display a window ...
I can offer a few suggestions to improve your code: 1. Don't create database connections in method scope. Use a pool to manage them and pass the connection into the object that requires it. 2. Make your SQL a static string. 3. What is that stored procedure doing for you? Straight, vanilla SQL should be enough to query...
42,688,211
\*\*\*\*Css File Cannot connect with the below\*\*\*\* it is in the flow of root /index.html /server.js /css/style.css **My /server.js Code** ```js var http = require('http'), fs = require('fs'); fs.readFile('./index.html', function (err, html) { if (err) { throw err; } http...
2017/03/09
[ "https://Stackoverflow.com/questions/42688211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7682440/" ]
The problem is caused by your web server not checking the path of the URL request but is rather going to return the same HTML file no mater the path or file extension you use. To get around this shortcoming of the node http module I would recommend utilizing a framework such as express.js Or if you only want to serve s...
Just Replace this line of code : ``` <link rel="stylesheet" type="text/css" href="/css/style.css" /> ``` with this, ``` <link rel="stylesheet" type="text/css" href="./css/style.css" /> ```
312,530
[Cisco antenna explanation](http://www.cisco.com/c/en/us/support/docs/wireless-mobility/wireless-lan-wlan/82068-omni-vs-direct.html) Here it says that antenna is passive device which doesn't offer any added power to the signal. But at same time it says that antenna is responsible for increasing the amount of energy to...
2017/06/22
[ "https://electronics.stackexchange.com/questions/312530", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/152875/" ]
An antenna is a passive device. The gain of an antenna refers to its directivity times efficiency compared to an isotropic antenna. An isotropic antenna is a theoretical antenna that radiates equally in all directions. If this antenna were encapsulated in the center of a sphere, it would illuminate all parts of the s...
It is passive, in that there are no electronics in it and it requires no power supply. However the shape and size of the antenna affects the shape and size of the radiation pattern that is emitted from it. At the heart all antennae are just a "dipole" - that is, two conductors heading away from each other (or a monop...
31,370,624
I have looked up and there are a few threads similar to this but I cant make any of them work for me so I have to ask my code at the moment is.It is different ``` <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="stylespacewars.css" /> <script src="jsspacewars.js"></script> <script...
2015/07/12
[ "https://Stackoverflow.com/questions/31370624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5108449/" ]
Your HTML and JS is a bit off. `img` tags go in the `body`. And for the jQuery you need to use `.` when referencing by class name. <http://jsfiddle.net/imthenachoman/1h3vsa3w/1/> The HTML: ``` <body> <img class="Ship" src="Ally ship.gif" alt="HTML5 Icon" /> <img class="EnemieBasic" src="Basic enemie.gif" alt...
Like this? <http://jsfiddle.net/JPvya/1275/> You weren't targeting the class by using the `.selector` method. Furthermore, you had the `img` in the `head` of your document. It needed to be part of the `body`.
233,399
I'm wondering if that is possible, so that I can use some X11 window manager for everything.
2016/04/01
[ "https://apple.stackexchange.com/questions/233399", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/4304/" ]
No. Native OS X apps don't call down to X11 protocol and no one (Apple or other) has implemented any sort of shim/translation layer/conversion tool to port over the API. It would surely involve slowdown, reduced acceleration, possibly loss of fidelity and loss of functionality.
You could have an alternate login to X11, but use a non- Apple X11 VNC client to call Apple screen sharing.
24,232,064
Code below is me trying to do just that. It returns all rows but only like DEFAULT VALUES (0, empty string, empty date...) and "Allow Nulls" is false for all columns in my db table. I am truly stuck. I am still in process of learning c#, so if someone could please explain to me WHAT am I doing wrong here? Is there a be...
2014/06/15
[ "https://Stackoverflow.com/questions/24232064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448923/" ]
There is a better way ( You need to just do it once and it will help in future). Derive a class from DbDataReader that will take sqldatareader in the constructor: ``` public class CustomReader : DbDataReader { private readonly SqlDataReader sqlDataReader; //Set the sqlDataReader public CustomReader(SqlDat...
Well it turns out that the code in my first post is OK! The mistake was in my POCO definition. This is what caused the problem : ``` ... private DateTime _dt_get; public DateTime dt_get { get { return _dt_get; } set { value = _dt_get; } // <-- !!! insted of set { _dt_get = value; } } ... ``` Thx for...
50,434,546
I am having an issue. I have the code defined here: ```js $('.js-cars-item [type="checkbox"]').change(function() { var idx = $(this).closest('li').index(); //Get the index - Number in order var chk = $(this).is(":checked"); //Get if checked or not var obj = this; //Checkbox object $('.js-cars-item').each(...
2018/05/20
[ "https://Stackoverflow.com/questions/50434546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7930353/" ]
1. Just use two different paths for processed and not processed blobs. 2. Put your new blobs with prefix ("notprocessed-" for example), when renaming remove prefix. Set `"path": "input/notprocessed-{name}"`
Actually, blob service only **supports filtering by blob prefix and not by suffix**. Your only option would be to list blobs and then do client side filtering. Also, the list blobs operation has an additional `delimiter` parameter that enables the caller to traverse the blob namespace by using a user-configured delimi...
1,111,527
I'm writing a Java application that will instantiate objects of a class to represent clients that have connected and registered with an external system on the other side of my application. Each client object has two nested classes within it, representing front-end and back-end. the front-end class will continuously r...
2009/07/10
[ "https://Stackoverflow.com/questions/1111527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136475/" ]
HTTPS is HTTP over SSL. So the whole HTTP communication is encrypted.
The entire HTTP session is encrypted including both the header and the body. Any packet sniffer should be able to show you the raw traffic, but it'll just look like random bytes to someone without a deep understanding of SSL, and even then you won't get beyond seeing the key exchange as a third party.
51,515
I've searched the Internet and found the question [Pattern(s) about hierarchical settings overwriting](https://softwareengineering.stackexchange.com/questions/159185/patterns-about-hierarchical-settings-overwriting) on Software Engineering SE. It exactly describes my need, the only difference is that I need to store th...
2013/10/15
[ "https://dba.stackexchange.com/questions/51515", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/10817/" ]
You don't give a lot of detail on your current structure, so I'm assuming each node in the hierarchy is in a simple table with a single parent relationship like so and the path being a string of ID like `/<rootNodeID>/<GPNodeID>/<PNodeID>/<LeadNodeID>` and that you intend to store the settings in a property bag arrange...
SQL Server 2016 has Hierarchical Data. Please refer to [Hierarchical Data (SQL Server)](https://msdn.microsoft.com/en-us/library/bb677173.aspx) in the product documentation. You can use `hierarchyid` to define the node hierarchy for each row. The link gives a clear example of how to use `hierarchyid` data type for a ...