qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
66,142,441 | I'm creating a dynamic form, there may be X fields to fill, for example there may be 10 inputs texts, 5 selects, 3 Radio etc.
I created the entire structure to assemble this form dynamically and it is working as expected.
However my biggest problem is when I will check if at least one RADIO BUTTON has been checked. I... | 2021/02/10 | [
"https://Stackoverflow.com/questions/66142441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12055252/"
] | You can use find here very well.
Consider that your name is an ID, so put in fron of your *name* the hashtag *#name*.
Also I would recommend using an event listener. I updated your code to use it therefore I gave your btn an id.
```js
document.getElementById('btn').addEventListener('click', function(){checkAll('Locati... | You want to prepend the selector passed to the functions with a `#` - an `id selector`. Then all you need in the function is:
```
$(name).find('input[type="checkbox"]').not(':disabled').prop('checked',true);
```
**DEMO**
```js
function checkAll(name) {
$(name).find('input[type="checkbox"]').not(':disabled').pro... |
38,503,384 | Hello guy I have two table Cells and a `<fo:leader/>` in both Cells. How can i avoid to get a space between the two Cells. It's not possible to span the two cells.
[](https://i.stack.imgur.com/ZTC37.png)
I use Antennahouse and XSLT 2.0 .
Here is my ... | 2016/07/21 | [
"https://Stackoverflow.com/questions/38503384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4694246/"
] | Without all the other stuff you have, with pure XSL FO and no extensions this works for me:
```
<fo:table width="100%" >
<fo:table-column column-width="50%"/>
<fo:table-column column-width="50%"/>
<fo:table-body >
<fo... | I think there are **two** reasons for the strange "gap" between the two series of dots on each table row:
1. **the column is not an exact multiple of the leader pattern** (dot + space); for example, supposing a dot and a space are 3 mm wide and the empty area to be filled by the `fo:leader` has a width of 17 mm, the f... |
10,984,053 | working on a dynamic request as a person types.
Would like to try to throttle it so not EVERY key press fires off a call.
First thought was to do a setimeout of 1s and clear the timeout with each keypress, therefore waiting till there is a lag of 1s before pushing off the request.
Wondering if there are any cleaner s... | 2012/06/11 | [
"https://Stackoverflow.com/questions/10984053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/604683/"
] | [Underscore.js](http://underscorejs.org/#throttle) Offers a throttle function that creates a version of a function that is executed only once every x milliseconds. You might want to look into that | That solution will work well if you don't have a lot of other script that will run simultaneous.
Otherwise you can set up an `if` loop which triggers the call every 5 keypress for example.
Something like this:
```
if(i == 5) {
//Execute your call
}
```
And then you you increase the value of i each time a key i... |
27,278,157 | I bought an html/angular js template and i try to integrated it in symfony 2.
The directive ng-include seems to be not working.
```
{# src/Neobe/AccueilBundle/Resources/views/layout.html.twig #}
{% extends '::base.html.twig' %}
{% block title %}
Welcome
{% endblock %}
{% block body %}
<!-- Wrapper-->
<div id="wrappe... | 2014/12/03 | [
"https://Stackoverflow.com/questions/27278157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2198685/"
] | I second @iCodez's answer to use `os.getenv`to get the path string from a system environment variable, but you might want to use the paths defined for APPDATA or LOCALAPPDATA instead.
Windows permissions settings on the Program Files directory may prevent a standard user account from writing data to the directory.
... | You could use [`os.getenv`](https://docs.python.org/3/library/os.html#os.getenv) or [`os.environ`](https://docs.python.org/3/library/os.html#os.environ):
```
>>> import os
>>>> os.getenv('PROGRAMFILES')
'C:\\Program Files'
>>> os.environ['PROGRAMFILES']
'C:\\Program Files'
>>>
```
Note that you can also specify a de... |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | This is the only that worked for me. It sorts by the selected sorted attribute AND set the out of stock products in the end of the listings:
You need to create a Plugin (type="\Magento\Catalog\Model\Layer") with the following function:
```
/**
* Retrieve current layer product collection
*
* @return \Magento\Catalog\M... | Go to `/namespace/Catalog/Model/layer.php` and add given below code.
```
$collection->joinField('in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id', 'in_stock>=0', 'left')->setOrder('in_stock','desc');
```
Note: This is working on default magento. |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | Go to `/namespace/Catalog/Model/layer.php` and add given below code.
```
$collection->joinField('in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id', 'in_stock>=0', 'left')->setOrder('in_stock','desc');
```
Note: This is working on default magento. | You can use this free extension to show out of stock items at the end of the catalog.
<https://github.com/bikashkaushik/magento2-OutOfStockLast> |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | This is the only that worked for me. It sorts by the selected sorted attribute AND set the out of stock products in the end of the listings:
You need to create a Plugin (type="\Magento\Catalog\Model\Layer") with the following function:
```
/**
* Retrieve current layer product collection
*
* @return \Magento\Catalog\M... | 1. Make a preference for class "**Magento\Catalog\Block\Product\ListProduct**"
2. Find line **$this->\_productCollection = $layer->getProductCollection();**
3. Add this after that line **$this->\_productCollection->getSelect()->order('is\_salable DESC');**
This may be not the perfect solution but it works. |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | 1. Make a preference for class "**Magento\Catalog\Block\Product\ListProduct**"
2. Find line **$this->\_productCollection = $layer->getProductCollection();**
3. Add this after that line **$this->\_productCollection->getSelect()->order('is\_salable DESC');**
This may be not the perfect solution but it works. | You can use this free extension to show out of stock items at the end of the catalog.
<https://github.com/bikashkaushik/magento2-OutOfStockLast> |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | This is the only that worked for me. It sorts by the selected sorted attribute AND set the out of stock products in the end of the listings:
You need to create a Plugin (type="\Magento\Catalog\Model\Layer") with the following function:
```
/**
* Retrieve current layer product collection
*
* @return \Magento\Catalog\M... | Use a custom module plugin to add sort criteria to the select. Uses `afterGetProductCollection()` for performance.
***`app/code/My/Namespace/etc/module.xml`***
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Fra... |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | This is the only that worked for me. It sorts by the selected sorted attribute AND set the out of stock products in the end of the listings:
You need to create a Plugin (type="\Magento\Catalog\Model\Layer") with the following function:
```
/**
* Retrieve current layer product collection
*
* @return \Magento\Catalog\M... | You can use this free extension to show out of stock items at the end of the catalog.
<https://github.com/bikashkaushik/magento2-OutOfStockLast> |
206,849 | I want to display out of stock products at the end of the listing page.
I have followed the link [here](https://magento.stackexchange.com/questions/159871/magento-2-show-out-of-stock-items-after-in-stock-items), getting error: `Exception #0 (Zend_Db_Select_Exception): You cannot define a correlation name '_inventory_t... | 2017/12/22 | [
"https://magento.stackexchange.com/questions/206849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/44608/"
] | Use a custom module plugin to add sort criteria to the select. Uses `afterGetProductCollection()` for performance.
***`app/code/My/Namespace/etc/module.xml`***
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Fra... | You can use this free extension to show out of stock items at the end of the catalog.
<https://github.com/bikashkaushik/magento2-OutOfStockLast> |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | You can build a custom function to insert a new item after a specific key:
```
function array_insert_after($array, $findAfter, $key, $new)
{
$pos = (int) array_search($findAfter, array_keys($array)) + 1;
return array_merge(
array_slice($array, 0, $pos),
array($key => $new),
array_slice(... | You can do that with `array_splice` look [here](http://uk.php.net/manual/en/function.array-splice.php#92651) or use a custom [sort function](http://www.php.net/manual/en/function.array-splice.php). |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | You can build a custom function to insert a new item after a specific key:
```
function array_insert_after($array, $findAfter, $key, $new)
{
$pos = (int) array_search($findAfter, array_keys($array)) + 1;
return array_merge(
array_slice($array, 0, $pos),
array($key => $new),
array_slice(... | In general:
1. Split your current array into two parts (`$larray, $rarray`)- before and after place you want to insert your key (for example using `foreach`).
2. Add your new key to the end of left side, for example `$larray = $larray + array('key' => 'value')`
3. Add right side to that: `$array = $larray + $rarray'
... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | Snippet from Nette framework (second method)
```
/**
* Searches the array for a given key and returns the offset if successful.
* @return int offset if it is found, FALSE otherwise
*/
public static function searchKey($arr, $key)
{
$foo = array($key => NULL);
return array_search(key(... | In general:
1. Split your current array into two parts (`$larray, $rarray`)- before and after place you want to insert your key (for example using `foreach`).
2. Add your new key to the end of left side, for example `$larray = $larray + array('key' => 'value')`
3. Add right side to that: `$array = $larray + $rarray'
... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | To put an element before or after one element, I use these two functions
```
/**
* @return array
* @param array $src
* @param array $in
* @param int|string $pos
*/
function array_push_before($src,$in,$pos){
if(is_int($pos)) $R=array_merge(array_slice($src,0,$pos), $in, array_slice($src,$pos));
else{
... | In general:
1. Split your current array into two parts (`$larray, $rarray`)- before and after place you want to insert your key (for example using `foreach`).
2. Add your new key to the end of left side, for example `$larray = $larray + array('key' => 'value')`
3. Add right side to that: `$array = $larray + $rarray'
... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | You can build a custom function to insert a new item after a specific key:
```
function array_insert_after($array, $findAfter, $key, $new)
{
$pos = (int) array_search($findAfter, array_keys($array)) + 1;
return array_merge(
array_slice($array, 0, $pos),
array($key => $new),
array_slice(... | Snippet from Nette framework (second method)
```
/**
* Searches the array for a given key and returns the offset if successful.
* @return int offset if it is found, FALSE otherwise
*/
public static function searchKey($arr, $key)
{
$foo = array($key => NULL);
return array_search(key(... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | You can build a custom function to insert a new item after a specific key:
```
function array_insert_after($array, $findAfter, $key, $new)
{
$pos = (int) array_search($findAfter, array_keys($array)) + 1;
return array_merge(
array_slice($array, 0, $pos),
array($key => $new),
array_slice(... | To put an element before or after one element, I use these two functions
```
/**
* @return array
* @param array $src
* @param array $in
* @param int|string $pos
*/
function array_push_before($src,$in,$pos){
if(is_int($pos)) $R=array_merge(array_slice($src,0,$pos), $in, array_slice($src,$pos));
else{
... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | This should do what you need:
```
// The columns
$columns = array(
'title' => 'Title',
'author' => 'Author',
'taxonomy-news_type' => 'News Types',
'date' => 'Date',
'wpseo-score' => 'SEO',
'p2p-from-news_to_people' => 'Staff linked to ... | You can do that with `array_splice` look [here](http://uk.php.net/manual/en/function.array-splice.php#92651) or use a custom [sort function](http://www.php.net/manual/en/function.array-splice.php). |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | You can build a custom function to insert a new item after a specific key:
```
function array_insert_after($array, $findAfter, $key, $new)
{
$pos = (int) array_search($findAfter, array_keys($array)) + 1;
return array_merge(
array_slice($array, 0, $pos),
array($key => $new),
array_slice(... | This should do what you need:
```
// The columns
$columns = array(
'title' => 'Title',
'author' => 'Author',
'taxonomy-news_type' => 'News Types',
'date' => 'Date',
'wpseo-score' => 'SEO',
'p2p-from-news_to_people' => 'Staff linked to ... |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | Snippet from Nette framework (second method)
```
/**
* Searches the array for a given key and returns the offset if successful.
* @return int offset if it is found, FALSE otherwise
*/
public static function searchKey($arr, $key)
{
$foo = array($key => NULL);
return array_search(key(... | You can do that with `array_splice` look [here](http://uk.php.net/manual/en/function.array-splice.php#92651) or use a custom [sort function](http://www.php.net/manual/en/function.array-splice.php). |
21,335,855 | I have an array with many JSON objects.
I want to push new row into one JSON object but JavaScript pushes the row to all JSONs in array how can I fix it or can I use something else rather than array?
My code is like this:
```
for (var i = 0; i < 5; i++) {
jsonArray.push(jsonPassengerList);
}
jsonArray[0].push... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21335855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2990963/"
] | This should do what you need:
```
// The columns
$columns = array(
'title' => 'Title',
'author' => 'Author',
'taxonomy-news_type' => 'News Types',
'date' => 'Date',
'wpseo-score' => 'SEO',
'p2p-from-news_to_people' => 'Staff linked to ... | In general:
1. Split your current array into two parts (`$larray, $rarray`)- before and after place you want to insert your key (for example using `foreach`).
2. Add your new key to the end of left side, for example `$larray = $larray + array('key' => 'value')`
3. Add right side to that: `$array = $larray + $rarray'
... |
1,028,931 | >
> $$\begin{align}
> \sum\_{r=0}^m\Delta\_r&=
> \begin{vmatrix}
> \displaystyle\sum\_{r=0}^m(2r-1)&\displaystyle\sum\_{r=0}^m\,^mC\_r&\displaystyle\sum\_{r=0}^m1\\
> m^2-1&2^m&m+1\\
> \sin^2\left(m^2\right)&\sin^2(m)&\sin^2(m+1)
> \end{vmatrix}\\
> &=\begin{vmatrix}
> m^2-1&2^m&m+1\\
> m^2-1&2^m&m+1\\
> \sin^2\left(m... | 2014/11/19 | [
"https://math.stackexchange.com/questions/1028931",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/184805/"
] | HINT:
We know $$e^x=\sum\_{r=0}^\infty\frac{x^r}{r!}$$
or we can use $$\lim\_{r\to\infty}\frac{C\_{r+1}}{C\_r}=\lim\_{r\to\infty}\frac9{r+1}=0$$ | Since $e^x=1+x+\frac{x^2}{2!}+\cdots+\frac{x^n}{n!}$, clearly, the series is equal to $e^9$. |
9,267,993 | Folks,
I am using REXML for a sample XML file:
```
<Accounts title="This is the test title">
<Account name="frenchcustomer">
<username name = "frencu"/>
<password pw = "hello34"/>
<accountdn dn = "https://frenchcu.com/"/>
<exporttest name="basic">
... | 2012/02/13 | [
"https://Stackoverflow.com/questions/9267993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
puts @data.elements["//Account[@name='frenchcustomer']"]
.elements["username"]
.attributes["name"]
```
If you want to iterate over multiple identical names:
```
@data.elements.each("//Account[@name='frenchcustomer']") do |fc|
puts fc.elements["username"].attributes["name"]
end
``` | I don't know what your `@@testdata` are, I tried with the following testcode:
```
require "rexml/document"
@data = (REXML::Document.new DATA).root
@dataarr = @data.elements.to_a("//Account")
# Works
p @dataarr[1].elements["username"].attributes["name"]
#Works not
#~ p @dataarr[@name='fenchcustomer'].elements["user... |
9,267,993 | Folks,
I am using REXML for a sample XML file:
```
<Accounts title="This is the test title">
<Account name="frenchcustomer">
<username name = "frencu"/>
<password pw = "hello34"/>
<accountdn dn = "https://frenchcu.com/"/>
<exporttest name="basic">
... | 2012/02/13 | [
"https://Stackoverflow.com/questions/9267993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I recommend you to use `XPath`.
For the first match, you can use `first` method, for an array, just use `match`.
The code above returns the username for the Account "frenchcustomer" :
```
REXML::XPath.first(yourREXMLDocument, "//Account[@name='frenchcustomer']/username/@name").value
```
If you really want to use t... | I don't know what your `@@testdata` are, I tried with the following testcode:
```
require "rexml/document"
@data = (REXML::Document.new DATA).root
@dataarr = @data.elements.to_a("//Account")
# Works
p @dataarr[1].elements["username"].attributes["name"]
#Works not
#~ p @dataarr[@name='fenchcustomer'].elements["user... |
9,267,993 | Folks,
I am using REXML for a sample XML file:
```
<Accounts title="This is the test title">
<Account name="frenchcustomer">
<username name = "frencu"/>
<password pw = "hello34"/>
<accountdn dn = "https://frenchcu.com/"/>
<exporttest name="basic">
... | 2012/02/13 | [
"https://Stackoverflow.com/questions/9267993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I recommend you to use `XPath`.
For the first match, you can use `first` method, for an array, just use `match`.
The code above returns the username for the Account "frenchcustomer" :
```
REXML::XPath.first(yourREXMLDocument, "//Account[@name='frenchcustomer']/username/@name").value
```
If you really want to use t... | ```
puts @data.elements["//Account[@name='frenchcustomer']"]
.elements["username"]
.attributes["name"]
```
If you want to iterate over multiple identical names:
```
@data.elements.each("//Account[@name='frenchcustomer']") do |fc|
puts fc.elements["username"].attributes["name"]
end
``` |
56,067,421 | I use the third-party API.
In request, I should add what fields I want to get. For example:
```
axios.get("APIURL", {
params: {
fields: ["username", "phone", ...etc]
}
})
```
And I get a response in this format:
```
{
"data": [{
"username": {
"id": 17,
"data": "Jo... | 2019/05/09 | [
"https://Stackoverflow.com/questions/56067421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10641093/"
] | I'm not entirely sure what's happening, but removing rownames from the first `xts` object seems to fix it.
```
rownames(data1.daily) <- NULL
rbind(data1.daily, data2.daily)
# col1
# 2019-05-02 23:00:00 1452
# 2019-05-03 23:00:00 876
# 2019-05-04 23:00:00 300
# 2019-05-06 23:00:00 1452
# 2019-05-0... | You could write a function for this purpose. I'm not sure, though, if you need the data as `data.frame` or something else. Anyway, I'll provide the former since it was quite a challenge.
```
res <- do.call(rbind, lapply(list(data1.daily, data2.daily), function(x) {
t <- as.POSIXct(attr(x, "index"),
... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | You might want to try the `repeatinterval` option. The way it works is a button will continually fire as long as the user holds it down. The `repeatinterval` parameter essentially lets the program know how often it should fire the button if so. Here is a link to the explanation:
<http://infohost.nmt.edu/tcc/help/pubs/... | Try this...
```
from Tkinter import *
root = Tk()
global hold_down
def button_hold(event):
hold_down = True
while hold_down:
print('test statement')
def stop_motor(event):
hold_down = False
print('button released')
button = Button(root, text ="forward")
button.pack(side=LEFT)
root.bind('<... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Set a flag when the button is pressed, unset the flag when the button is released. There's no need for a loop since you're already running a loop (`mainloop`)
```
from Tkinter import *
running = False
root = Tk()
def start_motor(event):
global running
running = True
print("starting motor...")
def stop_mo... | Try this...
```
from Tkinter import *
root = Tk()
global hold_down
def button_hold(event):
hold_down = True
while hold_down:
print('test statement')
def stop_motor(event):
hold_down = False
print('button released')
button = Button(root, text ="forward")
button.pack(side=LEFT)
root.bind('<... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Try this...
```
from Tkinter import *
root = Tk()
global hold_down
def button_hold(event):
hold_down = True
while hold_down:
print('test statement')
def stop_motor(event):
hold_down = False
print('button released')
button = Button(root, text ="forward")
button.pack(side=LEFT)
root.bind('<... | >
> @ Danny Try the following code:
>
>
> def stop\_motor(event):
> print('button released')
> return False
>
>
>
This answer run print 'test statement' one time. The while loop run one time when the button is pressed.
>
> @ Bryan Oakley Set a flag when the button is pressed, unset the flag when the button ... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Building on Bryan Oakley's answer of using flags to simulate a press and hold button. The problem is that you can't have any while loops in your tkinter application to say *while running move car forward*.
Which is why I suggest using threads. This way you can have a while loop running in the background checking if th... | Try this...
```
from Tkinter import *
root = Tk()
global hold_down
def button_hold(event):
hold_down = True
while hold_down:
print('test statement')
def stop_motor(event):
hold_down = False
print('button released')
button = Button(root, text ="forward")
button.pack(side=LEFT)
root.bind('<... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Set a flag when the button is pressed, unset the flag when the button is released. There's no need for a loop since you're already running a loop (`mainloop`)
```
from Tkinter import *
running = False
root = Tk()
def start_motor(event):
global running
running = True
print("starting motor...")
def stop_mo... | You might want to try the `repeatinterval` option. The way it works is a button will continually fire as long as the user holds it down. The `repeatinterval` parameter essentially lets the program know how often it should fire the button if so. Here is a link to the explanation:
<http://infohost.nmt.edu/tcc/help/pubs/... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | You might want to try the `repeatinterval` option. The way it works is a button will continually fire as long as the user holds it down. The `repeatinterval` parameter essentially lets the program know how often it should fire the button if so. Here is a link to the explanation:
<http://infohost.nmt.edu/tcc/help/pubs/... | >
> @ Danny Try the following code:
>
>
> def stop\_motor(event):
> print('button released')
> return False
>
>
>
This answer run print 'test statement' one time. The while loop run one time when the button is pressed.
>
> @ Bryan Oakley Set a flag when the button is pressed, unset the flag when the button ... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Set a flag when the button is pressed, unset the flag when the button is released. There's no need for a loop since you're already running a loop (`mainloop`)
```
from Tkinter import *
running = False
root = Tk()
def start_motor(event):
global running
running = True
print("starting motor...")
def stop_mo... | >
> @ Danny Try the following code:
>
>
> def stop\_motor(event):
> print('button released')
> return False
>
>
>
This answer run print 'test statement' one time. The while loop run one time when the button is pressed.
>
> @ Bryan Oakley Set a flag when the button is pressed, unset the flag when the button ... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Set a flag when the button is pressed, unset the flag when the button is released. There's no need for a loop since you're already running a loop (`mainloop`)
```
from Tkinter import *
running = False
root = Tk()
def start_motor(event):
global running
running = True
print("starting motor...")
def stop_mo... | Building on Bryan Oakley's answer of using flags to simulate a press and hold button. The problem is that you can't have any while loops in your tkinter application to say *while running move car forward*.
Which is why I suggest using threads. This way you can have a while loop running in the background checking if th... |
34,522,095 | I'm trying to do a GUI in python to control my robotic car. My question is how I do a function that determine a hold down button. I want to move the car when the button is pressed and held down and stop the car when the button is released.
```
from Tkinter import *
hold_down = False
root = Tk()
def button_hold(eve... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34522095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729115/"
] | Building on Bryan Oakley's answer of using flags to simulate a press and hold button. The problem is that you can't have any while loops in your tkinter application to say *while running move car forward*.
Which is why I suggest using threads. This way you can have a while loop running in the background checking if th... | >
> @ Danny Try the following code:
>
>
> def stop\_motor(event):
> print('button released')
> return False
>
>
>
This answer run print 'test statement' one time. The while loop run one time when the button is pressed.
>
> @ Bryan Oakley Set a flag when the button is pressed, unset the flag when the button ... |
27,791,256 | How can I get a random question in java from the resource file using following xml:
```
<array name="question1">
<item name="id">1</item>
<item name="question">Question 1?</item>
<item>@array/possible_answers1</item>
<item name="correct_answer">1</item>
</array>
<string-array name="possible_answers... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27791256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280562/"
] | The easiest way is to just move the `has_one` associations down on to user. Since only `Staff` records will have `staff_details`, the preloading will just work.
```
class User < ActiveRecord::Base
has_one :staff_detail
has_one :student_detail
end
class Staff < User; end
class Student < User; end
```
That's not ... | How about putting the `includes` on the STI models as a `default_scope`?
```
class Event < ActiveRecord::Base
has_many :attendances
class Attendance < ActiveRecord::Base
belongs_to :user
class Student < User
has_one :student_detail
default_scope includes(:student_detail)
class StudentDetail < ActiveRecord::... |
27,791,256 | How can I get a random question in java from the resource file using following xml:
```
<array name="question1">
<item name="id">1</item>
<item name="question">Question 1?</item>
<item>@array/possible_answers1</item>
<item name="correct_answer">1</item>
</array>
<string-array name="possible_answers... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27791256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280562/"
] | How about putting the `includes` on the STI models as a `default_scope`?
```
class Event < ActiveRecord::Base
has_many :attendances
class Attendance < ActiveRecord::Base
belongs_to :user
class Student < User
has_one :student_detail
default_scope includes(:student_detail)
class StudentDetail < ActiveRecord::... | You could just use named scopes to make your life a little easier.
```
class Event < ActiveRecord::Base
has_many :attendances
scope :for_students, -> { includes(:attendances => { :users => :student_detail }).where('users.type = ?', 'Student') }
scope :for_staff, -> { includes(:attendances => { :users => :staff_d... |
27,791,256 | How can I get a random question in java from the resource file using following xml:
```
<array name="question1">
<item name="id">1</item>
<item name="question">Question 1?</item>
<item>@array/possible_answers1</item>
<item name="correct_answer">1</item>
</array>
<string-array name="possible_answers... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27791256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280562/"
] | The easiest way is to just move the `has_one` associations down on to user. Since only `Staff` records will have `staff_details`, the preloading will just work.
```
class User < ActiveRecord::Base
has_one :staff_detail
has_one :student_detail
end
class Staff < User; end
class Student < User; end
```
That's not ... | You could just use named scopes to make your life a little easier.
```
class Event < ActiveRecord::Base
has_many :attendances
scope :for_students, -> { includes(:attendances => { :users => :student_detail }).where('users.type = ?', 'Student') }
scope :for_staff, -> { includes(:attendances => { :users => :staff_d... |
48,317,844 | I want to make a Web connector class.
I never want this class have set text to view controller.
I want this class just try request to web then return string.
MyTest.java
```
public class MyTest {
private String sUrl = "http://Secret";
public String sRequestMethod;
public String sResult;
public St... | 2018/01/18 | [
"https://Stackoverflow.com/questions/48317844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5949771/"
] | Step 1 is to get a standard C compiler. Then you can use an anonymous struct. To get the appropriate size for the array, use a struct tag, which is only needed internally by the union.
```
typedef union {
struct data {
uint8_t xaxis;
uint8_t yaxis;
uint8_t xraxis;
uint8_t yraxis;
... | You could use `offsetof()` for this with the last element in the struct
```
union
{
struct data
{
uint8_t xaxis;
uint8_t yaxis;
uint8_t xraxis;
uint8_t yraxis;
uint8_t zraxis;
uint8_t slider;
uint8_t buttons8;
uint8_t buttons16;
};
uint8_... |
48,317,844 | I want to make a Web connector class.
I never want this class have set text to view controller.
I want this class just try request to web then return string.
MyTest.java
```
public class MyTest {
private String sUrl = "http://Secret";
public String sRequestMethod;
public String sResult;
public St... | 2018/01/18 | [
"https://Stackoverflow.com/questions/48317844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5949771/"
] | Step 1 is to get a standard C compiler. Then you can use an anonymous struct. To get the appropriate size for the array, use a struct tag, which is only needed internally by the union.
```
typedef union {
struct data {
uint8_t xaxis;
uint8_t yaxis;
uint8_t xraxis;
uint8_t yraxis;
... | The solutions other people have proposed here will work. However, they are all hacks, due to your use of a union for ease of conversion to bytes. There is a cleaner solution, which is to do away with the union. Simply make your `struct` the top-level type, and have your function that sends data over USB take parameters... |
48,317,844 | I want to make a Web connector class.
I never want this class have set text to view controller.
I want this class just try request to web then return string.
MyTest.java
```
public class MyTest {
private String sUrl = "http://Secret";
public String sRequestMethod;
public String sResult;
public St... | 2018/01/18 | [
"https://Stackoverflow.com/questions/48317844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5949771/"
] | You could use `offsetof()` for this with the last element in the struct
```
union
{
struct data
{
uint8_t xaxis;
uint8_t yaxis;
uint8_t xraxis;
uint8_t yraxis;
uint8_t zraxis;
uint8_t slider;
uint8_t buttons8;
uint8_t buttons16;
};
uint8_... | The solutions other people have proposed here will work. However, they are all hacks, due to your use of a union for ease of conversion to bytes. There is a cleaner solution, which is to do away with the union. Simply make your `struct` the top-level type, and have your function that sends data over USB take parameters... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | Sure. Tying your bike to a tree with a rope is more secure than not tying it at all. The fact that there are ways around some security-devices doesn't mean you're just as vulnerable without them. Even if you're not encrypting your data, use a strong password because it will still offer some degree of protection. In all... | On the contrary, I say no.
The only benefit of '$$%fOe.\_ba' over an 'abc' password is if someone attempts to crack your password.
YES have a password, any password. You're owned anyway, but joe shmo will be foiled.
don't reuse this password. If someone with skill DOES get your pc, sure, they will get your data, bu... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | If it gets stolen, not really... but
If it's a complex password it will be harder or impossible to crack - meaning that yes, the data on the laptop is compromised - but as most people re-use passwords and if the thief can crack your password and figure out who you are, the thief may gain access to other resources of y... | What value is your data? Is it more valuable than the hardware itself? Stealing data of an unencrypted drive pretty easy . . . But if you aren't a high value target - just have a reasonably high quality password with letters and numbers and I think you'll be just fine. |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | A burglar once took off with two laptops from my employer. These were later found again, with the hard-disks nicely formatted running a Dutch version of Windows XP. (We only use English Windows versions, so we know it was reformatted and not hacked.) The thief got caught when he'd crashed his car while driving the stol... | If it gets stolen, not really... but
If it's a complex password it will be harder or impossible to crack - meaning that yes, the data on the laptop is compromised - but as most people re-use passwords and if the thief can crack your password and figure out who you are, the thief may gain access to other resources of y... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | On the contrary, I say no.
The only benefit of '$$%fOe.\_ba' over an 'abc' password is if someone attempts to crack your password.
YES have a password, any password. You're owned anyway, but joe shmo will be foiled.
don't reuse this password. If someone with skill DOES get your pc, sure, they will get your data, bu... | What value is your data? Is it more valuable than the hardware itself? Stealing data of an unencrypted drive pretty easy . . . But if you aren't a high value target - just have a reasonably high quality password with letters and numbers and I think you'll be just fine. |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | A strong password prevents viruses and worms from guessing it and inflicting more damage. Many worms try to replicate via SMB/CIFS and guessing the local admin password. | In my case, yes. I use Mac OS X and the Keychain feature that comes with it. It stores my passwords to websites and network shares in a secure database that is unlocked when I log in to my laptop.
The passwords in that database are encrypted (Triple DES) and can't be easily exposed just by having physical access to th... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | A strong password prevents viruses and worms from guessing it and inflicting more damage. Many worms try to replicate via SMB/CIFS and guessing the local admin password. | What value is your data? Is it more valuable than the hardware itself? Stealing data of an unencrypted drive pretty easy . . . But if you aren't a high value target - just have a reasonably high quality password with letters and numbers and I think you'll be just fine. |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | I'd say yes, you should always use a password on a laptop. As for a very secure password, it probably isn't necessary. Thieves and such aren't known for being the brightest bulbs in the chandelier. Chances are, if your laptop gets stolen, the thief is just looking to make a quick and dishonest buck and even a basic dic... | A burglar once took off with two laptops from my employer. These were later found again, with the hard-disks nicely formatted running a Dutch version of Windows XP. (We only use English Windows versions, so we know it was reformatted and not hacked.) The thief got caught when he'd crashed his car while driving the stol... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | Sure. Tying your bike to a tree with a rope is more secure than not tying it at all. The fact that there are ways around some security-devices doesn't mean you're just as vulnerable without them. Even if you're not encrypting your data, use a strong password because it will still offer some degree of protection. In all... | If it gets stolen, not really... but
If it's a complex password it will be harder or impossible to crack - meaning that yes, the data on the laptop is compromised - but as most people re-use passwords and if the thief can crack your password and figure out who you are, the thief may gain access to other resources of y... |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | I'd say yes, you should always use a password on a laptop. As for a very secure password, it probably isn't necessary. Thieves and such aren't known for being the brightest bulbs in the chandelier. Chances are, if your laptop gets stolen, the thief is just looking to make a quick and dishonest buck and even a basic dic... | Yes, there are benefits.
For one, the casual snooper is prevented from accessing your data.
However, with things like the TRK (<http://trinityhome.org/Home/index.php?wpid=1&front_id=12>) keep in mind that the only real security is full-drive encryption. |
26,001 | I was wondering whether an Admin password like "gW%94Slkx" on a laptop is any safer than, say, "abc" if your HDD is not encrypted. If you lose your laptop or if it gets stolen, all your data is easily accessible anyway. And there are shareware/freeware utilities to recover the password anyway. Any good reason for the f... | 2009/08/19 | [
"https://superuser.com/questions/26001",
"https://superuser.com",
"https://superuser.com/users/5872/"
] | On the contrary, I say no.
The only benefit of '$$%fOe.\_ba' over an 'abc' password is if someone attempts to crack your password.
YES have a password, any password. You're owned anyway, but joe shmo will be foiled.
don't reuse this password. If someone with skill DOES get your pc, sure, they will get your data, bu... | If it gets stolen, not really... but
If it's a complex password it will be harder or impossible to crack - meaning that yes, the data on the laptop is compromised - but as most people re-use passwords and if the thief can crack your password and figure out who you are, the thief may gain access to other resources of y... |
8,925,670 | I am using the following code to create an 'auto-sized' image:
```
String id="foo bar";
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 200;
Bitmap bitmap = new Bitmap(Width,Height);
Graphics graphics = Graphics.FromIm... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8925670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145150/"
] | You have to use:
```
SizeF size = graphics.MeasureString(id, font);
```
This will give you exactly your id dimension using choosen font.
See [MeasureString](http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring%28v=vs.100%29.aspx) syntax.
So you could do
```
Bitmap bmp = new Bitmap(1, 1)... | You can try this method. i have calculated fontsize based on image width and length of text.
```
private void WriteWatermarkText(Image image)
{
string watermark = config.Watermark.Text;
if (string.IsNullOrEmpty(watermark))
return;
// Pick an appropriate fon... |
8,925,670 | I am using the following code to create an 'auto-sized' image:
```
String id="foo bar";
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 200;
Bitmap bitmap = new Bitmap(Width,Height);
Graphics graphics = Graphics.FromIm... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8925670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145150/"
] | You have to use:
```
SizeF size = graphics.MeasureString(id, font);
```
This will give you exactly your id dimension using choosen font.
See [MeasureString](http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring%28v=vs.100%29.aspx) syntax.
So you could do
```
Bitmap bmp = new Bitmap(1, 1)... | Have a look at Measurestring and GetTextExtent GDI methods to get the size of the text you create then you can re-size the Bitmap size. |
8,925,670 | I am using the following code to create an 'auto-sized' image:
```
String id="foo bar";
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 200;
Bitmap bitmap = new Bitmap(Width,Height);
Graphics graphics = Graphics.FromIm... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8925670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145150/"
] | You have to use:
```
SizeF size = graphics.MeasureString(id, font);
```
This will give you exactly your id dimension using choosen font.
See [MeasureString](http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring%28v=vs.100%29.aspx) syntax.
So you could do
```
Bitmap bmp = new Bitmap(1, 1)... | I have a little method that using one Font it iterates decresing the font size in 1 point until the text fits in the given width.
```
Public Function GetBestFitFont(ByVal pText As String, ByVal pFontInitial As Font, ByVal pWidth As Integer, ByVal g As Graphics) As Font
Dim mfont As Font = pFontInitial
... |
8,925,670 | I am using the following code to create an 'auto-sized' image:
```
String id="foo bar";
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 200;
Bitmap bitmap = new Bitmap(Width,Height);
Graphics graphics = Graphics.FromIm... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8925670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145150/"
] | I have a little method that using one Font it iterates decresing the font size in 1 point until the text fits in the given width.
```
Public Function GetBestFitFont(ByVal pText As String, ByVal pFontInitial As Font, ByVal pWidth As Integer, ByVal g As Graphics) As Font
Dim mfont As Font = pFontInitial
... | You can try this method. i have calculated fontsize based on image width and length of text.
```
private void WriteWatermarkText(Image image)
{
string watermark = config.Watermark.Text;
if (string.IsNullOrEmpty(watermark))
return;
// Pick an appropriate fon... |
8,925,670 | I am using the following code to create an 'auto-sized' image:
```
String id="foo bar";
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 200;
Bitmap bitmap = new Bitmap(Width,Height);
Graphics graphics = Graphics.FromIm... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8925670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145150/"
] | I have a little method that using one Font it iterates decresing the font size in 1 point until the text fits in the given width.
```
Public Function GetBestFitFont(ByVal pText As String, ByVal pFontInitial As Font, ByVal pWidth As Integer, ByVal g As Graphics) As Font
Dim mfont As Font = pFontInitial
... | Have a look at Measurestring and GetTextExtent GDI methods to get the size of the text you create then you can re-size the Bitmap size. |
3,235,616 | Normally, the way I am solving those problems is the following:
$3T(\frac{n}{2})+ n^4$
$a=3 ; b = 2 ; d=4$
then I am doing $\log(b(a))$ which is $log(2(3))= 0.6$
Since $0.6 < d$ I can apply the 1st case of the Master Therom which is $n^d$
My issue right now is I have to solve $T(n) = 2T (\frac{n}{4}) + (\sqrt n)$
... | 2019/05/22 | [
"https://math.stackexchange.com/questions/3235616",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/597217/"
] | We know master's theorem as $$T(n)=aT(\frac{n}{b})+\Theta(n^k \log ^p n)$$
Comparing this with your question $T(n) = 2T (\frac{n}{4}) + (\sqrt n)$, we get $a=2, b=4,p=0,k=\frac{1}{2}$.
$a=\bf{2} ~~\& ~~ b^k = 4^{1/2}=\bf{2}$
$\because a=b^k ~~ \& ~~ p> -1$, we have $$T(n)=\Theta(n^{\log\_ba}\log^{p+1}n)$$
Substittin... | $$\log\_ba=\log\_42=1/2\implies f(n)=\sqrt n\in\Theta(n^{\log\_ba})$$Thus, by the Master Theorem, $T(n)\in\Theta(\sqrt n\log n)$. |
582,280 | I want to use the raise\_application\_error-procedure to stop the login process.
I wrote a trigger, that checks the TERMINAL String, if it is right (I know that isn't realy secure, but at first, it is enough)
So the Trigger works fine and does what i want, but the raise\_application\_error causes an rollback and sends ... | 2009/02/24 | [
"https://Stackoverflow.com/questions/582280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70431/"
] | Read this ask tom-thread: <http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3236035522926> | In the second part of the IF/ELSE add a commit; statement between the Insert and the Raise. This will ensure that the Login failure message is inserted into the database correctly.
You are aware the the on-logon trigger won't stop the user from logging in if they are a DBA (have the DAB role). This is a feature to en... |
1,528,470 | Everyday I have to rename 6 files todaydate.94E and todaydate.94N in txt file and then I have to merge every file.
The example would be:
26/02/2020.94E
26/02/2020 (1).94E
26/02/2020 (2).94E
26/02/2020.94N
26/02/2020 (1).94N
26/02/2020 (2).94N
So, I created this batch to rename and then merge them.
```
if exis... | 2020/02/26 | [
"https://superuser.com/questions/1528470",
"https://superuser.com",
"https://superuser.com/users/1144016/"
] | The command `ren *.94* *.txt` will try to rename all matching files and change their extension to `.txt`.
So what happens first is that `16022020.94e` is renamed to `16022020.txt`.
Then, an attempt is made to rename `16022020.94n` to `16022020.txt` too, but that file already exists so the operation fails.
You seco... | In PowerShell, you could use:
```
gci -FIle | Rename-Item -NewName {$_.BaseName + $_.Extension.Substring(1) + '.txt' }
```
```
Directory: C:\Users\keith\Sandbox\bat file
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/26/2020 1:49 PM ... |
63,241 | I'll be taking a written test in a few weeks to become a part-time translator for an automotive client; they sent me some practice documents in the meantime.
I am having issues at the moment, since I just don't understand the context well enough for my intuition to kick in. It's an uphill battle but I must improve to... | 2018/12/04 | [
"https://japanese.stackexchange.com/questions/63241",
"https://japanese.stackexchange.com",
"https://japanese.stackexchange.com/users/32160/"
] | It's a sort of 役割語{やくわりご}, though I don't any other character in fiction that uses it. 私様{わたくしさま} makes her 'regal' personality sound both queenly and extremely arrogant, which is the exact vibe she is going for. Interestingly, in the first game she pairs it with more modern 'regal, haughty woman' speech, but in the se... | It means “I/me/myself” but it is unusual to use this form rather than わたし or わたくし. Referring to yourself (or your inner circle) with an honorific is very impolite. These titles (such as さん, 氏, or 様) are typically used to refer to others, just like you don't call yourself "Mr/Ms", "Sir/Madam", "the Right Honorable", or ... |
69,650 | Ezekiel 23:1-2 NASB
>
> The word of the Lord came to me again, saying, 2 “Son of man, there were two women, ***the daughters of one mother***;
>
>
>
It is clear in the above text that the prophet is referring to Israel and Judah as the two daughters of one mother who are symbolized as Oholah and Oholibah.
Ezekie... | 2021/10/05 | [
"https://hermeneutics.stackexchange.com/questions/69650",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/16527/"
] | Oholah = Samaria = Northern Kingdom = collective names of 10 tribes
Oholibah = Judah = Southern Kingdom = collective names of 2 tribes
They have the same mother, meaning they have the same origin and before the kingdom divided, the united kingdom was called Israel. So Israel was the mother.
The names were metaphor to... | This could refer to the once-unified Israel having been divided into 2 different kingdoms. (The result being Judah was its own kingdom under David).
1 Kings 12:20 (KJV)
>
> And it came to pass, when all Israel heard that Jeroboam was come
> again, that they sent and called him unto the congregation, and made
> him k... |
69,650 | Ezekiel 23:1-2 NASB
>
> The word of the Lord came to me again, saying, 2 “Son of man, there were two women, ***the daughters of one mother***;
>
>
>
It is clear in the above text that the prophet is referring to Israel and Judah as the two daughters of one mother who are symbolized as Oholah and Oholibah.
Ezekie... | 2021/10/05 | [
"https://hermeneutics.stackexchange.com/questions/69650",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/16527/"
] | Oholah = Samaria = Northern Kingdom = collective names of 10 tribes
Oholibah = Judah = Southern Kingdom = collective names of 2 tribes
They have the same mother, meaning they have the same origin and before the kingdom divided, the united kingdom was called Israel. So Israel was the mother.
The names were metaphor to... | Ezekiel 23:4 NASB
>
> 4 Their names were Oholah the elder and Oholibah her sister. And they became Mine, and they gave birth to sons and daughters. And as for their names, Samaria is Oholah and Jerusalem is Oholibah
>
>
>
Oholah referred to the Northern Kingdom of Israel. Oholibah referred to the Southern Kingdom... |
12,899,514 | I'm trying to get the data from a `JTextField` to a `JTable` when the button Add
`ActionListener`:
```
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == AddBtn) {
System.out.println("HELLOO");
String nextRowId = Integer.toString(model.getRowCount());
... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12899514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1374820/"
] | The reason that nothing happens is that you update a `TableModel` which is not set on any `JTable`.
You use
```
JTable table = new JTable(data, columns);
```
to construct the table, instead of
```
JTable table = new JTable( model );
``` | I haven't tested your code, but when you create your `JTable` (as read from your pastebin link), you use the following line:
`JTable table = new JTable(data, columns);`
You should specify your model instead of the raw data, the modifications mades to the model will show in your table:
`JTable table = new JTable (mod... |
12,899,514 | I'm trying to get the data from a `JTextField` to a `JTable` when the button Add
`ActionListener`:
```
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == AddBtn) {
System.out.println("HELLOO");
String nextRowId = Integer.toString(model.getRowCount());
... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12899514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1374820/"
] | I haven't tested your code, but when you create your `JTable` (as read from your pastebin link), you use the following line:
`JTable table = new JTable(data, columns);`
You should specify your model instead of the raw data, the modifications mades to the model will show in your table:
`JTable table = new JTable (mod... | When I look your code, you haven't used the TableModel which you are updating into the Table.
If you want to notify your JTable about changes of your data, use
tableModel.fireTableDataChanged()
Please refer <http://docs.oracle.com/javase/7/docs/api/javax/swing/table/AbstractTableModel.html#fireTableDataChanged%28%29... |
12,899,514 | I'm trying to get the data from a `JTextField` to a `JTable` when the button Add
`ActionListener`:
```
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == AddBtn) {
System.out.println("HELLOO");
String nextRowId = Integer.toString(model.getRowCount());
... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12899514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1374820/"
] | There are two problems with the code.
The first has already been pointed out `JTable table = new JTable(data, columns)` is basically constructing it's own model, so when you try and add something your model in the action listener it's not the same model as that being used by the table.
The other is you declare the mo... | I haven't tested your code, but when you create your `JTable` (as read from your pastebin link), you use the following line:
`JTable table = new JTable(data, columns);`
You should specify your model instead of the raw data, the modifications mades to the model will show in your table:
`JTable table = new JTable (mod... |
12,899,514 | I'm trying to get the data from a `JTextField` to a `JTable` when the button Add
`ActionListener`:
```
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == AddBtn) {
System.out.println("HELLOO");
String nextRowId = Integer.toString(model.getRowCount());
... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12899514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1374820/"
] | The reason that nothing happens is that you update a `TableModel` which is not set on any `JTable`.
You use
```
JTable table = new JTable(data, columns);
```
to construct the table, instead of
```
JTable table = new JTable( model );
``` | When I look your code, you haven't used the TableModel which you are updating into the Table.
If you want to notify your JTable about changes of your data, use
tableModel.fireTableDataChanged()
Please refer <http://docs.oracle.com/javase/7/docs/api/javax/swing/table/AbstractTableModel.html#fireTableDataChanged%28%29... |
12,899,514 | I'm trying to get the data from a `JTextField` to a `JTable` when the button Add
`ActionListener`:
```
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == AddBtn) {
System.out.println("HELLOO");
String nextRowId = Integer.toString(model.getRowCount());
... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12899514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1374820/"
] | There are two problems with the code.
The first has already been pointed out `JTable table = new JTable(data, columns)` is basically constructing it's own model, so when you try and add something your model in the action listener it's not the same model as that being used by the table.
The other is you declare the mo... | When I look your code, you haven't used the TableModel which you are updating into the Table.
If you want to notify your JTable about changes of your data, use
tableModel.fireTableDataChanged()
Please refer <http://docs.oracle.com/javase/7/docs/api/javax/swing/table/AbstractTableModel.html#fireTableDataChanged%28%29... |
50,569,435 | So I'm trying to run a function, while returning its' return value to a variable, so that I can run another function with that information, but separately. I want to know if, when I do this, it actually runs the whole function.
Example:
```
function a() {
blah blah blah;
return b;
}
var c = a();
function d(x) {
... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50569435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9108653/"
] | At the moment `text2vec` doesn't provide any functionality for downloading/manipulating pre-trained word embeddings.
I have a drafts to add such utilities to the next release.
But on other side you can easily do it manually with just standard R tools. For example here is how to read [fasttext](https://github.com/face... | This comes a bit late, but might be of interest for other users. Taylor Van Anne provides a little tutorial how to use pretrained GloVe vector models with text2vec here:
<https://gist.github.com/tjvananne/8b0e7df7dcad414e8e6d5bf3947439a9> |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | This isn't a hotkey as such but can be accomplished entirely on the keyboard and doesn't require any programs or system changes:
`ALT`+`h`, `w` and then press `↑` or `↓` as many times as necessary. | Another shortcut on Windows10 will be:
alt+h, w - than right-click on "New Dokument" and from the dropdown menu choose "Add gallery to QuickAccess Toolbar". Now the whole dropdown menu is accessible on every WindowsExplorer Window at the very, very top left of the window.
Now whenever you need to open a WinExplorer win... |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | You can also do this:
`Shift` + `F10`(it will open context menu)
And then press `w` then `t` | Perhaps due to my bilingual keyboard
(and also non-english default-system-language Windows),
I actually couldn't reproduce "w" then "t" answers.
So I found **another similar solution** instead, that works just as nietly:
`Context menu` (usually on the right side between "Alt" and "Ctrl"),
+ `Up arrow` (tw... |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | Perhaps due to my bilingual keyboard
(and also non-english default-system-language Windows),
I actually couldn't reproduce "w" then "t" answers.
So I found **another similar solution** instead, that works just as nietly:
`Context menu` (usually on the right side between "Alt" and "Ctrl"),
+ `Up arrow` (tw... | 1- Create a batch file (.bat) that opens notepad
2- Create a shortcut of the batch file and add keyboard shortcut for it
Batch file contents:
```
@echo off
start notepad.exe
exit
``` |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | This isn't a hotkey as such but can be accomplished entirely on the keyboard and doesn't require any programs or system changes:
`ALT`+`h`, `w` and then press `↑` or `↓` as many times as necessary. | Perhaps due to my bilingual keyboard
(and also non-english default-system-language Windows),
I actually couldn't reproduce "w" then "t" answers.
So I found **another similar solution** instead, that works just as nietly:
`Context menu` (usually on the right side between "Alt" and "Ctrl"),
+ `Up arrow` (tw... |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | You can actually use your keyboard to naviagte the right-click menu.
Just `right click` and press `W` then `T`.
------------------------------------------
---
If you want to customise a keyboard shortcut, you could use something like [AutoHotKey](https://autohotkey.com/ "AutoHotKey"). An example script to do what... | 1- Create a batch file (.bat) that opens notepad
2- Create a shortcut of the batch file and add keyboard shortcut for it
Batch file contents:
```
@echo off
start notepad.exe
exit
``` |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | This isn't a hotkey as such but can be accomplished entirely on the keyboard and doesn't require any programs or system changes:
`ALT`+`h`, `w` and then press `↑` or `↓` as many times as necessary. | I use QTTabBar.Open QTTabBar options. Keyboard Shortcuts. Scroll down to Create a new txt file. It has assigned Ctrl + Shft + T already. Highlight and change it to F8 or any other. Done. In explorer press F8 and it creates "New Text Document" |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | You can actually use your keyboard to naviagte the right-click menu.
Just `right click` and press `W` then `T`.
------------------------------------------
---
If you want to customise a keyboard shortcut, you could use something like [AutoHotKey](https://autohotkey.com/ "AutoHotKey"). An example script to do what... | This is the autohotkey script I'm using,
* Works on file dialogs (save as / open file)
* Works even though a file is selected
* Works even though cursor is positioned off screen
.
```
; New text file
#IfWinActive AHK_CLASS #32770
Capslock & f11::
#IfWinActive AHK_CLASS CabinetWClass
Capslock & f11::
... |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | Another shortcut on Windows10 will be:
alt+h, w - than right-click on "New Dokument" and from the dropdown menu choose "Add gallery to QuickAccess Toolbar". Now the whole dropdown menu is accessible on every WindowsExplorer Window at the very, very top left of the window.
Now whenever you need to open a WinExplorer win... | 1- Create a batch file (.bat) that opens notepad
2- Create a shortcut of the batch file and add keyboard shortcut for it
Batch file contents:
```
@echo off
start notepad.exe
exit
``` |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | This is the autohotkey script I'm using,
* Works on file dialogs (save as / open file)
* Works even though a file is selected
* Works even though cursor is positioned off screen
.
```
; New text file
#IfWinActive AHK_CLASS #32770
Capslock & f11::
#IfWinActive AHK_CLASS CabinetWClass
Capslock & f11::
... | Perhaps due to my bilingual keyboard
(and also non-english default-system-language Windows),
I actually couldn't reproduce "w" then "t" answers.
So I found **another similar solution** instead, that works just as nietly:
`Context menu` (usually on the right side between "Alt" and "Ctrl"),
+ `Up arrow` (tw... |
1,091,269 | I'm trying to mail merge a MS Word letter with a MS Excel file which contains dates and times as well as other fields. I'm trying to put together for calling people to interviews at different times. Even though I have set the time format to show hours and minutes, e.g. 11.30, when I mail merge it the time also shows up... | 2016/06/20 | [
"https://superuser.com/questions/1091269",
"https://superuser.com",
"https://superuser.com/users/608169/"
] | You can actually use your keyboard to naviagte the right-click menu.
Just `right click` and press `W` then `T`.
------------------------------------------
---
If you want to customise a keyboard shortcut, you could use something like [AutoHotKey](https://autohotkey.com/ "AutoHotKey"). An example script to do what... | I use QTTabBar.Open QTTabBar options. Keyboard Shortcuts. Scroll down to Create a new txt file. It has assigned Ctrl + Shft + T already. Highlight and change it to F8 or any other. Done. In explorer press F8 and it creates "New Text Document" |
2,420,637 | in MySQL, If I create a unique key on two columns, say
UNIQUE KEY `my_key` (`column1`, `column2`)
is it necessary to build another key on `column1`? My goal is to have column1 and column2 to be unique, and I'll do lots of selects keyed by column1. | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156153/"
] | No, it is not necessary because an index on (column1, column2) can be used instead of an index of column1 alone.
You might want to make a new index on just column two though as the index (column1, column2) is not good when searching only for (column2). | No, your `my_key` index takes care of any queries on `column1` or conditions on `column1` AND `column2`. However, if you make queries on only `column2`, then you should add an additional index for `column2` to be able to query it efficiently.
Furthermore, if both `column1` and `column2` are unique, then you might want... |
2,420,637 | in MySQL, If I create a unique key on two columns, say
UNIQUE KEY `my_key` (`column1`, `column2`)
is it necessary to build another key on `column1`? My goal is to have column1 and column2 to be unique, and I'll do lots of selects keyed by column1. | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156153/"
] | No, it is not necessary because an index on (column1, column2) can be used instead of an index of column1 alone.
You might want to make a new index on just column two though as the index (column1, column2) is not good when searching only for (column2). | A UNIQUE-index is a [btree-index](http://en.wikipedia.org/wiki/Btree). This index is sorted and that's why you don't need a second index on the first colummn. The sort order of the combination will also work for only the first column, but not for only the second column. |
2,420,637 | in MySQL, If I create a unique key on two columns, say
UNIQUE KEY `my_key` (`column1`, `column2`)
is it necessary to build another key on `column1`? My goal is to have column1 and column2 to be unique, and I'll do lots of selects keyed by column1. | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156153/"
] | No, your `my_key` index takes care of any queries on `column1` or conditions on `column1` AND `column2`. However, if you make queries on only `column2`, then you should add an additional index for `column2` to be able to query it efficiently.
Furthermore, if both `column1` and `column2` are unique, then you might want... | A UNIQUE-index is a [btree-index](http://en.wikipedia.org/wiki/Btree). This index is sorted and that's why you don't need a second index on the first colummn. The sort order of the combination will also work for only the first column, but not for only the second column. |
46,183,011 | I am trying to compute a summation and Pi. I have gotten the Pi calculation to work, but am having difficulty on the summation. The output of the summation is supposed to calculate 1/3 + 3/5 + 5/7 .... a number/n the nth term is the user input, but I am uncertain about my calculation. If I input 5 the output should cal... | 2017/09/12 | [
"https://Stackoverflow.com/questions/46183011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7151148/"
] | I guess, you are doing the right calculation. I just changed the way you were using i. Also you just need to update the count how many times exactly you would like to go.
This is how I changed it
```
double userInput = 11;
int count =0;
if(userInput>=3){
count =(int)( userInput-1)/2;
... | According to your question your series is r/n where n is the nth term. Use this simple function to sum the series up to nth term.
```
private static void sum_up_series(int nth) {
double sum = 0;
for (int i = 0; i < nth; i++) {
int r = (1 + (i * 2));
int n = (3 + (i * 2));
if (n <= nth) ... |
42,436,766 | I'm trying to teach myself ansible by deploying a wordpress instance from a build server to another host server. Both servers are Ubuntu 16.04 and everything works fine until the build gets to running the mysql tasks main.yml file when i get the below error:
"the python mysqldb module is required"
I have included pyt... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42436766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2516193/"
] | You can install this as per-req:
```
- name: Install required software
apt: name={{ item }} state=present
sudo: yes
with_items:
- apache2
- build-essential
- python-dev
- libmysqlclient-dev
- python-mysqldb
- mysql-server
- mysql-client
- php7.0
- php7.0-mysql
- libapache2... | I had the same issue with error
>
> **{"changed": false, "failed": true, "msg": "the python mysqldb module is required"}**
>
>
>
Running this playbook fixed my issue. Tested on vagrant box `ubuntu/precise64`
```
---
- hosts: vagrant1
gather_facts: no
tasks:
- name: "updating server"
apt:
update_c... |
42,436,766 | I'm trying to teach myself ansible by deploying a wordpress instance from a build server to another host server. Both servers are Ubuntu 16.04 and everything works fine until the build gets to running the mysql tasks main.yml file when i get the below error:
"the python mysqldb module is required"
I have included pyt... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42436766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2516193/"
] | I had the same issue with error
>
> **{"changed": false, "failed": true, "msg": "the python mysqldb module is required"}**
>
>
>
Running this playbook fixed my issue. Tested on vagrant box `ubuntu/precise64`
```
---
- hosts: vagrant1
gather_facts: no
tasks:
- name: "updating server"
apt:
update_c... | Well, let's think about why this happens.
Ubuntu 16.04 comes by default with Python 3.5.1 installed as the python3 binary. Python 2 is still installable but is not default.
When we use ubuntu 16.04 with ansible usually we have some broken changes because the most of ansible modules are created by Python 2 and this err... |
42,436,766 | I'm trying to teach myself ansible by deploying a wordpress instance from a build server to another host server. Both servers are Ubuntu 16.04 and everything works fine until the build gets to running the mysql tasks main.yml file when i get the below error:
"the python mysqldb module is required"
I have included pyt... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42436766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2516193/"
] | You can install this as per-req:
```
- name: Install required software
apt: name={{ item }} state=present
sudo: yes
with_items:
- apache2
- build-essential
- python-dev
- libmysqlclient-dev
- python-mysqldb
- mysql-server
- mysql-client
- php7.0
- php7.0-mysql
- libapache2... | Well, let's think about why this happens.
Ubuntu 16.04 comes by default with Python 3.5.1 installed as the python3 binary. Python 2 is still installable but is not default.
When we use ubuntu 16.04 with ansible usually we have some broken changes because the most of ansible modules are created by Python 2 and this err... |
42,436,766 | I'm trying to teach myself ansible by deploying a wordpress instance from a build server to another host server. Both servers are Ubuntu 16.04 and everything works fine until the build gets to running the mysql tasks main.yml file when i get the below error:
"the python mysqldb module is required"
I have included pyt... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42436766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2516193/"
] | You can install this as per-req:
```
- name: Install required software
apt: name={{ item }} state=present
sudo: yes
with_items:
- apache2
- build-essential
- python-dev
- libmysqlclient-dev
- python-mysqldb
- mysql-server
- mysql-client
- php7.0
- php7.0-mysql
- libapache2... | In my case this works.
```
- apt:
name: "{{ item }}"
state: present
update_cache: True
with_items:
- mysql-server
- python3-pip
- libmysqlclient-dev
- python3-dev
- python3-mysqldb
``` |
42,436,766 | I'm trying to teach myself ansible by deploying a wordpress instance from a build server to another host server. Both servers are Ubuntu 16.04 and everything works fine until the build gets to running the mysql tasks main.yml file when i get the below error:
"the python mysqldb module is required"
I have included pyt... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42436766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2516193/"
] | In my case this works.
```
- apt:
name: "{{ item }}"
state: present
update_cache: True
with_items:
- mysql-server
- python3-pip
- libmysqlclient-dev
- python3-dev
- python3-mysqldb
``` | Well, let's think about why this happens.
Ubuntu 16.04 comes by default with Python 3.5.1 installed as the python3 binary. Python 2 is still installable but is not default.
When we use ubuntu 16.04 with ansible usually we have some broken changes because the most of ansible modules are created by Python 2 and this err... |
688,152 | I am trying to declare List in PowerShell, where the Person is defined using Add-Type:
```
add-type -Language CSharpVersion3 -TypeDefinition @"
public class Person
{
public Person() {}
public string First { get; set; }
public string Last { get; set; }
}
"@
```
This works fine:
... | 2009/03/27 | [
"https://Stackoverflow.com/questions/688152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62192/"
] | This is a bug in New-Object. This will help you create them more easily:
<http://www.leeholmes.com/blog/2006/08/18/creating-generic-types-in-powershell>
UPDATE: PowerShell added support for this in Version 2:
```
PS > $r = New-Object "System.Collections.Generic.List[Int]"
PS > $r.Add(10)
``` | Well, I was trying to create a list of `FileStream` objects and this was my solution (based on [this link](http://blogs.msdn.com/b/thottams/archive/2009/10/12/generic-list-and-powershell.aspx) -- which actually describes a way to solve your problem):
```
$fs = New-Object 'System.Collections.Generic.List[System.IO.File... |
43,974,330 | I am trying to use `lean` in my mongoDB query but the problem I am facing is that I don't use `.exec()` method. I use callback implementation like below
```
model.find({user_id: mobile_no }, {'_id':0, 'type':1}, {sort: {dateTime: -1}, skip: page*page_size, limit: page_size + 1}, function(err, docs) {
if (err) {
... | 2017/05/15 | [
"https://Stackoverflow.com/questions/43974330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6387388/"
] | You can use both `.exec()` and callbacks:
```
model.find(...).lean().exec(function(err, docs) {
...
});
```
See also [the documentation](http://mongoosejs.com/docs/api.html#query_Query-lean), where one of the examples does the same. | ```
model.find({user_id: mobile_no }, {'_id':0, 'type':1}, {sort: {dateTime: -1}, skip: page*page_size, limit: page_size + 1}, function(err, docs) {
if (err) {
} else {
}
}).lean();
```
You have to write .lean() at the end of the query :3 |
10,219,341 | I am looking for a little help in configuring NAGIOS for NRPE. I am quite new at Linux and seem to be having some trouble getting this working.
I am running Ubuntu 11.10 with the Nagios 3.3.1 core and Nagios plugins 1.4.15 running nrpe2.13
Currently I am trying to get the Nagios Exchange plugin `check_be.exe` to wo... | 2012/04/18 | [
"https://Stackoverflow.com/questions/10219341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1342658/"
] | This looks wrong
```
check_command check_nrpe! -t 240 -c check_be
```
I think those extra arguments need to be in the define command block.
Also change the name of the check\_command. You may confuse the check\_nrpe executable command (runs in terminal) with your check\_command of the same name (which is unknown... | You should read pdf from the following link you will get maximum posible answer
for NRPE NAGIOS comunication problem.
<http://assets.nagios.com/downloads/nagiosxi/docs/NRPE_Troubleshooting_and_Common_Solutions.pdf> |
44,961,834 | I very simply want something to run
* every say 20 seconds
* simply only when the app is foreground (explicitly not run when background)
* obviously, it would be more elegant if you don't have to bother following the app going in and out of foreground
* The issue, I was amazed to learn with `scheduleRepeating` that, i... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44961834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294884/"
] | ### Behind the scenes:
It isn't *gorgeous*, but it works pretty darn well.
```
struct ForegroundTimer {
static var sharedTimerDelegate: ForegroundTimerDelegate?
static var sharedTimer = Timer()
private var timeInterval: Double = 20.0
static func startTimer() {
ForegroundTimer.waitingTimer.in... | @Dopapp's answer is pretty solid and I'd go with it but if you want it even simpler you can try something with the RunLoop:
```
let timer = Timer.scheduledTimer(withTimeInterval: wait, repeats: true) { _ in print("time passed") }
RunLoop.current.add(timer, forMode: RunLoopMode.commonModes)
```
This will even give y... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | Try `LowercaseContractResolver` instead
```
var settings = new JsonSerializerSettings();
settings.ContractResolver = new LowercaseContractResolver();
var json = JsonConvert.DeserializeObject(input.DataJson, settings);
``` | This is easy way without Regex. Replace every [{ "A] with [{ "a]
```
var json = "{ \"Client\": { \"Name\": \"John\" } }";
var newJson = string.Empty;
foreach (var w in json.Split(new[] { "{ \"" }, StringSplitOptions.RemoveEmptyEntries))
{
if (w[0] != null)
{
newJson += "{ \"" + (w[0].ToString().ToLowe... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | If I understood you correctly, you need to modify properties in your Json string, but not convert the Json into object.
In this case you can try to parse Json into JObject and replace properties in that object.
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var prop... | Try `LowercaseContractResolver` instead
```
var settings = new JsonSerializerSettings();
settings.ContractResolver = new LowercaseContractResolver();
var json = JsonConvert.DeserializeObject(input.DataJson, settings);
``` |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | Try `LowercaseContractResolver` instead
```
var settings = new JsonSerializerSettings();
settings.ContractResolver = new LowercaseContractResolver();
var json = JsonConvert.DeserializeObject(input.DataJson, settings);
``` | All other solutions here modify the original object. Here's an immutable version which returns a new object with lowercase properties:
```
public static class JsonExtensions
{
public static JToken ToLowerRecursive(this JToken token)
{
if (token is JObject jobj)
return new JObject(jobj.Prope... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | If I understood you correctly, you need to modify properties in your Json string, but not convert the Json into object.
In this case you can try to parse Json into JObject and replace properties in that object.
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var prop... | This is easy way without Regex. Replace every [{ "A] with [{ "a]
```
var json = "{ \"Client\": { \"Name\": \"John\" } }";
var newJson = string.Empty;
foreach (var w in json.Split(new[] { "{ \"" }, StringSplitOptions.RemoveEmptyEntries))
{
if (w[0] != null)
{
newJson += "{ \"" + (w[0].ToString().ToLowe... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | Extending [Anton Semenov](https://stackoverflow.com/users/592835/anton-semenov) answer for cases when `JSON` can contain an `Array` of `Objects`:
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var property in jsonObject.Properties().ToList())
{
if (property.Value.Typ... | This is easy way without Regex. Replace every [{ "A] with [{ "a]
```
var json = "{ \"Client\": { \"Name\": \"John\" } }";
var newJson = string.Empty;
foreach (var w in json.Split(new[] { "{ \"" }, StringSplitOptions.RemoveEmptyEntries))
{
if (w[0] != null)
{
newJson += "{ \"" + (w[0].ToString().ToLowe... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | All other solutions here modify the original object. Here's an immutable version which returns a new object with lowercase properties:
```
public static class JsonExtensions
{
public static JToken ToLowerRecursive(this JToken token)
{
if (token is JObject jobj)
return new JObject(jobj.Prope... | This is easy way without Regex. Replace every [{ "A] with [{ "a]
```
var json = "{ \"Client\": { \"Name\": \"John\" } }";
var newJson = string.Empty;
foreach (var w in json.Split(new[] { "{ \"" }, StringSplitOptions.RemoveEmptyEntries))
{
if (w[0] != null)
{
newJson += "{ \"" + (w[0].ToString().ToLowe... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | If I understood you correctly, you need to modify properties in your Json string, but not convert the Json into object.
In this case you can try to parse Json into JObject and replace properties in that object.
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var prop... | Extending [Anton Semenov](https://stackoverflow.com/users/592835/anton-semenov) answer for cases when `JSON` can contain an `Array` of `Objects`:
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var property in jsonObject.Properties().ToList())
{
if (property.Value.Typ... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | If I understood you correctly, you need to modify properties in your Json string, but not convert the Json into object.
In this case you can try to parse Json into JObject and replace properties in that object.
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var prop... | All other solutions here modify the original object. Here's an immutable version which returns a new object with lowercase properties:
```
public static class JsonExtensions
{
public static JToken ToLowerRecursive(this JToken token)
{
if (token is JObject jobj)
return new JObject(jobj.Prope... |
48,558,099 | I'm getting from client json string:
```
{ "Client": { "Name": "John" } }
```
but for the further handling I need the following json:
```
{ "client": { "name": "John" } }
```
I tried something like that, but it didn't help:
```
public class LowerCaseNamingStrategy : NamingStrategy
{
protected override string... | 2018/02/01 | [
"https://Stackoverflow.com/questions/48558099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525734/"
] | Extending [Anton Semenov](https://stackoverflow.com/users/592835/anton-semenov) answer for cases when `JSON` can contain an `Array` of `Objects`:
```
private static void ChangePropertiesToLowerCase(JObject jsonObject)
{
foreach (var property in jsonObject.Properties().ToList())
{
if (property.Value.Typ... | All other solutions here modify the original object. Here's an immutable version which returns a new object with lowercase properties:
```
public static class JsonExtensions
{
public static JToken ToLowerRecursive(this JToken token)
{
if (token is JObject jobj)
return new JObject(jobj.Prope... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.