qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
5,226,352 | Okay. So I have declared an array of objects, and I have manually defined them using this code:
```
Object* objects[] =
{
new Object(/*constructor parameters*/),
new Object(/*constructor parameters*/)
};
```
Is there anyway to use some kind of a loop (preferably a for loop) to declare these? Something like:... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5226352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/629372/"
] | ```
Object* objects[20];
for(int i=0; i<20; /*number of objects*/ i++)
{
objects[i] = new Object(/*constructor parameters*/);
}
``` | Points in C++ can be used as arrays. Try something like this:
```
// Example
#include <iostream>
using namespace std;
class Object
{
public:
Object(){}
Object(int t) : w00t(t){}
void print(){ cout<< w00t << endl; }
private:
int w00t;
};
int main()
{
Object * objects = new Object[20];
for(int... |
5,226,352 | Okay. So I have declared an array of objects, and I have manually defined them using this code:
```
Object* objects[] =
{
new Object(/*constructor parameters*/),
new Object(/*constructor parameters*/)
};
```
Is there anyway to use some kind of a loop (preferably a for loop) to declare these? Something like:... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5226352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/629372/"
] | I strongly suggest using a standard library container instead of arrays and pointers:
```
#include <vector>
std::vector<Object> objects;
// ...
void inside_some_function()
{
objects.reserve(20);
for (int i = 0; i < 20; ++i)
{
objects.push_back(Object( /* constructor parameters */ ));
}
}
``... | ```
Object* objects[20];
for(int i=0; i<20; /*number of objects*/ i++)
{
objects[i] = new Object(/*constructor parameters*/);
}
``` |
5,226,352 | Okay. So I have declared an array of objects, and I have manually defined them using this code:
```
Object* objects[] =
{
new Object(/*constructor parameters*/),
new Object(/*constructor parameters*/)
};
```
Is there anyway to use some kind of a loop (preferably a for loop) to declare these? Something like:... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5226352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/629372/"
] | I strongly suggest using a standard library container instead of arrays and pointers:
```
#include <vector>
std::vector<Object> objects;
// ...
void inside_some_function()
{
objects.reserve(20);
for (int i = 0; i < 20; ++i)
{
objects.push_back(Object( /* constructor parameters */ ));
}
}
``... | Points in C++ can be used as arrays. Try something like this:
```
// Example
#include <iostream>
using namespace std;
class Object
{
public:
Object(){}
Object(int t) : w00t(t){}
void print(){ cout<< w00t << endl; }
private:
int w00t;
};
int main()
{
Object * objects = new Object[20];
for(int... |
18,313,741 | Suppose that I've a store containing following model structure:
```
Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'Id',
type: 'int'
},
{
name: 'Key1'
},
{
name: 'Key2'
... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18313741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1887931/"
] | You can try this code...
```
var filterValue = null;
favoritStore.each(function(record){
if(record.get('Key1') == 'yourValue1' && record.get('Key2') == 'yourValue2') {
filterValue = record;
}
});
``` | If you use the filter functionality of the store you can filter by your multiple keys, then iterate over the filtered store using .each()
```
store.filter([
{property: "key1", value: "value1"},
{property: "key2", value: "value2"}
]);
```
Check it out in the docs:
<http://docs.sencha.com/touch/2.3.0/#!/api/Ex... |
28,621,922 | ```
#include<stdio.h>
#define SIZE 3
int main()
{
char *arr[5];
for(i = 0; i < 5; i++) {
arr[i] = (char *)malloc(SIZE * sizeof(char));
scanf("%s",arr[i]);
}
for(i = 0; i < 5; i++) {
printf("%s",arr[i]);
}
return 0;
}
```
In the above code i am scanning more than 3(SIZE) characters but it is working fine.what is the ... | 2015/02/20 | [
"https://Stackoverflow.com/questions/28621922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3319120/"
] | Remove `single quotes` from your above statement.
```
<script>window.location.href="<?php echo base_url(); ?>/index.php/user/view_cart/viewCart";</script>
```
In Condigniter, you can redirect a page using UrlHelper class.
```
class MyController extends CI_Controller
{
public function index()
... | JS file cannot process PHP. Instead you can try this changing JS to PHP file and try this:
Rename your js file from:
```
<script src="yourExternalJsFile.js"></script>
```
To:
```
<script src="yourExternalJsFile.php"></script>
```
And in your php file include your script like this like this:
```
<?php header("Co... |
28,621,922 | ```
#include<stdio.h>
#define SIZE 3
int main()
{
char *arr[5];
for(i = 0; i < 5; i++) {
arr[i] = (char *)malloc(SIZE * sizeof(char));
scanf("%s",arr[i]);
}
for(i = 0; i < 5; i++) {
printf("%s",arr[i]);
}
return 0;
}
```
In the above code i am scanning more than 3(SIZE) characters but it is working fine.what is the ... | 2015/02/20 | [
"https://Stackoverflow.com/questions/28621922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3319120/"
] | Remove `single quotes` from your above statement.
```
<script>window.location.href="<?php echo base_url(); ?>/index.php/user/view_cart/viewCart";</script>
```
In Condigniter, you can redirect a page using UrlHelper class.
```
class MyController extends CI_Controller
{
public function index()
... | you can add disallowed chracters in permitted\_uri\_chars which exist in config file.
in cofig file
```
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=';
```
but in your case you added single quote which is wrong, you have to remove single quotes. |
9,926,998 | I'm using the tabs in jQuery UI : <http://jqueryui.com/demos/tabs/>
I've actually a lot of data in those tabs, so when the page is loading the data are completely messed up before the tabs are fully processed/rendered.
So i'm looking for a way to detect when the tabs are finished rendering probably with a **callback*... | 2012/03/29 | [
"https://Stackoverflow.com/questions/9926998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180686/"
] | We had the same problem at work, to be honest it can be an evident problem in most JQuery if you have loads of it on the page. To ensure that it's only shown when it's actually ready we initially hide the parent tab container like so:
```
<div id="tabs" style="display: none;">
```
then in the document.ready function... | Generally this is done by showing/hiding a div or two over the top of your content. You can get a fancy loading gif from <http://www.ajaxload.info/> to get you started. Then you'll want to place a DIV on your page:
```
<div id="loading">
<p><img src="loading.gif" /> Please Wait</p>
</div>
```
You'll want this hidd... |
2,690,656 | I am developing a game in VB6 (plz don't ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | [EGL25](https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=68507&lngWId=1) by Erkan Sanli is a fast open source VB 6 renderer that can render, rotate, animate, etc. complex solid shapes made of thousands of polygons. Just Windows API calls – no DirectX, no OpenGL.
[ ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | You may want to check out the [Game Programming Wiki](http://www.gpwiki.org/) -- it used to be "Lucky's VB Game Site" (and we're talking a LONG time ago) but all of the content (VB5/6 centric) moved to the Wiki with the addition of other languages.
It appears that much of the legacy VB6 content is still available on t... | Have a look at DxIce : <http://gamedev.digiapp.com/> |
2,690,656 | I am developing a game in VB6 (plz don't ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | [EGL25](https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=68507&lngWId=1) by Erkan Sanli is a fast open source VB 6 renderer that can render, rotate, animate, etc. complex solid shapes made of thousands of polygons. Just Windows API calls – no DirectX, no OpenGL.
[ you said you didn't want to use unless you want to BitBLT everything yourself using API cal... |
2,690,656 | I am developing a game in VB6 (plz don't ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | You may want to check out the [Game Programming Wiki](http://www.gpwiki.org/) -- it used to be "Lucky's VB Game Site" (and we're talking a LONG time ago) but all of the content (VB5/6 centric) moved to the Wiki with the addition of other languages.
It appears that much of the legacy VB6 content is still available on t... | I think you will find no well-acknowledged written games in VB6 for precisely the reasons you state above.
It was not designed to be a high performance language. For that you NEED to use the graphics libraries (DirectX, OpenGL) you said you didn't want to use unless you want to BitBLT everything yourself using API cal... |
2,690,656 | I am developing a game in VB6 (plz don't ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | You may want to check out the [Game Programming Wiki](http://www.gpwiki.org/) -- it used to be "Lucky's VB Game Site" (and we're talking a LONG time ago) but all of the content (VB5/6 centric) moved to the Wiki with the addition of other languages.
It appears that much of the legacy VB6 content is still available on t... | [EGL25](https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=68507&lngWId=1) by Erkan Sanli is a fast open source VB 6 renderer that can render, rotate, animate, etc. complex solid shapes made of thousands of polygons. Just Windows API calls – no DirectX, no OpenGL.
[ ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | [EGL25](https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=68507&lngWId=1) by Erkan Sanli is a fast open source VB 6 renderer that can render, rotate, animate, etc. complex solid shapes made of thousands of polygons. Just Windows API calls – no DirectX, no OpenGL.
[, are only free for non-commercial use. I also suggest avoiding the built-in multimedia playback object. |
2,690,656 | I am developing a game in VB6 (plz don't ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a "pure-software-rendering" approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following **"serious"** problems exist:
* **2D alpha transparency** reqd. to imp... | 2010/04/22 | [
"https://Stackoverflow.com/questions/2690656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319204/"
] | You may want to check out the [Game Programming Wiki](http://www.gpwiki.org/) -- it used to be "Lucky's VB Game Site" (and we're talking a LONG time ago) but all of the content (VB5/6 centric) moved to the Wiki with the addition of other languages.
It appears that much of the legacy VB6 content is still available on t... | For audio playback, I have used <http://www.fmod.org/> in the past. This, and other libraries like [BASS](http://www.un4seen.com/), are only free for non-commercial use. I also suggest avoiding the built-in multimedia playback object. |
35,261,683 | I am new to React and hoping someone can shed some light on why this is happening and how to debug it.
I have the following routes defined:
```
export default (withHistory, onUpdate) => {
const history = withHistory?
(Modernizr.history ?
new BrowserHistory
: new HashHisto... | 2016/02/08 | [
"https://Stackoverflow.com/questions/35261683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946396/"
] | Coming from an Angular background I had incorrectly assumed that routing was happening entirely client-side. It's possible to use react-router for both client-side *and* server side routing.
The `transition.to` call worked fine on the client-side, but threw an exception when server-side routing kicked in and returned ... | According to the current docs, the `onEnter` hook receives a `replace` function as its second param. i.e.
```
type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => any;
```
Are you using a different version of react-router? I tried looking through the alternate version docs for... |
73,940,657 | I have this simple html document:
```
<header>
<div><p>Fail</p></div>
<p>Success!</p>
</header>
```
How can I select the second paragraph using just the tag name.
I don't want to use something like this:
```
let successParagraph = document
.getElementsByTagName("header")[0]
.getElementsByT... | 2022/10/03 | [
"https://Stackoverflow.com/questions/73940657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15207982/"
] | You cannot using [`getElementsByTagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName)
1. by passing anything other than a tag name as a parameter
2. to get a single element.(It always returns a collection or null)
>
> **Syntax**: getElementsByTagName(tagName)
>
>
> **Parameters**... | you can use `querySelectorAll`
```
const paragraphs = document.querySelectorAll("p");
```
`paragraphs[1]` would be the second one. |
73,940,657 | I have this simple html document:
```
<header>
<div><p>Fail</p></div>
<p>Success!</p>
</header>
```
How can I select the second paragraph using just the tag name.
I don't want to use something like this:
```
let successParagraph = document
.getElementsByTagName("header")[0]
.getElementsByT... | 2022/10/03 | [
"https://Stackoverflow.com/questions/73940657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15207982/"
] | ```js
const secondElement = document.querySelectorAll('header p');
if (secondElement[1]) {
let successParagraph = secondElement[1].innerHTML;
console.log(successParagraph); // Success!
};
```
```html
<header>
<div><p>Fail</p></div>
<p>Success!</p>
</header>
``` | you can use `querySelectorAll`
```
const paragraphs = document.querySelectorAll("p");
```
`paragraphs[1]` would be the second one. |
30,521,162 | I was watching a talk, ["Efficiency with Algorithms, Performance with
Data Structures"](https://www.youtube.com/watch?v=fHNmRkzxHWs), and was
surprised by the comment that in:
```
#include <string>
#include <unordered_map>
#include <memory>
struct Foo {
int x;
};
Foo* getFoo(std::string key,
std::unord... | 2015/05/29 | [
"https://Stackoverflow.com/questions/30521162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/563477/"
] | CSE implementation in llvm is operating on Arithmatic Expressions.
You can see llvm Common Subexpression Elimination source code in llvm/lib/Transforms/Scalar/EarlyCSE.cpp
Case we face here is Interprocedural Optimizations.
This call `cache[key]` turn out to be `[](cache,key)` function. so optimizations such as inli... | There is a lot of stuff going on in an unordered\_map lookup. There are hash computations, searching through a bin, adding to the bin if it wasn't there, maybe growing the table if it is now too big. It is not the same as comparing that you have two instances of "x+y" in your code. You should be more amazed it actually... |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can chain together `|`s, using the null-coalescing operator at the end:
```
return (ckbx1.IsChecked | cxbx2.IsChecked | cxbx3.IsChecked | cxbx4.IsChecked) ?? false;
```
The lifted `|` operator returns `true` if either operand is `true`, `false` if both operands are `false`, and `null` if either operand is `null`... | I'm assuming that if null, then it'll be false, you can use the ?? operator.
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
(ckbx3.IsChecked ?? false) ||
(ckbx4.IsChecked ?? false));
}
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | Try:
```
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
...
``` | Use `??` operator inside your method;
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
(ckbx3.IsChecked ?? false) ||
(ckbx4.IsChecked ?? false)
}
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can chain together `|`s, using the null-coalescing operator at the end:
```
return (ckbx1.IsChecked | cxbx2.IsChecked | cxbx3.IsChecked | cxbx4.IsChecked) ?? false;
```
The lifted `|` operator returns `true` if either operand is `true`, `false` if both operands are `false`, and `null` if either operand is `null`... | You can use the following:
```
(ckbx1.IsChecked.HasValue && ckbx1.IsChecked.Value)
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | Try:
```
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
...
``` | You can use the following:
```
(ckbx1.IsChecked.HasValue && ckbx1.IsChecked.Value)
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can chain together `|`s, using the null-coalescing operator at the end:
```
return (ckbx1.IsChecked | cxbx2.IsChecked | cxbx3.IsChecked | cxbx4.IsChecked) ?? false;
```
The lifted `|` operator returns `true` if either operand is `true`, `false` if both operands are `false`, and `null` if either operand is `null`... | You can use `GetValueOrDefault()` to get either the value, or `false`.
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked.GetValueOrDefault()) ||
(ckbx2.IsChecked.GetValueOrDefault()) ||
(ckbx3.IsChecked.GetValueOrDefault()) ||
(ckbx4.IsChecked.GetValueOrDef... |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can use `GetValueOrDefault()` to get either the value, or `false`.
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked.GetValueOrDefault()) ||
(ckbx2.IsChecked.GetValueOrDefault()) ||
(ckbx3.IsChecked.GetValueOrDefault()) ||
(ckbx4.IsChecked.GetValueOrDef... | Use `??` operator inside your method;
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
(ckbx3.IsChecked ?? false) ||
(ckbx4.IsChecked ?? false)
}
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can chain together `|`s, using the null-coalescing operator at the end:
```
return (ckbx1.IsChecked | cxbx2.IsChecked | cxbx3.IsChecked | cxbx4.IsChecked) ?? false;
```
The lifted `|` operator returns `true` if either operand is `true`, `false` if both operands are `false`, and `null` if either operand is `null`... | Try:
```
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
...
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | You can chain together `|`s, using the null-coalescing operator at the end:
```
return (ckbx1.IsChecked | cxbx2.IsChecked | cxbx3.IsChecked | cxbx4.IsChecked) ?? false;
```
The lifted `|` operator returns `true` if either operand is `true`, `false` if both operands are `false`, and `null` if either operand is `null`... | Use `??` operator inside your method;
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
(ckbx3.IsChecked ?? false) ||
(ckbx4.IsChecked ?? false)
}
``` |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | Try:
```
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
...
``` | You can use `GetValueOrDefault()` to get either the value, or `false`.
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked.GetValueOrDefault()) ||
(ckbx2.IsChecked.GetValueOrDefault()) ||
(ckbx3.IsChecked.GetValueOrDefault()) ||
(ckbx4.IsChecked.GetValueOrDef... |
13,942,160 | For the last few days i have been trying to figure out the best way to get AutomationElement for a specific control in a vb6 application.
My initial way of doing so was by doing a search with the following condition:
new PropertyCondition(AutomationElement.NameProperty, *controlName*)
I was under the assumption that ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13942160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440668/"
] | Try:
```
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
...
``` | I'm assuming that if null, then it'll be false, you can use the ?? operator.
```
private bool AtLeastOnePlatypusChecked()
{
return ((ckbx1.IsChecked ?? false) ||
(ckbx2.IsChecked ?? false) ||
(ckbx3.IsChecked ?? false) ||
(ckbx4.IsChecked ?? false));
}
``` |
38,239,343 | In a python script I am using re.finditer for finding strings inside a text file.
How do I know if re.finditer does not find a specific string?
I tried with
```
for n in re.finditer("string",line2):
if n.start() == "":
print("empty")
```
But this does not work.
(I would like to use re.finditer as it ... | 2016/07/07 | [
"https://Stackoverflow.com/questions/38239343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538579/"
] | If the regex pattern is not matched anywhere in the text you're searching, `finditer` will return an empty iterable. That is, your `for` loop will never run the code in the indented block.
There are a few ways you could detect this. One might be to set an initial value for the `n` loop variable and then test if it has... | With those requirements, you could do something like:
```
n = re.finditer(pattern, line2)
try:
first_item = next(n)
#do something with the rest of the iterable eg:
print(first_item)
for item in n:
print(n)
except StopIteration:
print("empty")
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | I call this a set-within-sets query. I like to approach this using `group by` and `having`, because this is a very flexible method for expressing these conditions:
```
select id
from t
group by id
having sum(case when source = 'Android' then 1 else 0 end) > 0 and -- has Android
sum(case when source = 'Desktop' ... | Try this:
```
SELECT Id
FROM mytable
GROUP BY Id
HAVING COUNT(*) = COUNT(CASE WHEN Source='Android' THEN 1 END) +
COUNT(CASE WHEN Source='Desktop' THEN 1 END) AND
COUNT(CASE WHEN Source='Desktop' THEN 1 END) > 0 AND
COUNT(CASE WHEN Source='Android' THEN 1 END) > 0
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | I call this a set-within-sets query. I like to approach this using `group by` and `having`, because this is a very flexible method for expressing these conditions:
```
select id
from t
group by id
having sum(case when source = 'Android' then 1 else 0 end) > 0 and -- has Android
sum(case when source = 'Desktop' ... | Try to use
```
Select *
from yourtable a
where a.source = 'Android'
and not exist (Select b.id
from yourtable b
where b.id = a.id and b.source <> 'Android')
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | I call this a set-within-sets query. I like to approach this using `group by` and `having`, because this is a very flexible method for expressing these conditions:
```
select id
from t
group by id
having sum(case when source = 'Android' then 1 else 0 end) > 0 and -- has Android
sum(case when source = 'Desktop' ... | Try this
```
select id from your_table
group by id
having
max(case when source in ('Android') then 1 else 0 end))=1
and
max(case when source in ('Desktop') then 1 else 0 end))=1
and count(distinct source)=2
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | Try this:
```
SELECT Id
FROM mytable
GROUP BY Id
HAVING COUNT(*) = COUNT(CASE WHEN Source='Android' THEN 1 END) +
COUNT(CASE WHEN Source='Desktop' THEN 1 END) AND
COUNT(CASE WHEN Source='Desktop' THEN 1 END) > 0 AND
COUNT(CASE WHEN Source='Android' THEN 1 END) > 0
``` | Try to use
```
Select *
from yourtable a
where a.source = 'Android'
and not exist (Select b.id
from yourtable b
where b.id = a.id and b.source <> 'Android')
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | Try this:
```
SELECT Id
FROM mytable
GROUP BY Id
HAVING COUNT(*) = COUNT(CASE WHEN Source='Android' THEN 1 END) +
COUNT(CASE WHEN Source='Desktop' THEN 1 END) AND
COUNT(CASE WHEN Source='Desktop' THEN 1 END) > 0 AND
COUNT(CASE WHEN Source='Android' THEN 1 END) > 0
``` | Try this
```
select id from your_table
group by id
having
max(case when source in ('Android') then 1 else 0 end))=1
and
max(case when source in ('Desktop') then 1 else 0 end))=1
and count(distinct source)=2
``` |
39,832,001 | I'm using T-SQL
I have a table: user session with platform source.
I need to get users who used only "Android" and "Desktop".
Data Example:
```
ID | Source | DateTime
1 | Android | 2016-06-01
1 | Desktop | 2016-06-01
2 | Android | 2016-06-02
3 | iOS | 2016-06-01
3 | Desktop | 2016-06-02
3 | Android | 20... | 2016/10/03 | [
"https://Stackoverflow.com/questions/39832001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6154996/"
] | Try this
```
select id from your_table
group by id
having
max(case when source in ('Android') then 1 else 0 end))=1
and
max(case when source in ('Desktop') then 1 else 0 end))=1
and count(distinct source)=2
``` | Try to use
```
Select *
from yourtable a
where a.source = 'Android'
and not exist (Select b.id
from yourtable b
where b.id = a.id and b.source <> 'Android')
``` |
50,868,589 | I am learning Machine Learning and trying to write a code from myself using the Iris Dataset.
I open the dataset with pandas and then I am trying to pass a dictionary in my dataset to convert the last column from Strings into Int but when try this:
```
dataset.columns = ['sepal length', 'sepal width', 'petal length',... | 2018/06/15 | [
"https://Stackoverflow.com/questions/50868589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886059/"
] | one mistake is there,
You already have arraylist in your activity so try this,
```
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
... | ```
String value = mList.getItemAtPosition(position).toString();
```
it will be get `Penyakit` object.
if you want get `penyakit_nama` value, use below code.
```
String value = ((Penyakit)mList.getItemAtPosition(position)).getpenyakit_nama();
```
because generic type of your ArrayAdapter is `<Penyakit>`, `getItemA... |
50,868,589 | I am learning Machine Learning and trying to write a code from myself using the Iris Dataset.
I open the dataset with pandas and then I am trying to pass a dictionary in my dataset to convert the last column from Strings into Int but when try this:
```
dataset.columns = ['sepal length', 'sepal width', 'petal length',... | 2018/06/15 | [
"https://Stackoverflow.com/questions/50868589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886059/"
] | By using this code you can get the current value of the textview.
```
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
String contactI... | ```
String value = mList.getItemAtPosition(position).toString();
```
it will be get `Penyakit` object.
if you want get `penyakit_nama` value, use below code.
```
String value = ((Penyakit)mList.getItemAtPosition(position)).getpenyakit_nama();
```
because generic type of your ArrayAdapter is `<Penyakit>`, `getItemA... |
18,776,414 | I have a problem...
I need to store a daily barrage of about 3,000 mid-sized XML documents (100 to 200 data elements).
The data is somewhat unstable in the sense that the schema changes from time to time and the changes are not announced with enough advance notice, but need to be dealt with retroactively on an emerge... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18776414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196032/"
] | You may have a look at BaseX, (Basex.org), with built in XQuery processor and Lucene text indexing. | ### That Data Volume is Small
If there is no need for parallel data processing, there is no need for Mongo DB. Especially if dealing with small data amounts like 4GB, the overhead of distributing work can easily get larger than the actual evaluation effort.
4GB / 60k nodes is not large of XML databases, either. After... |
10,384,199 | I have a script that will send items to the recycle bin (if selected) or delete items permanently. If the script is run locally, the recycle piece works properly.
However, if it's run from a different computer - in this case, my local machine runs the script against a shared folder on a server - the delete is **perman... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10384199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/912800/"
] | 1. You can get the local computer name with $env:COMPUTERNAME. Use it to compare the value against the target server name.
2. For each file, you'd have to check first if the drive is a mapped drive, if it is, get the server name from the wmi instance and compare it to $env:COMPUTERNAME.
You can get a file's Drive qual... | The OP wrote:
>
> @Shay - Thanks for your help. I've learned a great deal from many posts by you on various Powershell sites.
>
>
> I was able to use almost everything you suggested, and only had to add an extra line of code to make it work. I checked the property `([System.Uri]$markedFile).IsUnc` to determine if t... |
25,851,041 | Is there a way to hide a cmd window in Clarion 8?
I run xcopy to copy files defined in fields an application so it looks something like this:
```
Run('Xcopy '&Clip(Loc:Pathfrom)&' '&loc:Pathto')
```
i.e. `Run(' C:\Temp\Temp.tps c:\Bakup\')`.
Maybe there is a cmd or Clarion command not to show the black window but ... | 2014/09/15 | [
"https://Stackoverflow.com/questions/25851041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4043036/"
] | I understand why you don't want to use the builtin COPY command as you should need to find every single file (and possibly folder too) under that folder you want to copy. If I were you I'll use the proper tools to do it: Windows API and hide the window.
```
PROGRAM
SW_HIDE EQUATE(0)
SW_SHOW E... | No. Using the Clarion `RUN()` function with a console application like `xcopy.exe`, it isn't possible to hide the command line interface window using the documented options.
Example Clarion program:
```
PROGRAM
MAP
END
pathFrom cstring('C:\Temp\Temp.tps') !You could use STRING instead of CSTRING, but then must ... |
25,851,041 | Is there a way to hide a cmd window in Clarion 8?
I run xcopy to copy files defined in fields an application so it looks something like this:
```
Run('Xcopy '&Clip(Loc:Pathfrom)&' '&loc:Pathto')
```
i.e. `Run(' C:\Temp\Temp.tps c:\Bakup\')`.
Maybe there is a cmd or Clarion command not to show the black window but ... | 2014/09/15 | [
"https://Stackoverflow.com/questions/25851041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4043036/"
] | Perhaps using the [CreateProcess](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) API function with the `CREATE_NO_WINDOW` flag is another way to do this?
You should be able to locate some examples in Clarion code around the place. A good starting point is the `CreateProcessCaptureOutp... | No. Using the Clarion `RUN()` function with a console application like `xcopy.exe`, it isn't possible to hide the command line interface window using the documented options.
Example Clarion program:
```
PROGRAM
MAP
END
pathFrom cstring('C:\Temp\Temp.tps') !You could use STRING instead of CSTRING, but then must ... |
25,851,041 | Is there a way to hide a cmd window in Clarion 8?
I run xcopy to copy files defined in fields an application so it looks something like this:
```
Run('Xcopy '&Clip(Loc:Pathfrom)&' '&loc:Pathto')
```
i.e. `Run(' C:\Temp\Temp.tps c:\Bakup\')`.
Maybe there is a cmd or Clarion command not to show the black window but ... | 2014/09/15 | [
"https://Stackoverflow.com/questions/25851041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4043036/"
] | I understand why you don't want to use the builtin COPY command as you should need to find every single file (and possibly folder too) under that folder you want to copy. If I were you I'll use the proper tools to do it: Windows API and hide the window.
```
PROGRAM
SW_HIDE EQUATE(0)
SW_SHOW E... | Unless there is some reason that you prefer to use the command line copy/xcopy command, why not just use Clarion's built in Copy function to copy the file? |
25,851,041 | Is there a way to hide a cmd window in Clarion 8?
I run xcopy to copy files defined in fields an application so it looks something like this:
```
Run('Xcopy '&Clip(Loc:Pathfrom)&' '&loc:Pathto')
```
i.e. `Run(' C:\Temp\Temp.tps c:\Bakup\')`.
Maybe there is a cmd or Clarion command not to show the black window but ... | 2014/09/15 | [
"https://Stackoverflow.com/questions/25851041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4043036/"
] | Perhaps using the [CreateProcess](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) API function with the `CREATE_NO_WINDOW` flag is another way to do this?
You should be able to locate some examples in Clarion code around the place. A good starting point is the `CreateProcessCaptureOutp... | Unless there is some reason that you prefer to use the command line copy/xcopy command, why not just use Clarion's built in Copy function to copy the file? |
19,071,112 | `number_format` **stupidly** rounds numbers by default. Is there just a simple way to turn off the rounding? I'm working with randomly generated numbers, and I could get things like...
42533 \* .003 = 127.599 or,
42533 \* .03 = 1275.99 or,
42533 \* .3 = 12759.9
I need number\_format (or something else) to expre... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19071112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541165/"
] | The second argument of [number\_format](http://php.net/number_format) is the number of decimals in the number. The easiest way to find that out is probably to treat it as a string (as per [this question](https://stackoverflow.com/questions/2430084/php-get-number-of-decimal-digits)). Traditional US format is default beh... | If anyone's interested in this, I've written a little function to get around this problem.
With credit to Joel Hinz above, I came up with...
```
function number_format_with_decimals($value, $round_to){
//$value is the decimal number you want to show with number_format.
//$round_to is the deicimal place value ... |
19,071,112 | `number_format` **stupidly** rounds numbers by default. Is there just a simple way to turn off the rounding? I'm working with randomly generated numbers, and I could get things like...
42533 \* .003 = 127.599 or,
42533 \* .03 = 1275.99 or,
42533 \* .3 = 12759.9
I need number\_format (or something else) to expre... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19071112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541165/"
] | The second argument of [number\_format](http://php.net/number_format) is the number of decimals in the number. The easiest way to find that out is probably to treat it as a string (as per [this question](https://stackoverflow.com/questions/2430084/php-get-number-of-decimal-digits)). Traditional US format is default beh... | I tried these solutions, but what ended up being my answer was this:
```
$output=money_format('%!i', $value);
```
This gives you something like 3,234.90 instead of 3,234 or 3,234.9 |
40,097 | Wondering if I have to boil my homemade jars of salsa to seal them if they sealed on their own. (Yes I sterilized them before hand)
The salsa went in hot and once the lid was on, about 5 minutes later there was the telltale pop!
IF this is safe, how long does something like homemade salsa and homemade sauces keep for... | 2013/12/09 | [
"https://cooking.stackexchange.com/questions/40097",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/21782/"
] | Yes, you should fully process your salsa, even if you got the "hot jelly" seal just from hot packing.
The reason for this is that part of the processing is to ensure that the entire contents of the jar, all the way through, is at a high enough temperature for a long enough time to be safe as a shelf-stable product. Th... | All the books I have read on canning and preserving say that in order to safely process a non,or low acid fruit or veg ,you must pressure can it. They even go so far as to say that Tomatoes ,which have usually been the one "veg" you can hot -water bath, should be pressure canned ,because todays' market tomatoes are low... |
9,543 | People [often say](https://ham.stackexchange.com/search?q=outside%20of%20the%20shield) common-mode current flows on the outside of the shield, while the current on the inside of the shield is always opposed by an equal but opposite current on the center conductor. This is because skin effect separates the inside and ou... | 2017/11/20 | [
"https://ham.stackexchange.com/questions/9543",
"https://ham.stackexchange.com",
"https://ham.stackexchange.com/users/218/"
] | First, does it matter where the common-mode currents flow? Coax works as a transmission line because the (ideally) equal but opposite currents on the center and shield create opposite fields which exactly cancel for points outside the cable. Thus, it does not radiate. And by reciprocity, external interference is reject... | The statement "common-mode current flows on the outside of the shield" is true for a perfect shield. A low cost 60 ohm TV cable might have some common-mode current on the inside. Look at it the other way, Inject a common-mode current on the coax by use of a toroid transformer and measure the voltage between screen and ... |
9,543 | People [often say](https://ham.stackexchange.com/search?q=outside%20of%20the%20shield) common-mode current flows on the outside of the shield, while the current on the inside of the shield is always opposed by an equal but opposite current on the center conductor. This is because skin effect separates the inside and ou... | 2017/11/20 | [
"https://ham.stackexchange.com/questions/9543",
"https://ham.stackexchange.com",
"https://ham.stackexchange.com/users/218/"
] | It is helpful to understand the basic functioning of a coaxial cable. But first there are two important phenomenons that must be understood in order to proceed.
**Skin Effect**
When direct current (time invariant current) passes through a conductor it tends to uniformly use the entire cross sectional area of the cond... | The statement "common-mode current flows on the outside of the shield" is true for a perfect shield. A low cost 60 ohm TV cable might have some common-mode current on the inside. Look at it the other way, Inject a common-mode current on the coax by use of a toroid transformer and measure the voltage between screen and ... |
9,543 | People [often say](https://ham.stackexchange.com/search?q=outside%20of%20the%20shield) common-mode current flows on the outside of the shield, while the current on the inside of the shield is always opposed by an equal but opposite current on the center conductor. This is because skin effect separates the inside and ou... | 2017/11/20 | [
"https://ham.stackexchange.com/questions/9543",
"https://ham.stackexchange.com",
"https://ham.stackexchange.com/users/218/"
] | First, does it matter where the common-mode currents flow? Coax works as a transmission line because the (ideally) equal but opposite currents on the center and shield create opposite fields which exactly cancel for points outside the cable. Thus, it does not radiate. And by reciprocity, external interference is reject... | The name "common mode" means that the current on the shield and the center conductor is traveling in a common direction. This condition is a violation of the assumptions required to make a transmission line work.
For the transmission line to work correctly, the current must be in opposite directions on the shield and ... |
9,543 | People [often say](https://ham.stackexchange.com/search?q=outside%20of%20the%20shield) common-mode current flows on the outside of the shield, while the current on the inside of the shield is always opposed by an equal but opposite current on the center conductor. This is because skin effect separates the inside and ou... | 2017/11/20 | [
"https://ham.stackexchange.com/questions/9543",
"https://ham.stackexchange.com",
"https://ham.stackexchange.com/users/218/"
] | It is helpful to understand the basic functioning of a coaxial cable. But first there are two important phenomenons that must be understood in order to proceed.
**Skin Effect**
When direct current (time invariant current) passes through a conductor it tends to uniformly use the entire cross sectional area of the cond... | The name "common mode" means that the current on the shield and the center conductor is traveling in a common direction. This condition is a violation of the assumptions required to make a transmission line work.
For the transmission line to work correctly, the current must be in opposite directions on the shield and ... |
9,543 | People [often say](https://ham.stackexchange.com/search?q=outside%20of%20the%20shield) common-mode current flows on the outside of the shield, while the current on the inside of the shield is always opposed by an equal but opposite current on the center conductor. This is because skin effect separates the inside and ou... | 2017/11/20 | [
"https://ham.stackexchange.com/questions/9543",
"https://ham.stackexchange.com",
"https://ham.stackexchange.com/users/218/"
] | It is helpful to understand the basic functioning of a coaxial cable. But first there are two important phenomenons that must be understood in order to proceed.
**Skin Effect**
When direct current (time invariant current) passes through a conductor it tends to uniformly use the entire cross sectional area of the cond... | First, does it matter where the common-mode currents flow? Coax works as a transmission line because the (ideally) equal but opposite currents on the center and shield create opposite fields which exactly cancel for points outside the cable. Thus, it does not radiate. And by reciprocity, external interference is reject... |
186,940 | I'm working on an iOS Game and I found a piece of code on this site that I **really** want to use, and don't want to waste time studying and writing my own similar one that follows the same basic idea. Am I allowed to directly copy the code for my game?
Thanks in advance. | 2013/07/01 | [
"https://meta.stackexchange.com/questions/186940",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/251952/"
] | Yes. Any code posted on Stackoverflow is for the benefit, help, and use of others. If you use a ton of code give credit where credit is due. | In short: **Yes**
I see no reason you couldn't use it as a template for your own work or even copy sections directly, after all building on top of things other people have created is totally normal.
*However*, you'll probably find you get more from doing it yourself. Plus it's often more fun.
See: [Do I have to worr... |
186,940 | I'm working on an iOS Game and I found a piece of code on this site that I **really** want to use, and don't want to waste time studying and writing my own similar one that follows the same basic idea. Am I allowed to directly copy the code for my game?
Thanks in advance. | 2013/07/01 | [
"https://meta.stackexchange.com/questions/186940",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/251952/"
] | Since contributors to Stack Overflow license their work under the [CC-Wiki license](http://creativecommons.org/licenses/by-sa/3.0/)...
>
> 
>
>
>
But only under the following conditions:
>
> 
* like a crazy ex. (also cliche)
* like a bloodhound tracking down a stag.
* like a mosquito/Great White/vampire
drawn to blood.
* like a curse/nightmare that reminds me everyday of my terrible luck/life.
* like ... |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | Suppose you have mulitple record for same date or leave\_type but different id and you want the maximum no of id for same date or leave\_type as i also sucked with this issue,
so Yes you can do it with the following query:
```
select * from tabel_name where employee_no='123' and id=(
select max(id) from table_name... | ```
SELECT * FROM `permlog` as one
RIGHT JOIN (SELECT MAX(id) as max_id FROM `permlog`) as two
ON one.id = two.max_id
``` |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | Suppose you have mulitple record for same date or leave\_type but different id and you want the maximum no of id for same date or leave\_type as i also sucked with this issue,
so Yes you can do it with the following query:
```
select * from tabel_name where employee_no='123' and id=(
select max(id) from table_name... | This is the only proposed method who actually selects the whole row, not only the max(id) field. It uses a subquery
SELECT \* FROM permlog WHERE id = ( SELECT MAX( id ) FROM permlog ) |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT * FROM permlog ORDER BY id DESC LIMIT 0, 1
``` | Suppose you have mulitple record for same date or leave\_type but different id and you want the maximum no of id for same date or leave\_type as i also sucked with this issue,
so Yes you can do it with the following query:
```
select * from tabel_name where employee_no='123' and id=(
select max(id) from table_name... |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT * FROM permlog ORDER BY id DESC LIMIT 0, 1
``` | ```
SELECT MAX(ID) FROM tablename LIMIT 1
```
Use this query to find the highest ID in the MySQL table. |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | Since both `SELECT MAX(id) FROM table` and `SELECT id FROM table ORDER BY id DESC LIMIT 0,1` fulfill the goal, the interesting part is, which performs better.
`SELECT MAX(id) FROM table`: 152ms
`SELECT id FROM table ORDER BY id DESC LIMIT 0,1`: 25ms
(InnoDB-table with 55M rows on MySQL 8.0, 10 runs, average resu... | ```
SELECT * FROM `permlog` as one
RIGHT JOIN (SELECT MAX(id) as max_id FROM `permlog`) as two
ON one.id = two.max_id
``` |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT * FROM permlog ORDER BY id DESC LIMIT 0, 1
``` | This is the only proposed method who actually selects the whole row, not only the max(id) field. It uses a subquery
SELECT \* FROM permlog WHERE id = ( SELECT MAX( id ) FROM permlog ) |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT * FROM permlog ORDER BY id DESC LIMIT 0, 1
``` | For MySQL:
```
SELECT *
FROM permlog
ORDER BY id DESC
LIMIT 1
```
You want to sort the rows from highest to lowest `id`, hence the `ORDER BY id DESC`. Then you just want the first one so [`LIMIT 1`](http://dev.mysql.com/doc/refman/5.6/en/select.html):
>
> The LIMIT clause can be used to constrain the number of row... |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT MAX(ID) FROM tablename LIMIT 1
```
Use this query to find the highest ID in the MySQL table. | This is the only proposed method who actually selects the whole row, not only the max(id) field. It uses a subquery
SELECT \* FROM permlog WHERE id = ( SELECT MAX( id ) FROM permlog ) |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | if it's just the highest ID you want. and ID is unique/auto\_increment:
```
SELECT MAX(ID) FROM tablename
``` | Since both `SELECT MAX(id) FROM table` and `SELECT id FROM table ORDER BY id DESC LIMIT 0,1` fulfill the goal, the interesting part is, which performs better.
`SELECT MAX(id) FROM table`: 152ms
`SELECT id FROM table ORDER BY id DESC LIMIT 0,1`: 25ms
(InnoDB-table with 55M rows on MySQL 8.0, 10 runs, average resu... |
6,881,424 | How can I select the row with the highest ID in MySQL? This is my current code:
```
SELECT * FROM permlog WHERE max(id)
```
Errors come up, can someone help me? | 2011/07/30 | [
"https://Stackoverflow.com/questions/6881424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870380/"
] | ```
SELECT * FROM permlog ORDER BY id DESC LIMIT 0, 1
``` | ```
SELECT * FROM `permlog` as one
RIGHT JOIN (SELECT MAX(id) as max_id FROM `permlog`) as two
ON one.id = two.max_id
``` |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | **Update**: As others pointed out, this can be done now with newer versions (>=0.20). See [this answer](https://stackoverflow.com/a/65128634/3388962). (Side note: even the OP's code works now, but doing it without alias is even better.)
---
From skim reading documentation and source of pydantic, I tend to to say that... | You should be able to use `values` according to [pydantic docs](https://pydantic-docs.helpmanual.io/usage/validators/)
>
> you can also add any subset of the following arguments to the
> signature (the names must match):
>
>
> values: a dict containing the
> name-to-value mapping of any previously-validated fiel... |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | If you want to be able to dynamically modify a field according to another one, you can use the `values` argument. It holds all the previous fields, and careful: the **order matters**. You could do this either using a `validator` or a `root_validator`.
With a `validator`
------------------
```py
>>> from datetime impo... | **Update**: As others pointed out, this can be done now with newer versions (>=0.20). See [this answer](https://stackoverflow.com/a/65128634/3388962). (Side note: even the OP's code works now, but doing it without alias is even better.)
---
From skim reading documentation and source of pydantic, I tend to to say that... |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | **Update**: As others pointed out, this can be done now with newer versions (>=0.20). See [this answer](https://stackoverflow.com/a/65128634/3388962). (Side note: even the OP's code works now, but doing it without alias is even better.)
---
From skim reading documentation and source of pydantic, I tend to to say that... | What about overriding the `__init__`?
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel
class Model(BaseModel):
some_date: Optional[date]
some_list: List[date]
def __init__(self, *args, **kwargs):
# Modify the arguments
if len(kwargs['some_lis... |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | If you want to be able to dynamically modify a field according to another one, you can use the `values` argument. It holds all the previous fields, and careful: the **order matters**. You could do this either using a `validator` or a `root_validator`.
With a `validator`
------------------
```py
>>> from datetime impo... | You should be able to use `values` according to [pydantic docs](https://pydantic-docs.helpmanual.io/usage/validators/)
>
> you can also add any subset of the following arguments to the
> signature (the names must match):
>
>
> values: a dict containing the
> name-to-value mapping of any previously-validated fiel... |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | You should be able to use `values` according to [pydantic docs](https://pydantic-docs.helpmanual.io/usage/validators/)
>
> you can also add any subset of the following arguments to the
> signature (the names must match):
>
>
> values: a dict containing the
> name-to-value mapping of any previously-validated fiel... | What about overriding the `__init__`?
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel
class Model(BaseModel):
some_date: Optional[date]
some_list: List[date]
def __init__(self, *args, **kwargs):
# Modify the arguments
if len(kwargs['some_lis... |
54,023,782 | I'm using the pydantic `BaseModel` with a validator like this:
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel, BaseConfig, validator
class Model(BaseModel):
class Config(BaseConfig):
allow_population_by_alias = True
fields = {
"some_date"... | 2019/01/03 | [
"https://Stackoverflow.com/questions/54023782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592349/"
] | If you want to be able to dynamically modify a field according to another one, you can use the `values` argument. It holds all the previous fields, and careful: the **order matters**. You could do this either using a `validator` or a `root_validator`.
With a `validator`
------------------
```py
>>> from datetime impo... | What about overriding the `__init__`?
```
from datetime import date
from typing import List, Optional
from pydantic import BaseModel
class Model(BaseModel):
some_date: Optional[date]
some_list: List[date]
def __init__(self, *args, **kwargs):
# Modify the arguments
if len(kwargs['some_lis... |
3,990,338 | Let $\mathcal{E}$ be a category with finite limits, and let $Cat(\mathcal{E})$ be the category of internal categories in $\mathcal{E}$, with forgetful functor $Ob : Cat(\mathcal{E}) \to \mathcal{E}$, sending each internal category in $\mathcal{E}$ to its $\mathcal{E}$-object of objects. A colleague of mine has conjectu... | 2021/01/18 | [
"https://math.stackexchange.com/questions/3990338",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/202159/"
] | From our experience in the category of sets, we can see that the left adjoint should be a "discrete internal category" functor, and the right adjoint should be an "indiscrete internal category" functor. The discrete case is easier: we can define $L(X)$ to be the internal category $X\rightrightarrows X$ in which the sou... | Not 100% sure that this works, but I would argue as follows.
Your friend's claim amounts to say that every object defines a discrete and a codiscrete internal category; discreteness is the easiest: the object of morphisms $C\_1$ is just the object of objects, and all structure is trivial.
Codiscreteness can be argued... |
3,639,712 | I would like to apologize at first instant for asking some stupid question(well not the case for me), but i cannot help it out. i must admit i do not know jQuery but i do have the basic understanding of Javascript and i am a dedicated PHP developer. i don't have any problem understanding the HTML or css. when it comes ... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3639712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | My guess is that these items are not fading-in because they're visible to start with. Use simple CSS (`display:none`) to hide them, then the jquery fadeIn calls should display them once the page is loaded.
**update**
As others have pointed out, it's probably better to hide the messages with js instead of css, to allow... | I'm just guessing here, but the problem might be that, given what I can see here, your "msg-error" `div`s are already displayed, so they can't be faded in. Try modifying your jQuery like so:
```
$(document).ready(function(){
$(".block").hide().fadeIn(1000);
$(".msg-error").hid... |
3,639,712 | I would like to apologize at first instant for asking some stupid question(well not the case for me), but i cannot help it out. i must admit i do not know jQuery but i do have the basic understanding of Javascript and i am a dedicated PHP developer. i don't have any problem understanding the HTML or css. when it comes ... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3639712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | As grossvogel suggests, it is likely that the elements are not hidden to begin with. Bear in mind that if you hide them with CSS, they will be less accessible to users without JavaScript. You could do something like this instead:
```
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(){
... | My guess is that these items are not fading-in because they're visible to start with. Use simple CSS (`display:none`) to hide them, then the jquery fadeIn calls should display them once the page is loaded.
**update**
As others have pointed out, it's probably better to hide the messages with js instead of css, to allow... |
3,639,712 | I would like to apologize at first instant for asking some stupid question(well not the case for me), but i cannot help it out. i must admit i do not know jQuery but i do have the basic understanding of Javascript and i am a dedicated PHP developer. i don't have any problem understanding the HTML or css. when it comes ... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3639712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | My guess is that these items are not fading-in because they're visible to start with. Use simple CSS (`display:none`) to hide them, then the jquery fadeIn calls should display them once the page is loaded.
**update**
As others have pointed out, it's probably better to hide the messages with js instead of css, to allow... | You can change these three calls:
```
$(".block").fadeIn(1000);
$(".msg-error").fadeIn(1000);
$(".msg-warning").fadeIn(1000);
```
To just this:
```
$(".block, .msg-error, .msg-warning").hide().fadeIn(1000);
```
This uses the [multiple selector](http://api.jquery.com/multiple-selector/) to get ... |
3,639,712 | I would like to apologize at first instant for asking some stupid question(well not the case for me), but i cannot help it out. i must admit i do not know jQuery but i do have the basic understanding of Javascript and i am a dedicated PHP developer. i don't have any problem understanding the HTML or css. when it comes ... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3639712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | As grossvogel suggests, it is likely that the elements are not hidden to begin with. Bear in mind that if you hide them with CSS, they will be less accessible to users without JavaScript. You could do something like this instead:
```
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(){
... | I'm just guessing here, but the problem might be that, given what I can see here, your "msg-error" `div`s are already displayed, so they can't be faded in. Try modifying your jQuery like so:
```
$(document).ready(function(){
$(".block").hide().fadeIn(1000);
$(".msg-error").hid... |
3,639,712 | I would like to apologize at first instant for asking some stupid question(well not the case for me), but i cannot help it out. i must admit i do not know jQuery but i do have the basic understanding of Javascript and i am a dedicated PHP developer. i don't have any problem understanding the HTML or css. when it comes ... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3639712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396476/"
] | As grossvogel suggests, it is likely that the elements are not hidden to begin with. Bear in mind that if you hide them with CSS, they will be less accessible to users without JavaScript. You could do something like this instead:
```
<script type="text/javascript">
/* < to get ... |
59,874,958 | I'm starting to learn Ruby along with selenium and cucumber:
I'm running on ubuntu and using Firefox as a browser
Ubuntu:
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Firefox version: 72.0.1
selenium-webdriver version : 3.142.7
Ruby version: 2.5.1p57
I've started with a small simple test:
```
require 'rubygems'
r... | 2020/01/23 | [
"https://Stackoverflow.com/questions/59874958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10273452/"
] | In general, parsing JSON content with regex alone is not ideal. We might be able to use SQL Server's enhanced `LIKE` operator here:
```
SELECT *
FROM yourTable
WHERE json LIKE '%"Id":1234[^5]%';
```
This would return all occurrences of `"Id":1234` which are followed by any character other than 5. Note that there sho... | I think pattern `'%"Id":1234[^a-zA-Z0-9]%'` will do.
It uses negated character class `[^a-zA-Z0-9]`, which works as in regular regex :)
Sample:
```
declare @tbl table (col varchar(100));
insert into @tbl values
('{"Id":1234, "Title": "The quick brown"}'),
('{"Id":1234, "Title": "The quick brown"}'),
('Id":1234, "T... |
59,874,958 | I'm starting to learn Ruby along with selenium and cucumber:
I'm running on ubuntu and using Firefox as a browser
Ubuntu:
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Firefox version: 72.0.1
selenium-webdriver version : 3.142.7
Ruby version: 2.5.1p57
I've started with a small simple test:
```
require 'rubygems'
r... | 2020/01/23 | [
"https://Stackoverflow.com/questions/59874958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10273452/"
] | Considering you have JSON data, why not parse it as such?
```
DECLARE @JSON nvarchar(MAX) = '{"Id":1234, "Title": "The quick brown"}';
SELECT *
FROM (VALUES(@JSON)) V(J)
CROSS APPLY OPENJSON(@JSON)
WITH (Id int,
Title varchar(50)) OJ
WHERE OJ.Id = 1234;
``` | I think pattern `'%"Id":1234[^a-zA-Z0-9]%'` will do.
It uses negated character class `[^a-zA-Z0-9]`, which works as in regular regex :)
Sample:
```
declare @tbl table (col varchar(100));
insert into @tbl values
('{"Id":1234, "Title": "The quick brown"}'),
('{"Id":1234, "Title": "The quick brown"}'),
('Id":1234, "T... |
68,014,252 | I was wondering on how to upload an image via API postman in Laravel and save to my database
which is phpMyAdmin. When I try to run my code in postman, this is what is showing:
```
"image null"
```
This is currently my code:
Banner CRUD Controller:
```
<?php
namespace App\Http\Controllers\Api;
use App\Http\... | 2021/06/17 | [
"https://Stackoverflow.com/questions/68014252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12019847/"
] | You just use this code to upload an image and in postman select type file
```
public function store(Request $request)
{
$data = $request->validate([
'id'=>'required',
'web_banner_profile'=>'required',
]);
$image = $request->file('image');
if($request->hasFil... | The error is clear request has empty image. So You should select key type file in postman
[](https://i.stack.imgur.com/FEEfT.jpg)
[](https://i.stack.imgur.com/Tsqo2.jpg) |
68,014,252 | I was wondering on how to upload an image via API postman in Laravel and save to my database
which is phpMyAdmin. When I try to run my code in postman, this is what is showing:
```
"image null"
```
This is currently my code:
Banner CRUD Controller:
```
<?php
namespace App\Http\Controllers\Api;
use App\Http\... | 2021/06/17 | [
"https://Stackoverflow.com/questions/68014252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12019847/"
] | You just use this code to upload an image and in postman select type file
```
public function store(Request $request)
{
$data = $request->validate([
'id'=>'required',
'web_banner_profile'=>'required',
]);
$image = $request->file('image');
if($request->hasFil... | Replace store function with below in your BannerCRUDController.php.
Create `images` directory in storage.
```
public function store(Request $request)
{
$data = $request->validate([
'id'=>'required',
'web_banner_profile'=>'required',
]);
$image = $request->file('... |
47,435,453 | I'm trying to get the OS and compiler name as a string in C++. Although there are many questions about this I did not find a definitive answer. So I tried to use Boost.Predef 1.55 which defines macros of the type `BOOST_OS_<OS>` and `BOOST_OS_<OS>_NAME`.
Hence one could simply do `if(BOOST_OS_<OS>) return BOOST_OS_<OS... | 2017/11/22 | [
"https://Stackoverflow.com/questions/47435453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1930508/"
] | You defined `listofthings` as an empty C-style array (zero elements).
```
std::string listofthings[]
{
};
```
As [pointed by AndyG](https://stackoverflow.com/a/47435756/6022656), the language require that a size grather than zero, so your program is ill-formed.
So, when you use it,
```
listofthings[counter] = wo... | The statement
```
std::string listofthings[]
{
};
```
Is ill-formed C++ because the language requires that the initializer for an array contain more than zero elements ([dcl.init.aggr]):
>
> An array of unknown size initialized with a brace-enclosed initializer-list containing `n` *initializer-clauses*,
> where ... |
13,984 | Where can I find the source of Nautilus? I'd like to play around with its source code and compile it. What's the best way to go about this? Obviously, it would be nice if I would easily be able to revert to the repository version if something bad happens :) | 2010/11/19 | [
"https://askubuntu.com/questions/13984",
"https://askubuntu.com",
"https://askubuntu.com/users/2331/"
] | If you want use the same sources from the installed version you must get it from the Ubuntu repository.
First, from the softwate center, software sources, you need to enable the "source code" sources.
Then you can use `apt-get source`, to get the source, and `dpkg-buildpackage`, to build the package.
Check the follo... | ```
apt-get source nautilus
``` |
13,984 | Where can I find the source of Nautilus? I'd like to play around with its source code and compile it. What's the best way to go about this? Obviously, it would be nice if I would easily be able to revert to the repository version if something bad happens :) | 2010/11/19 | [
"https://askubuntu.com/questions/13984",
"https://askubuntu.com",
"https://askubuntu.com/users/2331/"
] | If you want use the same sources from the installed version you must get it from the Ubuntu repository.
First, from the softwate center, software sources, you need to enable the "source code" sources.
Then you can use `apt-get source`, to get the source, and `dpkg-buildpackage`, to build the package.
Check the follo... | Instructions for hacking on the Nautilus code are available [here](http://live.gnome.org/Nautilus/Development/). Instructions on how to get the code and build it can be found on [this page](http://live.gnome.org/Nautilus/Development/Nautilus).
It seems you don't need to install it and can test it by running it from th... |
1,757,213 | How do I specify multiple stream specifier metadata tag keys?
For example, this copies the video from the input to the output and only selects those audio tracks that are in English (there are two, one is Mono the other is Stereo):
```
ffmpeg -i "s1950e15 What's up Doc.mkv" -map 0:a:m:language:eng -map 0:v -c:v copy ... | 2022/12/11 | [
"https://superuser.com/questions/1757213",
"https://superuser.com",
"https://superuser.com/users/359463/"
] | I don't know of such a method - it doesn't seem to exist.
You may use the Feedback Hub to signal the problem to Microsoft.
As a very weak workaround, you could set the default user to be an
extremely limited guest user account. This will force to do the real
login using the command `su - username`, which will require ... | There's always going to be one "default" user for a WSL distribution. This is because [WSL distributions are "containers"](https://superuser.com/q/1736527/1210833). A container doesn't have the concept of a "login", but rather is "entered" from the parent namespace. Docker works the same way.
There are several possibl... |
6,540,418 | I am having an odd problem with jQuery 1.5.2 in Chrome.
I have code that looks like the following
```
$("img").each(function () {
if (this.complete) {
imageOnload.call(this);
} else {
$(this).bind("load", imageOnload);
}
});
function imageOnload () {
var $this = $(this);
foo($this); ... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6540418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364913/"
] | You can use something similar to this:
load\_data.php
```
function get_data() {
// May be you want to load data from DB
// This is just a hint
return array('key1' => 'Value 1', 'key2' => 'Value 2');
}
```
And in your main file:
```
<select name="myselect">
<?php
include 'load_data.php';
$da... | If you want to do it without reloading the page, you'll need to look into AJAX. If you want to do this at the time you request the page, you can [include the page](http://php.net/manual/en/function.include.php) and call any functions out of it. |
30,041,816 | I'm using ACE Editor within a Chrome extension. I'm using ACE's Autocomplete feature but I want to be able to completely define a list of static strings to use for the autocomplete, instead of any local strings or snippets. (In the future I might be using something more sophisticated than a static list, but for now sta... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30041816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1466992/"
] | you need to add a completer like this
```
var staticWordCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
var wordList = ["foo", "bar", "baz"];
callback(null, wordList.map(function(word) {
return {
caption: word,
value: word... | If you want to persist the old keyword list and want to append a new list
```
var staticWordCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
var wordList = ["foo", "bar", "baz"];
callback(null, [...wordList.map(function(word) {
return {
ca... |
47,389,223 | Run the following, and it's supposed to return the sequence. The Xpath are coped using chrome Xpath but in `nokogiri` it just returns empty string.
```
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open("https://pt.wiktionary.org/wiki/fazer"))
p sequence = doc.xpath('//*[@id="NavFrame1"]/div[2]/ta... | 2017/11/20 | [
"https://Stackoverflow.com/questions/47389223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8951931/"
] | To match **all** jpg files in `/tmp/stream` use:
```
ffmpeg -framerate 25 -pattern_type glob -i '*.jpg'
```
For more specificity use additional glob patterns. For example, if you only want images from 2017-11-08 to 2017-11-10:
```
ffmpeg -framerate 25 -pattern_type glob -i '/tmp/stream/2017_11_{08,09,10}*.jpg'
```... | `_%09d.jpg` matches names of the form `_000000001.jpg`, `_000000002.jpg`
Use `-pattern_type glob -i '/tmp/stream/*_%09d.jpg'` |
36,497,967 | I am trying to insert data into a table using POST method for that I have a angular service function
```
angular.module("productCategoryModule")
.factory("productCategoryService",productCategoryService);
productCategoryService.$inject = ['$http'];
function productCategoryService($http){
return {
createPr... | 2016/04/08 | [
"https://Stackoverflow.com/questions/36497967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5308896/"
] | Are you sure you have included the module `body-parser`.
It seems the code you posted here to be the same as the tutorial I have been following.
Your code seems to be fine except I don't know what your code in `app.js` looks like.
I have verified that I get the console response for *req.body* as `undefined` when I c... | I got the same error but in my case there was a node-modules function that increments id for each POST I made and i forgot to add id in my DTO..and now it's working; maybe it's not your case since u are using mysql but I'll post the answer anyway, maybe some1 will resolve his error thank to this help |
25,215,672 | I used in my genimotion and it display normally, but in my real device it is only while screen :(, I config my code for longtime but it's still not display.
API\_Key is right, almost thing is right, I think so because I runed normally in genymotion.
here is my code:
```
package fu.capstone.hemo;
import java.io.IOE... | 2014/08/09 | [
"https://Stackoverflow.com/questions/25215672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733430/"
] | **Try this way,hope this will help you to solve your problem.**
<https://developers.google.com/maps/documentation/android/start>
1.I think the problem is with the Obtaining an API Key Or With The SHA-1 Finger Print.
2.have You Give the application Package with the SHA-1 fingerprint in the Google [Consol](https://cod... | create a **new api key** using your **project keystore file** and package name.And try,because the api created using **debug.keystore** will show map only in debug mode |
557,821 | I want to remove the extensions and prefixes from these files:
```
awstats.www.test1.com.conf
awstats.www.test2.com.conf
awstats.www.test3.com.conf
```
I need to remove `awstats.` and `.conf`, but leave files like `www.test1.com` unchanged. How can I do this? | 2019/12/18 | [
"https://unix.stackexchange.com/questions/557821",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/296594/"
] | Assuming that you are in the same directory as your files:
```none
for name in awstats.*.conf; do
basename "${name#awstats.}" .conf
done
```
The code inside the loop will first trim the `awstats.` prefix off from `$name` using a standard parameter substitution, and then lets `basename` trim off the `.conf` suffi... | I assume `rename` (`perl-rename` on some systems, just `rename` on others) is simplest here:
```
rename 's/^awstats\.//;s/\.conf$//' awstats.*.conf
```
Explanation of the regex:
* `s/^awstats\.//` substitute `awstats.` at beginning of line (filename) with nothing
* `s/\.conf$//` substitute `.conf` at end of line (f... |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | You can use the [p4 unshelve](http://www.perforce.com/perforce/doc.current/manuals/cmdref/unshelve.html) command to remap the shelved files in a changelist to another stream using the -S option. Ex:
```
p4 unshelve -s <changlist#-with-shelved-files> -S //depot/streamname
```
Not sure if this is only available in a c... | I believe the shelve/unshelve technique requires the 2013.1 server, not the 2012.2 server. You should confirm this with Perforce Technical Support. |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | If you're for some reason more comfortable using P4V than command line, the solution az2tonez gave can be done with the GUI, at least in P4V 2014.2.
1. Shelve your changeset, and make sure you have no other files checked out in the workspace.
2. In the 'Streams' tab, drag the workspace icon from the current stream to ... | I believe the shelve/unshelve technique requires the 2013.1 server, not the 2012.2 server. You should confirm this with Perforce Technical Support. |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | The other answers here are correct, but they don't warn you that you can't just shelve from any stream and unshelve on any unrelated stream. In particular, the original poster asked about the error message "file(s) not in client view" which is the error message that P4V displays when you haven't selected the proper map... | I believe the shelve/unshelve technique requires the 2013.1 server, not the 2012.2 server. You should confirm this with Perforce Technical Support. |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | You can use the [p4 unshelve](http://www.perforce.com/perforce/doc.current/manuals/cmdref/unshelve.html) command to remap the shelved files in a changelist to another stream using the -S option. Ex:
```
p4 unshelve -s <changlist#-with-shelved-files> -S //depot/streamname
```
Not sure if this is only available in a c... | If you're for some reason more comfortable using P4V than command line, the solution az2tonez gave can be done with the GUI, at least in P4V 2014.2.
1. Shelve your changeset, and make sure you have no other files checked out in the workspace.
2. In the 'Streams' tab, drag the workspace icon from the current stream to ... |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | You can use the [p4 unshelve](http://www.perforce.com/perforce/doc.current/manuals/cmdref/unshelve.html) command to remap the shelved files in a changelist to another stream using the -S option. Ex:
```
p4 unshelve -s <changlist#-with-shelved-files> -S //depot/streamname
```
Not sure if this is only available in a c... | The other answers here are correct, but they don't warn you that you can't just shelve from any stream and unshelve on any unrelated stream. In particular, the original poster asked about the error message "file(s) not in client view" which is the error message that P4V displays when you haven't selected the proper map... |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | You can use the [p4 unshelve](http://www.perforce.com/perforce/doc.current/manuals/cmdref/unshelve.html) command to remap the shelved files in a changelist to another stream using the -S option. Ex:
```
p4 unshelve -s <changlist#-with-shelved-files> -S //depot/streamname
```
Not sure if this is only available in a c... | I know this is an old thread, but I just recently needed to do this exact thing. While these answers were conceptually useful in understanding what needed to be done, unfortunately using only the information in this thread, I couldn't quite get it to work.
I wanted to add the perforce link I found afterwards that fill... |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | If you're for some reason more comfortable using P4V than command line, the solution az2tonez gave can be done with the GUI, at least in P4V 2014.2.
1. Shelve your changeset, and make sure you have no other files checked out in the workspace.
2. In the 'Streams' tab, drag the workspace icon from the current stream to ... | I know this is an old thread, but I just recently needed to do this exact thing. While these answers were conceptually useful in understanding what needed to be done, unfortunately using only the information in this thread, I couldn't quite get it to work.
I wanted to add the perforce link I found afterwards that fill... |
16,166,571 | Is there a good way in Perforce to move unsubmitted changes to a different stream before submitting them (equivalent of `git stash`, `git checkout otherbranch`, `git stash pop`)?
I currently have the files checked out locally (non-exclusively) and edited. I've tried shelving them and then trying to unshelve them into ... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16166571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1783475/"
] | The other answers here are correct, but they don't warn you that you can't just shelve from any stream and unshelve on any unrelated stream. In particular, the original poster asked about the error message "file(s) not in client view" which is the error message that P4V displays when you haven't selected the proper map... | I know this is an old thread, but I just recently needed to do this exact thing. While these answers were conceptually useful in understanding what needed to be done, unfortunately using only the information in this thread, I couldn't quite get it to work.
I wanted to add the perforce link I found afterwards that fill... |
1,473,819 | Let $n\geq 1$. A contest has two rounds. You are automatically in the second round, while $n$ other people are in the first round. Each of the $n$ other people proceeds to the second round with probability $1/n$, independently. If there are $k$ people in the second round, you win the contest with probability $1/k$. Is ... | 2015/10/10 | [
"https://math.stackexchange.com/questions/1473819",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/201597/"
] | To answer your question, let $X\sim Binom(n,\frac 1 n)$. Then $$P(Win(n))=E\big(\frac 1 {1+X}\big)\geq\frac 1 {1+E(X)}=\frac 1 2$$ by Jensen's inequality (with equality only if $n=1$).
We can also integrate probability generating function for $X$ from $0$ to $1$ to yield $$P(Win(n))=\sum\_{k=0}^n\frac 1 {k+1}P(X=k)=\s... | Let $p\_i$ be the probability that $i$ other people reach the second round. The expected number of other people who reach the second round is $1$. Hence $p\_0\ge1-p\_0-p\_1$, so your winning probability is at least
$$
p\_0+\frac12p\_1\ge\frac12p\_0+\frac12p\_1+\frac12(1-p\_0-p\_1)=\frac12
$$
(and this would hold even... |
13,316,134 | There's lots of topics touching on part of the title, but nothing that quite satisfies the whole thing. I'm pushing a command on a remote server and need the full output after a long execution time, say 5 minutes or so. Using channel I was able to set a timeout, but when I read back stdout I got only a small portion of... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13316134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772459/"
] | I'm having the same kind of issue. I think we can handle it with signalling. <http://docs.python.org/2/library/signal.html>
Here is a plain dumb example to show how it works.
```
import signal, time
def handler(signum, frame):
pass
... | I had a lot of problem calling the exec\_command from the channel, instead I use directly the exec\_command from the ssh connection and call the channel of the std output, the code that works for me is like **myexec**:
```
#!/usr/bin/env python
import paramiko
import select
def myexec(ssh, cmd, timeout):
stdin, std... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.