qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
33,299,667
I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t...
2015/10/23
[ "https://Stackoverflow.com/questions/33299667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5303568/" ]
Square Root of a number, given that the number is a perfect square. The complexity is log(n) ``` /** * Calculate square root if the given number is a perfect square. * * Approach: Sum of n odd numbers is equals to the square root of n*n, given * that n is a perfect square. * * @param number * @return squareR...
``` #include <iostream> using namespace std; int main() { double x = 1, average, s, r; cout << "Squareroot a Number: "; cin >> s; r = s * 2; for ( ; ; ) //for ; ; ; is to run the code forever until it breaks { average = (x + s / x) / 2; if (x == average) { cou...
33,299,667
I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t...
2015/10/23
[ "https://Stackoverflow.com/questions/33299667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5303568/" ]
Below explanation is given for the integer square root calculation: > > In number theory, the integer square root of a positive > integer n is the positive integer m which is the greatest integer less > than or equal to the square root of n > > > The approach your started is good but needs several correction to...
This function uses Nested Intervals (untested) and you can define the accuracy: ``` #include <math.h> #include <stdio.h> double mySqrt(double r) { double l=0, m; do { m = (l+r)/2; if (m*m<2) { l = m; } else { r = m; } } while(fabs(m*m-2) > 1e-10); return m; } ``` ...
33,299,667
I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t...
2015/10/23
[ "https://Stackoverflow.com/questions/33299667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5303568/" ]
Below explanation is given for the integer square root calculation: > > In number theory, the integer square root of a positive > integer n is the positive integer m which is the greatest integer less > than or equal to the square root of n > > > The approach your started is good but needs several correction to...
The problem with your code, is that it only works if the square root of the number is exactly N\*0.1, where N is an integer, meaning that if the answer is 1.4142 and not 1.400000000 exactly your code will fail. There are better ways , but they're all more complicated and use numerical analysis to approximate the answer...
59,090,987
This is my XML: ``` <?xml version="1.0" encoding="utf-8"?> <Fruit> <Fruit_group name='Tropical'> <fruit_types name ='Tropical Used'> <fruit>bananas</fruit> <fruit>mangoes</fruit> </fruit_types> </Fruit_group> <Fruit_group name='Citrus'> <fruit_types name ='Citruses Used'> <fruit...
2019/11/28
[ "https://Stackoverflow.com/questions/59090987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7726727/" ]
As you have written, both `Virtual` and `Target` needs to provide a constructor for `Base`. If you make `Virtual` abstract, then it does not need to initialize `Base` any longer. ``` class Base { public: explicit Base(int arg) : arg(arg) {} private: const int arg; }; class Virtual : public virtu...
It is necessary because otherwise the compiler doesn't know how to call the costructor of `Virtual` on its own, when the object is not a part of furher inheritance chain. You don't have to provide a constructor for `Virtual`, but when you do, you need to initialise `Base` as well. (If you don't provide a constructor fo...
49,102,047
I have a checkbox field. I want to display the values from that field in a column view. The values in the field are names such as John Doe Smith. When there are multiple values in the checkbox they are displayed in an awkward manner. For instance John Doe Smith,Jane Doe Smith,Mary Doe Smith I want to remove the comma...
2018/03/05
[ "https://Stackoverflow.com/questions/49102047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3538181/" ]
[@Implode](https://www.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/basic/H_IMPLODE.html) is the way to go. Your column formula is then: ``` @Implode(YourCheckBoxField; ", ") ```
In the column properties, in the second tab, select the option "Show multiple values in separate entries" Sorry for the English, I'm using google translate
292,996
Hopefully this is something not too difficult! I am trying to get a voltage divider which has a positive and negative rail such as this: ![schematic](https://i.stack.imgur.com/ezVvn.png) [simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fezVvn.png) – Schematic created using [CircuitL...
2017/03/17
[ "https://electronics.stackexchange.com/questions/292996", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/138493/" ]
This is your equation for Vout in terms of V+,V- R1 and R2: VO = V+ - ((V+ - V-)/(R1+R2))\*R1 In short, just find the total voltage, divide by the total resistance to get current, then find the voltage drop across one of the resistors (I used R1) and use that to get VO. If you found the voltage across R1 then do V+ -...
You cannot *really* calculate the voltages across the divider because they depend on the current. This means the voltages depend on the load you plan to connect. This is because of Ohms law (U=I\*R), where I is unknown. In general, a voltage regulator such as the 7805 (positive 5V) or 7905 (negative 5V) is a better id...
292,996
Hopefully this is something not too difficult! I am trying to get a voltage divider which has a positive and negative rail such as this: ![schematic](https://i.stack.imgur.com/ezVvn.png) [simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fezVvn.png) – Schematic created using [CircuitL...
2017/03/17
[ "https://electronics.stackexchange.com/questions/292996", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/138493/" ]
This is your equation for Vout in terms of V+,V- R1 and R2: VO = V+ - ((V+ - V-)/(R1+R2))\*R1 In short, just find the total voltage, divide by the total resistance to get current, then find the voltage drop across one of the resistors (I used R1) and use that to get VO. If you found the voltage across R1 then do V+ -...
try this circuit with GND reference: [![enter image description here](https://i.stack.imgur.com/whuuD.png)](https://i.stack.imgur.com/whuuD.png)
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
Depends on the context, if its is a local variable, as eg ``` int num = text.scan(SEARCH_ENGINE_NAME).size(); ``` the more explicit the right-hand of the expression the shorter the name I'd pick. The rational is that we are in a limited scope of maybe 4-5 lines and can thus assume that the reader will be able to mak...
If it is a local variable in a function, I would probably call it `n`, or perhaps `ne`. Most functions only contain two or three variables, so a long name is unnecessary.
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
See similar [question](https://stackoverflow.com/questions/2230871/when-is-a-java-method-name-too-long) The [primary technical imperative](http://megakemp.wordpress.com/2008/10/07/mcconnells-primary-technical-imperative/) is to reduce complexity. Variables should be named to reduce complexity. Sometimes this results i...
I'd name it "search\_engine\_count", because it holds a count of search engines.
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
How about `numEngineNames`? Choosing variable names is more art than science. You want something that doesn't take an epoch to type, but long enough to be expressive. It's a subjective balance. Ask yourself, if someone were looking at the variable name for the first time, is it reasonably likely that person will unde...
See similar [question](https://stackoverflow.com/questions/2230871/when-is-a-java-method-name-too-long) The [primary technical imperative](http://megakemp.wordpress.com/2008/10/07/mcconnells-primary-technical-imperative/) is to reduce complexity. Variables should be named to reduce complexity. Sometimes this results i...
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
I'd name it "search\_engine\_count", because it holds a count of search engines.
Use `Esc`+`_`+`Esc` to write: ``` this_is_a_long_variable = 42 ``` `Esc`+`_`+`Esc` and `_` are not identical characters in Mathematica. That's why you are allowed to use the former but not the latter.
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
It depends on the scope of the variable. A local variable in a short function is usually not worth a 'perfect name', just call it `engine_count` or something like that. Usually the meaning will be easy to spot, if not a comment might be better than a two-line variable name. Variables of wider scope – i.e. global varia...
I'd name it "search\_engine\_count", because it holds a count of search engines.
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
How about `numEngineNames`? Choosing variable names is more art than science. You want something that doesn't take an epoch to type, but long enough to be expressive. It's a subjective balance. Ask yourself, if someone were looking at the variable name for the first time, is it reasonably likely that person will unde...
It depends on the scope of the variable. A local variable in a short function is usually not worth a 'perfect name', just call it `engine_count` or something like that. Usually the meaning will be easy to spot, if not a comment might be better than a two-line variable name. Variables of wider scope – i.e. global varia...
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
Depends on the context, if its is a local variable, as eg ``` int num = text.scan(SEARCH_ENGINE_NAME).size(); ``` the more explicit the right-hand of the expression the shorter the name I'd pick. The rational is that we are in a limited scope of maybe 4-5 lines and can thus assume that the reader will be able to mak...
When thinking about your code, try to look at it from the perspective of someone else. This will help not only with picking names, but with keeping your code readable as a whole. Having really long variable names will muddle up your code's readability, so you want to avoid those. But on the other end of the spectrum, ...
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
Use `Esc`+`_`+`Esc` to write: ``` this_is_a_long_variable = 42 ``` `Esc`+`_`+`Esc` and `_` are not identical characters in Mathematica. That's why you are allowed to use the former but not the latter.
If it is a local variable in a function, I would probably call it `n`, or perhaps `ne`. Most functions only contain two or three variables, so a long name is unnecessary.
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
A name is too long when there exists a shorter name that equally conveys the purpose of the variable. I think `engineCount` would be fine here. The number of engine names is presumably equal to the number of engines. See [JaredPar](https://stackoverflow.com/questions/2230871/when-is-a-java-method-name-too-long/223089...
Depends on the context, if its is a local variable, as eg ``` int num = text.scan(SEARCH_ENGINE_NAME).size(); ``` the more explicit the right-hand of the expression the shorter the name I'd pick. The rational is that we are in a limited scope of maybe 4-5 lines and can thus assume that the reader will be able to mak...
2,981,691
Lets say i have a variable that contains the number of search engine names in a file, what would you name it? * number\_of\_seach\_engine\_names * search\_engine\_name\_count * num\_search\_engines * engines * engine\_names * other name? The first name describes what the variable contains precisely, but isn't it too ...
2010/06/05
[ "https://Stackoverflow.com/questions/2981691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82044/" ]
It depends on the scope of the variable. A local variable in a short function is usually not worth a 'perfect name', just call it `engine_count` or something like that. Usually the meaning will be easy to spot, if not a comment might be better than a two-line variable name. Variables of wider scope – i.e. global varia...
Use `Esc`+`_`+`Esc` to write: ``` this_is_a_long_variable = 42 ``` `Esc`+`_`+`Esc` and `_` are not identical characters in Mathematica. That's why you are allowed to use the former but not the latter.
31,405,424
I have used following jquery code ``` jQuery.validator.addMethod("unique", function(value, element, params) { var prefix = params; var selector = jQuery.validator.format("[name!='{0}'][name^='{1}'][unique='{1}']", element.name, prefix); var matches = new Array(); $(selector).each(function(index, item)...
2015/07/14
[ "https://Stackoverflow.com/questions/31405424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1900235/" ]
You **cannot** use the same `name` on more than one input field. There is no workaround for this requirement of the plugin. (It's how the plugin keeps track of the input elements.) > > So how to fix it? > > > You **must** use a unique `name` on every input. `currency[1]`, `currency[2]`, etc.
It has nothing to do with your names. Your script is not loading properly. Blocked loading mixed active content "<http://ajax.microsoft.com/ajax/jquery.validate/1.8/jquery.validate.min.js>" This is the error shown in console.
57,176,363
I am using a **build\_runner** to generate auto-generated code in the flutter project. Issue: When I make an update in the model class and then I try to run below command, but it does not update auto-generated class. Command: ``` pub run build_runner build ``` Dart Packages: ``` built_value: '>=5.5.5 <7.0.0' bu...
2019/07/24
[ "https://Stackoverflow.com/questions/57176363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11157659/" ]
When it conflicts with current generated classes, it may possible that it will not update the generated classes. So I have tested with below command and it's working fine. ``` flutter packages pub run build_runner build --delete-conflicting-outputs ``` This will delete current conflict files and recreate as per the ...
You need to use the `watch` sub-command to Continuous generation of code. ``` flutter packages pub run build_runner watch ``` It runs a persistent build server that watches the files system for edits and does rebuilds as necessary.
1,714,286
There are allegedly six mistakes in the following network: [![enter image description here](https://i.stack.imgur.com/yL1Oj.png)](https://i.stack.imgur.com/yL1Oj.png) I was able to identify four: 1. Host A4's IP address 192.168.10.40 is subnet A's broadcast address. 2. Host A5's IP address 192.168.10.39 is outside su...
2022/04/03
[ "https://superuser.com/questions/1714286", "https://superuser.com", "https://superuser.com/users/1681804/" ]
This looks like the kind of homework question where the "correct" answer actually depends on the person who will be grading it. It may depend on what was taught earlier in the course; there are some things that could be overlooked unless you were specifically told "don't do it like that" the previous day. One actual p...
I guess that depends on how they count errors. Subnet A stops at 192.168.10.38. So, Host A4 is both the broadcast address **and** not addressable. Host A5 is outside the subnet. That gets you to five errors. Is the gateway address on eth0 correct? There's no indication of what network it's supposed to belong to.
16,786,739
I want to use [this](http://www.fileformat.info/info/unicode/char/1f4e1/index.htm) unicode character in my resource file. But whatever I do, I end with dalvikvm crash (tested with Android 2.3 and 4.2.2): ```none W/dalvikvm( 8797): JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xf0 W/dalvikvm( 879...
2013/05/28
[ "https://Stackoverflow.com/questions/16786739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/946409/" ]
Your character (`U+1F4E1`) is outside of Unicode BMP (Basic Multilingual Plane - range from `U+0000` to `U+FFFF`). Unfortunately, Android has very weak (if any) support for non-BMP characters. `UTF-8` representation for non-BMP characters requires 4 bytes (`0xF0 0x9F 0x93 0xA1`). But, Android `UTF-8` parser only under...
**Do it this way** Do not keep problematic emoji in the strings.xml add it programmatically ``` <string name="hi_welcome_msg">Hi %1$s</string> getString(R.string.hi_welcome_msg, user.getFullName() + " \uD83D\uDC4B" ); ```
840,207
I have an nginx.conf file currently that looks like this (with brackets replacing sensitive data): ``` worker_processes 3; events { worker_connections 1024; } http { access_log [/...]; error_log [/...] crit; include mime.types; sendfile on; server { server_name [...] [...]; ...
2017/03/23
[ "https://serverfault.com/questions/840207", "https://serverfault.com", "https://serverfault.com/users/290914/" ]
It's a simple issue of your location statements being out of order. Your wrote that you put the static file location clause *after* the `location / {}` block. This means your static files will be checked for there, first. Since your uwsgi socket can't find the file paths, it returns 404. What you want will look more ...
[The solution](https://stackoverflow.com/a/42998387/4400277) that resolved my issue was to put the `uwsgi_pass [.../uwsgi.sock];` clause inside of each `location {...}` block.
33,510,080
I am getting null pointer exception at the line ``` SessionFactory sesionFactory = new Configuration().configure().buildSessionFactory() ; ``` any suggestion what might be causing it ?? error log says this : ``` Exception in thread "main" java.lang.NullPointerException at org.hibernate.service.jdbc.connection...
2015/11/03
[ "https://Stackoverflow.com/questions/33510080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
CTE it is. ``` DECLARE @BeginPeriod DATETIME = '2010-06-10', @EndPeriod DATETIME = '2011-06-11' ;WITH cte AS ( SELECT DATEADD(month, DATEDIFF(month, 0, @BeginPeriod), 0) AS StartOfMonth, DATEADD(s, -1, DATEADD(mm, DATEDIFF(m, 0, @BeginPeriod) + 1, 0)) AS EndOfMonth UNION ALL SELECT DAT...
Another options with "Numbers" CTE ``` declare @df datetime, @dt datetime set @df = '20100610' set @dt = '20110611' ;WITH e1(n) AS ( SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION AL...
33,510,080
I am getting null pointer exception at the line ``` SessionFactory sesionFactory = new Configuration().configure().buildSessionFactory() ; ``` any suggestion what might be causing it ?? error log says this : ``` Exception in thread "main" java.lang.NullPointerException at org.hibernate.service.jdbc.connection...
2015/11/03
[ "https://Stackoverflow.com/questions/33510080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
CTE it is. ``` DECLARE @BeginPeriod DATETIME = '2010-06-10', @EndPeriod DATETIME = '2011-06-11' ;WITH cte AS ( SELECT DATEADD(month, DATEDIFF(month, 0, @BeginPeriod), 0) AS StartOfMonth, DATEADD(s, -1, DATEADD(mm, DATEDIFF(m, 0, @BeginPeriod) + 1, 0)) AS EndOfMonth UNION ALL SELECT DAT...
I know that this is an old question, but I just came across with the same problem recently, and wrote an version without CTE. Here's the tested [code](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=dabc4e41c58ab95b8d83c652996bd51c) ``` DECLARE @FromDate DATETIME , @ToDate DATETIME , @UpdateBeginDate B...
504,615
I have a Snap-On impact driver with a blown diode. I believe it's a flyback diode as it's on the output of the switch up to the motor. I can make out several markings on the diode. C39 and C5, there is also an M or an N. These markings don't make a lot of sense - I think some of the text is missing as the case is cra...
2020/06/09
[ "https://electronics.stackexchange.com/questions/504615", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/254883/" ]
The diode needs to be a fast recovery type, usually a Schottky too. A regular rectifier diode is too slow and will be overloading the output as you’ve seen.
Any 3Amp diode soldered in that place watching its polarity band, should do the job, it is to absorb high voltage spikes when forward motor current switches off, it generates a reverse current that can destroy the circuit and output switching transistor or hexfet or mosfet used as an output speed control transistor.
504,615
I have a Snap-On impact driver with a blown diode. I believe it's a flyback diode as it's on the output of the switch up to the motor. I can make out several markings on the diode. C39 and C5, there is also an M or an N. These markings don't make a lot of sense - I think some of the text is missing as the case is cra...
2020/06/09
[ "https://electronics.stackexchange.com/questions/504615", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/254883/" ]
The diode needs to be a fast recovery type, usually a Schottky too. A regular rectifier diode is too slow and will be overloading the output as you’ve seen.
Try 1N5401, or 1N5404. These are 3 A, 50 or 200 V diodes.
38,989,682
I am trying to upload my react-native apk to redmi note 3 but encountered an error unable to upload some apk after downgrading the gradle from 1.3.1 to 1.2.3 i was able to sought it but still after successfully uploading the app I can only see blank white screen. I am unable to see any app screen. I followed <https://...
2016/08/17
[ "https://Stackoverflow.com/questions/38989682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5850512/" ]
I have the same problem with my Redmi Note4 ( white screen and no develop pop-up menu ) I solved this problem by giving the permission to allow your react-native app to display Pop-up Window. After that the App works fine. It seems that you may have already solved this problem. If not, hope this answer can help you.
i dont know is my answer suitable or not , but i faced this problem , when i tried to root my phone using SuperSU . adb could find my device but i could not installing react-native app . so i restored my phone to before rooting and everything worked good ! my phone is Xiaomi Mi Note 3 .
9,153,616
I have 2 variables: 1. `UIView *view1;` 2. `UIView *view2 = [[UIView alloc] init]` When I assign `view1=view2` - should I release `view2`? Or just release `view1`? Or `view1 = [view2 retain]; [view1 release];` is right way?
2012/02/05
[ "https://Stackoverflow.com/questions/9153616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1160813/" ]
It totally depends on what `view1` and `view2` are at the time of your `view1 = view2`. If it's like this: ``` UIView *view1; UIView *view2 = [[UIView alloc] init]; ``` Then it's totally fine to just do: ``` view1 = view2; ``` If however `view1` already points to an object such as in this: ``` UIView *view1 = [[...
If you own an object (allocate, retain or copy it), you must release it. If you don't own it you don't release it. That is to say, that view2 owns the view, and view1 doesn't. You should release view2, but not view1.
32,293,027
Is it possible to use websockets (via socket.io etc.) in a React Native app for bidirectional communication with a custom backend rather that using the supported `fetch()` with polling etc.? For example, neccessary for a chat app with React Native. Their website does not mention an API for this yet.
2015/08/30
[ "https://Stackoverflow.com/questions/32293027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2605049/" ]
If "genre" is not defined in the route that matches the action method as a parameter, it will be passed as query string.
That's called a [query parameter](https://en.wikipedia.org/wiki/Query_string). It's a very common way to pass variables in the URL.
32,293,027
Is it possible to use websockets (via socket.io etc.) in a React Native app for bidirectional communication with a custom backend rather that using the supported `fetch()` with polling etc.? For example, neccessary for a chat app with React Native. Their website does not mention an API for this yet.
2015/08/30
[ "https://Stackoverflow.com/questions/32293027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2605049/" ]
There is typical example. We have one route for BookDetail: ``` routes.MapRoute( name: "BookDetail", url: "{controller}/{action}/{id}", defaults: new { controller = "Book", action = "Detail", id = UrlParameter.Optional } ); ``` **First example** - with one parameter `id` defined in route rule ``` <li>@Html...
That's called a [query parameter](https://en.wikipedia.org/wiki/Query_string). It's a very common way to pass variables in the URL.
50,819,117
I need to separate the three div's, remaining on the same line but the background color of each other does not allow that. The problem is, when I set additional margin or padding, the divs wrap up, not remaining aligned horizontally. ```css #service_container { text-align: center; } .servicon { font-size: 54...
2018/06/12
[ "https://Stackoverflow.com/questions/50819117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9681305/" ]
When you add margin to your a fixed width element, the calculated width adds the margin value to fixed width which will cause it to go underneath, and thats because there is no more space in the same line **Solution:** Wrap the content of your divs inside another div, and apply margin to the inner div, or just add pa...
The quick-and-dirty solution is to use a transparent border, and then clip the background to its inside boundary: ``` .service_page_tile { background-color: rgba(161, 204, 239, 0.5); background-clip: padding-box; border: 8px solid transparent; } ``` An advantage to this solution is that the tile background col...
265,615
I am trying to advance my coding skills and venture into the world of high-end microcontrollers, coming mainly from a Java background (1 year of android developer as a daytime job plus a bit of C developing around Attiny in Atmel Studio) I fell in love with the abstraction provided by STM's HAL. I am aware that this is...
2016/10/25
[ "https://electronics.stackexchange.com/questions/265615", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/127875/" ]
Basically what @bitsmack suggested should look something like this: ``` #include "stm32f4xx.h" #include "stm32f4xx_hal_cortex.h" #include "stm32f4xx_hal.h" void SystemClock_Config(void); int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure ...
I haven't used this HAL, but it looks like you are missing some necessary system configuration code. I would expect to see (at least) something like this: ``` RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; HAL_Init(); // Oscillator settings here: // ... // ... HAL_RCC_OscConfig(&RCC_OscI...
21,029,963
I am making an off-canvas navigation using Foundation, however, I only want the off-canvas nav to display on mobile devices, on desktop browsers I will use a standard navigation menu. My question is, can I reuse the code from my off-canvas nav for my desktop nav, or will I have to code 2 separate navigation menus? Her...
2014/01/09
[ "https://Stackoverflow.com/questions/21029963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3101431/" ]
You'll need to use separate sets of navigation in order to achieve what you're wanting, unfortunately. In order to use both, however, you'll need to structure your website to accommodate the off-canvas menu, but only call the off-canvas menu when you're on small menus. The menu that you'll use within the main part of t...
hide the navigation as follow: ``` .tab-bar, .left-off-canvas-menu { visibility: hidden; } ``` and display it usind media queries on small devices (150px - 600px): ``` @media only screen and (min-width: 150px) and (max-width: 600px){ /* only --> tells older browsers to ignore this code*/ /* DISPLAY ALTER...
6,196,297
Currently I'm using: ``` <% @items.each do |item| %> <li class="list-item"> <%= render :partial => '/widgets/vertical_widget', :object => item %> </li> <% end %> ``` to render about 20 items on a page (there's also another 20 of a different widget on the same page). When I look at my server l...
2011/06/01
[ "https://Stackoverflow.com/questions/6196297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/661469/" ]
Give `content_tag` a try: ``` #some_file.html.erb <ul> <%= render :partial => 'widgets/vertical_widget', :collection => @items, :locals => { :wrap_in => :li } %> </ul> #/widgets/vertical_widget.html.erb #First, render and capture the content once. <% @rendered_content = capture do %> #rend...
I realize this is a late answer but it may be useful to people with similar questions. Zabba's answer is very good and should help as a general guideline. However, your slowness problem is probably not to do with rendering. If a single render is taking 400ms, then it's likely that you are hitting the database repeate...
29,539,871
I tried using the Achart Engine and then GraphView to plot data coming from a sensor (real time, live updating) in opposite x-axis direction. I am doing it this way since I want to plot the Magnitude (y) in function of Frequency (x) and I am receiving these magnitudes in decreasing frequency order (from 6000Hz down to ...
2015/04/09
[ "https://Stackoverflow.com/questions/29539871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4658752/" ]
The `time` function typically returns the time in second resolution, which means that if you call `time(NULL)` twice within one second then you will get the same result. That will of course mean that you set the same starting seed to the random-number generator, which means the sequence will be the same. You typicall...
Move ``` srand ( time(NULL)); ``` to `main()` . You need to call `srand()` once in `main()` and keep calling `rand()`
116,590
On page 292 of the *Dungeon Master Guide*, **Filth Fever** is listed as a **DC 12**. The **Dire Rat** entry in the Monster Manual says the DC of Filth Fever inflicted by such a beast is **DC 11**. I'm currently ruling on the assumption that Filth Fever on it's own is a DC 12, but when inflicted by a Dire Rat it has a...
2018/03/03
[ "https://rpg.stackexchange.com/questions/116590", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/27573/" ]
You are correct. Sometimes diseases and poisons have specific DC when carried by certain creatures.
This is an intentional difference in the 'lethality' of a disease depending on circumstances like on what creature carries it and their HD, just as various poisons from various creatures have different DC from each other instead of having the same DC whatever the creature is. Here is a list with diseases and their usu...
116,590
On page 292 of the *Dungeon Master Guide*, **Filth Fever** is listed as a **DC 12**. The **Dire Rat** entry in the Monster Manual says the DC of Filth Fever inflicted by such a beast is **DC 11**. I'm currently ruling on the assumption that Filth Fever on it's own is a DC 12, but when inflicted by a Dire Rat it has a...
2018/03/03
[ "https://rpg.stackexchange.com/questions/116590", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/27573/" ]
The DCs are calculated differently. The Dire Rat's DC is constitution based. 10 + CON modifier. Dire Rat CON = 12 (+1 modifier), therefore DC 11.
This is an intentional difference in the 'lethality' of a disease depending on circumstances like on what creature carries it and their HD, just as various poisons from various creatures have different DC from each other instead of having the same DC whatever the creature is. Here is a list with diseases and their usu...
116,590
On page 292 of the *Dungeon Master Guide*, **Filth Fever** is listed as a **DC 12**. The **Dire Rat** entry in the Monster Manual says the DC of Filth Fever inflicted by such a beast is **DC 11**. I'm currently ruling on the assumption that Filth Fever on it's own is a DC 12, but when inflicted by a Dire Rat it has a...
2018/03/03
[ "https://rpg.stackexchange.com/questions/116590", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/27573/" ]
Your assumption is correct—it's both! ===================================== When there's a chance of exposure to [filth fever](http://dndsrd.net/abilitiesAndConditions.html#filth-fever) that's *not* dependent upon a creature exposing an adventurer to the disease, the disease filth fever typically requires succeeding o...
This is an intentional difference in the 'lethality' of a disease depending on circumstances like on what creature carries it and their HD, just as various poisons from various creatures have different DC from each other instead of having the same DC whatever the creature is. Here is a list with diseases and their usu...
19,229,725
I am trying to run karma as a grunt task on a Ubuntu 12.04 machine in Jenkins CI. The issue I am running into is that karma will not open Chrome and gives the following error: ``` Started by GitHub push by spencerapplegate [EnvInject] - Loading node environment variables. Building in workspace /var/lib/jenkins/jobs/re...
2013/10/07
[ "https://Stackoverflow.com/questions/19229725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577663/" ]
I had the same problem. After install **xvnc** plugin for Jenkins (<https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin>), problem disappeared.
For me, it was a misuse of karma start vs karma run. You need to have a karma server running, and use karma run in the jenkins job. See my question and answer [here](https://stackoverflow.com/questions/21124895/karma-cannot-start-firefox-with-jenkins-and-ubuntu-12-04 "here"). **Edit**: Lehu's answer works for both st...
36,367,008
I'm trying to install zeromq on OS X 10.11.2. To do this, the following shell commands were suggested: ``` cd libzmq ./autogen.sh && configure && make -j 4 ``` But when I enter the second line, I get the following errors: ``` configure.ac:59: error: missing some pkg-config macros (pkg-config package) If this toke...
2016/04/01
[ "https://Stackoverflow.com/questions/36367008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5739458/" ]
I had the same problem. Install pkg-config ``` apt-get install pkg-config ```
First of all, do not install anything manually. This adds unmanaged libraries and headers to your file system and you will meet a lot of problems in future. Use homebrew instead ``` brew install zeromq ``` If you really want to compile and install it manually - you are missing pkg-config, which itself must be instal...
5,605,527
Several radio buttons with the same name act as a set, where checking one unchecks the others. What is the scope of this behavior? 1. The form in which the button resides 2. The page / document on which the button resides 3. Does scope pass into `iframe`s? I have always used them in forms, but now writing formless H...
2011/04/09
[ "https://Stackoverflow.com/questions/5605527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/662063/" ]
Radio buttons with the same name in the same form act as a set, but not with those of different forms. Radio buttons with no form act as a set with those with no forms. test it yourself: <http://jsfiddle.net/8qqNC/1/>
Radio buttons are scoped to the form they are in. Frames contain external documents, and nothing in them is considered part of the current document, let alone an element within that document.
12,657,112
I would like to get a String like: ``` Ljava/lang/Class;.getName()Ljava/lang/String; ``` (JNI style type/method description, or called type descriptor) from an `javax.lang.model.type.TypeMirror` object in an `AnnotationProcessor`. Is there any Convenience method or library, which parses the `TypeMirror` object and ...
2012/09/29
[ "https://Stackoverflow.com/questions/12657112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709013/" ]
I realize this is nearly a decade old, but I've written a library to add TypeMirror/Element support to the ASM library. See here: <https://github.com/soabase/asm-mirror-descriptor> - with this library you can now do: ``` MirrorClassReader reader = new MirrorClassReader(processingEnv, element); reader.accept(myClassVis...
Open console, go to your already compiled classes f.e. : cd ./build/classes . Then type javap -s NameOfYourCompiledClass.class (in console) and you'l get your descriptors. For your situation I'd extend this TypeMirror class with your custom class, overload all methods, compile the project and folow the instructions bel...
6,591,346
I have read the Load runner basics and understood an overview of the components of Load Runner and general workflow. As its Load Testing of a website, I need to plan real time scenarios of the functionality of the website with example 100 users who log-in simultaneously. In Load runner,I need to create all these use...
2011/07/06
[ "https://Stackoverflow.com/questions/6591346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/830829/" ]
Works fine: ``` var foo = { foo : 22, bar : 42 }; for(var i in foo); alert(i); // "bar" ``` What, exactly, are you passing to the function?
Your example looks fine. After `getKeyNames` is called, `lastValue` will hold the last key found in the object. However, your example does not call `getKeyNames`, so the `alert(lastValue)` should alert "undefined". If you ARE calling it somewhere, and you find that `lastValue` contains a number, well it's probably be...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` <asp:Button OnClientClick="return confirm('Are you sure you want to go?');" Text="Confirm" runat="server" onclick="Unnamed1_Click" /> ``` If they click OK, the server onclick event will happen, if they click cancel, it will be like they didn't even press the button, of course, you can always add func...
Put the check before rendering the page to the client. Then attach a handler (on the client side, eg. javascript) to the save-button or form that displays the confirmation box (but only if the saving results in a replacement).
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` <asp:Button OnClientClick="return confirm('Are you sure you want to go?');" Text="Confirm" runat="server" onclick="Unnamed1_Click" /> ``` If they click OK, the server onclick event will happen, if they click cancel, it will be like they didn't even press the button, of course, you can always add func...
An alternative, simpler approach which doesn't require AJAX would be to allow the post-back as normal, then in the code-behind, do your checks. If the user confirmation is required, just return the user back to the same page but make an extra panel visible and hide the original 'Save' button. In this extra panel, di...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` <asp:Button OnClientClick="return confirm('Are you sure you want to go?');" Text="Confirm" runat="server" onclick="Unnamed1_Click" /> ``` If they click OK, the server onclick event will happen, if they click cancel, it will be like they didn't even press the button, of course, you can always add func...
add a hidden field to your page for example Hiddenfield1 then add this function ``` public bool Confirm(string MSG) { string tmp = ""; tmp = "<script language='javascript'>"; tmp += "document.getElementById('HiddenField1').value=0; if(confirm('" + MSG + "')) document.getElementById('HiddenField...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I appreciate both previous answers and they were helpful but not exactly what I was looking for. After considering the responses and doing more research I'm posting my solution so that maybe it will help someone else. Button code: ``` <asp:Button ID="btnSave" OnClick="btnSaveClick" runat="server" Text="Save" OnClien...
Put the check before rendering the page to the client. Then attach a handler (on the client side, eg. javascript) to the save-button or form that displays the confirmation box (but only if the saving results in a replacement).
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
An alternative, simpler approach which doesn't require AJAX would be to allow the post-back as normal, then in the code-behind, do your checks. If the user confirmation is required, just return the user back to the same page but make an extra panel visible and hide the original 'Save' button. In this extra panel, di...
Put the check before rendering the page to the client. Then attach a handler (on the client side, eg. javascript) to the save-button or form that displays the confirmation box (but only if the saving results in a replacement).
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Put the check before rendering the page to the client. Then attach a handler (on the client side, eg. javascript) to the save-button or form that displays the confirmation box (but only if the saving results in a replacement).
add a hidden field to your page for example Hiddenfield1 then add this function ``` public bool Confirm(string MSG) { string tmp = ""; tmp = "<script language='javascript'>"; tmp += "document.getElementById('HiddenField1').value=0; if(confirm('" + MSG + "')) document.getElementById('HiddenField...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I appreciate both previous answers and they were helpful but not exactly what I was looking for. After considering the responses and doing more research I'm posting my solution so that maybe it will help someone else. Button code: ``` <asp:Button ID="btnSave" OnClick="btnSaveClick" runat="server" Text="Save" OnClien...
An alternative, simpler approach which doesn't require AJAX would be to allow the post-back as normal, then in the code-behind, do your checks. If the user confirmation is required, just return the user back to the same page but make an extra panel visible and hide the original 'Save' button. In this extra panel, di...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I appreciate both previous answers and they were helpful but not exactly what I was looking for. After considering the responses and doing more research I'm posting my solution so that maybe it will help someone else. Button code: ``` <asp:Button ID="btnSave" OnClick="btnSaveClick" runat="server" Text="Save" OnClien...
add a hidden field to your page for example Hiddenfield1 then add this function ``` public bool Confirm(string MSG) { string tmp = ""; tmp = "<script language='javascript'>"; tmp += "document.getElementById('HiddenField1').value=0; if(confirm('" + MSG + "')) document.getElementById('HiddenField...
1,234,972
I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
2009/08/05
[ "https://Stackoverflow.com/questions/1234972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
An alternative, simpler approach which doesn't require AJAX would be to allow the post-back as normal, then in the code-behind, do your checks. If the user confirmation is required, just return the user back to the same page but make an extra panel visible and hide the original 'Save' button. In this extra panel, di...
add a hidden field to your page for example Hiddenfield1 then add this function ``` public bool Confirm(string MSG) { string tmp = ""; tmp = "<script language='javascript'>"; tmp += "document.getElementById('HiddenField1').value=0; if(confirm('" + MSG + "')) document.getElementById('HiddenField...
10,487,250
How Can i specific require and unique condition for a list of select box like below? ``` <form name="signupForm" class="cmxform" id="signupForm" method="get" action=""> <select name="category[]" id="cat_1"> <option value="">Select One</option> <option value="1">aa</option> <option value="2">bb</option> <option value="...
2012/05/07
[ "https://Stackoverflow.com/questions/10487250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1280996/" ]
``` var $selects = $('form select[name^=category]'), values = []; $(':submit').click(function(e) { e.preventDefault(); values = []; $($selects).each(function() { if($(this).val()) { values.push($(this).val()); } }); if(!values.length) { alert('Please select all cat...
Here is a great jQuery validation plugin that will make your life easier: <http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/> This is all you need to do: (the plugin does the rest) ``` <select id="sport" class="validate[required]" name="sport"> <option value="">--Selec...
2,817,707
Assume that notepad.exe is opening and the it's window is inactive. I will write an application to activate it. How to make? **Update:** The window title is undefined. So, I don't like to use to FindWindow which based on window's title. My application is Winform C# 2.0. Thanks.
2010/05/12
[ "https://Stackoverflow.com/questions/2817707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253940/" ]
You'll need to P/invoke SetForegroundWindow(). Process.MainWindowHandle can give you the handle you'll need. For example: ``` using System; using System.Diagnostics; using System.Runtime.InteropServices; class Program { static void Main(string[] args) { var prc = Process.GetProcessesByName("notepad"); ...
You'd need to PInvoke the Windows API calls such as FindWindow and or EnumWindows and GetWindowText (for the title). Ideally you might also want to use GeWindowThreadProcessId so you can tie it down to the actual process.
2,817,707
Assume that notepad.exe is opening and the it's window is inactive. I will write an application to activate it. How to make? **Update:** The window title is undefined. So, I don't like to use to FindWindow which based on window's title. My application is Winform C# 2.0. Thanks.
2010/05/12
[ "https://Stackoverflow.com/questions/2817707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253940/" ]
You'll need to P/invoke SetForegroundWindow(). Process.MainWindowHandle can give you the handle you'll need. For example: ``` using System; using System.Diagnostics; using System.Runtime.InteropServices; class Program { static void Main(string[] args) { var prc = Process.GetProcessesByName("notepad"); ...
You have to use combination of these - [Toggle Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden at runtime](https://stackoverflow.com/questions/2647820/toggle-process-startinfo-windowstyle-processwindowstyle-hidden-at-runtime/2648017#2648017) and [Bring another processes Window to foreground when it has Sho...
41,059,230
okay so i have strings in a list like so: `- String, boolean` I basically want to grab a whole heap of these from a long string list (progressing downward) and throw them into a hashmap like the following so i can simply get the key (the string) and get the `boolean` value from the key. The hashmap: `public HashMap<St...
2016/12/09
[ "https://Stackoverflow.com/questions/41059230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7272355/" ]
If you want to do it in one-line: ``` Pattern.compile("-") .splitAsStream(s) .map(string -> string.split(",")) .collect(Collectors.toMap(k -> k[0], v -> Boolean.valueOf(v[1]))); ``` Where `s` is a string like this: ``` SIGN_COLOUR, false - SIGN_FORMAT, false - SIGN_ASHOP, false - SIGN_PSHOP,...
That should be easy, isn't it? ``` public static Map<String,Boolean> toMap(List<String> l) { HashMap<String,Boolean> m = new HashMap<String,Boolean>(); l.forEach((s) -> { String[] t=s.split(","); m.put(t[0], new Boolean(t[1])); }); return m; } ```
41,280,287
I'm trying to make a program that rolls a dice and checks if the user wants to continue every roll, if not, the program should halt. Although, no matter what you input, the program breaks out of the loop. Can someone explain why and give me some tips to making a program that is simpler and works? Thanks ``` import ra...
2016/12/22
[ "https://Stackoverflow.com/questions/41280287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7329691/" ]
If you've only got 1 value in the array, you can use; ``` {{mongoDbData[0]._id.$oid}} ``` For every value in your array, use 0 because it's the first item in your array.
If not mistaken, the issue seems to be that the document object you were expecting in wrapped as the only element of an array. In your controller, do as follows: ``` // assuming document to be the array-wrapped response $scope.documentData = document[0]; ``` so that in your view you can use data binding on `document...
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
Use the following (remember to include System.Configuration assembly) ``` ConfigurationManager.OpenExeConfiguration(exePath) ```
You can set it by creating a new app domain: ``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = fileLocation; AppDomain add = AppDomain.CreateDomain("myNewAppDomain", securityInfo, domainSetup); ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
``` using System.Configuration; Configuration config = ConfigurationManager.OpenExeConfiguration("C:\Test.exe"); ``` You can then access the app settings, connection strings, etc from the config instance. This assumes of course that the config file is properly formatted and your app has read access to the direct...
Use the following (remember to include System.Configuration assembly) ``` ConfigurationManager.OpenExeConfiguration(exePath) ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
Use the following (remember to include System.Configuration assembly) ``` ConfigurationManager.OpenExeConfiguration(exePath) ```
``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = @"D:\Mine\Company\"; string browserName = ConfigurationManager.AppSettings["browser"]; ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
``` using System.Configuration; Configuration config = ConfigurationManager.OpenExeConfiguration("C:\Test.exe"); ``` You can then access the app settings, connection strings, etc from the config instance. This assumes of course that the config file is properly formatted and your app has read access to the direct...
You can set it by creating a new app domain: ``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = fileLocation; AppDomain add = AppDomain.CreateDomain("myNewAppDomain", securityInfo, domainSetup); ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
It appears that you can use the [`AppDomain.SetData`](http://msdn.microsoft.com/en-us/library/37z40s1c.aspx) method to achieve this. The documentation states: > > You cannot insert or modify system entries with this method. > > > Regardless, doing so does appear to work. The documentation for the [`AppDomain.GetD...
You can set it by creating a new app domain: ``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = fileLocation; AppDomain add = AppDomain.CreateDomain("myNewAppDomain", securityInfo, domainSetup); ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
You can set it by creating a new app domain: ``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = fileLocation; AppDomain add = AppDomain.CreateDomain("myNewAppDomain", securityInfo, domainSetup); ```
``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = @"D:\Mine\Company\"; string browserName = ConfigurationManager.AppSettings["browser"]; ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
``` using System.Configuration; Configuration config = ConfigurationManager.OpenExeConfiguration("C:\Test.exe"); ``` You can then access the app settings, connection strings, etc from the config instance. This assumes of course that the config file is properly formatted and your app has read access to the direct...
It appears that you can use the [`AppDomain.SetData`](http://msdn.microsoft.com/en-us/library/37z40s1c.aspx) method to achieve this. The documentation states: > > You cannot insert or modify system entries with this method. > > > Regardless, doing so does appear to work. The documentation for the [`AppDomain.GetD...
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
``` using System.Configuration; Configuration config = ConfigurationManager.OpenExeConfiguration("C:\Test.exe"); ``` You can then access the app settings, connection strings, etc from the config instance. This assumes of course that the config file is properly formatted and your app has read access to the direct...
``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = @"D:\Mine\Company\"; string browserName = ConfigurationManager.AppSettings["browser"]; ```
75,978
In a .NET Win console application, I would like to access an App.config file in a location different from the console application binary. For example, how can C:\bin\Text.exe get its settings from C:\Test.exe.config?
2008/09/16
[ "https://Stackoverflow.com/questions/75978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2748/" ]
It appears that you can use the [`AppDomain.SetData`](http://msdn.microsoft.com/en-us/library/37z40s1c.aspx) method to achieve this. The documentation states: > > You cannot insert or modify system entries with this method. > > > Regardless, doing so does appear to work. The documentation for the [`AppDomain.GetD...
``` AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ConfigurationFile = @"D:\Mine\Company\"; string browserName = ConfigurationManager.AppSettings["browser"]; ```
35,650,551
In a perfect information environment, where we are able to know the state after an action, like playing chess, is there any reason to use Q learning not TD (temporal difference) learning? As far as I understand, TD learning will try to learn V(state) value, but Q learning will learn Q(state action value) value, which ...
2016/02/26
[ "https://Stackoverflow.com/questions/35650551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5985622/" ]
Q-Learning is a TD (temporal difference) learning method. I think you are trying to refer to TD(0) vs Q-learning. I would say it depends on your actions being deterministic or not. Even if you have the transition function, it can be expensive to decide which action to take in TD(0) as you need to calculate the expe...
Q learning is a TD **control** algorithm, this means it tries to give you an optimal policy as you said. TD learning is more general in the sense that can include control algorithms and also only prediction methods of V for a fixed policy.
35,650,551
In a perfect information environment, where we are able to know the state after an action, like playing chess, is there any reason to use Q learning not TD (temporal difference) learning? As far as I understand, TD learning will try to learn V(state) value, but Q learning will learn Q(state action value) value, which ...
2016/02/26
[ "https://Stackoverflow.com/questions/35650551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5985622/" ]
Q-Learning is a TD (temporal difference) learning method. I think you are trying to refer to TD(0) vs Q-learning. I would say it depends on your actions being deterministic or not. Even if you have the transition function, it can be expensive to decide which action to take in TD(0) as you need to calculate the expe...
Actually Q-learning is the process of using state-action pairs instead of just states. But that doesnt mean Q learning is different from TD. In TD(0) our agent takes one step(which could be one step in state-action pair or just state) and then updates it's Q-value. And same in n-step TD where our agent takes n steps an...
35,650,551
In a perfect information environment, where we are able to know the state after an action, like playing chess, is there any reason to use Q learning not TD (temporal difference) learning? As far as I understand, TD learning will try to learn V(state) value, but Q learning will learn Q(state action value) value, which ...
2016/02/26
[ "https://Stackoverflow.com/questions/35650551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5985622/" ]
Given a deterministic environment (or as you say, a "perfect" environment in which you are able to know the state after performing an action), I guess you can simulate the affect of all possible actions in a given state (i.e., compute all possible next states), and choose the action that achieves the next state with th...
Q learning is a TD **control** algorithm, this means it tries to give you an optimal policy as you said. TD learning is more general in the sense that can include control algorithms and also only prediction methods of V for a fixed policy.
35,650,551
In a perfect information environment, where we are able to know the state after an action, like playing chess, is there any reason to use Q learning not TD (temporal difference) learning? As far as I understand, TD learning will try to learn V(state) value, but Q learning will learn Q(state action value) value, which ...
2016/02/26
[ "https://Stackoverflow.com/questions/35650551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5985622/" ]
Given a deterministic environment (or as you say, a "perfect" environment in which you are able to know the state after performing an action), I guess you can simulate the affect of all possible actions in a given state (i.e., compute all possible next states), and choose the action that achieves the next state with th...
Actually Q-learning is the process of using state-action pairs instead of just states. But that doesnt mean Q learning is different from TD. In TD(0) our agent takes one step(which could be one step in state-action pair or just state) and then updates it's Q-value. And same in n-step TD where our agent takes n steps an...
50,336,489
In my Xamarin.Forms app, I want my `Grid` background color to be the same as the Navigation Bar's background color, something like this: ``` BackgroundColor="{StaticResource BarBackgroundColor}" ``` How can I do this?
2018/05/14
[ "https://Stackoverflow.com/questions/50336489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1136506/" ]
You can retrieve the color of your navbar by casting your current page to a navigation page. Then you can simply change the color of your grid with that retrieved color. On the OnAppearing override of your page, use the following code to obtain your nav bar color: ``` protected override void OnAppearing() { var nav...
The `BarBackgroundProperty` is an attached property from `NavigationPage`. Be aware that it can change on every page you push to your NavigationPage. Supposing you have an App.Current.MainPage set like this: ``` Page main = new MainPage(); Page navigation = new NavigationPage(main) { BarBackgroundColor = Color.Re...
50,336,489
In my Xamarin.Forms app, I want my `Grid` background color to be the same as the Navigation Bar's background color, something like this: ``` BackgroundColor="{StaticResource BarBackgroundColor}" ``` How can I do this?
2018/05/14
[ "https://Stackoverflow.com/questions/50336489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1136506/" ]
You can retrieve the color of your navbar by casting your current page to a navigation page. Then you can simply change the color of your grid with that retrieved color. On the OnAppearing override of your page, use the following code to obtain your nav bar color: ``` protected override void OnAppearing() { var nav...
You may use global style by placing the code below into App.xaml ``` <Application.Resources> <ResourceDictionary> <Color x:Key="NavigationPrimary">#1A237E</Color> <Style TargetType="NavigationPage"> <Setter Property="BarBackgroundColor" Value="{StaticResource NavigationP...
55,477
I have an old Peugeot Vagabond. It's been sitting out in the New Mexico weather for more than a few years. I'm wondering if it's worth trying to fix up, or if I should just go get a new bike? I tried to get the chain off (yes, with a chain tool), but it's not going to come off without considerable effort. Both sprocke...
2018/06/23
[ "https://bicycles.stackexchange.com/questions/55477", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/38323/" ]
It might be salvageable but the cost of: * new chain ($10) * new tires and tubes ($25) * rear cluster (maybe; $20) * new brake cables and pads ($10) * new derailleur cables ($10) which is the minimal repair, is going to be around $75 in just parts, that’s if you get the dirt cheapest versions. If any of your bearings...
Fundamentally, it’s the frame. If the frame just has a little cosmetic rust or paint problems, but is fundamentally sound, it will be definitely not-not-worth-it. You definitely need some new tires. A little Phil Wood grease in the right places helps a lot In many ways you have a lot of freedom. WD40? why not. A p...
55,477
I have an old Peugeot Vagabond. It's been sitting out in the New Mexico weather for more than a few years. I'm wondering if it's worth trying to fix up, or if I should just go get a new bike? I tried to get the chain off (yes, with a chain tool), but it's not going to come off without considerable effort. Both sprocke...
2018/06/23
[ "https://bicycles.stackexchange.com/questions/55477", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/38323/" ]
It might be salvageable but the cost of: * new chain ($10) * new tires and tubes ($25) * rear cluster (maybe; $20) * new brake cables and pads ($10) * new derailleur cables ($10) which is the minimal repair, is going to be around $75 in just parts, that’s if you get the dirt cheapest versions. If any of your bearings...
I've seen far worse. Go to a paint store and buy some "wood bleach". Be sure to get the stuff that's a liquid and contains "oxalic acid". Put some of that in a spray bottle and spray down all the rusted bits with it, getting them thoroughly wetted. Wipe well with paper towel or rag. Next spray well with WD-40 & wipe. F...
55,477
I have an old Peugeot Vagabond. It's been sitting out in the New Mexico weather for more than a few years. I'm wondering if it's worth trying to fix up, or if I should just go get a new bike? I tried to get the chain off (yes, with a chain tool), but it's not going to come off without considerable effort. Both sprocke...
2018/06/23
[ "https://bicycles.stackexchange.com/questions/55477", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/38323/" ]
I've seen far worse. Go to a paint store and buy some "wood bleach". Be sure to get the stuff that's a liquid and contains "oxalic acid". Put some of that in a spray bottle and spray down all the rusted bits with it, getting them thoroughly wetted. Wipe well with paper towel or rag. Next spray well with WD-40 & wipe. F...
Fundamentally, it’s the frame. If the frame just has a little cosmetic rust or paint problems, but is fundamentally sound, it will be definitely not-not-worth-it. You definitely need some new tires. A little Phil Wood grease in the right places helps a lot In many ways you have a lot of freedom. WD40? why not. A p...
66,965,475
I'm trying to create a simple ontology, following the tutorial on the official website. The code runs smoothly and everything seems fine when running this code: ``` import owlready2 owlready2.JAVA_EXE = r"my-path-to-java-exe" # new.owl is a non-existing file and therefore onto has no pre-defined classes # i...
2021/04/06
[ "https://Stackoverflow.com/questions/66965475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15292369/" ]
I found an answer! The problem was in the base IRI, "new.owl" is not acceptable. IRI must be formatted as a link - even if it's a fake one. For example, if IRI is "http://test.org/new.owl", my code works perfectly.
Regarding your extra question, there seems to be an error in how `rdfxml` is saved. Switching to `ntriples` format solves the problem with data and object properties being written out properly (exported using Owlready2 v0.37 and imported in Protégé v5.5.0)
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
In xcode > 4.5 select Preferences -> Download -> Components -> Command Line Tools
You can also right click the "Install Xcode X.X" icon and Show Package Contents then in `Contents > Resources > Packages`, you will find many packages from among which resides DeveloperToolsCLI.pkg. This package installs the files you want in /usr/bin.
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
With Xcode 4.3 (from Apple App Store) you can enable Unix Command Line Tools via the Xcode Menu: Preferences -> Download -> Components
You should uninstall and then re-install the developer tools. To uninstall the tools, run the following command in Terminal: ``` sudo /Developer/Library/uninstall-devtools --mode=all ```
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
Finally. I had to download from [Apple's website](http://developer.apple.com) the latest version of Xcode 3 (3.2) along with the iPhone SDK that I won't use in the near feature. This time the "UNIX Development Support" was enabled: ![Xcode 3.2 Installation](https://i.stack.imgur.com/iEWdx.png) So now I can compile ...
You can also right click the "Install Xcode X.X" icon and Show Package Contents then in `Contents > Resources > Packages`, you will find many packages from among which resides DeveloperToolsCLI.pkg. This package installs the files you want in /usr/bin.
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
In xcode > 4.5 select Preferences -> Download -> Components -> Command Line Tools
In the Xcode `.dmg` file, there is a `Packages` folder. You can manually install `DeveloperToolsCLI.pkg` which creates the link in `/usr/bin`. *At least, it worked for me.*
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
With Xcode 4.3 (from Apple App Store) you can enable Unix Command Line Tools via the Xcode Menu: Preferences -> Download -> Components
Finally. I had to download from [Apple's website](http://developer.apple.com) the latest version of Xcode 3 (3.2) along with the iPhone SDK that I won't use in the near feature. This time the "UNIX Development Support" was enabled: ![Xcode 3.2 Installation](https://i.stack.imgur.com/iEWdx.png) So now I can compile ...
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
You can also right click the "Install Xcode X.X" icon and Show Package Contents then in `Contents > Resources > Packages`, you will find many packages from among which resides DeveloperToolsCLI.pkg. This package installs the files you want in /usr/bin.
You should uninstall and then re-install the developer tools. To uninstall the tools, run the following command in Terminal: ``` sudo /Developer/Library/uninstall-devtools --mode=all ```
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
With Xcode 4.3 (from Apple App Store) you can enable Unix Command Line Tools via the Xcode Menu: Preferences -> Download -> Components
In xcode > 4.5 select Preferences -> Download -> Components -> Command Line Tools
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
In the Xcode `.dmg` file, there is a `Packages` folder. You can manually install `DeveloperToolsCLI.pkg` which creates the link in `/usr/bin`. *At least, it worked for me.*
You should uninstall and then re-install the developer tools. To uninstall the tools, run the following command in Terminal: ``` sudo /Developer/Library/uninstall-devtools --mode=all ```
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
Finally. I had to download from [Apple's website](http://developer.apple.com) the latest version of Xcode 3 (3.2) along with the iPhone SDK that I won't use in the near feature. This time the "UNIX Development Support" was enabled: ![Xcode 3.2 Installation](https://i.stack.imgur.com/iEWdx.png) So now I can compile ...
In the Xcode `.dmg` file, there is a `Packages` folder. You can manually install `DeveloperToolsCLI.pkg` which creates the link in `/usr/bin`. *At least, it worked for me.*
2,693,336
I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Development Support" checkbox. Now I want to have them but when I click on the installation this is what appears: ![disabled](https://i.stack.imgur.com/fKJ4z.png) The *UNIX Development Support* check box is disabled **Q:** How can I ...
2010/04/22
[ "https://Stackoverflow.com/questions/2693336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
In xcode > 4.5 select Preferences -> Download -> Components -> Command Line Tools
You should uninstall and then re-install the developer tools. To uninstall the tools, run the following command in Terminal: ``` sudo /Developer/Library/uninstall-devtools --mode=all ```
45,350,160
I'm running PHP 7 with the php\_mongodb-1.2.2-7.0-nts-vc14-x64 driver. ``` $ar = new \MongoDB\BSON\UTCDateTime(strtotime('2017-07-27 06:17:25.123000') * 1000); ``` Output of above statement is: > > ISODate("2017-07-27T06:17:25.000+0000") > > > but I need milliseconds also like: > > ISODate("2017-07-27T06:17:...
2017/07/27
[ "https://Stackoverflow.com/questions/45350160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841833/" ]
The `Where` method has to return a boolean value. ``` _UoW.OrganisationRepo.Where(x => new GeoCoordinate(x.Latitude, x.Longitude)) ``` Maybe you meant to use a `.Select` there? Would the following code work? ``` _UoW.OrganisationRepo.Select(x => new GeoCoordinate(x.Latitude, x.Longitude)) ...
I think your problem is with your first `Where` as you are trying to create a new GeoCoordinate class and `Where` is expecting a bool output from the lambda not a GeoCoordinate instance. I would suggest making the following change: ``` var result = _UoW.OrganisationRepo.Where(x => new GeoCoordinate(x.Latitude, x.Long...
49,551,377
When I use docker run command, the variable "`SPRING_PROFILES_ACTIVE`" is right, but "`SPRING_MAIN_WEB-APPLICATION-TYPE`" does not work, how to pass "`SPRING_MAIN_WEB-APPLICATION-TYPE`" to dokcer image? ``` sudo docker run -d -e SPRING_PROFILES_ACTIVE=product -e SPRING_MAIN_WEB-APPLICATION-TYPE=SERVLET -e SERVER_PORT=...
2018/03/29
[ "https://Stackoverflow.com/questions/49551377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1147265/" ]
Use the xDomain or yDomain props on the XYPlot component `<XYPlot xDomain={[0, 50]}`
From their docs about scales at: <https://uber.github.io/react-vis/documentation/general-principles/scales-and-data> "To redefine a scale, you must pass a prop to the series that uses that scale. The prop names are based on the name of the attribute: name + Domain, name + Range, name + Type, name + Padding (for instan...
1,065,999
My apache2 service has `PrivateTmp=true`. When the service first starts it works fine, but after a few days, writing to /tmp fails with "no such file or directory". To debug I've tried running `nsenter -t <apache-pid> -m bash` and I've confirmed that `/tmp` exists, but `mkdir /tmp/test` fails with "no such file or dire...
2021/06/07
[ "https://serverfault.com/questions/1065999", "https://serverfault.com", "https://serverfault.com/users/381850/" ]
I found the problem. I had `tmpreaper` enabled and configured to clean up old files and directories under `/tmp`. I didn't have an exclude rule for `/tmp/systemd-private-*`, so tmpreaper was deleting the private tmp directory for apache2.
As I understand it `PrivateTmp=true` forbids exactly what you tried when you were debugging. The daemon will create it's own subdirectory and change it's namespace accordingly. As your problem only occurs after some time I have the following advice: Make sure the application cleans up and does not store large files in...
22,219,784
I successfully install cocoapods 0.29, and after attempting to run pod setup, it claims I must install 0.29. Can someone please explain this to me?? ```none Successfully installed cocoapods-0.29.0 Parsing documentation for cocoapods-0.29.0 1 gem installed bash-3.2$ pod setup Setting up CocoaPods master repo Already u...
2014/03/06
[ "https://Stackoverflow.com/questions/22219784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014164/" ]
navigate this file and delete it **/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/claide-0.3.2/lib/claide** then open ur terminal add this **sudo gem update** its worked for me 100%
Based on your comment ``` $ type -a pod pod is /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/pod pod is /Users/me/.rvm/rubies/ruby-2.0.0-p247/bin/pod pod is /usr/bin/pod ``` it appears you have multiple installations of Cocoapods: one with `gem install cocoapods` in `/Users/me/.rvm/gems/ruby-2.0.0-p247/bin/pod` and anothe...
22,219,784
I successfully install cocoapods 0.29, and after attempting to run pod setup, it claims I must install 0.29. Can someone please explain this to me?? ```none Successfully installed cocoapods-0.29.0 Parsing documentation for cocoapods-0.29.0 1 gem installed bash-3.2$ pod setup Setting up CocoaPods master repo Already u...
2014/03/06
[ "https://Stackoverflow.com/questions/22219784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014164/" ]
Based on your comment ``` $ type -a pod pod is /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/pod pod is /Users/me/.rvm/rubies/ruby-2.0.0-p247/bin/pod pod is /usr/bin/pod ``` it appears you have multiple installations of Cocoapods: one with `gem install cocoapods` in `/Users/me/.rvm/gems/ruby-2.0.0-p247/bin/pod` and anothe...
I found the mismatch of version reported by 'pod --version' and what I was seeing when I updated to be mystifying. Then I realized I had more than one ruby installed on my machine. I changed my $PATH so that the ruby I needed to use came first (e.g. /usr/local/opt/ruby/bin): In a new shell I found that 'pod --version...
22,219,784
I successfully install cocoapods 0.29, and after attempting to run pod setup, it claims I must install 0.29. Can someone please explain this to me?? ```none Successfully installed cocoapods-0.29.0 Parsing documentation for cocoapods-0.29.0 1 gem installed bash-3.2$ pod setup Setting up CocoaPods master repo Already u...
2014/03/06
[ "https://Stackoverflow.com/questions/22219784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014164/" ]
navigate this file and delete it **/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/claide-0.3.2/lib/claide** then open ur terminal add this **sudo gem update** its worked for me 100%
I found the mismatch of version reported by 'pod --version' and what I was seeing when I updated to be mystifying. Then I realized I had more than one ruby installed on my machine. I changed my $PATH so that the ruby I needed to use came first (e.g. /usr/local/opt/ruby/bin): In a new shell I found that 'pod --version...
47,150,076
So I'm wondering if/how I can use a value in a object as a arg in a function ex: ``` var mousePos = { chaos: (-950, 22) } console.log(mousePos.chaos) // chaos mouse.Move(mousePos.chaos) // which would take two args, and then output Invalid number of arguments. ```
2017/11/07
[ "https://Stackoverflow.com/questions/47150076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes you can if you use an array and `Function.prototype.apply` ``` var mousePos = { chaos: [-950, 22] } mouse.Move.apply(mouse, mousePos.chaos) ``` If you are fancy and are using Node or Babel, you can also use spread syntax: ``` mose.Move(...mousePos.chaos) ```
You are looking for a single object with two value (x,y) for mouse position. so manage your object like key/value base array. ``` var mousePos = { chaos: {x : -950, y:22} }; mouse.move(mousePos.chaos.x,mousePos.chaos.y) // equivalent to mouse.move(-950,22) ```
47,150,076
So I'm wondering if/how I can use a value in a object as a arg in a function ex: ``` var mousePos = { chaos: (-950, 22) } console.log(mousePos.chaos) // chaos mouse.Move(mousePos.chaos) // which would take two args, and then output Invalid number of arguments. ```
2017/11/07
[ "https://Stackoverflow.com/questions/47150076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I think you're looking for an array and [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator): ``` var mousePos = { chaos: [-950, 22] }; console.log(mousePos.chaos) // [-950, 22] mouse.move(...mousePos.chaos) // equivalent to `mouse.move(-950, 22)` ```
You are looking for a single object with two value (x,y) for mouse position. so manage your object like key/value base array. ``` var mousePos = { chaos: {x : -950, y:22} }; mouse.move(mousePos.chaos.x,mousePos.chaos.y) // equivalent to mouse.move(-950,22) ```
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
As lxrec pointed out, it'll vary from codebase to codebase. Some applications will allow you to put those kind of business logic into SQL Functions and/or queries and allow you to run those anytime you need to show those values to the user. Sometimes it may seem stupid, but it's better to code for correctness than per...
I've written a silly example to explain an idea: ``` class BinaryIntegerOperation { public int Execute(string operation, int operand1, int operand2) { var split = operation.Split(':'); var opCode = split[0]; if (opCode == "MULTIPLY") { var args = split[1].Split(',');...
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
As lxrec pointed out, it'll vary from codebase to codebase. Some applications will allow you to put those kind of business logic into SQL Functions and/or queries and allow you to run those anytime you need to show those values to the user. Sometimes it may seem stupid, but it's better to code for correctness than per...
You say that the example is artificial, so I don't know if what I'm saying here suits your actual situation, but my answer is - use an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) (Object-relational mapping) layer to define the structure and querying/manipulation of your database. That way you have no...
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
As lxrec pointed out, it'll vary from codebase to codebase. Some applications will allow you to put those kind of business logic into SQL Functions and/or queries and allow you to run those anytime you need to show those values to the user. Sometimes it may seem stupid, but it's better to code for correctness than per...
As @Machado said, the easiest way to do it is to avoid it and doing all your processing in your main java. However, it is still possible to have to code base with similar code without repeating your self by generating the code for both of code base. For example using [cog](http://nedbatchelder.com/code/cog/) enable to...
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
You say that the example is artificial, so I don't know if what I'm saying here suits your actual situation, but my answer is - use an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) (Object-relational mapping) layer to define the structure and querying/manipulation of your database. That way you have no...
I've written a silly example to explain an idea: ``` class BinaryIntegerOperation { public int Execute(string operation, int operand1, int operand2) { var split = operation.Split(':'); var opCode = split[0]; if (opCode == "MULTIPLY") { var args = split[1].Split(',');...
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
I've written a silly example to explain an idea: ``` class BinaryIntegerOperation { public int Execute(string operation, int operand1, int operand2) { var split = operation.Split(':'); var opCode = split[0]; if (opCode == "MULTIPLY") { var args = split[1].Split(',');...
As @Machado said, the easiest way to do it is to avoid it and doing all your processing in your main java. However, it is still possible to have to code base with similar code without repeating your self by generating the code for both of code base. For example using [cog](http://nedbatchelder.com/code/cog/) enable to...
290,405
Where I define Cyclomatic complexity density as: ``` Cyclomatic complexity density = Cyclomatic complexity / Lines of code ``` I was reading previous discussions about cyclomatic complexity and there seems to be a sort of consensus that it has mixed usefulness, and as such there probably isn't a strong motive for us...
2015/07/21
[ "https://softwareengineering.stackexchange.com/questions/290405", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/32728/" ]
You say that the example is artificial, so I don't know if what I'm saying here suits your actual situation, but my answer is - use an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) (Object-relational mapping) layer to define the structure and querying/manipulation of your database. That way you have no...
As @Machado said, the easiest way to do it is to avoid it and doing all your processing in your main java. However, it is still possible to have to code base with similar code without repeating your self by generating the code for both of code base. For example using [cog](http://nedbatchelder.com/code/cog/) enable to...