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 |
|---|---|---|---|---|---|
6,195,329 | I now its still early but I also know you guys are on top of it.
I want to use the [HTML5 details element](http://www.w3.org/TR/html5/interactive-elements.html#the-details-element):
```html
<details>
<summary>What's the HTML5 details element?</summary>
<p>The details element represents a disclosure widget fro... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6195329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278337/"
] | I am on Firefox 65.0.1 and can remove the arrow this way:
```
details > summary {display:block}
``` | This solution worked for me, since the highest rated on did not work on Chrome for me. It's a variation of the original solution.
```
details summary {
list-style: none;
```
} |
6,195,329 | I now its still early but I also know you guys are on top of it.
I want to use the [HTML5 details element](http://www.w3.org/TR/html5/interactive-elements.html#the-details-element):
```html
<details>
<summary>What's the HTML5 details element?</summary>
<p>The details element represents a disclosure widget fro... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6195329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278337/"
] | According to <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details#Customizing_the_disclosure_widget>
You can achieve this with:
```css
details > summary {
list-style: none;
}
details > summary::-webkit-details-marker {
display: none;
}
``` | ```css
summary::-webkit-details-marker {
font-size:0px
}
``` |
6,195,329 | I now its still early but I also know you guys are on top of it.
I want to use the [HTML5 details element](http://www.w3.org/TR/html5/interactive-elements.html#the-details-element):
```html
<details>
<summary>What's the HTML5 details element?</summary>
<p>The details element represents a disclosure widget fro... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6195329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278337/"
] | ```css
summary::-webkit-details-marker {
font-size:0px
}
``` | Changing the display to 'block' will remove the arrow.
```
summary {
display:block;
}
``` |
67,812,278 | Is there a single command that will print the current branch (e.g. `master`) if there is one, or the commit hash if it is detached? The purpose is to give me something to write down so I can later execute `git switch <branch_or_commit>` to get back to where I started.
This is to be used programmatically, so no scrapin... | 2021/06/02 | [
"https://Stackoverflow.com/questions/67812278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265521/"
] | Impossible with exactly one command but possible with two:
```
git symbolic-ref -q --short HEAD || git rev-parse HEAD
```
Get the current branch; but if detached get the hash. | >
> The purpose is to give me something to write down so I can later execute `git switch <branch_or_commit>` to get back to where I started.
>
>
>
You'll need to know whether the thing-you-got-back is a *branch name* or a *commit hash ID* because `git switch` demands the `--detach` flag when using a hash ID, but u... |
2,632,116 | why do I have to do this:
```
$('#myfoo').change(function(){mylongfunc();});
```
instead of this:
```
$('#myfoo').change(mylongfunc());
```
what does that extra function(){} wrapper do? | 2010/04/13 | [
"https://Stackoverflow.com/questions/2632116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228169/"
] | You don't need the wrapper function, just a little tweak to your approach, like this:
```
$('#myfoo').change(mylongfunc);
```
The `function() {}` is just an anonymous function, you can use a named function directly like you want, just pass the function.
```
mylongfunc //passes the function
mylongfunc() //passes the... | There is a subtle difference.
When you do `function(){ myLongFunc(); }` you're defining an anonymous function that is a wrapper around `myLongFunc`.
When you do `change(myLongFunc())` you don't get the result you expect, because that actually *calls* the function and passes the result of the call to `change`.
So wha... |
2,632,116 | why do I have to do this:
```
$('#myfoo').change(function(){mylongfunc();});
```
instead of this:
```
$('#myfoo').change(mylongfunc());
```
what does that extra function(){} wrapper do? | 2010/04/13 | [
"https://Stackoverflow.com/questions/2632116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228169/"
] | You don't need the wrapper function, just a little tweak to your approach, like this:
```
$('#myfoo').change(mylongfunc);
```
The `function() {}` is just an anonymous function, you can use a named function directly like you want, just pass the function.
```
mylongfunc //passes the function
mylongfunc() //passes the... | This uses an "anonymous" function.
```
$('#myfoo').change(function(){mylongfunc();});
```
This uses a pre-defined, reusable function. **Note:** I removed the `()` from `mylongfunc`
```
$('#myfoo').change(mylongfunc);
```
---
### The basic rule is this:
Use anonymous functions when they're only going to be used ... |
120,999 | I am designing an App and I want to use the "Choose Color Scheme" tools inside Button.
[](https://i.stack.imgur.com/EBbzL.jpg)
I am looking to have this tool in popup window when the Button is clicked but I can't find the command to get this tools.
... | 2016/07/18 | [
"https://mathematica.stackexchange.com/questions/120999",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/13548/"
] | Do you mean
```
Button[
Tooltip["click",
Column[{"Click this button to select a ColorScheme.",
"This button will be replaced with ColorData"}]],
With[{box = EvaluationBox[]}, SelectionMove[box, All, Expression];
FrontEndExecute@
FrontEnd`AttachCell[box,
FrontEndResource["ColorSchemeSelector"], {1, ... | Here is a modification of Karsten's answer attempting to get the behavior you described in a comment.
* The selected value is assigned to `Global`$color` (as shown by `Dynamic`)
* I made the picker wider to get rid of the annoying bottom scroll bar
Code:
```
Button["Pick a color",
Module[{picker, box = EvaluationBo... |
11,584,514 | I'm at a loss - after wracking my brain for hours on this one, it's time to throw the question up here.
I'm trying to have a checkbox execute some javascript code that, when checked, enables some form elements, and when unchecked, disables those elements again.
Here's the javascript that I have:
```
function housecl... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11584514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275036/"
] | This code will do the trick. You should be explicit about your element IDs and use getElementById whenever possible.
The HTML:
```
<form id="orderform" style="margin-left: 6cm;">
<input type="checkbox" id="cleaning" name="cleaning" value="yes" onclick="javascript:houseclean();"/> Home cleaning <br />
Service: <select... | I got your code to work. I added the `id` attribute to the form elements and used `document.getElementById` to be on the safe side.
JFiddle example: <http://jsfiddle.net/vxRjw/1/> |
11,584,514 | I'm at a loss - after wracking my brain for hours on this one, it's time to throw the question up here.
I'm trying to have a checkbox execute some javascript code that, when checked, enables some form elements, and when unchecked, disables those elements again.
Here's the javascript that I have:
```
function housecl... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11584514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275036/"
] | This code will do the trick. You should be explicit about your element IDs and use getElementById whenever possible.
The HTML:
```
<form id="orderform" style="margin-left: 6cm;">
<input type="checkbox" id="cleaning" name="cleaning" value="yes" onclick="javascript:houseclean();"/> Home cleaning <br />
Service: <select... | Not super robust, but a dynamic jquery solution...
```
$("#mycheckbox").click(function() {
enableFormElements("#myform", $(this).attr('checked'));
});
function enableFormElements(form, enable) {
var fields = ["checkbox","textarea","select"];
var selector = form+" input";
$.each(fields, funct... |
11,584,514 | I'm at a loss - after wracking my brain for hours on this one, it's time to throw the question up here.
I'm trying to have a checkbox execute some javascript code that, when checked, enables some form elements, and when unchecked, disables those elements again.
Here's the javascript that I have:
```
function housecl... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11584514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275036/"
] | I got your code to work. I added the `id` attribute to the form elements and used `document.getElementById` to be on the safe side.
JFiddle example: <http://jsfiddle.net/vxRjw/1/> | Not super robust, but a dynamic jquery solution...
```
$("#mycheckbox").click(function() {
enableFormElements("#myform", $(this).attr('checked'));
});
function enableFormElements(form, enable) {
var fields = ["checkbox","textarea","select"];
var selector = form+" input";
$.each(fields, funct... |
56,284,049 | I upgraded expo for my React Native App from SDK25 to SDK32 directly following the steps explained on the Expo Documentation.
When i try to run the app into the Expo client, i get the following error
>
> `undefined is not an object (evaluating '_expo2.default.KeepAwake')
> <unknown>
> crna-entry.js:20:17
> loadMod... | 2019/05/23 | [
"https://Stackoverflow.com/questions/56284049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6589410/"
] | Remove react-native-scripts and update main key | Upgrading your project to use Expo CLI.
Make these changes to `package.jso`n:
Replace `react-native-scripts` with `expo` in the `scripts` config.
Example:
```
"scripts": {
"start": "expo start",
"eject": "expo eject",
"android": "expo start --android",
"ios": "expo start --ios",
"test": "jest"
}
... |
55,095,752 | I have a table called **email\_id** and column name as **email\_id** and I have these email id’s in the column
```
name@yahoo.com
name@msn.com
name@gmail.com
name@xmsoftware.com
```
And I need only domain names like these as **result**
```
yahoo
msn
gmail
xmsoftware
```
Is there a simplest way (or) any other f... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55095752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11149790/"
] | I would prefer `REGEXP_SUBSTR`
```
select REGEXP_SUBSTR(email_id,'^.*@(.*)\.(.*)$',1,1,null,1) as domain
FROM emails;-- ^ first match ^ within()
```
[**Demo**](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=9b839374cab5ef56fe1f3e39a1a2345d) | The *oldfashioned* way is to use `SUBSTR + INSTR` combination. It takes more letters to type (when compared to regular expressions), but might work faster on large data sets.
```
SQL> WITH email_id (email_id)
2 AS (SELECT 'name@yahoo.com' FROM DUAL
3 UNION ALL
4 SELECT 'name@msn.com' FR... |
25,945,724 | Lets say for instance my url is localhost:3000/posts/98Xjsd39sdk, with my unique id being the last part of that URL. Is there a built in way to grab that parameter that is being passed in? I know I can also pass a data object with Iron Router, but this data seems limited to being used in the actual template with handle... | 2014/09/20 | [
"https://Stackoverflow.com/questions/25945724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3927685/"
] | There's no built in way in Meteor to extract it, but you can use plain JavaScript:
```js
var parts = location.href.split('/')
var id = parts.pop()
``` | I'm not exactly sure whether I understood what you are trying to achieve so please leave a comment if this is not what you wanted:.
You can declare you route with a wildcard parameter like so:
```
this.route('post', {
path: "/posts/:postId"
});
```
Then you can acces the postId via `this.params.postId`. You can... |
25,945,724 | Lets say for instance my url is localhost:3000/posts/98Xjsd39sdk, with my unique id being the last part of that URL. Is there a built in way to grab that parameter that is being passed in? I know I can also pass a data object with Iron Router, but this data seems limited to being used in the actual template with handle... | 2014/09/20 | [
"https://Stackoverflow.com/questions/25945724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3927685/"
] | There's no built in way in Meteor to extract it, but you can use plain JavaScript:
```js
var parts = location.href.split('/')
var id = parts.pop()
``` | ```
var help = Router.current().params.postId
```
in your template will get the Id of the post.
if you have defined your route as such:
```
Router.route('/posts/:postId', function () {
//subscriptions go here
if (this.ready()) {
this.render('postsTemplate');
} else {
this.render('loadingTemplate');
}
)};
... |
25,945,724 | Lets say for instance my url is localhost:3000/posts/98Xjsd39sdk, with my unique id being the last part of that URL. Is there a built in way to grab that parameter that is being passed in? I know I can also pass a data object with Iron Router, but this data seems limited to being used in the actual template with handle... | 2014/09/20 | [
"https://Stackoverflow.com/questions/25945724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3927685/"
] | I'm not exactly sure whether I understood what you are trying to achieve so please leave a comment if this is not what you wanted:.
You can declare you route with a wildcard parameter like so:
```
this.route('post', {
path: "/posts/:postId"
});
```
Then you can acces the postId via `this.params.postId`. You can... | ```
var help = Router.current().params.postId
```
in your template will get the Id of the post.
if you have defined your route as such:
```
Router.route('/posts/:postId', function () {
//subscriptions go here
if (this.ready()) {
this.render('postsTemplate');
} else {
this.render('loadingTemplate');
}
)};
... |
7,850,207 | I'm investigating the options for using Shibboleth in a Django deployment. From what I've found, things look somewhat sparse. Can anyone comment on the following?
* Is anyone using the django\_shibboleth module (see <http://code.arcs.org.au/gitorious/django/django-shibboleth/trees/1.1>)? If so, what experiences have y... | 2011/10/21 | [
"https://Stackoverflow.com/questions/7850207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1007116/"
] | I would recommend using the Shibboleth Native SP (apache mod\_shib). It's well tested, has a large user base, and is very stable.
I took a quick look at the [django\_shibboleth](https://github.com/sorrison/django-shibboleth) module, and it seems that it depends on mod\_shib, and doesn't do any SAML on it's own. In th... | While I don't have experience with Django+Shibboleth, I have some with "plain" Shibboleth.
If your Apache has mod\_shibboleth configured properly, then integrating it with a web app is relatively trivial. Check out the django\_shibboleth module and you can see it does not contain that much code.
In particular, if you... |
7,850,207 | I'm investigating the options for using Shibboleth in a Django deployment. From what I've found, things look somewhat sparse. Can anyone comment on the following?
* Is anyone using the django\_shibboleth module (see <http://code.arcs.org.au/gitorious/django/django-shibboleth/trees/1.1>)? If so, what experiences have y... | 2011/10/21 | [
"https://Stackoverflow.com/questions/7850207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1007116/"
] | I would recommend using the Shibboleth Native SP (apache mod\_shib). It's well tested, has a large user base, and is very stable.
I took a quick look at the [django\_shibboleth](https://github.com/sorrison/django-shibboleth) module, and it seems that it depends on mod\_shib, and doesn't do any SAML on it's own. In th... | A django-shibboleth module is available which can be used to obtain attributes from an IdP and map them to users in the Django auth system. Most of the work is done by Shibboleth itself, with only a small amount of code required for the mapping.
The packing is available from here.
linuxsoft.cern.ch/internal/repos/ai6... |
32,796,541 | Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed [this](https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist) link to remove that t... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32796541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931487/"
] | You could use the `__dict__` property which composes a class, for example:
```
In [1]: class Foo(object):
...: bar = "b"
...: zulu = "z"
...:
In [2]: "bar" in Foo.__dict__
Out[2]: True
```
Or as you're searching for the values use `__dict__.values()`:
```
In [3]: "b" in Foo.__dict__.values()
... | Why don't you use a dictionary? Its a lot simpler and lookups will be easier as well.
```
states = {'AL': 'Alabama', 'AK': 'Alaska' ... }
test_state = 'Foo'
if test_state not in states.keys():
print('{} is not valid input'.format(test_state))
``` |
32,796,541 | Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed [this](https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist) link to remove that t... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32796541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931487/"
] | Why don't you use a dictionary? Its a lot simpler and lookups will be easier as well.
```
states = {'AL': 'Alabama', 'AK': 'Alaska' ... }
test_state = 'Foo'
if test_state not in states.keys():
print('{} is not valid input'.format(test_state))
``` | Indeed if you can set at the beginning all your arguments it is better just to put the required arguments without default arguments. This forces the user to set the arguments. However, often you might want to set the attributes later for various reasons.
I find very handy to define a class Required that I can use as a... |
32,796,541 | Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed [this](https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist) link to remove that t... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32796541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931487/"
] | You could use the `__dict__` property which composes a class, for example:
```
In [1]: class Foo(object):
...: bar = "b"
...: zulu = "z"
...:
In [2]: "bar" in Foo.__dict__
Out[2]: True
```
Or as you're searching for the values use `__dict__.values()`:
```
In [3]: "b" in Foo.__dict__.values()
... | I would suggest using Enum to define both `Gender` and `States`.
[Enum](https://docs.python.org/3/library/enum.html) if part of the standard library on `Python 3`. If you are on `Python 2` use [enum34](https://pypi.python.org/pypi/enum34), install with `pip install enum34`.
```
from enum import Enum
class States(E... |
32,796,541 | Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed [this](https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist) link to remove that t... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32796541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931487/"
] | You could use the `__dict__` property which composes a class, for example:
```
In [1]: class Foo(object):
...: bar = "b"
...: zulu = "z"
...:
In [2]: "bar" in Foo.__dict__
Out[2]: True
```
Or as you're searching for the values use `__dict__.values()`:
```
In [3]: "b" in Foo.__dict__.values()
... | Indeed if you can set at the beginning all your arguments it is better just to put the required arguments without default arguments. This forces the user to set the arguments. However, often you might want to set the attributes later for various reasons.
I find very handy to define a class Required that I can use as a... |
32,796,541 | Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed [this](https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist) link to remove that t... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32796541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931487/"
] | I would suggest using Enum to define both `Gender` and `States`.
[Enum](https://docs.python.org/3/library/enum.html) if part of the standard library on `Python 3`. If you are on `Python 2` use [enum34](https://pypi.python.org/pypi/enum34), install with `pip install enum34`.
```
from enum import Enum
class States(E... | Indeed if you can set at the beginning all your arguments it is better just to put the required arguments without default arguments. This forces the user to set the arguments. However, often you might want to set the attributes later for various reasons.
I find very handy to define a class Required that I can use as a... |
42,238,176 | [](https://i.stack.imgur.com/ZBitb.jpg)
Googlebot sees content differently (doesn't index it at all) than the visitor if the content was generated dynamically from a JS file (see image above). Let's say I have the following code:
```
<body>
<div... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42238176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3375880/"
] | Google CAN index dynamic content, but it does not mean it will index it, or display it in search results, as it usually only looks for it in search of negative aspects (like black-hat SEO practices), although for some sites it may decide to use it for its index (it's a blind guess really, when it comes to how Google ha... | You could use jQuery to accomplish this, like in the example below:
```js
$(document).ready(function() {
var el = "<section>Dynamically added content</section>";
$('.a').after(el);
})
```
```css
div {
padding: 10px;
background-color: #ccc;
}
section {
padding: 10px;
}
```
```html
<script src="htt... |
51,645,298 | ```
if(){
redirect('Login');
}
```
I have a condition above that redirect the page to log in depending on some values. I can see in url that I get redirect because when I enter
`http://www.myapp.com` it changes to `http://www.myapp.com/Login`
Now In my route I have:
```
$route['default_controller'] = 'welcome';
$r... | 2018/08/02 | [
"https://Stackoverflow.com/questions/51645298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4452553/"
] | Try including below lines on the `.htaccess` at the root level of the codeigniter app folder :
```
RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
``` | change your value like following
```
$route['login'] = 'Login';
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
```
if not work, replace this code in **htaccess**
```
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
``` |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | **Performance**: `shared_ptr` performs pretty well, but in my experience is slightly less efficient than explicit memory management, mostly because it is reference counted and the reference count has to allocated as well. How well it performs depends on a lot of factors and how well it compares to Java/C# garbage colle... | The key difference is that when the shared pointer's use count goes to zero, the object it points to is destroyed (destructor is called and object is deallocated), immediately. In Java and C# the deallocation of the object is postponed until the Garbage Collector chooses to deallocate the object (i.e., it is non-determ... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | The key difference is that when the shared pointer's use count goes to zero, the object it points to is destroyed (destructor is called and object is deallocated), immediately. In Java and C# the deallocation of the object is postponed until the Garbage Collector chooses to deallocate the object (i.e., it is non-determ... | Cyclical references with C++ reference-counted pointers will not be disposed. You can use weak pointers to work around this. Cyclical references in Java or C# may be disposed, when the garbage collector feels like it.
When the count in a C++ reference-counted pointer drops to zero, the destructor is called. When a Jav... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | The key difference is that when the shared pointer's use count goes to zero, the object it points to is destroyed (destructor is called and object is deallocated), immediately. In Java and C# the deallocation of the object is postponed until the Garbage Collector chooses to deallocate the object (i.e., it is non-determ... | First of all, Java/C# have only pointers, not references, though they call them that way. Reference is a unique C++ feature. Garbage collection in Java/C# basically means infinite life-time. `shared_ptr` on the other hand provides sharing and deterministic destruction, when the count goes to zero. Therefore, `shared_pt... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | **Performance**: `shared_ptr` performs pretty well, but in my experience is slightly less efficient than explicit memory management, mostly because it is reference counted and the reference count has to allocated as well. How well it performs depends on a lot of factors and how well it compares to Java/C# garbage colle... | Cyclical references with C++ reference-counted pointers will not be disposed. You can use weak pointers to work around this. Cyclical references in Java or C# may be disposed, when the garbage collector feels like it.
When the count in a C++ reference-counted pointer drops to zero, the destructor is called. When a Jav... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | **Performance**: `shared_ptr` performs pretty well, but in my experience is slightly less efficient than explicit memory management, mostly because it is reference counted and the reference count has to allocated as well. How well it performs depends on a lot of factors and how well it compares to Java/C# garbage colle... | First of all, Java/C# have only pointers, not references, though they call them that way. Reference is a unique C++ feature. Garbage collection in Java/C# basically means infinite life-time. `shared_ptr` on the other hand provides sharing and deterministic destruction, when the count goes to zero. Therefore, `shared_pt... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | **Performance**: `shared_ptr` performs pretty well, but in my experience is slightly less efficient than explicit memory management, mostly because it is reference counted and the reference count has to allocated as well. How well it performs depends on a lot of factors and how well it compares to Java/C# garbage colle... | Nobody pointed the possibility of moving the object by the memory manager in managed memory. So in C# there are no simple references/pointers, they work like IDs describing object which is returned by the manager.
In C++ you can't achieve this with shared\_ptr, because the object stays in the same location after it ... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | Nobody pointed the possibility of moving the object by the memory manager in managed memory. So in C# there are no simple references/pointers, they work like IDs describing object which is returned by the manager.
In C++ you can't achieve this with shared\_ptr, because the object stays in the same location after it ... | Cyclical references with C++ reference-counted pointers will not be disposed. You can use weak pointers to work around this. Cyclical references in Java or C# may be disposed, when the garbage collector feels like it.
When the count in a C++ reference-counted pointer drops to zero, the destructor is called. When a Jav... |
4,570,832 | Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared\_ptr (from Boost or from C++0x).
I more or less aware how shared\_ptr is implemented. I am curious about differences in the following ares:
1) Performance.
2) Cycling. shared\_ptr can be cycled (A ... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/539885/"
] | Nobody pointed the possibility of moving the object by the memory manager in managed memory. So in C# there are no simple references/pointers, they work like IDs describing object which is returned by the manager.
In C++ you can't achieve this with shared\_ptr, because the object stays in the same location after it ... | First of all, Java/C# have only pointers, not references, though they call them that way. Reference is a unique C++ feature. Garbage collection in Java/C# basically means infinite life-time. `shared_ptr` on the other hand provides sharing and deterministic destruction, when the count goes to zero. Therefore, `shared_pt... |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | In my experience, that's just how they are. Just ignore them as much as you can (impossible to ignore completely), and rescue them when necessary. 'least, that's how I usually treat it. | AI in Left 4 Dead 2 is not bad but pretty limited compared to an human. If you can, try playing with friends or other unknown player.
It is much more fun and no frustration due to strange bot behavior. |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | In my experience, that's just how they are. Just ignore them as much as you can (impossible to ignore completely), and rescue them when necessary. 'least, that's how I usually treat it. | The AI should shoot and defend along with you. This just happened with the latest patch. Do not believe they just hang out, or this is not normal. I have been playing this game for as long as it have been out, and this just started happening. |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | In my experience, that's just how they are. Just ignore them as much as you can (impossible to ignore completely), and rescue them when necessary. 'least, that's how I usually treat it. | The fix that worked for me is quitting the game and starting it again but sometimes these bots are a pain and I hate that they cause me to lose progress. |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | Do this
1. On your Steam Library, right click on L4D2 and click on Properties
2. Go to the Local Files Tab, and then click on Verify Integrity of the Game files
3. Now you just wait for it and if something is wrong it should fix it and redownload the corrupted files. | AI in Left 4 Dead 2 is not bad but pretty limited compared to an human. If you can, try playing with friends or other unknown player.
It is much more fun and no frustration due to strange bot behavior. |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | Do this
1. On your Steam Library, right click on L4D2 and click on Properties
2. Go to the Local Files Tab, and then click on Verify Integrity of the Game files
3. Now you just wait for it and if something is wrong it should fix it and redownload the corrupted files. | The AI should shoot and defend along with you. This just happened with the latest patch. Do not believe they just hang out, or this is not normal. I have been playing this game for as long as it have been out, and this just started happening. |
11,921 | I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.
Has anyone else experi... | 2010/12/01 | [
"https://gaming.stackexchange.com/questions/11921",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3835/"
] | Do this
1. On your Steam Library, right click on L4D2 and click on Properties
2. Go to the Local Files Tab, and then click on Verify Integrity of the Game files
3. Now you just wait for it and if something is wrong it should fix it and redownload the corrupted files. | The fix that worked for me is quitting the game and starting it again but sometimes these bots are a pain and I hate that they cause me to lose progress. |
7,051,574 | I am trying to implement a video retrieval system and I need to first extract key frames from a video, ideally I want to have a library for automatically detecting those key frames, one key frame from each shot. Bonus if I can configure which key frame to extract(first, middle, or last of the continuous frames in a sho... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7051574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/587617/"
] | What you're after is called shot segmentation. While it's a pretty active research area, I think you're unlikely to find any complete libraries that solve the problem for you out-of-the-box. Your best option may be reading up on the topic, selecting an approach that best fits your requirements and coding it up yourself... | The ffmpeg lib (included in openCV) can seek to a keyframe with av\_seek\_frame()
see [FFMPEG reading keyframes](https://stackoverflow.com/questions/6316407/ffmpeg-reading-keyframes) |
7,051,574 | I am trying to implement a video retrieval system and I need to first extract key frames from a video, ideally I want to have a library for automatically detecting those key frames, one key frame from each shot. Bonus if I can configure which key frame to extract(first, middle, or last of the continuous frames in a sho... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7051574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/587617/"
] | The ffmpeg lib (included in openCV) can seek to a keyframe with av\_seek\_frame()
see [FFMPEG reading keyframes](https://stackoverflow.com/questions/6316407/ffmpeg-reading-keyframes) | If you have as an input an uncompressed video, you can download the ffmpeg from [www.ffmpeg.org] and use this executable to decompress your video stream into its frames.
Subsequently, in order to detect your shot boundaries you have to extract some features from the video keyframes. An efficient technique for shot bou... |
7,051,574 | I am trying to implement a video retrieval system and I need to first extract key frames from a video, ideally I want to have a library for automatically detecting those key frames, one key frame from each shot. Bonus if I can configure which key frame to extract(first, middle, or last of the continuous frames in a sho... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7051574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/587617/"
] | What you're after is called shot segmentation. While it's a pretty active research area, I think you're unlikely to find any complete libraries that solve the problem for you out-of-the-box. Your best option may be reading up on the topic, selecting an approach that best fits your requirements and coding it up yourself... | If you have as an input an uncompressed video, you can download the ffmpeg from [www.ffmpeg.org] and use this executable to decompress your video stream into its frames.
Subsequently, in order to detect your shot boundaries you have to extract some features from the video keyframes. An efficient technique for shot bou... |
56,880,398 | I have a sample db with 3 different tables, `customers`, `orders`, `orderdetails`.
The assignment is to show customer name, and address from a customers table and then show each order total amount by order id. Order details has order id several times and it is by unit x price so I have to sum these after performing th... | 2019/07/04 | [
"https://Stackoverflow.com/questions/56880398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | try this -
```
SELECT c.CustomerID, c.[Address], od.orderid, SUM(od.UnitPrice* od.Quantity) as 'Subtotal'
FROM OrderDetails od
Join Orders o
ON od.OrderID = o.OrderID
join Customers c ON c.CustomerID = o.CustomerID
Group by c.CustomerID, c.[Address], od.OrderID
``` | You can join three tables together like given below. I am using derived table OrderDetails to calculate subtotal at orderId level.
```
SELECT c.CustomerID, c.[Address], o.orderid, SUM(od.Subtotal) as 'Subtotal'
FROM Customers c
Join Orders o
ON c.CustomerID = o.CustomerID
join (SELECT orderid, SUM(od.UnitPrice... |
56,880,398 | I have a sample db with 3 different tables, `customers`, `orders`, `orderdetails`.
The assignment is to show customer name, and address from a customers table and then show each order total amount by order id. Order details has order id several times and it is by unit x price so I have to sum these after performing th... | 2019/07/04 | [
"https://Stackoverflow.com/questions/56880398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | try this -
```
SELECT c.CustomerID, c.[Address], od.orderid, SUM(od.UnitPrice* od.Quantity) as 'Subtotal'
FROM OrderDetails od
Join Orders o
ON od.OrderID = o.OrderID
join Customers c ON c.CustomerID = o.CustomerID
Group by c.CustomerID, c.[Address], od.OrderID
``` | Mukesh's answer led me directly to the finish, I was able to leave the customerid out of the result with the following. This helped a lot and I appreciate everyone's input.
```
SELECT c.CompanyName, c.[Address], od.orderid, SUM(od.UnitPrice* od.Quantity) as
'Subtotal'
FROM OrderDetails od
Join Orders o
ON od... |
29,367,816 | I am currently facing the problem of creating many (over 20) scales in Tkinter and naturally I am trying not to create and use them "manually".
Creating works just fine:
```
for ii in range(0,25):
nam='input_a' + str(ii)
nam = Scale(master, from_=100, to=0, orient=VERTICAL)
nam.grid(row=0, column=2+ii)
```
... | 2015/03/31 | [
"https://Stackoverflow.com/questions/29367816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4378361/"
] | ```
var $username;
var $password;
var $hostname;
var $database;
```
these values are blank give valid values for above variables | try this,
```
$param = array('username' => 'root', 'password' => 'password', 'hostname' => 'localhost', 'database' => 'DBNAME');
$db = new CI_DB_driver($param);
```
$param array have all the required details which will be used to connect the database. |
235,457 | In my school, there is a trend of using computer software for teaching a first course in Chemistry for undergraduate students. I hypothesized that the use of this tool could make the students achieve better scores than without this help. So far what I have done is the following:
* I chose two groups, both of them were... | 2016/09/17 | [
"https://stats.stackexchange.com/questions/235457",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/69395/"
] | The **central question** is whether you assigned students completely **at random** to the experimental groups.
**If yes** you can use a standard test for independent samples to assess the significance of the group difference. This is probably the hypothesis test that you have already done.
**If no**, it is indeed a ... | please try propensity score matching ..here's a simple tutorial for you <http://web.hku.hk/~bcowling/examples/propensity.htm>
ideally you divvy up the groups (like you have already tried) and ID different attributes of the students in both the groups , perform a logistic regression on both groups. For e.g. if you ID a... |
18,719,426 | ```
$arr = asort($arr);
//some magic code goes here, $arr is not changed
$arr = array_unique($arr);
```
Should I use asort again to be sure `$arr` is asorted?
My tests show that no, I don't. But I'm not sure for 100% if `array_unique` actually removes the 2nd+ repeated elements. | 2013/09/10 | [
"https://Stackoverflow.com/questions/18719426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886906/"
] | No you do not need to. array\_unique will only remove elements, so the order will always be preserved. | If you do not modify the array after the 'asort()', the array will be ordered. |
18,719,426 | ```
$arr = asort($arr);
//some magic code goes here, $arr is not changed
$arr = array_unique($arr);
```
Should I use asort again to be sure `$arr` is asorted?
My tests show that no, I don't. But I'm not sure for 100% if `array_unique` actually removes the 2nd+ repeated elements. | 2013/09/10 | [
"https://Stackoverflow.com/questions/18719426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886906/"
] | You merely want to ensure that `asort` and `array_unique` use the same sort\_flags.
By default:
* array array\_unique ( array $array [, int $sort\_flags = SORT\_STRING ] )
* bool asort ( array &$array [, int $sort\_flags = SORT\_REGULAR ] )
So you can see that each will sort based on a different algorithm, which mi... | If you do not modify the array after the 'asort()', the array will be ordered. |
18,719,426 | ```
$arr = asort($arr);
//some magic code goes here, $arr is not changed
$arr = array_unique($arr);
```
Should I use asort again to be sure `$arr` is asorted?
My tests show that no, I don't. But I'm not sure for 100% if `array_unique` actually removes the 2nd+ repeated elements. | 2013/09/10 | [
"https://Stackoverflow.com/questions/18719426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886906/"
] | No you do not need to. array\_unique will only remove elements, so the order will always be preserved. | No, you shouldn't. The function `array_unique` preserves keys, so there is no need to sort it again. |
18,719,426 | ```
$arr = asort($arr);
//some magic code goes here, $arr is not changed
$arr = array_unique($arr);
```
Should I use asort again to be sure `$arr` is asorted?
My tests show that no, I don't. But I'm not sure for 100% if `array_unique` actually removes the 2nd+ repeated elements. | 2013/09/10 | [
"https://Stackoverflow.com/questions/18719426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886906/"
] | You merely want to ensure that `asort` and `array_unique` use the same sort\_flags.
By default:
* array array\_unique ( array $array [, int $sort\_flags = SORT\_STRING ] )
* bool asort ( array &$array [, int $sort\_flags = SORT\_REGULAR ] )
So you can see that each will sort based on a different algorithm, which mi... | No, you shouldn't. The function `array_unique` preserves keys, so there is no need to sort it again. |
18,719,426 | ```
$arr = asort($arr);
//some magic code goes here, $arr is not changed
$arr = array_unique($arr);
```
Should I use asort again to be sure `$arr` is asorted?
My tests show that no, I don't. But I'm not sure for 100% if `array_unique` actually removes the 2nd+ repeated elements. | 2013/09/10 | [
"https://Stackoverflow.com/questions/18719426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886906/"
] | You merely want to ensure that `asort` and `array_unique` use the same sort\_flags.
By default:
* array array\_unique ( array $array [, int $sort\_flags = SORT\_STRING ] )
* bool asort ( array &$array [, int $sort\_flags = SORT\_REGULAR ] )
So you can see that each will sort based on a different algorithm, which mi... | No you do not need to. array\_unique will only remove elements, so the order will always be preserved. |
97,687 | I accepted job offer based on agreed two weeks paid vacation available year one. When I received written job offer from recruiter that negotiated on my behalf job offer stated "vacation per employee handbook". I asked recruiter to request copy of employee handbook to verify. She was not able to obtain employee handbook... | 2017/08/23 | [
"https://workplace.stackexchange.com/questions/97687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/75990/"
] | Really the only move you have at this point is to talk to your boss, not HR, about this. Tell him or her what you were promised and that they didn't give you want was negotiated and that this is a deal breaker for you and you will need to find another job. Let him/her work the system for you with the new CEO if he want... | *Disclaimer: I am not a lawyer. This is a legal question. We do not answer legal questions like this on here. That being said...*
1. You should ask your current boss to see if he/she can intervene on your behalf. If that option works, then so be it, you do not need to move on to step 2.
2. You should nail down what wa... |
97,687 | I accepted job offer based on agreed two weeks paid vacation available year one. When I received written job offer from recruiter that negotiated on my behalf job offer stated "vacation per employee handbook". I asked recruiter to request copy of employee handbook to verify. She was not able to obtain employee handbook... | 2017/08/23 | [
"https://workplace.stackexchange.com/questions/97687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/75990/"
] | You made several mistakes
### Mistake 1
Don't go to HR. As we are fond to say around here, HR is not your friend. Going to your new boss would have been better and then he could have helped you clarify it as well as having a witness, but even better would be...
### Mistake 2
Never sign a contract or employment agre... | *Disclaimer: I am not a lawyer. This is a legal question. We do not answer legal questions like this on here. That being said...*
1. You should ask your current boss to see if he/she can intervene on your behalf. If that option works, then so be it, you do not need to move on to step 2.
2. You should nail down what wa... |
28,419,128 | I'm working on a rails 3.2.8 app that will be soon shut down.
This app has a post model that has\_many assets.
The asset model is paperclip managed.
```
class Asset < ActiveRecord::Base
attr_accessible :post_id, :photo
belongs_to :post
has_attached_file :photo,
:styles => {
... | 2015/02/09 | [
"https://Stackoverflow.com/questions/28419128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1637183/"
] | I would use the shell `cp` command to copy the assets to the backup directory; this should be markedly quicker than opening and reading every asset in Ruby:
```
require 'shellwords'
backup_destination = '/home/app/backup_directory'
# create the backup base directory
FileUtils.mkdir_p backup_destination
Post.find_ea... | Here is example of how to backup a file using `rake` command, you can enhance its logic for folder backup, I hope this will help
1. Create a rake file inside `<root_folder>/lib/task/photo_backup.rake`.
```
task :photo_backup => :environment do
require 'rubygems'
require 'rake'
# file path on production
... |
17,473,457 | I am new to GWT and I am a bit confused if I should use GWTP PlaceManager or GWT Places/Activities. I read into GWTP and the PlaceManager and it seems pretty easy and works with less code than Activities, Places and the Mapper which seems really complicated (I dont really understand it now..) But I think that its bette... | 2013/07/04 | [
"https://Stackoverflow.com/questions/17473457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2212501/"
] | Add `display:inline-block` to your `.vote` class, because `<span>` is an `inline` element by default.
[**JSFiddle Demo**](http://jsfiddle.net/wE4RJ/1/)
**CSS**
```
.vote{
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
cursor: pointer;
vertical-... | if I well understood, just add `display: inline-block;` to `.vote`
<http://jsbin.com/ehamoj/1/> |
24,031 | I’ve red that some universities in Japan offer a non-degree program called *research student.* I want to know:
1. Why do students usually apply as a research student?
2. Do research students work on things that haven’t been done before? Or do they work on anything that interests them (of course) but that is not necess... | 2014/06/27 | [
"https://academia.stackexchange.com/questions/24031",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/17944/"
] | I've only encountered the term "research student" in Japan (研究生), most (all ?) graduate schools in Japan offer it (see for example the [Graduate School of Information Sciences of Tohoku University](http://is.tohoku.ac.jp/_eng/entrance/guide.html)). As I understand it
1. A student will apply as a research student if th... | Usually, students who go through a research program, aim for a research project or a project the output of which may be a research report or a scientific publication. As far as this program is only offered in a few number of universities or research centers; I just want to add some comment to the questions you asked. ... |
79,510 | Suppose I want to find the numbers that appear in at least 3 of the 10 sorted lists, is there an efficient way to do it apart from iterating over all 10 of them in parallel? | 2017/07/30 | [
"https://cs.stackexchange.com/questions/79510",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/62695/"
] | The simplest way is to first remove duplicates from the 10 lists, and then merge all of them. Any number appearing 3 times in the merged list also appears in 3 of the 10 sorted lists.
A more complicated way is using pointers as you indicate. Briefly, the pointers start at the beginning of the lists, and then you keep ... | There's a method I found some time ago that works if you have iterators that can "forward" to or past a given value easily, eg with a skip list, in addition to the usual "next", ie it can do the equivalent of multiple next's to reach a given value, with sublinear cost. (I'll refer to these iterators below as single val... |
79,510 | Suppose I want to find the numbers that appear in at least 3 of the 10 sorted lists, is there an efficient way to do it apart from iterating over all 10 of them in parallel? | 2017/07/30 | [
"https://cs.stackexchange.com/questions/79510",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/62695/"
] | The simplest way is to first remove duplicates from the 10 lists, and then merge all of them. Any number appearing 3 times in the merged list also appears in 3 of the 10 sorted lists.
A more complicated way is using pointers as you indicate. Briefly, the pointers start at the beginning of the lists, and then you keep ... | You could consider using a hash table.
Just store each number together with three element array that holds information about which array that integer belongs to (pointer to the list for example). Every time you add an element to the hash table, check if its three element array is full, meaning that element is in at le... |
79,510 | Suppose I want to find the numbers that appear in at least 3 of the 10 sorted lists, is there an efficient way to do it apart from iterating over all 10 of them in parallel? | 2017/07/30 | [
"https://cs.stackexchange.com/questions/79510",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/62695/"
] | You could consider using a hash table.
Just store each number together with three element array that holds information about which array that integer belongs to (pointer to the list for example). Every time you add an element to the hash table, check if its three element array is full, meaning that element is in at le... | There's a method I found some time ago that works if you have iterators that can "forward" to or past a given value easily, eg with a skip list, in addition to the usual "next", ie it can do the equivalent of multiple next's to reach a given value, with sublinear cost. (I'll refer to these iterators below as single val... |
9,387,302 | Can anyone point me in the way of a guide/tutorial on how to limit the number of unique IP's a user can have to around 5-6 for a members area. It seems like many users on a site i help manage share their user names with tens to hundreds of other people. Or can anyone explain how i can implement some kind of security ag... | 2012/02/22 | [
"https://Stackoverflow.com/questions/9387302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106275/"
] | IP blocking isn't the way to go.
Consider a bunch of users inside the same corporate firewall. When they browse the net ALL of them will appear to have the same IP address due to a proxy server. The proxy server is responsible for making sure the requests/responses get to the right people.
So, that won't work.
What ... | What I would do is create a database table that stores the userId, IP address used and date that IP was seen. Something like this:
```
Table IP
Id UserId IP Date
-------------------------------
0 42 192.168.1.3 2-21-12:01:32:00
```
Then in your php count how many IPs the user in question has ... |
11,602,290 | I currently have all the posts displayed in one column:
1
2
3
...
I'd like to achieve something similar:
1
23
4
56
...
does anyone have any ideas of how I could do this? is it possible?
thank you so much in advance :)
right now I have:
```
<?php if( $wp_query->current_post <= 0 ) : ?>
code fo... | 2012/07/22 | [
"https://Stackoverflow.com/questions/11602290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1544231/"
] | The solution I found for this problem was using the $wp\_query->current\_post of a default loop, in a filter function added to `functions.php` file in the theme, when post's div is `post_class()`
```
function special_recurrent_post_class($classes) {
if( is_home() ) {
global $wp_query;
$extra_classes ... | Just use a counter like this:
```
// before loop
$ctr = 1;
if ($ctr == 1) {
*** code for one column; ***
$ctr ++;
} else {
*** code for two column; ***
$ctr++
if ($ctr == 4) $ctr = 1 // Reset the counter, back to one column
}
``` |
44,229,395 | I have two arrays I want to combine them together first array
`$array1[]=(11,12,3,9);`
and second array
`$array2[]=(mikel,joe,sami,toni);`
I need the combined array like that
```
$combined_array[]=(Mikel,11,joe,12,sami,3,toni,9);
```
I tried this code in PHP but didn't work
```
$array1[]=(11,12,3,9);
$array2... | 2017/05/28 | [
"https://Stackoverflow.com/questions/44229395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7829226/"
] | ```
$array1[]=(11,12,3,9);
$array2[]=(mikel,joe,sami,toni);
$combined= array();
for( $i=0;$i<sizeof($array1); $i++){
$a = $array1[$i];
$b= $array2[$i];
array_push($combined,$a,$b);
}
```
EDIT:
Declare your $combine array before for loop | ```
$array1 = array(11, 12, 3, 9);
$array2 = array('mikel', 'joe', 'sami', 'toni');
$combined = array();
for($i = 0 ; $i < sizeof($array1); $i++) {
array_push($combined, $array2[$i], $array1[$i]);
}
print_r($combined);
``` |
44,229,395 | I have two arrays I want to combine them together first array
`$array1[]=(11,12,3,9);`
and second array
`$array2[]=(mikel,joe,sami,toni);`
I need the combined array like that
```
$combined_array[]=(Mikel,11,joe,12,sami,3,toni,9);
```
I tried this code in PHP but didn't work
```
$array1[]=(11,12,3,9);
$array2... | 2017/05/28 | [
"https://Stackoverflow.com/questions/44229395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7829226/"
] | ```
$array1[]=(11,12,3,9);
$array2[]=(mikel,joe,sami,toni);
$combined= array();
for( $i=0;$i<sizeof($array1); $i++){
$a = $array1[$i];
$b= $array2[$i];
array_push($combined,$a,$b);
}
```
EDIT:
Declare your $combine array before for loop | just you must replace `array_push($combined, $a, $b)` to 2 line code :
```
array_push($combined, $a)
```
and
```
array_push($combined, $b)
```
also you could replace `sizeof($array1)` in your `forloop` to `count($array1) - 1`
will be ok |
44,229,395 | I have two arrays I want to combine them together first array
`$array1[]=(11,12,3,9);`
and second array
`$array2[]=(mikel,joe,sami,toni);`
I need the combined array like that
```
$combined_array[]=(Mikel,11,joe,12,sami,3,toni,9);
```
I tried this code in PHP but didn't work
```
$array1[]=(11,12,3,9);
$array2... | 2017/05/28 | [
"https://Stackoverflow.com/questions/44229395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7829226/"
] | ```
$array1 = array(11, 12, 3, 9);
$array2 = array('mikel', 'joe', 'sami', 'toni');
$combined = array();
for($i = 0 ; $i < sizeof($array1); $i++) {
array_push($combined, $array2[$i], $array1[$i]);
}
print_r($combined);
``` | just you must replace `array_push($combined, $a, $b)` to 2 line code :
```
array_push($combined, $a)
```
and
```
array_push($combined, $b)
```
also you could replace `sizeof($array1)` in your `forloop` to `count($array1) - 1`
will be ok |
983,028 | I will start by saying that I'm completely new to Linux, so bear with me please.
I saw other questions on different sites but either there was no answer, or I didn't understand it.
I'm on a Asus ROG GL502VS-GZ427T at work and Xubuntu 16.04.3 is installed. It's a fresh installed, the laptop is a few days old. In the m... | 2017/12/04 | [
"https://askubuntu.com/questions/983028",
"https://askubuntu.com",
"https://askubuntu.com/users/767596/"
] | The `random` module in iptables can be used to create packet loss.
For a 10% incoming packet loss:
```
$ sudo iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
```
Resulting in this ping result from another computer:
```
--- rpi01-wifi.smythies.com ping statistics ---
247 packets transmitted... | [netem](https://wiki.linuxfoundation.org/networking/netem) leverages functionality already built into Linux and userspace utilities to simulate networks and can do exactly what you're asking.
From their [homepage](https://wiki.linuxfoundation.org/networking/netem).
>
> **Packet loss**
>
>
> Random packet loss is s... |
13,295,300 | I have a single-page web app that's using Backbone.js client routing with pushState. In order to get this to work, I have to tell my server (Java, Spring 3, Tomcat) which URLs should be resolved on the server (actual JSP views, API requets), and which should simply be sent to the index page to be handled by the client.... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13295300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/146563/"
] | I found that Spring MVC 3 added a tag that does exactly what I need, the `mvc:view-controller` tag. This got it done for me:
```
<mvc:view-controller path="/" view-name="index" />
<mvc:view-controller path="/admin" view-name="index" />
<mvc:view-controller path="/volume" view-name="index" />
```
<http://static.sprin... | I would give a clear scheme to my urls and separate frontend from backend.
Some suggestions:
* Route all requests starting by `/server` to the backend and all others to the frontend.
* Setup two different domains, one for the backend, one for the frontend. |
13,295,300 | I have a single-page web app that's using Backbone.js client routing with pushState. In order to get this to work, I have to tell my server (Java, Spring 3, Tomcat) which URLs should be resolved on the server (actual JSP views, API requets), and which should simply be sent to the index page to be handled by the client.... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13295300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/146563/"
] | In theory, to handle navigation via history.pushState you want to return index.html for unhandled resources. If you look at official documentation for modern web frameworks it's often realised based on 404 status.
In spring you should handle resources in order:
* path mapped REST controllers
* app static resources
* ... | I would give a clear scheme to my urls and separate frontend from backend.
Some suggestions:
* Route all requests starting by `/server` to the backend and all others to the frontend.
* Setup two different domains, one for the backend, one for the frontend. |
13,295,300 | I have a single-page web app that's using Backbone.js client routing with pushState. In order to get this to work, I have to tell my server (Java, Spring 3, Tomcat) which URLs should be resolved on the server (actual JSP views, API requets), and which should simply be sent to the index page to be handled by the client.... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13295300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/146563/"
] | I found that Spring MVC 3 added a tag that does exactly what I need, the `mvc:view-controller` tag. This got it done for me:
```
<mvc:view-controller path="/" view-name="index" />
<mvc:view-controller path="/admin" view-name="index" />
<mvc:view-controller path="/volume" view-name="index" />
```
<http://static.sprin... | In theory, to handle navigation via history.pushState you want to return index.html for unhandled resources. If you look at official documentation for modern web frameworks it's often realised based on 404 status.
In spring you should handle resources in order:
* path mapped REST controllers
* app static resources
* ... |
56,865,315 | I want to add an image to the database in an image column in byte form
I am using SQLite to save my database data and WPF Application using dbContext c# to write my code
can anyone help me please?
```
private void ChooseImageButtonClick(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog dlg = new ... | 2019/07/03 | [
"https://Stackoverflow.com/questions/56865315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11723909/"
] | Just convert BitmapImage to byte array first
```
byte[] image;
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.QualityLevel = 100;
using (MemoryStream ms = new MemoryStream())
{
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageBox.Source));
encoder.Save(ms);
image = ms.ToArray();
}
e... | Add Property in 'Part' class
```
public byte[] ImageCol { get; set; }
```
Then from "OpenFileDialog" create Image from selected file. For Example
```
OpenFileDialog openFileDialog = new OpenFileDialog
{
Filter = "Image Files(*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG)|*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG",
... |
5,514 | Highcharts is supposed to be an open source chart project that is free for personal use and for non-profit organisations. For non-profit organisations and individuals it is licensed under the [Creative Commons (CC) Attribution-NonCommercial licence](http://Creative%20Commons%20(CC)%20Attribution-NonCommercial%20licence... | 2017/05/26 | [
"https://opensource.stackexchange.com/questions/5514",
"https://opensource.stackexchange.com",
"https://opensource.stackexchange.com/users/5534/"
] | Firstly, IANAL/IANYL.
That said, [Creative Commons says](https://creativecommons.org/faq/#does-my-use-violate-the-noncommercial-clause-of-the-licenses) that the NC licence prohibits uses that are "*primarily intended for or directed toward commercial advantage or monetary compensation*". They go on to note that
>
> ... | The CC-BY-NC 3.0 license has this to say about non-commercial/commercial use:
>
> You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation.
>
>
> — [CC-BY-NC 3.0](https://creativecom... |
5,514 | Highcharts is supposed to be an open source chart project that is free for personal use and for non-profit organisations. For non-profit organisations and individuals it is licensed under the [Creative Commons (CC) Attribution-NonCommercial licence](http://Creative%20Commons%20(CC)%20Attribution-NonCommercial%20licence... | 2017/05/26 | [
"https://opensource.stackexchange.com/questions/5514",
"https://opensource.stackexchange.com",
"https://opensource.stackexchange.com/users/5534/"
] | The CC-BY-NC 3.0 license has this to say about non-commercial/commercial use:
>
> You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation.
>
>
> — [CC-BY-NC 3.0](https://creativecom... | No answer seems to have told you this already so let me highlight that Highcharts is *not* open source nor free software! On their website they are very careful not to use these terms. Instead they say that they are "Free for non-commercial" (this means at no cost) and "Open" (which is vague but is basically about tryi... |
5,514 | Highcharts is supposed to be an open source chart project that is free for personal use and for non-profit organisations. For non-profit organisations and individuals it is licensed under the [Creative Commons (CC) Attribution-NonCommercial licence](http://Creative%20Commons%20(CC)%20Attribution-NonCommercial%20licence... | 2017/05/26 | [
"https://opensource.stackexchange.com/questions/5514",
"https://opensource.stackexchange.com",
"https://opensource.stackexchange.com/users/5534/"
] | Firstly, IANAL/IANYL.
That said, [Creative Commons says](https://creativecommons.org/faq/#does-my-use-violate-the-noncommercial-clause-of-the-licenses) that the NC licence prohibits uses that are "*primarily intended for or directed toward commercial advantage or monetary compensation*". They go on to note that
>
> ... | >
> Now as I understand it, this organisation does not need a licence for
> Highcharts and if I was an employee of this organisation I could just
> use highcharts to develop a Highcharts enabled website for them.
>
>
>
IANAL. But
(a) the licensee would normally be the organisation rather than its employers or c... |
5,514 | Highcharts is supposed to be an open source chart project that is free for personal use and for non-profit organisations. For non-profit organisations and individuals it is licensed under the [Creative Commons (CC) Attribution-NonCommercial licence](http://Creative%20Commons%20(CC)%20Attribution-NonCommercial%20licence... | 2017/05/26 | [
"https://opensource.stackexchange.com/questions/5514",
"https://opensource.stackexchange.com",
"https://opensource.stackexchange.com/users/5534/"
] | Firstly, IANAL/IANYL.
That said, [Creative Commons says](https://creativecommons.org/faq/#does-my-use-violate-the-noncommercial-clause-of-the-licenses) that the NC licence prohibits uses that are "*primarily intended for or directed toward commercial advantage or monetary compensation*". They go on to note that
>
> ... | No answer seems to have told you this already so let me highlight that Highcharts is *not* open source nor free software! On their website they are very careful not to use these terms. Instead they say that they are "Free for non-commercial" (this means at no cost) and "Open" (which is vague but is basically about tryi... |
5,514 | Highcharts is supposed to be an open source chart project that is free for personal use and for non-profit organisations. For non-profit organisations and individuals it is licensed under the [Creative Commons (CC) Attribution-NonCommercial licence](http://Creative%20Commons%20(CC)%20Attribution-NonCommercial%20licence... | 2017/05/26 | [
"https://opensource.stackexchange.com/questions/5514",
"https://opensource.stackexchange.com",
"https://opensource.stackexchange.com/users/5534/"
] | >
> Now as I understand it, this organisation does not need a licence for
> Highcharts and if I was an employee of this organisation I could just
> use highcharts to develop a Highcharts enabled website for them.
>
>
>
IANAL. But
(a) the licensee would normally be the organisation rather than its employers or c... | No answer seems to have told you this already so let me highlight that Highcharts is *not* open source nor free software! On their website they are very careful not to use these terms. Instead they say that they are "Free for non-commercial" (this means at no cost) and "Open" (which is vague but is basically about tryi... |
52,102,612 | I'm trying to submit a simple HTTP GET request in WebAssembly. For this purpose, I wrote this program (copied from [Emscripten site](https://kripken.github.io/emscripten-site/docs/api_reference/fetch.html) with slight modifications):
```
#include <stdio.h>
#include <string.h>
#ifdef __EMSCRIPTEN__
#include <emscripten... | 2018/08/30 | [
"https://Stackoverflow.com/questions/52102612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399457/"
] | No, you cannot execute HTTP request from WebAssembly (or access DOM, or any other browser APIs). WebAssembly by itself doesn’t have any access to its host environment, hence it doesn’t have any built in IO capabilities.
You can however export functions from WebAssembly, and import functions from the host environment. ... | Unfortunately, there is no way to make a CORS request to Google.com from any website *other than* Google.com.
[From MDN:](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
>
> For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts. For example, XMLHttpRequest and the F... |
52,102,612 | I'm trying to submit a simple HTTP GET request in WebAssembly. For this purpose, I wrote this program (copied from [Emscripten site](https://kripken.github.io/emscripten-site/docs/api_reference/fetch.html) with slight modifications):
```
#include <stdio.h>
#include <string.h>
#ifdef __EMSCRIPTEN__
#include <emscripten... | 2018/08/30 | [
"https://Stackoverflow.com/questions/52102612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399457/"
] | I recently ran across this issue with esmcripten fixed it in: <https://github.com/kripken/emscripten/pull/7010>
You should now be able to use FETCH=1 and WASM=1 together. | Unfortunately, there is no way to make a CORS request to Google.com from any website *other than* Google.com.
[From MDN:](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
>
> For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts. For example, XMLHttpRequest and the F... |
1,016,267 | In this problem we discuss a betting strategy known as "progressive betting". Here's the setup:
Bets are repeatedly made at a roulette according to the following strategy:
* All bets are made the same way: by betting on black. i.e., the bettor has a 18/38 chance of winning each bet, and when that happens, he receives... | 2014/11/11 | [
"https://math.stackexchange.com/questions/1016267",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/191544/"
] | You describe a Martingale.
<https://en.wikipedia.org/wiki/Martingale_(betting_system)>
A better of infinite wealth almost surely has a positive return. But no better has infinite wealth.
$1+2+2^2+\cdots 2^{n-1} = 2^n - 1$
You will win $1$ dollar if any of the first $n$ bets hit and lose $2^n-1$ if none hit.
Your p... | Yes, for part a, the desired answer is $B=2^n-1$ |
4,361,192 | Karen has 12 cards, each written with a letter from the word PENNSYLVANIA. She picks a card at random. Without replacing she picks another card at random. Find the probability she picks two vowels.
I was sure the answer is $\frac{5}{12}\times\frac{4}{11}$ :-) | 2022/01/19 | [
"https://math.stackexchange.com/questions/4361192",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/985560/"
] | With Y as vowel:
>
> There are 5 vowels, picking a vowel first try gives you $\frac{5}{12}$ and then we have 11 letters and 4 vowels left, giving you $\frac{4}{11}$. Therefore, the answer would be $\frac{5}{12}\times\frac{4}{11}$, or $\frac{5}{33}$.
>
>
>
Without Y as vowel:
>
> There are 4 vowels, picking a ... | There are four vowels, which are E, A, I, and A, so there's $\frac{5}{12}$ chance that Karen will pick a vowel at the first try. At the second try, there will be three vowels and eleven cards left, so we multiply $\frac{5}{12}$ by $\frac{3}{11}$ and you will get $\frac{1}{11}$ |
32,469,696 | When I use Resharper's Code-Cleanup, this is what it does to my backing fields...
`[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly DateTime_auctionOn;`
^ all on a single line.
How can I tell R# that I want it to be formatted like this:
```
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private... | 2015/09/09 | [
"https://Stackoverflow.com/questions/32469696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] | Look under `Code Editing > C# > Formatting Style > Line Breaks and Wrapping` in the options and take a look at the following entries. specifically this one: `Place field attribute on same line`
[](https://i.stack.imgur.com/XTdu1.png) | Goto Resharper Options → `Code Editing` → `Code Cleanup` and now you need to add your own Code Cleanup profile (as MyProfile in screen shot) and set rules as you required, and save the profile. (**Keep Un-check Reformat Code**)
[](https://i.stack.imgur... |
66,143,393 | I am trying to check a condition using the logical or operator and seems like I am doing that wrong. It works of course if it is just 1, but when I add other values it seems to be incorrect as in below. How do I make this work to check if it's more than one. Does something go in quotes instead?
```js
if (data.Items.fi... | 2021/02/10 | [
"https://Stackoverflow.com/questions/66143393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4570185/"
] | You can't compare against multiple values like that. You could use `Array#includes` instead.
```
if([110 , 120 , 130 ,140].includes(data.Items.find((item) => item.OrgUnit?.Id === (parseInt(match))).Role.Id)){
}
``` | Because the left side of the equation needs to be repeated for every instance of `||`
```
let roleId = data.Items.find((item) => item.OrgUnit?.Id === (parseInt(match))).Role.Id
if(roleId === 110 || roleId === 120 || roleId === 130 || roleId === 140){
alert="test"
}
```
This could also be written like this:
```
le... |
66,143,393 | I am trying to check a condition using the logical or operator and seems like I am doing that wrong. It works of course if it is just 1, but when I add other values it seems to be incorrect as in below. How do I make this work to check if it's more than one. Does something go in quotes instead?
```js
if (data.Items.fi... | 2021/02/10 | [
"https://Stackoverflow.com/questions/66143393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4570185/"
] | You can't compare against multiple values like that. You could use `Array#includes` instead.
```
if([110 , 120 , 130 ,140].includes(data.Items.find((item) => item.OrgUnit?.Id === (parseInt(match))).Role.Id)){
}
``` | in addition to iota's answer , the following part of the code could fail
```
data.Items.find((item) => item.OrgUnit?.Id === (parseInt(match))).Role.Id
```
because `find` could return undefined , so you need to add `?` to the result of find method
```
const values = [110,120,130,140];
const roleId = data.Items.find(... |
64,919,429 | I have a workflow\_dispatch trigger like blow:
[](https://i.stack.imgur.com/nj7Iq.png)
I need to define validation, so that logLevel must be within specific set of values `['info', 'warning', 'error']`
I know I can do bash if commands and check for ... | 2020/11/19 | [
"https://Stackoverflow.com/questions/64919429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1088979/"
] | Manually triggered workflows in Github Actions now supports `choice` as an input type, so you can do something like this and the user will see this as a dropdown.
```yaml
on:
workflow_dispatch:
inputs:
logLevel:
type: choice
description: Log level
default: warning
options:
... | I don't think there's currently a built-in way to do this, but you can accomplish it by doing something like:
1. Create a validator script (eg. `.github/scripts/validateInputs.js`)
```js
if (['info', 'warning', 'error'].includes(process.env.logLevel)) {
console.log("logLevel must be either 'info', 'warning' or 'err... |
34,307,617 | I'm using a Mongo Database to store information from my Java program.
I'm using Eclipse and MongoDB 3.0
The problem I am having is that whenever my program has any interaction with Mongo it fills the console with red text from JULLogger.
I do not currently have any code to set the logger level, as all examples I have... | 2015/12/16 | [
"https://Stackoverflow.com/questions/34307617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5685677/"
] | Thank you very much Ross for your suggestion:
`java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(java.util.logging.Level.SEVERE);`
In fact the correct code was this, so only a minor change:
`java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(Level.SEVERE);`
I can confirm that I am n... | You can try this solution Just add following dependency in your pom file or add this jar manually
```
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.22</version>
</dependency>
```
Read these
1. <http://grokbase.com/t/gg/mongodb-user/153eg0pczd/deactivate-logg... |
34,307,617 | I'm using a Mongo Database to store information from my Java program.
I'm using Eclipse and MongoDB 3.0
The problem I am having is that whenever my program has any interaction with Mongo it fills the console with red text from JULLogger.
I do not currently have any code to set the logger level, as all examples I have... | 2015/12/16 | [
"https://Stackoverflow.com/questions/34307617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5685677/"
] | Thank you very much Ross for your suggestion:
`java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(java.util.logging.Level.SEVERE);`
In fact the correct code was this, so only a minor change:
`java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(Level.SEVERE);`
I can confirm that I am n... | I tried all the above but none worked.the One which finally worked is
The one which finally worked for me is as below.
```
LoggerContext loggerContext = (LoggerContext)LoggerFactory.getILoggerFactory();
loggerContext.getLogger("org.mongodb.driver").setLevel(Level.ERROR);
```
Please note the imports as well:
```
... |
34,307,617 | I'm using a Mongo Database to store information from my Java program.
I'm using Eclipse and MongoDB 3.0
The problem I am having is that whenever my program has any interaction with Mongo it fills the console with red text from JULLogger.
I do not currently have any code to set the logger level, as all examples I have... | 2015/12/16 | [
"https://Stackoverflow.com/questions/34307617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5685677/"
] | You can try this solution Just add following dependency in your pom file or add this jar manually
```
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.22</version>
</dependency>
```
Read these
1. <http://grokbase.com/t/gg/mongodb-user/153eg0pczd/deactivate-logg... | I tried all the above but none worked.the One which finally worked is
The one which finally worked for me is as below.
```
LoggerContext loggerContext = (LoggerContext)LoggerFactory.getILoggerFactory();
loggerContext.getLogger("org.mongodb.driver").setLevel(Level.ERROR);
```
Please note the imports as well:
```
... |
44,362,100 | I've a client and server running on the same server(Linux machine) and TCP connection in between them.
I've observed that when I kill client, Kernel/OS sends RST packet after exactly 2 seconds after the client is killed.
My question is which kernel parameter os Socket options govern this timer(2 secs)? | 2017/06/05 | [
"https://Stackoverflow.com/questions/44362100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2370087/"
] | A `RST` isn't ordinarily sent between peers in a normal connection termination. A `FIN` *is*. When you kill the client, a `FIN` is sent on the connection to indicate to the server that the client won't be sending any more data.
But the server is apparently not paying attention to the `FIN` it receives when the client ... | As mentioned in the [UNIX Network programming Volume 1 Section Generic socket options](https://books.google.com/books?id=ptSC4LpwGA0C&pg=PA201&lpg=PA201&dq=TCP+FIN+sent+by+kernel+when+client+is+killed+or+crashed&source=bl&ots=Kt3AQjcjQq&sig=7iESDh2lP39bDqlguuHTS1zHaG0&hl=en&sa=X&ved=2ahUKEwjh1sq61NfcAhVrwVQKHUNgCnQ4ChD... |
570,497 | Show that if x is small compared with unity, then $$f(x)=\frac{(1-x)^\frac{-2}{3}+(1-4x)^\frac{-1}{3}}{(1-3x)^\frac{-1}{3}+(1-4x)^\frac{-1}{4}}=1-\frac{7x^2}{36}$$
In my first attempt I expanded all four brackets up to second order of x, but this didn't lead me to something that could be expressed as the final result.... | 2013/11/17 | [
"https://math.stackexchange.com/questions/570497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/89929/"
] | Expand each piece in the numerator and denominator up to the second order in Taylor series (this is the minimum taking into account what you are supposed to find). Then develop the result again as a Taylor series ... and you will find it ! | For two real functions $f,g$, we have
$$
\left( \frac fg \right)' = \frac{f'g -fg'}{g^2}, \quad \left( \frac fg \right)'' = \frac{f''g -fg''}{g^2} - 2 \frac{f'g-fg'}{g^3}g'.
$$
It follows that the Taylor expansion of your function to the second order depends only on the Taylor expansion of your numerator and denominato... |
570,497 | Show that if x is small compared with unity, then $$f(x)=\frac{(1-x)^\frac{-2}{3}+(1-4x)^\frac{-1}{3}}{(1-3x)^\frac{-1}{3}+(1-4x)^\frac{-1}{4}}=1-\frac{7x^2}{36}$$
In my first attempt I expanded all four brackets up to second order of x, but this didn't lead me to something that could be expressed as the final result.... | 2013/11/17 | [
"https://math.stackexchange.com/questions/570497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/89929/"
] | Expand each piece in the numerator and denominator up to the second order in Taylor series (this is the minimum taking into account what you are supposed to find). Then develop the result again as a Taylor series ... and you will find it ! | The development of the last fraction (ratio of the two quadratic polynomials) is
1 - 7 x^2 / 36 + 7 x^3 / 36 + 35 x^4 / 144. |
55,165,697 | I have
```
def f(x):
return (x**2 / 10) - 2 * np.sin(x)
def plot_fn():
x = np.arange(-10, 10, 0.1)
fn = f(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bott... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | Had the same problem, making the file executable fixed the problem for me:
`sudo chmod +x arcoreimg` | I believe the official documentation on using this may not be very clear, as this portion `./arcoreimg` of the sample code refers to the exact directory where your arcoreimage cli tool is located, as well as the name it is called. So you may correctly run the code like this;
`/Users/.../GoogleARCore/CLI/augmented_imag... |
55,165,697 | I have
```
def f(x):
return (x**2 / 10) - 2 * np.sin(x)
def plot_fn():
x = np.arange(-10, 10, 0.1)
fn = f(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bott... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | Had the same problem, making the file executable fixed the problem for me:
`sudo chmod +x arcoreimg` | The official documentation doesn't point to the right steps.
First, locate the `arcoreimg` file on your system. On MacOS, I found it inside `<arcore-sdk-location</arcore-android-sdk/tools/arcoreimg/macos`.
You can use the executable directly from here, or copy it to a more convenient location (maybe next to your imag... |
55,165,697 | I have
```
def f(x):
return (x**2 / 10) - 2 * np.sin(x)
def plot_fn():
x = np.arange(-10, 10, 0.1)
fn = f(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bott... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | Had the same problem, making the file executable fixed the problem for me:
`sudo chmod +x arcoreimg` | **Step 1:** Give read/write access to your tool. Open your arcoreimg directory from terminal. And give following command
```
sudo chmod +x arcoreimg
```
**Step 2:** Copy your images in one folder
**Step 3:** Create one empty output folder
**Step 4:** Give following command
```
./arcoreimg build-db --input_images_... |
55,165,697 | I have
```
def f(x):
return (x**2 / 10) - 2 * np.sin(x)
def plot_fn():
x = np.arange(-10, 10, 0.1)
fn = f(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bott... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | The official documentation doesn't point to the right steps.
First, locate the `arcoreimg` file on your system. On MacOS, I found it inside `<arcore-sdk-location</arcore-android-sdk/tools/arcoreimg/macos`.
You can use the executable directly from here, or copy it to a more convenient location (maybe next to your imag... | I believe the official documentation on using this may not be very clear, as this portion `./arcoreimg` of the sample code refers to the exact directory where your arcoreimage cli tool is located, as well as the name it is called. So you may correctly run the code like this;
`/Users/.../GoogleARCore/CLI/augmented_imag... |
55,165,697 | I have
```
def f(x):
return (x**2 / 10) - 2 * np.sin(x)
def plot_fn():
x = np.arange(-10, 10, 0.1)
fn = f(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bott... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239879/"
] | The official documentation doesn't point to the right steps.
First, locate the `arcoreimg` file on your system. On MacOS, I found it inside `<arcore-sdk-location</arcore-android-sdk/tools/arcoreimg/macos`.
You can use the executable directly from here, or copy it to a more convenient location (maybe next to your imag... | **Step 1:** Give read/write access to your tool. Open your arcoreimg directory from terminal. And give following command
```
sudo chmod +x arcoreimg
```
**Step 2:** Copy your images in one folder
**Step 3:** Create one empty output folder
**Step 4:** Give following command
```
./arcoreimg build-db --input_images_... |
11,653,805 | I am trying to embed a youtube video inside a webview and it seems there is a small margin on the right-side of the video which is not going away.
I saw many other Questions like these and tried fixing the javascript but still the margin is there.
Here is my code :
```
video = (WebView) v.findViewById(R.i... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11653805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497188/"
] | Well, HTML is left-aligned by default, so, in case you have a margin on the RIGHT hand side, this means that margin:0 worked. However, setting the right-hand side margin to 0 won't help as it doesn't mean the object would fill.
Try to say
```
+ " type='application/x-shockwave-flash' style='margin:0;width:100... | So after much researching and trying to figure out how it works i have this working code for whoever who might need it in the future :
```
Display display = getActivity().getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int widthdp = (int) (width / getResources().getDisplayMe... |
22,157,116 | This is what I have, but the number of children never prints out. I'm getting the raw JSON, then making a JSONArray, accessing the second member's children. What am I missing here? I have similar code that works perfectly, only difference is in the JSON, it does not start with an array
JSON Input:
```
[
{
"k... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22157116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2230341/"
] | If you app is iOS 7+, you have some flexibility by using MKTileOverlay. It allows you to put your own tile set on top of a normal Apple map.
By creating a MKTileOverlay subclass and overload `loadTileAtPath:` you could check your bundle for the initial state, then maybe a separate cache for tiles loaded when there wa... | I got this issue before and the only way I found was by using a third party map tiles provider called [MapBox](https://www.mapbox.com/). They provide an API for iOS and other platforms as well. You can even customize your own maps by using [TileMill](https://www.mapbox.com/tilemill/%E2%80%8E). The former even allows yo... |
65,465,731 | when I type ls or clear...
“command is not recognized as an internal or external command, operable program or batch file”
[enter image description here](https://i.stack.imgur.com/dYzj8.png) | 2020/12/27 | [
"https://Stackoverflow.com/questions/65465731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14052638/"
] | `ls` and `clear`, are Linux commands, not Windows. | Use `dir` and `cls` commands in Windows.
Or use Git Bash (which comes along with Git Installation) to use linux commands like `clear` and `ls` |
6,038,430 | The main question is how do I implement startTest() so that it calls runTest in all the subclasses. Thanks!
```
/*******************
COMPILER TEST
*******************/
class archeTest
{
protected:
short verbosity_;
public:
void setVerbosity(short v)
{
if( ((v == 1) || (v == 0) )
{... | 2011/05/17 | [
"https://Stackoverflow.com/questions/6038430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It is possible but to do it you will have to use an abstract factory pattern. Please [read this](http://en.wikipedia.org/wiki/Abstract_factory_pattern) for an overview on what the abstract pattern is and how it can do what you need.
If you can use boost in your project then you can implement your own abstract factory ... | EDIT: never mind, my first answer didn't make any sense. In C++, you cannot obtain the list of all subclasses of a class to instantiate them, so I don't think you can implement runTests() the way you want it. |
6,038,430 | The main question is how do I implement startTest() so that it calls runTest in all the subclasses. Thanks!
```
/*******************
COMPILER TEST
*******************/
class archeTest
{
protected:
short verbosity_;
public:
void setVerbosity(short v)
{
if( ((v == 1) || (v == 0) )
{... | 2011/05/17 | [
"https://Stackoverflow.com/questions/6038430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since a lot of people were finding it difficult to follow through all the posts I listed. I implemented a version of this using boost.
The trick is the fact that when the definition for TestTemplate is expanded with the derived class definitions(new Test cases) it forces a call to the TestManager::Register method due... | First off, you would declare startTest like this in archeTest.
```
virtual void startTest() = 0;
```
That makes it a pure virtual function that must be implemented in child classes. To call this method on a child class, you must have an object of that particular class instantiated. Then you can call startTest either... |
6,038,430 | The main question is how do I implement startTest() so that it calls runTest in all the subclasses. Thanks!
```
/*******************
COMPILER TEST
*******************/
class archeTest
{
protected:
short verbosity_;
public:
void setVerbosity(short v)
{
if( ((v == 1) || (v == 0) )
{... | 2011/05/17 | [
"https://Stackoverflow.com/questions/6038430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since a lot of people were finding it difficult to follow through all the posts I listed. I implemented a version of this using boost.
The trick is the fact that when the definition for TestTemplate is expanded with the derived class definitions(new Test cases) it forces a call to the TestManager::Register method due... | You might want to check out [UnitTest++](http://unittest-cpp.sourceforge.net/) (you can [browse the source code here](http://unittest-cpp.svn.sourceforge.net/viewvc/unittest-cpp/UnitTest%2B%2B/src/)). Pay particular attention to [`TestMacros.h`](http://unittest-cpp.svn.sourceforge.net/viewvc/unittest-cpp/UnitTest%2B%2B... |
6,038,430 | The main question is how do I implement startTest() so that it calls runTest in all the subclasses. Thanks!
```
/*******************
COMPILER TEST
*******************/
class archeTest
{
protected:
short verbosity_;
public:
void setVerbosity(short v)
{
if( ((v == 1) || (v == 0) )
{... | 2011/05/17 | [
"https://Stackoverflow.com/questions/6038430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First off, you would declare startTest like this in archeTest.
```
virtual void startTest() = 0;
```
That makes it a pure virtual function that must be implemented in child classes. To call this method on a child class, you must have an object of that particular class instantiated. Then you can call startTest either... | EDIT: never mind, my first answer didn't make any sense. In C++, you cannot obtain the list of all subclasses of a class to instantiate them, so I don't think you can implement runTests() the way you want it. |
6,038,430 | The main question is how do I implement startTest() so that it calls runTest in all the subclasses. Thanks!
```
/*******************
COMPILER TEST
*******************/
class archeTest
{
protected:
short verbosity_;
public:
void setVerbosity(short v)
{
if( ((v == 1) || (v == 0) )
{... | 2011/05/17 | [
"https://Stackoverflow.com/questions/6038430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Well, first - **single responsibility principle**. That in mind, your `archeTest` shouldn't manage alle test objects. Just have an (in)famous `Manager` do that!
```
#include <vector>
class TestManager{
std::vector<archeTest*> _tests;
public:
// either
void AddTest(archeTest* test){
_tests.push_back(test);
... | EDIT: never mind, my first answer didn't make any sense. In C++, you cannot obtain the list of all subclasses of a class to instantiate them, so I don't think you can implement runTests() the way you want it. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.