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 |
|---|---|---|---|---|---|
7,332,110 | There is a strange thing happening when I execute the following code:
```
private void doStuff(Long inLong) {
long theNumber = inLong;
/* ... */
}
```
Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea? | 2011/09/07 | [
"https://Stackoverflow.com/questions/7332110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/932457/"
] | For `long theNumber = inLong;`, the long value of inLong is fetched by implicitly calling `inLong.longValue()`. This is called auto-unboxing (sometimes more general auto-boxing). When inLong is null, you therefore get a NullPointerException just like calling any other method on null.
Therefore, you should think of som... | if inLong is null, then NPE is the expected behaviour.
```
long theNumber = inLong;
```
is semantically equivalent to
```
long theNumber = inLong.longValue();
```
which should make the cause of the NPE obvious. |
7,332,110 | There is a strange thing happening when I execute the following code:
```
private void doStuff(Long inLong) {
long theNumber = inLong;
/* ... */
}
```
Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea? | 2011/09/07 | [
"https://Stackoverflow.com/questions/7332110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/932457/"
] | because `inLong` can be null and will not be automatically mapped to 0.
I guess what you want to do is this:
```
theNumber = 0; // or Long.MIN_VALUE or Long.MAX_VALUE or whatever you prefer
if (inLong != null) {
theNumber = inLong;
}
// ...
``` | That's because the inLong parameter is null.
Whenever you assign a `Long` object to a `long` variable, Java automatically tries to unbox it to the proper type, but it fails if value of the Long variable is null.
Just put a null-check before that assignment and you'll get rid of that error, but you may have to raise an... |
31,445,251 | I'd like to be able to take this code block
```
var uVacationLandLubbers = new UserAttribute {
Name = "Land Lubbers",
Project = pVacation,
SystemUserAttribute = context.SystemUserAttributes.Single(x => x.Name == "Yes/No")
};
```
and reformat it to
```
var uVacationLandLubbers = new UserAtt... | 2015/07/16 | [
"https://Stackoverflow.com/questions/31445251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/782880/"
] | 1) For asynchronous request, it depends on the time it takes for a specific operation to complete. Only once the operation is complete the response would be received by the client.
If you need sequential order then you should be using synchronous calls to server.
If you are using jquery.Ajax method, then you can speci... | Short answer first.
Q1 the order is not guaranteed(usually)
Q2 Yes
1) Ajax method will be executed asynchronously unless You set `async: false`.So callbacks execution orders are all depends on the server side.
But once you use `async: false` option,Javascript can not do anything until you receive a responce. which i... |
31,445,251 | I'd like to be able to take this code block
```
var uVacationLandLubbers = new UserAttribute {
Name = "Land Lubbers",
Project = pVacation,
SystemUserAttribute = context.SystemUserAttributes.Single(x => x.Name == "Yes/No")
};
```
and reformat it to
```
var uVacationLandLubbers = new UserAtt... | 2015/07/16 | [
"https://Stackoverflow.com/questions/31445251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/782880/"
] | 1) For asynchronous request, it depends on the time it takes for a specific operation to complete. Only once the operation is complete the response would be received by the client.
If you need sequential order then you should be using synchronous calls to server.
If you are using jquery.Ajax method, then you can speci... | The order is not guaranteed. What you can do if you want to use asynchronous is send a unique key with your request, and then also include that unique key in the response.
Here is a function to create random string...
```
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i)... |
31,445,251 | I'd like to be able to take this code block
```
var uVacationLandLubbers = new UserAttribute {
Name = "Land Lubbers",
Project = pVacation,
SystemUserAttribute = context.SystemUserAttributes.Single(x => x.Name == "Yes/No")
};
```
and reformat it to
```
var uVacationLandLubbers = new UserAtt... | 2015/07/16 | [
"https://Stackoverflow.com/questions/31445251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/782880/"
] | Short answer first.
Q1 the order is not guaranteed(usually)
Q2 Yes
1) Ajax method will be executed asynchronously unless You set `async: false`.So callbacks execution orders are all depends on the server side.
But once you use `async: false` option,Javascript can not do anything until you receive a responce. which i... | The order is not guaranteed. What you can do if you want to use asynchronous is send a unique key with your request, and then also include that unique key in the response.
Here is a function to create random string...
```
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i)... |
54,725,131 | I wrote the following code to retrieve a div with the class "tab-statistics-1-statistic". This one is nested in the "statistics-content" div.
```
soup.find(id="statistics-content").find(id="tab-statistics-1-statistic")
```
But when I print the output of the above line it only returns "div id='statistics-content'>" ... | 2019/02/16 | [
"https://Stackoverflow.com/questions/54725131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7828662/"
] | You are navigating to landing page but need to click through to the statistics tab to generate the required html. You need to allow time for javascript to run to populate info.
```
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from s... | In the browser and the dev tools you will be getting those values, because the browser might have already loaded the content. You will have to emulate the same behavior when using selenium. Wait for some time till the content is loaded in the selenium web driver by using
`WebDriverwait`
The sample code below.
`drive... |
30,153,516 | I have several strings from which I want to extract a substring. Here is an example:
```
/skukke/integration/build/IO/something
```
I would like to extract everything after the 3rd `/` character. In this case, the output should be
```
/build/IO/something
```
I tried something like this
```
/\/\s*([^\\]*)\s*$/
... | 2015/05/10 | [
"https://Stackoverflow.com/questions/30153516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4884717/"
] | Regex Solution
==============
The regex you can use is:
```
(?:\/[^\/]+){2}(.*)
```
See [demo](https://regex101.com/r/bT8eL9/1)
Regex explanation:
* `(?:\/[^\/]+){2}` - Match exactly 2 times `/` and everything that is not `/` 1 or more times
* `(.*)` - Match 0 or more characters after what we matched before and p... | **Use This Regex:**
```
my $string = "/skukke/integration/build/IO/something";
$string =~ s/\/[a-zA-Z0-9]*\/[a-zA-Z0-9]*//;
```
Hope This helps. |
6,835,147 | I have a problem where I have two forms that are identical except that the required fields are different. For example, let's say the forms have the same fields: X, Y, and Z. In Form #1, X is required, but in Form #2, Y is required.
So I created two view models, Form1 and Form2, with the same properties but with the Re... | 2011/07/26 | [
"https://Stackoverflow.com/questions/6835147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/243340/"
] | I have put together a sample with what you described (I think) and I'm able to get it to work:
```
public class TestController : Controller
{
public ActionResult Foo()
{
return View("IFoo");
}
[HttpPost]
public ActionResult Foo(Foo foo)
{
if (!ModelState.IsValid)
re... | Try partial form validation approach.
<http://softwaredevelopmentsolutions.blogspot.com/2011/06/aspnet-mvc-3-partial-form-validation-on.html>
Create custom action filter attribute. Decorate the action methods with it to ignore validation properties according to the forms. |
7,524,110 | I am confused on how to handle the logic of reusing the database object and configuration variables or constants that stands global for the application.
the way i have been doing till now is, i created a `config.php` file in `Config` directory and declare all the `config` elements for example my typical config.php fi... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7524110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | I have a similar design pattern where I connect and store the connection in a global.
You do not need to pass the database variable to every class as it is a global.
You can use it anywhere like this:
```
$GLOBALS['dbh'];
```
To hide this I have actually created a function named `get_db_connection()` which first c... | here is what i came up with finally.
```
class DB {
protected static $_dbh;
const HOST = 'localhost';
const DATABASE = 'dbname';
const USERNAME = 'usname';
const PASSWORD = 'passwo';
private function __construct() { }
public static function get_db_connection() {
if(!isset(self::$... |
7,524,110 | I am confused on how to handle the logic of reusing the database object and configuration variables or constants that stands global for the application.
the way i have been doing till now is, i created a `config.php` file in `Config` directory and declare all the `config` elements for example my typical config.php fi... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7524110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | I have a similar design pattern where I connect and store the connection in a global.
You do not need to pass the database variable to every class as it is a global.
You can use it anywhere like this:
```
$GLOBALS['dbh'];
```
To hide this I have actually created a function named `get_db_connection()` which first c... | You could try something like this:
```
function cnn() {
static $pdo;
if(!isset($pdo)) {
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS);
$pdo->setAttribute(PDO::ATTR_TIMEOUT, 30);
$pdo->setAttribute(PDO::ATTR_PERSISTENT, true);
$pdo->setAttribute(PDO::... |
23,697,804 | I have been studying node.js and mongodb. I want to bring the specific db values. But is not easy for me. I want to get values that array in the Vidget.
I don't know how to implement.
my mongodb data
```
{
"Seq": 1,
"UID": "kingnight99",
"DBID": "yyyymmddhhmmss",
"NAME": "name",
"DESC": "desc"... | 2014/05/16 | [
"https://Stackoverflow.com/questions/23697804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3639054/"
] | You have to access the result where it is returned to you:
```
var db = require('mongojs').connect('vizboard', [ 'member', 'count', 'Dashboard' ]);
exports.checkData = function (req, res) {
console.log('check Dats json in');
console.log('Forms Seq:' + req.param('seq'));
db.Dashboard.find({
"Forms.S... | It is simply your query that is badly written, so its result is `null`:
```
{
"Forms":{"Seq":Number(req.param('seq'))}
}
```
Your Forms field is an array (containing a single element), whose elements are JSON objects.
Hence, your query should be:
```
{
"Forms": {
$elemMatch: {"Seq": 1}
}
}
```... |
65,259,485 | I run into an extremely annoying problem that no one has nearly a solution for. I've lost hours on it and unfortunately I can't get it working. This is the problem:
I am trying to extend a base.html file into 2 different html files. For some reason it is possible to extend it in home.html but not in pakbon.html.
Belo... | 2020/12/11 | [
"https://Stackoverflow.com/questions/65259485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10498787/"
] | A few things, your `useEffect` does not need to be in that custom hook at all... It should probably look like this:
```
const MyComponent = (props)=>{
const [randVar, setRandVar] = useState(null);
const randomFunction = useCallback(()=>{
console.log(randVar, props);
}, [props, randVar]);
use... | I don't think you need `randVar` as a dependency and if you had ESLint, it would tell you the same since you never acutally reference `randVar` in the effect.
If you don't want the function to get rebuilt over and over, you need to either memoize it or `useRef`. Unfortunately, once it's a ref it's not reactive. Maybe ... |
8,344,754 | I work a *ton* with our IBM i data and I can't use EF to work with that data. So instead I do something similar to the following:
```
DataTable dt = new DataTable();
using (iDB2Connection conn = new iDB2Connection(_connString))
{
using (iDB2Command cmd = new iDB2Command(sb.ToString(), conn))
{
conn.Ope... | 2011/12/01 | [
"https://Stackoverflow.com/questions/8344754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2535/"
] | If you look at the text of the `InvalidCastException` it will include a line number inside it. The line number it mentions is the source of the `InvalidCastException`. | In which variable do you get the `InvalidCastException`?
Consider if you get an `InvalidCastException` on the below field. Then try this way
```
try
{
CustomerId = i.Field<int>("CCUSTN");
}
catch(InvalidCastException)
{
CustomerId = "yourValue";
}
``` |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | router.navigate vs router.navigateByUrl
=======================================
`router.navigate` is just a convenience method that wraps `router.navigateByUrl`, it boils down to:
```js
navigate(commands: any[], extras) {
return router.navigateByUrl(router.createUrlTree(commands, extras), extras);
}
```
As ment... | I faced the same issue. My solution:
```
...
<p @click=parseHTML v-html=data.html></p>
...
methods: {
parseHTML(event) {
if (event.target.href) {
event.preventDefault();
if (event.target.href.includes(location.hostname)) {
this.$router.push(event.target.href)
}
}
}
}
``` |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | router.navigate vs router.navigateByUrl
=======================================
`router.navigate` is just a convenience method that wraps `router.navigateByUrl`, it boils down to:
```js
navigate(commands: any[], extras) {
return router.navigateByUrl(router.createUrlTree(commands, extras), extras);
}
```
As ment... | In addition to the provided answer, there are more details to `navigate`. From the function's comments:
```
/**
* Navigate based on the provided array of commands and a starting point.
* If no starting route is provided, the navigation is absolute.
*
* Returns a promise that:
* - resolves to 'true' when navigatio... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | In addition to the provided answer, there are more details to `navigate`. From the function's comments:
```
/**
* Navigate based on the provided array of commands and a starting point.
* If no starting route is provided, the navigation is absolute.
*
* Returns a promise that:
* - resolves to 'true' when navigatio... | Let's say you're running your server on http://localhost:4200 and you're on http://localhost:4200/abc and under routing module you've defined path as below:
```
const appRoutes: Routes = [
{ path: 'abc', component: MainComponent, children: [
{path: '', component: InitialComponent},
{path: 'new', component: Loa... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | ### navigateByUrl
`routerLink` directive as used like this:
```
<a [routerLink]="/inbox/33/messages/44">Open Message 44</a>
```
is just a wrapper around imperative navigation using `router` and its [navigateByUrl](https://angular.io/api/router/Router#navigateByUrl) method:
```
router.navigateByUrl('/inbox/33/messa... | Let's say you're running your server on http://localhost:4200 and you're on http://localhost:4200/abc and under routing module you've defined path as below:
```
const appRoutes: Routes = [
{ path: 'abc', component: MainComponent, children: [
{path: '', component: InitialComponent},
{path: 'new', component: Loa... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | In addition to the provided answer, there are more details to `navigate`. From the function's comments:
```
/**
* Navigate based on the provided array of commands and a starting point.
* If no starting route is provided, the navigation is absolute.
*
* Returns a promise that:
* - resolves to 'true' when navigatio... | I faced the same issue. My solution:
```
...
<p @click=parseHTML v-html=data.html></p>
...
methods: {
parseHTML(event) {
if (event.target.href) {
event.preventDefault();
if (event.target.href.includes(location.hostname)) {
this.$router.push(event.target.href)
}
}
}
}
``` |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | router.navigate vs router.navigateByUrl
=======================================
`router.navigate` is just a convenience method that wraps `router.navigateByUrl`, it boils down to:
```js
navigate(commands: any[], extras) {
return router.navigateByUrl(router.createUrlTree(commands, extras), extras);
}
```
As ment... | From my understanding, router.navigate is used to navigate relatively to current path.
For eg :
If our current path is **abc.com/user**, we want to navigate to the url : **abc.com/user/10** for this scenario we can use router.navigate .
---
router.navigateByUrl() is used for absolute path navigation.
ie,
If we ne... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | ### navigateByUrl
`routerLink` directive as used like this:
```
<a [routerLink]="/inbox/33/messages/44">Open Message 44</a>
```
is just a wrapper around imperative navigation using `router` and its [navigateByUrl](https://angular.io/api/router/Router#navigateByUrl) method:
```
router.navigateByUrl('/inbox/33/messa... | router.navigate vs router.navigateByUrl
=======================================
`router.navigate` is just a convenience method that wraps `router.navigateByUrl`, it boils down to:
```js
navigate(commands: any[], extras) {
return router.navigateByUrl(router.createUrlTree(commands, extras), extras);
}
```
As ment... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | ### navigateByUrl
`routerLink` directive as used like this:
```
<a [routerLink]="/inbox/33/messages/44">Open Message 44</a>
```
is just a wrapper around imperative navigation using `router` and its [navigateByUrl](https://angular.io/api/router/Router#navigateByUrl) method:
```
router.navigateByUrl('/inbox/33/messa... | From my understanding, router.navigate is used to navigate relatively to current path.
For eg :
If our current path is **abc.com/user**, we want to navigate to the url : **abc.com/user/10** for this scenario we can use router.navigate .
---
router.navigateByUrl() is used for absolute path navigation.
ie,
If we ne... |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | ### navigateByUrl
`routerLink` directive as used like this:
```
<a [routerLink]="/inbox/33/messages/44">Open Message 44</a>
```
is just a wrapper around imperative navigation using `router` and its [navigateByUrl](https://angular.io/api/router/Router#navigateByUrl) method:
```
router.navigateByUrl('/inbox/33/messa... | I faced the same issue. My solution:
```
...
<p @click=parseHTML v-html=data.html></p>
...
methods: {
parseHTML(event) {
if (event.target.href) {
event.preventDefault();
if (event.target.href.includes(location.hostname)) {
this.$router.push(event.target.href)
}
}
}
}
``` |
45,025,334 | <https://angular.io/api/router/RouterLink> gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link | 2017/07/11 | [
"https://Stackoverflow.com/questions/45025334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6879750/"
] | From my understanding, router.navigate is used to navigate relatively to current path.
For eg :
If our current path is **abc.com/user**, we want to navigate to the url : **abc.com/user/10** for this scenario we can use router.navigate .
---
router.navigateByUrl() is used for absolute path navigation.
ie,
If we ne... | Let's say you're running your server on http://localhost:4200 and you're on http://localhost:4200/abc and under routing module you've defined path as below:
```
const appRoutes: Routes = [
{ path: 'abc', component: MainComponent, children: [
{path: '', component: InitialComponent},
{path: 'new', component: Loa... |
62,599,100 | question:
---------
I have finished the rest of the dialog, but the top side has a round overflow avatar. I don’t know how to do it now. As shown in this picture
demo picture
============
[](https://i.stack.imgur.com/azTMs.png) | 2020/06/26 | [
"https://Stackoverflow.com/questions/62599100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9763596/"
] | You need to create a Home Screen Widget to call a function showDialog in any button, when Pressed or Tap, passing the arguments that you need, like QRCode Image and Avatar.
```
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomeP... | Can be solved with the [Badges](https://pub.dev/packages/badges) plugin. Wrap the QRCode with **Badge** and modify the **position** parameter which is a BadgePosition to the exact **top** and **left** values.
```
Badge(
position: BadgePosition.topLeft(top: 0,left: 0),//change this to get the right location
... |
3,671,936 | I'm using a function in a card game, to check the value of each card, and see if it is higher than the last card played.
```
def Valid(card):
prev=pile[len(pile)-1]
cardValue=0
prevValue=0
if card[0]=="J":
cardValue=11
elif card[0]=="Q":
cardValue=12
elif card[0]=="K":
cardValue=13
elif card[0]=="A":
c... | 2010/09/08 | [
"https://Stackoverflow.com/questions/3671936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442842/"
] | I think what you meant is that it is saying that "2" > 13 which is true. You need to change
```
cardValue=card[0]
```
to
```
cardValue=int(card[0])
``` | Why not use a dictionary instead of a big cascade of if/else blocks?
```
cards = dict(zip((str(x) for x in range(1, 11)), range(1, 11)))
cards['J'] = 11
cards['Q'] = 12
cards['K'] = 13
cards['A'] = 14
```
then
```
cardValue = cards[card[0]]
``` |
3,671,936 | I'm using a function in a card game, to check the value of each card, and see if it is higher than the last card played.
```
def Valid(card):
prev=pile[len(pile)-1]
cardValue=0
prevValue=0
if card[0]=="J":
cardValue=11
elif card[0]=="Q":
cardValue=12
elif card[0]=="K":
cardValue=13
elif card[0]=="A":
c... | 2010/09/08 | [
"https://Stackoverflow.com/questions/3671936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442842/"
] | I think what you meant is that it is saying that "2" > 13 which is true. You need to change
```
cardValue=card[0]
```
to
```
cardValue=int(card[0])
``` | Using a dict will make your code much cleaner:
Replace:
```
if card[0]=="J":
cardValue=11
elif card[0]=="Q":
cardValue=12
elif card[0]=="K":
cardValue=13
elif card[0]=="A":
cardValue=14
else:
cardValue=card[0]
```
with:
```
cardMap = { 'J': 11, 'Q':12, 'K': 13, 'A': 14 }
cardValue = cardMap.get... |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | In the `spring-webmvc-3.0.x.RELEASE.jar`, of course. | The spring-webmvc-3.x.x.RELEASE.jar can be included using the following maven:
```
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
```
Just make sure that the ${spring.version} that you use matches the version o... |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | In the `spring-webmvc-3.0.x.RELEASE.jar`, of course. | I had this problem, because the springmvc jar was in an EAR library, I had to place the tld files under the WEB-INF folder, and everything is working now |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | In the `spring-webmvc-3.0.x.RELEASE.jar`, of course. | 1. spring-from.tld path in org.springframework.web.servlet-version.jar meta-inf
2. org.springframework.web.servlet.version.jar dependent on org.springframework.web-version.jar.
just download both jars..paste in lib folder.
3. in jsp add the below line:
```
<%@ taglib uri="http://www.springframework.org/tags/form" pref... |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | From Spring 3.0 release, both **spring.tld** and **spring-form.tld** can be found in the [spring-webmvc-3.0.x.RELEASE.jar](http://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar) file.
To use them the JAR file must be in the classpath. Just add the following lines... | The spring-webmvc-3.x.x.RELEASE.jar can be included using the following maven:
```
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
```
Just make sure that the ${spring.version} that you use matches the version o... |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | From Spring 3.0 release, both **spring.tld** and **spring-form.tld** can be found in the [spring-webmvc-3.0.x.RELEASE.jar](http://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar) file.
To use them the JAR file must be in the classpath. Just add the following lines... | I had this problem, because the springmvc jar was in an EAR library, I had to place the tld files under the WEB-INF folder, and everything is working now |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | From Spring 3.0 release, both **spring.tld** and **spring-form.tld** can be found in the [spring-webmvc-3.0.x.RELEASE.jar](http://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar) file.
To use them the JAR file must be in the classpath. Just add the following lines... | 1. spring-from.tld path in org.springframework.web.servlet-version.jar meta-inf
2. org.springframework.web.servlet.version.jar dependent on org.springframework.web-version.jar.
just download both jars..paste in lib folder.
3. in jsp add the below line:
```
<%@ taglib uri="http://www.springframework.org/tags/form" pref... |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | The spring-webmvc-3.x.x.RELEASE.jar can be included using the following maven:
```
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
```
Just make sure that the ${spring.version} that you use matches the version o... | I had this problem, because the springmvc jar was in an EAR library, I had to place the tld files under the WEB-INF folder, and everything is working now |
2,900,689 | I cannot find this tag lib, i need it because <http://www.springframework.org/tags/form>
does not work. | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89566/"
] | The spring-webmvc-3.x.x.RELEASE.jar can be included using the following maven:
```
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
```
Just make sure that the ${spring.version} that you use matches the version o... | 1. spring-from.tld path in org.springframework.web.servlet-version.jar meta-inf
2. org.springframework.web.servlet.version.jar dependent on org.springframework.web-version.jar.
just download both jars..paste in lib folder.
3. in jsp add the below line:
```
<%@ taglib uri="http://www.springframework.org/tags/form" pref... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Obviously finishing a project is important in the "real world" as unless the project is completed and delivered you don't (or your employer doesn't) get paid.
However, for hobby and learning projects it's a little more complicated. Having finished projects demonstrates to potential employers that you can deliver what ... | Plain and simple: if you want to finish it , finish it! If you dont want to, dont! You dont have anybody waiting for the delivery , so why agonize so much? Doing hobby projects is not the same as industry projects. They are very different. No one will ask you why you did not finish your hobby projects if you dont tell ... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Take it from someone who has the same problem, finishing at least some of your projects is very important. It's completely ok to do some experimental projects and abandon them when you've learnt what you need to or it simply wasn't a good idea to start with.
However, creative people tend to like the challenging first ... | I have countless projects from my student days that remain unfinished. I don't think it's important to finish them. I never finished most of mine. Some of them were completely hair brained, like creating a better string class or manipulating bitmaps with Pixel class arrays.
Maybe you are choosing projects that are to... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Firstly, it is important for the self-satisfaction. You have achieved something from scratch to a clear end state. You can then pop one item of your "project-stack-in-mind", and for me it has always been a relief.
For your career, and more precisely for job interviews, until you have finished your project, you don't h... | Finishing projects is what separates the kids from the adults, the wheat from the chaff, the men/women from the boys/girls.
"Real programmers ship." |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Take it from someone who has the same problem, finishing at least some of your projects is very important. It's completely ok to do some experimental projects and abandon them when you've learnt what you need to or it simply wasn't a good idea to start with.
However, creative people tend to like the challenging first ... | Take pride in your unfinished projects folder and don't beat yourself up about it!
If you were in another discipline, e.g. art, then the unfinished projects would not really matter, the point is that you are having a go and that in itself is admirable. You could be sat at home watching the television instead? Or wasti... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Firstly, it is important for the self-satisfaction. You have achieved something from scratch to a clear end state. You can then pop one item of your "project-stack-in-mind", and for me it has always been a relief.
For your career, and more precisely for job interviews, until you have finished your project, you don't h... | Seth Godin has written a lot about getting into the habit of shipping:
<http://the99percent.com/tips/6249/seth-godin-the-truth-about-shipping>
I think it's important, and here's why: it's not enough to do a project for yourself, even though it may be of some educational value to you. If you never share your gift with... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Obviously finishing a project is important in the "real world" as unless the project is completed and delivered you don't (or your employer doesn't) get paid.
However, for hobby and learning projects it's a little more complicated. Having finished projects demonstrates to potential employers that you can deliver what ... | Take pride in your unfinished projects folder and don't beat yourself up about it!
If you were in another discipline, e.g. art, then the unfinished projects would not really matter, the point is that you are having a go and that in itself is admirable. You could be sat at home watching the television instead? Or wasti... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | I have countless projects from my student days that remain unfinished. I don't think it's important to finish them. I never finished most of mine. Some of them were completely hair brained, like creating a better string class or manipulating bitmaps with Pixel class arrays.
Maybe you are choosing projects that are to... | If its any consolation despite being a professional software developer for over 8 years I still find it difficult to finish personal projects. I've always felt that its a combination of open ended goals, a desire to 'do the cool bit first' and a lack of any real pressure to complete it.... to answer your two questions ... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | Take it from someone who has the same problem, finishing at least some of your projects is very important. It's completely ok to do some experimental projects and abandon them when you've learnt what you need to or it simply wasn't a good idea to start with.
However, creative people tend to like the challenging first ... | Firstly, it is important for the self-satisfaction. You have achieved something from scratch to a clear end state. You can then pop one item of your "project-stack-in-mind", and for me it has always been a relief.
For your career, and more precisely for job interviews, until you have finished your project, you don't h... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | If its any consolation despite being a professional software developer for over 8 years I still find it difficult to finish personal projects. I've always felt that its a combination of open ended goals, a desire to 'do the cool bit first' and a lack of any real pressure to complete it.... to answer your two questions ... | Plain and simple: if you want to finish it , finish it! If you dont want to, dont! You dont have anybody waiting for the delivery , so why agonize so much? Doing hobby projects is not the same as industry projects. They are very different. No one will ask you why you did not finish your hobby projects if you dont tell ... |
76,858 | I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times a... | 2011/05/17 | [
"https://softwareengineering.stackexchange.com/questions/76858",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9972/"
] | I have countless projects from my student days that remain unfinished. I don't think it's important to finish them. I never finished most of mine. Some of them were completely hair brained, like creating a better string class or manipulating bitmaps with Pixel class arrays.
Maybe you are choosing projects that are to... | Finishing projects is what separates the kids from the adults, the wheat from the chaff, the men/women from the boys/girls.
"Real programmers ship." |
61,515,141 | I want to break the function after the `if` statement, but I unable to do so.
Below is my code snippet.
>
>
> ```
> void addOrderToCart(Product product, int quantity, String color, String size) {
> _lastOrder = Order(product, quantity, _orderId++, color, size);
>
> _orders.forEach((element) {
> if(el... | 2020/04/30 | [
"https://Stackoverflow.com/questions/61515141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9657968/"
] | I think you should return `bool` or any other instead of `void` and use `for` instead of `forEach`.
Here's the solution you looking for.
>
>
> ```
> bool addOrderToCart(Product product, int quantity, String color, String size) {
> _lastOrder = Order(product, quantity, _orderId++, color, size);
>
>
> for(v... | >
> Dart does not support non-local returns, so returning from a callback
> won't break the loop. Dart forEach callback returns void.
>
>
>
You can use `any` instead of `forEach` since `any` callback returns bool. So you can modify your code as follows.
```
void addOrderToCart(Product product, int quantity, Strin... |
28,091,789 | ```
<div class='comment'>
<div id='image'>image</div>
<div id='date'>date</div>
<p> Comment 1</p>
<p> Comment 2</p>
<p> Comment 3</p>
<div>signature</div>
</div>
```
I need to give all p element one style
for example if i try this :
```
.comment p {
background-color: #CED7BA;
color: rgb(15, 8, 119);
border-radius: 1... | 2015/01/22 | [
"https://Stackoverflow.com/questions/28091789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A solution was found here: [here](https://stackoverflow.com/questions/3168484/pendingintent-works-correctly-for-the-first-notification-but-incorrectly-for-the#comment3283736_3168653).
You've to use setAction on the intent to a unique value so that there will be no matching PendingIntents
Here's what I used:
```
set... | From the official documentation
>
> If you truly need multiple distinct PendingIntent objects active at the same time (such as to use as two notifications that are both shown at the same time), then you will need to ensure there is something that is different about them to associate them with different PendingIntents... |
5,197,550 | is it possible to run some of my PLINQ AsParallel() - Queries with a lower priority than others?
(Or some with a higher priority than others)
Is this possible with PLinq or will I have to avoid PLINQ and do all the stuff on my own?
EDIT/UPDATE:
Would it be possible to call
```
Thread.Sleep(0)
```
inside the parall... | 2011/03/04 | [
"https://Stackoverflow.com/questions/5197550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381043/"
] | Unfortunately, this is not directly possible in PLINQ.
You can do it in most of the rest of the Task Parallel Library via creation of a custom [TaskScheduler](http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.aspx). This would allow you to have custom "priorities" when using `Parallel.For` o... | `AsParallel` is very high level API. You should really use `Thread`s if you want fine grained control over what is happening using [Priority](http://msdn.microsoft.com/en-us/library/system.threading.thread.priority%28v=VS.100%29.aspx) |
5,197,550 | is it possible to run some of my PLINQ AsParallel() - Queries with a lower priority than others?
(Or some with a higher priority than others)
Is this possible with PLinq or will I have to avoid PLINQ and do all the stuff on my own?
EDIT/UPDATE:
Would it be possible to call
```
Thread.Sleep(0)
```
inside the parall... | 2011/03/04 | [
"https://Stackoverflow.com/questions/5197550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381043/"
] | `AsParallel` is very high level API. You should really use `Thread`s if you want fine grained control over what is happening using [Priority](http://msdn.microsoft.com/en-us/library/system.threading.thread.priority%28v=VS.100%29.aspx) | The PLINQ library does not allow configuring the `TaskScheduler`, [for good reasons](https://github.com/dotnet/runtime/issues/4727#issuecomment-160673747 "Add a guaranteed DOP to Parallel and a max-DOP to PLINQ"):
>
> The reason we didn't make this public initially and then haven't each time the question has come up ... |
5,197,550 | is it possible to run some of my PLINQ AsParallel() - Queries with a lower priority than others?
(Or some with a higher priority than others)
Is this possible with PLinq or will I have to avoid PLINQ and do all the stuff on my own?
EDIT/UPDATE:
Would it be possible to call
```
Thread.Sleep(0)
```
inside the parall... | 2011/03/04 | [
"https://Stackoverflow.com/questions/5197550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381043/"
] | Unfortunately, this is not directly possible in PLINQ.
You can do it in most of the rest of the Task Parallel Library via creation of a custom [TaskScheduler](http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.aspx). This would allow you to have custom "priorities" when using `Parallel.For` o... | The PLINQ library does not allow configuring the `TaskScheduler`, [for good reasons](https://github.com/dotnet/runtime/issues/4727#issuecomment-160673747 "Add a guaranteed DOP to Parallel and a max-DOP to PLINQ"):
>
> The reason we didn't make this public initially and then haven't each time the question has come up ... |
52,953,448 | I'm building a keyboard for an assignment at school, and I've noticed an issue I've never had before. My `JFrame` is opening right away, but the `JPanels` within it, mainly the content pane, are loading in slowly after the fact. This gives an unfinished feel to the project, and I'm looking for a fix. They do load event... | 2018/10/23 | [
"https://Stackoverflow.com/questions/52953448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10425391/"
] | I've found a solution to the issue, though I'm still not quite sure as to what caused it to execute slowly. As soon as I added a component to the other JPanel, option, my program ran exactly as I wanted it to. It didn't stall out like it was.
```
public class main {
public static JFrame frame;
public static JPanel p... | You should always use Threads for heavy tasks like loading files or read from a database so they can run on the background without affecting your GUI. I hope this can help you:
```
new Runnable() {
@Override
public void run() {
C3.addActionListener((ActionEvent ae) -> {
try... |
43,656,246 | I got a nullPointerException when unit testing my service and i do not understand why? I m using Spring boot.
This is my simple service which provide Templating. I autowired TemplateEngine Component.
```
@Service
public class TicketTemplatingService implements ITemplatingService{
@Autowired
private TemplateEn... | 2017/04/27 | [
"https://Stackoverflow.com/questions/43656246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7710232/"
] | Instead of
```
@Autowired
private TemplateEngine templateEngine;
```
use this interface in your Service.
```
import org.thymeleaf.ITemplateEngine;
@Autowired
private ITemplateEngine templateEngine;
```
And in your test class use same class as a Mock
```
@Mock
private ITemplateEngine emailTemplateEngine;
@Befo... | I was encountering the same issue as you while testing thymeleaf template using Mokito. Based on my research, you may want to try:
1. check the version of your Thymeleaf jar. If you use the spring-boot-starter-thymeleaf dependecny, it might still use version < 3.0, which is older than the current stable version.
Acco... |
43,656,246 | I got a nullPointerException when unit testing my service and i do not understand why? I m using Spring boot.
This is my simple service which provide Templating. I autowired TemplateEngine Component.
```
@Service
public class TicketTemplatingService implements ITemplatingService{
@Autowired
private TemplateEn... | 2017/04/27 | [
"https://Stackoverflow.com/questions/43656246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7710232/"
] | I was encountering the same issue as you while testing thymeleaf template using Mokito. Based on my research, you may want to try:
1. check the version of your Thymeleaf jar. If you use the spring-boot-starter-thymeleaf dependecny, it might still use version < 3.0, which is older than the current stable version.
Acco... | How @Mengru said, Mockito has issues with final classes and methods, but that is solved with a simple configuration file: <https://www.baeldung.com/mockito-final>. I don't know if this file has any implications or issues, you could give a try.
Or how @Mengru and @cazador said, in version 3.0+ you could replace it with... |
43,656,246 | I got a nullPointerException when unit testing my service and i do not understand why? I m using Spring boot.
This is my simple service which provide Templating. I autowired TemplateEngine Component.
```
@Service
public class TicketTemplatingService implements ITemplatingService{
@Autowired
private TemplateEn... | 2017/04/27 | [
"https://Stackoverflow.com/questions/43656246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7710232/"
] | Instead of
```
@Autowired
private TemplateEngine templateEngine;
```
use this interface in your Service.
```
import org.thymeleaf.ITemplateEngine;
@Autowired
private ITemplateEngine templateEngine;
```
And in your test class use same class as a Mock
```
@Mock
private ITemplateEngine emailTemplateEngine;
@Befo... | How @Mengru said, Mockito has issues with final classes and methods, but that is solved with a simple configuration file: <https://www.baeldung.com/mockito-final>. I don't know if this file has any implications or issues, you could give a try.
Or how @Mengru and @cazador said, in version 3.0+ you could replace it with... |
67,018,161 | I believe `FFFFFFFF` is `-1` because of `Two's Complement`.
I tried to convert Hex String into Integer, but I got the error.
Here is the code I have tried.
* code
```
// Extension functions
val Int.asByteArray get() =
byteArrayOf(
(this shr 24).toByte(),
(this shr 16).toByte(),
... | 2021/04/09 | [
"https://Stackoverflow.com/questions/67018161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8139410/"
] | Your code presumably can't parse 4 bytes (32 bit) to a signed integer, since this only contains 31 bits as one bit is reserved for the sign.
A solution would be to parse it into an unsigned integer (as **Some random IT boy** stated) and then convert the (16bit-)UInt to a (16bit-)Int:
```kotlin
fun main()
{
val u ... | It's -1 because the first bit of the 4 byte memory block decides the sign of the number. In this case since it's all 1's then it's a negative number. Then the value of this memory block is the Two's complement because we're dealing with a signed integer
The problem you're facing is not Kotlin specific: [checkout this ... |
2,285,235 | I am trying to add information from main()
to a items class where i am storing the information in a hashset
i have 3 classes
1. project - main()
2. libaray - addBandMembers function
3. Item - addband(String... member)
i am adding CD information. first, i add band, # of songs, title - which works good
then in anothe... | 2010/02/17 | [
"https://Stackoverflow.com/questions/2285235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A [varargs argument](http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html) resolves to an [array](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html).
So, change
```
private String members;
```
to
```
private String[] members;
``` | Change your getter to return a String array instead of a String. |
2,285,235 | I am trying to add information from main()
to a items class where i am storing the information in a hashset
i have 3 classes
1. project - main()
2. libaray - addBandMembers function
3. Item - addband(String... member)
i am adding CD information. first, i add band, # of songs, title - which works good
then in anothe... | 2010/02/17 | [
"https://Stackoverflow.com/questions/2285235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A [varargs argument](http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html) resolves to an [array](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html).
So, change
```
private String members;
```
to
```
private String[] members;
``` | String... member gives you an array, so what you are looking at is a member that is of type String[].
I think once you get that, you kind of get over the hump of the issue. |
65,053,578 | I have started learning Dart and Flutter and wanted to understand one concept:
Updated code: try in dartpad
```
class Service{
String ask = '';
void write (String receivedData){
ask = receivedData;
}
}
class WriteNow{
String hi = 'hi';
Service art = Service();
void okay () {
art.writ... | 2020/11/28 | [
"https://Stackoverflow.com/questions/65053578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12940363/"
] | You are creating different instances of the `Service` class, that's the reason you can't get the updated String. Let me explain, in this piece of code:
```dart
WriteNow a = WriteNow();
a.okay();
```
You are creating an instance of the `Service` class, called `art`. The `art` instance has its member called `ask`, whi... | ```
class Service {
String ask = '';
void write (String receivedData){
ask = receivedData;
}
}
```
```
class WriteToService{
Service a = Service();
a.write('hello');
}
```
```
class ReadFromService {
Service b = Service();
print(b.ask);
}
```
What you are Doing:
**Step 1:** T... |
13,381,971 | I have tried this different ways, but still can't get the filter to work. My ext app lets user to choose a single state from a combobox, and the grid below displays more data on that selected "value"=state.. On select, the combobox fires a function that filters the store of the grid and updates the store...
this is my ... | 2012/11/14 | [
"https://Stackoverflow.com/questions/13381971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1689649/"
] | In addition to dbrin's anwser I also can't understand why you are using `remoteSort` but not `remoteFilter`? You may also have a scope issue by using `this`.
Anyway I would recommend you to extend a new combo type so that you are also be able to clear your filter if you have the need to. Here is an extension I have wr... | i see 2 issues
1. store should have `remoteFilter: true` set
2. in JavaScript all variables declarations are picked out and hoisted to the beginning of the function. so any variables declared inside a loop should be taken out and declared at the top of the function. JS has no block scope (like Java). |
32,066,432 | How can I convert this `201402110544` to `date`(2014-02-11) in SQL server 2008? | 2015/08/18 | [
"https://Stackoverflow.com/questions/32066432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4410073/"
] | You can cast as `DATE` data type (<https://msdn.microsoft.com/en-us/library/bb630352(v=sql.100).aspx>)
```
SELECT CAST(datetime_value AS DATE)
SELECT CAST(GETDATE() AS DATE) --> 2015-08-18
```
If you have a string to cast as `DATE` you can use:
```
SELECT CAST(LEFT('201402110544', 8) AS DATE)
```
You trim out th... | String to date conversion sure is a weakness of SQL Server. CONVERT does that, but can only deal with a number of given formats. So you must convert your string into such a format first and then convert it to date afterwards.
One such format is 120 = 'yyyy-mm-dd hh:mi:ss' which I think comes closest to yours. Another ... |
32,066,432 | How can I convert this `201402110544` to `date`(2014-02-11) in SQL server 2008? | 2015/08/18 | [
"https://Stackoverflow.com/questions/32066432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4410073/"
] | You can cast as `DATE` data type (<https://msdn.microsoft.com/en-us/library/bb630352(v=sql.100).aspx>)
```
SELECT CAST(datetime_value AS DATE)
SELECT CAST(GETDATE() AS DATE) --> 2015-08-18
```
If you have a string to cast as `DATE` you can use:
```
SELECT CAST(LEFT('201402110544', 8) AS DATE)
```
You trim out th... | If this format is always the same, you can do this
```
DECLARE @d VARCHAR(20)='201402110544'
SELECT CAST(SUBSTRING(@d,0,9) as DATETIME)
```
Also have a look at [The ultimate guide to the datetime datatypes](http://www.karaszi.com/SQLServer/info_datetime.asp) which explains in detail about handling date-times |
20,035,917 | I am trying to setup Reachability using the new 2.0 [AFNetworking](https://github.com/AFNetworking/AFNetworking#network-reachability-manager).
In my AppDelegate I initialise the sharedManager.
```
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
```
Then in the relevant VC method I check... | 2013/11/17 | [
"https://Stackoverflow.com/questions/20035917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523603/"
] | As you can read in the [AFNetworking read me page](https://github.com/AFNetworking/AFNetworking#network-reachability-manager)
```
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(s... | I have a singleton AFHTTPRequestOperationManager class. In the singleton has a method:
```
+(void)connectedCompletionBlock:(void(^)(BOOL connected))block {
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachab... |
20,035,917 | I am trying to setup Reachability using the new 2.0 [AFNetworking](https://github.com/AFNetworking/AFNetworking#network-reachability-manager).
In my AppDelegate I initialise the sharedManager.
```
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
```
Then in the relevant VC method I check... | 2013/11/17 | [
"https://Stackoverflow.com/questions/20035917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523603/"
] | As you can read in the [AFNetworking read me page](https://github.com/AFNetworking/AFNetworking#network-reachability-manager)
```
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(s... | I was just going through your question and all the answers. After that I decided to do all these things once. So, in my existing project I just included the AFNetworking through cocoa-pods and here is the solution which is woking for me completely.
Solution -- First of all AFNetworkReachabilityManager is a singleton c... |
20,035,917 | I am trying to setup Reachability using the new 2.0 [AFNetworking](https://github.com/AFNetworking/AFNetworking#network-reachability-manager).
In my AppDelegate I initialise the sharedManager.
```
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
```
Then in the relevant VC method I check... | 2013/11/17 | [
"https://Stackoverflow.com/questions/20035917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523603/"
] | As you can read in the [AFNetworking read me page](https://github.com/AFNetworking/AFNetworking#network-reachability-manager)
```
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(s... | I use this in the app delegate ->
```
func reachablityCode() {
AFNetworkReachabilityManager.sharedManager()
AFNetworkReachabilityManager.sharedManager().startMonitoring()
AFNetworkReachabilityManager.sharedManager().setReachabilityStatusChangeBlock({(status) in
let defaults = NSUse... |
20,035,917 | I am trying to setup Reachability using the new 2.0 [AFNetworking](https://github.com/AFNetworking/AFNetworking#network-reachability-manager).
In my AppDelegate I initialise the sharedManager.
```
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
```
Then in the relevant VC method I check... | 2013/11/17 | [
"https://Stackoverflow.com/questions/20035917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523603/"
] | I have a singleton AFHTTPRequestOperationManager class. In the singleton has a method:
```
+(void)connectedCompletionBlock:(void(^)(BOOL connected))block {
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachab... | I was just going through your question and all the answers. After that I decided to do all these things once. So, in my existing project I just included the AFNetworking through cocoa-pods and here is the solution which is woking for me completely.
Solution -- First of all AFNetworkReachabilityManager is a singleton c... |
20,035,917 | I am trying to setup Reachability using the new 2.0 [AFNetworking](https://github.com/AFNetworking/AFNetworking#network-reachability-manager).
In my AppDelegate I initialise the sharedManager.
```
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
```
Then in the relevant VC method I check... | 2013/11/17 | [
"https://Stackoverflow.com/questions/20035917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523603/"
] | I have a singleton AFHTTPRequestOperationManager class. In the singleton has a method:
```
+(void)connectedCompletionBlock:(void(^)(BOOL connected))block {
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachab... | I use this in the app delegate ->
```
func reachablityCode() {
AFNetworkReachabilityManager.sharedManager()
AFNetworkReachabilityManager.sharedManager().startMonitoring()
AFNetworkReachabilityManager.sharedManager().setReachabilityStatusChangeBlock({(status) in
let defaults = NSUse... |
17,993,389 | I want a function in excel that i can call and pass a cell into. Input:
```
Firstname Lastname email@mail.com
Firstname midname Lastname email@mail.com
```
The number of spaces in between are random. Output should just be an array. The array can have any length since i don't know w... | 2013/08/01 | [
"https://Stackoverflow.com/questions/17993389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2489815/"
] | * Enter you input data in A1
* Select the B1:D1 range
* enter your formula `=MySplitFunction(A1)`
* make it an array formula by pressing CTRL + SHIFT + ENTER instead of just ENTER.
To remove the multiple spaces, you could amend your code like this (not super efficient but works):
```
Function MySplitFunction(s As Str... | Alternative solution is to:
1. use RegEx as a first step to remove all spaces
2. split result of step first based on single spaces left
3. moreover, because you need to return different element of the text in different cells than additional function parameter will solved that.
This is proposed function:
```
Public F... |
48,796,444 | I am reading [Typeclassopedia](https://wiki.haskell.org/Typeclassopedia) and I was having trouble in the section on Applicatives. I think I (sort of) have it figured out but I want to see if my understanding is correct.
The laws for applicative made sense right up until the Composition law. I just couldn't parse the r... | 2018/02/14 | [
"https://Stackoverflow.com/questions/48796444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/780350/"
] | Using `position: fixed` with `display: flex` is totally fine.
I suspect that when you added `position: fixed;` it caused the size of the `nav` to change. This is because when `position: fixed` is applied it takes the element out of the flow of the document. This means you'll need to explicitly define the size of the ... | When you add `position:fixed` to `.MyBlog-menu` the context of the element changes. It's now kind of floating above the other content, and loses it's "full page" width and position. You can resposition the menu using the attributes `top, bottom, left, right`.
For more information about the position attribute in CSS, ... |
625,790 | I am on Ubuntu 18.04 and trying swap `Ctrl` and `CapsLock` using `xmodmap`. But failed to find a way of doing that automatically: `.[X|x]modmap[rc]` and `.config/autostart` didn't work. What other ways are there? Could it be possible throgh `systemd`?
**SHORT**:
Desktop entry in `.config/autostart` or `/etc/xdg/autost... | 2020/12/23 | [
"https://unix.stackexchange.com/questions/625790",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/390120/"
] | Since Ubuntu switched back from Unity to Gnome in version 17.10, you should be able to use the [Gnome autostart mechanism](https://help.gnome.org/admin/system-admin-guide/stable/autostart-applications.html.en) (if it is sufficient that the shell command is launched on login).
To do so:
* you will need `sudo` privileg... | The `systemd`-way:
**Upon login**
```
[Unit]
Description=Change keyboard layout AFTER LOGIN TO GUI session
After=graphical.target
[Service]
#execute once only
Type=oneshot
ExecStart=/usr/bin/xmodmap home/<user>/.xmodmaprc
[Install]
WantedBy=graphical.target
```
To be put under `~/.config/systemd/user/xmodmap.serv... |
3,055,905 | I have a flash object I wish to load and I believe the best place to store that asset is in the `public` directory. Suppose it's stored in `public/flash`, there must be a better way to path to the swf than what I've done below. Note the 'data' element, it has a relative path.
```
def create_vnc_object
haml_tag :obje... | 2010/06/16 | [
"https://Stackoverflow.com/questions/3055905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/189488/"
] | Wouldn't this work?
```
def create_vnc_object
haml_tag :object,
:id => 'flash',
:width => '100%',
:height => '100%',
:type => 'application/x-shockwave-flash',
:data => '/flash/flash.swf' do
haml_tag :param,
:name => 'movie',
:value => '/flash/flash.swf'
end
end
```
A... | An alternative method is to extend `ActionView::Helpers::AssetTagHelper`, which is most useful if you're using asset servers. This is the module that already implements `javascript_path` and `stylesheet_path`. You could do it like this:
```
module ActionView
module Helpers
module AssetTagHelper
def flash_m... |
59,649,599 | I'm working on a makeshift algorithm using Python 3.0, i'm still new to programming overall and i'm just working on a personal project.
```
A = for i in range(1):
print(random.uniform(9, 80))
```
Python told me that it's a syntax error so I just want to know what's the correct syntax on defining variables with lo... | 2020/01/08 | [
"https://Stackoverflow.com/questions/59649599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12676652/"
] | You can't assign a `for` loop into a variable, instead you just can perform this without the variable:
```
import random
for i in range(1):
print(random.uniform(9, 80))
``` | You would over write the variable if you were looping through something and assigning. You could create A as an empty list, then add each variable in the loop to that list, then print the final list like so:
```
import random
A = []
for i in range(10):
A.append(random.uniform(9, 87))
print(A)
``` |
20,186,930 | Assume I have the following lists
```
list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
```
I can write the first list to a JSON file using `json.dump(list1,file,indent=2)` and the result is
```
[
{
"created_at": "2012-01... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20186930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241821/"
] | ```
In [1]: import json
In [2]: list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
In [3]: list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
In [4]: list1.extend(list2)
In [5]: json.dumps(list1)
Out[5]: '[{"created_at": "2012-01-31T10:00:04Z"}, {"created_at": "2013-01-31T10:00:... | When parse the files append (or extend) to a unique list and finally convert to JSON. Assume that your function for parse is `parse`.
```
>>> import json
>>> result = []
>>> for file in files:
... result.append(parse(file))
...
>>> json.dump(result, file1, indent=2)
``` |
20,186,930 | Assume I have the following lists
```
list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
```
I can write the first list to a JSON file using `json.dump(list1,file,indent=2)` and the result is
```
[
{
"created_at": "2012-01... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20186930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241821/"
] | ```
In [1]: import json
In [2]: list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
In [3]: list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
In [4]: list1.extend(list2)
In [5]: json.dumps(list1)
Out[5]: '[{"created_at": "2012-01-31T10:00:04Z"}, {"created_at": "2013-01-31T10:00:... | I found a little lacking in the explanation given below that's why trying to make a point considered over here.
A `Json` file can have a *single* parent element. Therefore, if at the first iteration, you dump 1st list then at the 2nd iteration, you will get the formatting error in the file. B/c Json demands these two ... |
20,186,930 | Assume I have the following lists
```
list1 = [{"created_at": "2012-01-31T10:00:04Z"},{"created_at": "2013-01-31T10:00:04Z"}]
list2 = [{"created_at": "2014-01-31T10:00:04Z"}]
```
I can write the first list to a JSON file using `json.dump(list1,file,indent=2)` and the result is
```
[
{
"created_at": "2012-01... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20186930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241821/"
] | When parse the files append (or extend) to a unique list and finally convert to JSON. Assume that your function for parse is `parse`.
```
>>> import json
>>> result = []
>>> for file in files:
... result.append(parse(file))
...
>>> json.dump(result, file1, indent=2)
``` | I found a little lacking in the explanation given below that's why trying to make a point considered over here.
A `Json` file can have a *single* parent element. Therefore, if at the first iteration, you dump 1st list then at the 2nd iteration, you will get the formatting error in the file. B/c Json demands these two ... |
28,286,694 | I try to create a data structure for working with logical expressions. At first glance, the logical expressions look like `Trees`, so it seems reasonable to make up it from trees:
```
data Property a = And (Property a) (Property a) |
Or (Property a) (Property a) |
Not (Property a) |... | 2015/02/02 | [
"https://Stackoverflow.com/questions/28286694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2615160/"
] | We're going to follow Daniel Wagner's excellent suggestion and use the "naive representation (your first one), plus a function that picks one of the famous normal forms". We are going to use [algebraic normal form](http://en.wikipedia.org/wiki/Algebraic_normal_form) for two reasons. The main reason is that algebraic no... | If you want to reflect the associativity of logical connectives *and* (`&&`) and *or*, use a data structure that is associative, like list:
```
data Property a = And [Property a] | ...
```
If you also want commutativity (`A && B == B && A`), go with [Data.Set](https://downloads.haskell.org/~ghc/6.12.2/docs/html/libr... |
28,286,694 | I try to create a data structure for working with logical expressions. At first glance, the logical expressions look like `Trees`, so it seems reasonable to make up it from trees:
```
data Property a = And (Property a) (Property a) |
Or (Property a) (Property a) |
Not (Property a) |... | 2015/02/02 | [
"https://Stackoverflow.com/questions/28286694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2615160/"
] | We're going to follow Daniel Wagner's excellent suggestion and use the "naive representation (your first one), plus a function that picks one of the famous normal forms". We are going to use [algebraic normal form](http://en.wikipedia.org/wiki/Algebraic_normal_form) for two reasons. The main reason is that algebraic no... | I'd recommend using a SAT/SMT solver for the equivalence check. In general, these sorts of checks can be very expensive (NP-complete), and any sort of translation to normal-forms can cause exponential blow-up in representation. SAT/SMT solvers have custom algorithms for dealing with such problems, and it might be best ... |
28,286,694 | I try to create a data structure for working with logical expressions. At first glance, the logical expressions look like `Trees`, so it seems reasonable to make up it from trees:
```
data Property a = And (Property a) (Property a) |
Or (Property a) (Property a) |
Not (Property a) |... | 2015/02/02 | [
"https://Stackoverflow.com/questions/28286694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2615160/"
] | I'd recommend using a SAT/SMT solver for the equivalence check. In general, these sorts of checks can be very expensive (NP-complete), and any sort of translation to normal-forms can cause exponential blow-up in representation. SAT/SMT solvers have custom algorithms for dealing with such problems, and it might be best ... | If you want to reflect the associativity of logical connectives *and* (`&&`) and *or*, use a data structure that is associative, like list:
```
data Property a = And [Property a] | ...
```
If you also want commutativity (`A && B == B && A`), go with [Data.Set](https://downloads.haskell.org/~ghc/6.12.2/docs/html/libr... |
62,748,262 | I am using below spring boot config:
```
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.s... | 2020/07/06 | [
"https://Stackoverflow.com/questions/62748262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1318369/"
] | * [Reconsider default for spring.datasource.generate-unique-name as the current one makes test cases brittle #16747](https://github.com/spring-projects/spring-boot/issues/16747)
+ [commit](https://github.com/spring-projects/spring-boot/commit/9ff50f903f691bf0c016313c7ac8de6d04714f97)
>
> This change ensures that eac... | Update:
As you are using h2 console, you probably have a property called
```
spring.h2.console.enabled=true
```
If so then Spring's **H2ConsoleAutoConfiguration** class gets enabled and it does the auto-configuration as given below. (Check [here](https://docs.spring.io/spring-boot/docs/current/api/org/springframewo... |
62,748,262 | I am using below spring boot config:
```
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.s... | 2020/07/06 | [
"https://Stackoverflow.com/questions/62748262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1318369/"
] | Found out that with the latest versions of Spring Boot (2.3+), the H2 database name is randomly generated each time you restart the server. Similar post: [springboot 2.3.0 while connecting to h2 database](https://stackoverflow.com/questions/61865206/springboot-2-3-0-while-connecting-to-h2-database) | Update:
As you are using h2 console, you probably have a property called
```
spring.h2.console.enabled=true
```
If so then Spring's **H2ConsoleAutoConfiguration** class gets enabled and it does the auto-configuration as given below. (Check [here](https://docs.spring.io/spring-boot/docs/current/api/org/springframewo... |
62,748,262 | I am using below spring boot config:
```
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.s... | 2020/07/06 | [
"https://Stackoverflow.com/questions/62748262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1318369/"
] | Found out that with the latest versions of Spring Boot (2.3+), the H2 database name is randomly generated each time you restart the server. Similar post: [springboot 2.3.0 while connecting to h2 database](https://stackoverflow.com/questions/61865206/springboot-2-3-0-while-connecting-to-h2-database) | * [Reconsider default for spring.datasource.generate-unique-name as the current one makes test cases brittle #16747](https://github.com/spring-projects/spring-boot/issues/16747)
+ [commit](https://github.com/spring-projects/spring-boot/commit/9ff50f903f691bf0c016313c7ac8de6d04714f97)
>
> This change ensures that eac... |
55,315 | So I have a large number of signals like the one in the first picture below and I would like to extract and compare the frequencies within them.
I applied a Fourier transform which resulted in results like those shown in the second picture. The large power of very low frequencies suggests to me that the signals includ... | 2019/02/05 | [
"https://dsp.stackexchange.com/questions/55315",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/40404/"
] | If you are ever unsure, just go back to the definition and work out the Fourier Transform property for the specific situation:
$$\begin{align\*}\mathscr{F}\left\{x\left(t-t\_0\right)e^{j2\pi f\_0\left(t-t\_0\right)}\right\} &= \int\_{-\infty}^\infty x\left(t-t\_0\right)e^{j2\pi f\_0\left(t-t\_0\right)} e^{-j2\pi f t}d... | As an alternative to going back to the definitions, as explained in [Andy Walls' answer](https://dsp.stackexchange.com/a/55312/4298), you can also just apply the rules as you stated them:
$$\mathcal{F}\left\{x(t-t\_0)e^{j2\pi f\_0(t-t\_0)}\right\}=\mathcal{F}\left\{x(t)e^{j2\pi f\_0t}\right\}e^{-j2\pi ft\_0}=X(f-f\_0)... |
64,186,340 | I was trying to make some controls to the box move to left, right, up and down. But when i make all the functions in the script tag, it get an error (in all the four `onclick` button):
>
> Function not defined at HTMLButtonElement.onclick
>
>
>
in the lines that i make the button tag.
```html
<html>
<button oncl... | 2020/10/03 | [
"https://Stackoverflow.com/questions/64186340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12608650/"
] | The issue looks to be inside your `getAllUsersOnFirebaseAuthentication` Cloud Functions code.
```
export const getAllUsersOnFirebaseAuthentication = functions.https.onRequest((req, res) => {
admin.initializeApp();
const auth = admin.auth();
const maxResults = 10; // optional arg.
let usersList: any ... | There was a similar Q&A on Stack a while back:
[firebase cloud function CORS error with axios request](https://stackoverflow.com/questions/62818364/firebase-cloud-function-cors-error-with-axios-request)
I made a angular app with async calls. I resolved my cors error through angularfire/cloud functions after seeing th... |
63,229,856 | ```
def weather_info (temp):
c : convert(temp)
if (c > 0):
return (c + " is freezing temperature")
else:
return (c + " is above freezing temperature")
def convert_to_celsius (temperature):
var celsius = (tempertur) - 32 + (5/9)
return temperature
``` | 2020/08/03 | [
"https://Stackoverflow.com/questions/63229856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14041881/"
] | It turns out, the data wasn't showing because of a 500 custom field limit per workspace was reached. Once support increased it, KV log analytics became visible again | I don't know how do you do to enable the Diagnostics for the Key Vault. I'll show the steps below which I have done and it works well:
**Key Vault -> Diagnostics settings -> Add diagnostics settings**
[](https://i.stack.imgur.com/wHOYo.png)
Here is ... |
63,229,856 | ```
def weather_info (temp):
c : convert(temp)
if (c > 0):
return (c + " is freezing temperature")
else:
return (c + " is above freezing temperature")
def convert_to_celsius (temperature):
var celsius = (tempertur) - 32 + (5/9)
return temperature
``` | 2020/08/03 | [
"https://Stackoverflow.com/questions/63229856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14041881/"
] | It turns out, the data wasn't showing because of a 500 custom field limit per workspace was reached. Once support increased it, KV log analytics became visible again | There are multiple reasons why the AzureDiagnostics are not logging
1 You have not enabled the diagnostics logs properly
2 You have chosen resource specific option when configuring diagnostic logs which will dump the logs only to the specific resource tables and not to AzureDiagnostics. |
56,251,253 | I've a Data frame that contain dtypes as categorical, float, int.
X - contain features of all the three given dtypes and y is int.
I've created a pipline as given below.
```
get_imputer():
imputing function
get_encoder():
some encoder function
#model
pipeline = Pipeline(steps=[
('imputer', ge... | 2019/05/22 | [
"https://Stackoverflow.com/questions/56251253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7404892/"
] | Let's understand the working of PermutationImportance in short.
After you have trained your model with all the features, PermutationImportance shuffles values of column/s and checks the effect on Loss function.
Eg.
There are 5 features(columns) and there are n rows:
f1 f2 f3 f4 f5
v1 v2 v3 v4 v5
v6 v7 v8 v9 v10
.
... | For the next poor soul...
I came across this post while having the same problem. While the accepted answer makes total sense - the fact is that in the OP's pipeline, it appears as though he is handling the categorical data with encoders which will convert them to numeric.
So, it appears that PermutationImportance is ... |
55,416,915 | I'm making an app which can write to firebase database on button click.
The app is working on emulator but it's not working on my physical device.
The app was working fine last week but today started giving error.
Here's the main activity code:
```
public class MainActivity extends AppCompatActivity {
private Fire... | 2019/03/29 | [
"https://Stackoverflow.com/questions/55416915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10851894/"
] | Since I recently faced this issue, let me list out why it came and how I could solve it.
I had already an app added (call it app1) to a project. now, while doing the clean up for the app, I did not want to delete this app, so I added another app with different package in the same project (lets call it newAPP.)
The pr... | I had this issue once. Few things you can try.
1. Try restarting your device
2. check if google play service and play store are enabled.
3. some times google play service or play store are restricted over Cellular Data. To solve it, I did the following: App Data Usage -> Google Services -> Turn Off the "Restrict Cell... |
55,416,915 | I'm making an app which can write to firebase database on button click.
The app is working on emulator but it's not working on my physical device.
The app was working fine last week but today started giving error.
Here's the main activity code:
```
public class MainActivity extends AppCompatActivity {
private Fire... | 2019/03/29 | [
"https://Stackoverflow.com/questions/55416915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10851894/"
] | I had this issue once. Few things you can try.
1. Try restarting your device
2. check if google play service and play store are enabled.
3. some times google play service or play store are restricted over Cellular Data. To solve it, I did the following: App Data Usage -> Google Services -> Turn Off the "Restrict Cell... | Remove your existing application and then again run this application in your android device |
55,416,915 | I'm making an app which can write to firebase database on button click.
The app is working on emulator but it's not working on my physical device.
The app was working fine last week but today started giving error.
Here's the main activity code:
```
public class MainActivity extends AppCompatActivity {
private Fire... | 2019/03/29 | [
"https://Stackoverflow.com/questions/55416915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10851894/"
] | Since I recently faced this issue, let me list out why it came and how I could solve it.
I had already an app added (call it app1) to a project. now, while doing the clean up for the app, I did not want to delete this app, so I added another app with different package in the same project (lets call it newAPP.)
The pr... | Remove your existing application and then again run this application in your android device |
145,335 | I am trying to boot my Raspberry Pi using an NFS share. I have copied the boot partition of the Raspbian Wheezy image to the SD card and copied the root partition to a networked hard drive. I have edited cmdline.txt to boot from the NFS share. This works correctly.
The system boots successfully and I can issue command... | 2014/07/18 | [
"https://unix.stackexchange.com/questions/145335",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/77987/"
] | Although you don't have `nosuid` on your mount, it seems like your NFS client is defaulting to nosuid.
You can change this by explicitly setting the suid flag. To do this live as root:
```
mount -o remount,suid /
```
If that works you can add it to your boot options.
See also [this Ask Ubuntu question](https://ask... | Check the permissions of the sudo executable. If you copied the files to another location, it may be possible that you lost the SUID bit on the file.
```
$ which sudo
/usr/bin/sudo
$ ls -la /usr/bin/sudo
---s--x--x 2 root root 208808 Jun 3 2011 /usr/bin/sudo
``` |
145,335 | I am trying to boot my Raspberry Pi using an NFS share. I have copied the boot partition of the Raspbian Wheezy image to the SD card and copied the root partition to a networked hard drive. I have edited cmdline.txt to boot from the NFS share. This works correctly.
The system boots successfully and I can issue command... | 2014/07/18 | [
"https://unix.stackexchange.com/questions/145335",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/77987/"
] | Decided to try out Arch Linux ARM, worked flawlessly. | Check the permissions of the sudo executable. If you copied the files to another location, it may be possible that you lost the SUID bit on the file.
```
$ which sudo
/usr/bin/sudo
$ ls -la /usr/bin/sudo
---s--x--x 2 root root 208808 Jun 3 2011 /usr/bin/sudo
``` |
108,719 | * Did [Charles-Augustin de Coulomb](http://en.wikipedia.org/wiki/Charles-Augustin_de_Coulomb) know:
+ [Coulomb's constant](http://en.wikipedia.org/wiki/Coulomb%27s_constant)
+ Coulomb (as a unit)
if not then what was the first time it was measured? | 2014/04/17 | [
"https://physics.stackexchange.com/questions/108719",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/37421/"
] | No, Coulomb did not know the Coulomb as a unit. According to [this page](http://lamar.colostate.edu/~hillger/unit-definitions.html), the Coulomb was defined at the 9th CGPM (General Conference on Weights and Measures) conference, in 1948. [Wikipedia](http://en.wikipedia.org/wiki/General_Conference_on_Weights_and_Measur... | Coulombs date back to the 1860's, and even predate CGS units. The connection between the volt-ohm-second and mks units were made only in 1904.
Coulomb used e.s.u. based on the french ft lb s system. The coulomb constant is a feature of choice of units, if charge is found from LMT, then the size of the coulomb constan... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | Sorry to "resurect" this post but i was going to be crazy !
If some of you have problems using theses sample codes ( none of them were working, all were returning "Undefined" instead of showing the name
Just add
```
displayKey: 'name',
```
Replace of course 'name' by your label var name returned by your remote so... | My solution is:
```
var productNames = new Array();
var productIds = new Object();
$.getJSON( '/getAjaxProducts', null,
function ( jsonData )
{
$.each( jsonData, function ( index, product )
{
productNames.push( product.id + product.name );
product... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | ```
......updater: function (item) {
var item = JSON.parse(item);
console.log(item.name);
$('#VehicleAssignedTechId').val(item.id);
return item.name;
}
```
On updater of the typeahead call you can put as above code which allows you to add selcted value in the textbox or whe... | I noticed when using this code that if the match included the letters 'st', the typeahead suggestions include the style tag in the typeahead suggestions.
For example the suggested matches would show
>
> style="padding: 10px; font-size: 1.5em;">standard
>
>
>
instead of
>
> standard
>
>
>
I changed the rep... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | A typical JSON document that contains name/ID pairs is going to look like this:
```
[
{
"id": 1
"name": "firstName"
},
{
"id": 2
"name": "secondName"
}
]
```
The strategy here is to build an object literal that maps names to IDs as you parse the result, while only using the name to populate t... | I had the same issue when i tried to process username and id.I had a tricky fix but later on i have fixed it with proper solution.
Have a look at this one,
```
$('#search').typeahead({
source: function(query, process) {
var $url = "/controller/function/list_users/?q="+query;
var $datas = new Array;
$datas = [""];... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | My solution is:
```
var productNames = new Array();
var productIds = new Object();
$.getJSON( '/getAjaxProducts', null,
function ( jsonData )
{
$.each( jsonData, function ( index, product )
{
productNames.push( product.id + product.name );
product... | I had the same issue when i tried to process username and id.I had a tricky fix but later on i have fixed it with proper solution.
Have a look at this one,
```
$('#search').typeahead({
source: function(query, process) {
var $url = "/controller/function/list_users/?q="+query;
var $datas = new Array;
$datas = [""];... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | A typical JSON document that contains name/ID pairs is going to look like this:
```
[
{
"id": 1
"name": "firstName"
},
{
"id": 2
"name": "secondName"
}
]
```
The strategy here is to build an object literal that maps names to IDs as you parse the result, while only using the name to populate t... | My solution is:
```
var productNames = new Array();
var productIds = new Object();
$.getJSON( '/getAjaxProducts', null,
function ( jsonData )
{
$.each( jsonData, function ( index, product )
{
productNames.push( product.id + product.name );
product... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | A typical JSON document that contains name/ID pairs is going to look like this:
```
[
{
"id": 1
"name": "firstName"
},
{
"id": 2
"name": "secondName"
}
]
```
The strategy here is to build an object literal that maps names to IDs as you parse the result, while only using the name to populate t... | ```
......updater: function (item) {
var item = JSON.parse(item);
console.log(item.name);
$('#VehicleAssignedTechId').val(item.id);
return item.name;
}
```
On updater of the typeahead call you can put as above code which allows you to add selcted value in the textbox or whe... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | ```
......updater: function (item) {
var item = JSON.parse(item);
console.log(item.name);
$('#VehicleAssignedTechId').val(item.id);
return item.name;
}
```
On updater of the typeahead call you can put as above code which allows you to add selcted value in the textbox or whe... | I had the same issue when i tried to process username and id.I had a tricky fix but later on i have fixed it with proper solution.
Have a look at this one,
```
$('#search').typeahead({
source: function(query, process) {
var $url = "/controller/function/list_users/?q="+query;
var $datas = new Array;
$datas = [""];... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | My solution is:
```
var productNames = new Array();
var productIds = new Object();
$.getJSON( '/getAjaxProducts', null,
function ( jsonData )
{
$.each( jsonData, function ( index, product )
{
productNames.push( product.id + product.name );
product... | I noticed when using this code that if the match included the letters 'st', the typeahead suggestions include the style tag in the typeahead suggestions.
For example the suggested matches would show
>
> style="padding: 10px; font-size: 1.5em;">standard
>
>
>
instead of
>
> standard
>
>
>
I changed the rep... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | Sorry to "resurect" this post but i was going to be crazy !
If some of you have problems using theses sample codes ( none of them were working, all were returning "Undefined" instead of showing the name
Just add
```
displayKey: 'name',
```
Replace of course 'name' by your label var name returned by your remote so... | ```
......updater: function (item) {
var item = JSON.parse(item);
console.log(item.name);
$('#VehicleAssignedTechId').val(item.id);
return item.name;
}
```
On updater of the typeahead call you can put as above code which allows you to add selcted value in the textbox or whe... |
14,136,973 | Hy! I'm using twitter bootstraps typeahead:
I'm calling a page that returns a response with json\_encode
the page returns a name and an ID,
I want that the typeahead list will show me the list of names,
and when I select one of the name
to write the id value to a hidden field.
the calling works fine, and to write a ... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14136973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1240005/"
] | Sorry to "resurect" this post but i was going to be crazy !
If some of you have problems using theses sample codes ( none of them were working, all were returning "Undefined" instead of showing the name
Just add
```
displayKey: 'name',
```
Replace of course 'name' by your label var name returned by your remote so... | I noticed when using this code that if the match included the letters 'st', the typeahead suggestions include the style tag in the typeahead suggestions.
For example the suggested matches would show
>
> style="padding: 10px; font-size: 1.5em;">standard
>
>
>
instead of
>
> standard
>
>
>
I changed the rep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.