qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | ```js
const fetchData = async () => {
try {
const responsesJSON = await Promise.all([
fetch('https://jsonplaceholder.typicode.com/todos/1'),
fetch('https://jsonplaceholder.typicode.com/todos/2')
]);
const [todoOne, todoTwo] = await Promise.all(responsesJSON.map(r => r.json()));
console... | My suggestion:
```js
let url = "https://jsonplaceholder.typicode.com/todos/";
async function doRequest() {
let toDo1 = await (await fetch(url + "1")).json();
console.log(toDo1);
let toDo2 = await (await fetch(url + "2")).json();
console.log(toDo2);
}
doRequest()
.catch(err => console.log(err));
```
This w... |
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | The problem was on my side. I was accidentally filtering the browser console. However thank you all for your help.
[](https://i.stack.imgur.com/1wcSp.png) | please use axios for fetch data in js . react or angular etc...
<https://github.com/axios/axios>
please install with npm and read doc
```
$ npm install axios
```
```
axios.get('/user')
.then(function (response) {
console.log(response);
axios.get('/user') .then(function (res) {
console.log(res);
... |
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | You can try this thing. I tested it on a fiddle and it looks like it works.
```js
Promise.all([
fetch("https://jsonplaceholder.typicode.com/todos/1"),
fetch("https://jsonplaceholder.typicode.com/todos/2")
]).then(responses =>
Promise.all(responses.map(response => response.json()))
).then(data =>
console.log(da... | please use axios for fetch data in js . react or angular etc...
<https://github.com/axios/axios>
please install with npm and read doc
```
$ npm install axios
```
```
axios.get('/user')
.then(function (response) {
console.log(response);
axios.get('/user') .then(function (res) {
console.log(res);
... |
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | My suggestion:
```js
let url = "https://jsonplaceholder.typicode.com/todos/";
async function doRequest() {
let toDo1 = await (await fetch(url + "1")).json();
console.log(toDo1);
let toDo2 = await (await fetch(url + "2")).json();
console.log(toDo2);
}
doRequest()
.catch(err => console.log(err));
```
This w... | please use axios for fetch data in js . react or angular etc...
<https://github.com/axios/axios>
please install with npm and read doc
```
$ npm install axios
```
```
axios.get('/user')
.then(function (response) {
console.log(response);
axios.get('/user') .then(function (res) {
console.log(res);
... |
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | You can try this thing. I tested it on a fiddle and it looks like it works.
```js
Promise.all([
fetch("https://jsonplaceholder.typicode.com/todos/1"),
fetch("https://jsonplaceholder.typicode.com/todos/2")
]).then(responses =>
Promise.all(responses.map(response => response.json()))
).then(data =>
console.log(da... | The problem was on my side. I was accidentally filtering the browser console. However thank you all for your help.
[](https://i.stack.imgur.com/1wcSp.png) |
66,635,290 | I need to wait for two `fetch()` API calls and then to save data from each fetch to different window object. I found this article <https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/> and tried following code to wait for the API calls:
```
Promise.all([
... | 2021/03/15 | [
"https://Stackoverflow.com/questions/66635290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12054189/"
] | You can try this thing. I tested it on a fiddle and it looks like it works.
```js
Promise.all([
fetch("https://jsonplaceholder.typicode.com/todos/1"),
fetch("https://jsonplaceholder.typicode.com/todos/2")
]).then(responses =>
Promise.all(responses.map(response => response.json()))
).then(data =>
console.log(da... | My suggestion:
```js
let url = "https://jsonplaceholder.typicode.com/todos/";
async function doRequest() {
let toDo1 = await (await fetch(url + "1")).json();
console.log(toDo1);
let toDo2 = await (await fetch(url + "2")).json();
console.log(toDo2);
}
doRequest()
.catch(err => console.log(err));
```
This w... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | There are several texts that are readable. One is available on IMSLP: <https://imslp.org/wiki/Thorough-Bass_Made_Easy_(Pasquali%2C_Nicolo)>
Arnold's two volume set is available from Dover so not too expensive. Not all thorough bass manuals agree with each other. Likewise, much modern stuff (like secondary dominants AK... | Thanks to you I have found this link:
<https://www.musik-akademie.ch/dam/jcr:da28dd16-cec4-4f03-8b6c-56c4236bfe9f/Compendium_Generalbass_nur_Text_ohne_Audio.pdf>
It's in German and translated to English. So it will be very fine to me - as I'm here to make an course in English. If you want to learn German too it will b... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | There are several texts that are readable. One is available on IMSLP: <https://imslp.org/wiki/Thorough-Bass_Made_Easy_(Pasquali%2C_Nicolo)>
Arnold's two volume set is available from Dover so not too expensive. Not all thorough bass manuals agree with each other. Likewise, much modern stuff (like secondary dominants AK... | For myself and others a list of terms...
* figured bass: a system to represent chords, synonymous with 'thorough bass'
* basso continuo : executing a figured bass
* partimenti : figured bass exercises to teach students harmony and practice basso continuo performance
[The Art of Partimento](https://rads.stackoverflow... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | There are several texts that are readable. One is available on IMSLP: <https://imslp.org/wiki/Thorough-Bass_Made_Easy_(Pasquali%2C_Nicolo)>
Arnold's two volume set is available from Dover so not too expensive. Not all thorough bass manuals agree with each other. Likewise, much modern stuff (like secondary dominants AK... | ### TL;DR
The curriculum for one modern course (ca. 2012) is based on:
1. Fux, *The Study of Counterpoint*
2. Morris, *Figured Harmony at the Keyboard*
3. Kearney, *Figured Bass for Beginners*
---
I took a course in figured bass as part of a university music degree program. It was considered an upper-level course a... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | As someone who is currently learning to play from figured bass on the harpsichord, I can recommend starting with the book "Continuo Playing According to Handel: His figured bass exercises" edited and with commentary by David Ledbetter.
The exercises start with just root position chords for the first exercise and mostl... | Thanks to you I have found this link:
<https://www.musik-akademie.ch/dam/jcr:da28dd16-cec4-4f03-8b6c-56c4236bfe9f/Compendium_Generalbass_nur_Text_ohne_Audio.pdf>
It's in German and translated to English. So it will be very fine to me - as I'm here to make an course in English. If you want to learn German too it will b... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | Thanks to you I have found this link:
<https://www.musik-akademie.ch/dam/jcr:da28dd16-cec4-4f03-8b6c-56c4236bfe9f/Compendium_Generalbass_nur_Text_ohne_Audio.pdf>
It's in German and translated to English. So it will be very fine to me - as I'm here to make an course in English. If you want to learn German too it will b... | ### TL;DR
The curriculum for one modern course (ca. 2012) is based on:
1. Fux, *The Study of Counterpoint*
2. Morris, *Figured Harmony at the Keyboard*
3. Kearney, *Figured Bass for Beginners*
---
I took a course in figured bass as part of a university music degree program. It was considered an upper-level course a... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | As someone who is currently learning to play from figured bass on the harpsichord, I can recommend starting with the book "Continuo Playing According to Handel: His figured bass exercises" edited and with commentary by David Ledbetter.
The exercises start with just root position chords for the first exercise and mostl... | For myself and others a list of terms...
* figured bass: a system to represent chords, synonymous with 'thorough bass'
* basso continuo : executing a figured bass
* partimenti : figured bass exercises to teach students harmony and practice basso continuo performance
[The Art of Partimento](https://rads.stackoverflow... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | For myself and others a list of terms...
* figured bass: a system to represent chords, synonymous with 'thorough bass'
* basso continuo : executing a figured bass
* partimenti : figured bass exercises to teach students harmony and practice basso continuo performance
[The Art of Partimento](https://rads.stackoverflow... | ### TL;DR
The curriculum for one modern course (ca. 2012) is based on:
1. Fux, *The Study of Counterpoint*
2. Morris, *Figured Harmony at the Keyboard*
3. Kearney, *Figured Bass for Beginners*
---
I took a course in figured bass as part of a university music degree program. It was considered an upper-level course a... |
82,093 | I've done some reading and I've discovered that our modern system of music theory (I'm looking at you Roman numeral analysis) is not the same system that most of the great composers used, including the "Big Three": Mozart, Bach, and Beethoven. Apparently, they favored the system of thoroughbass. Bach himself was suppos... | 2019/03/28 | [
"https://music.stackexchange.com/questions/82093",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/58699/"
] | As someone who is currently learning to play from figured bass on the harpsichord, I can recommend starting with the book "Continuo Playing According to Handel: His figured bass exercises" edited and with commentary by David Ledbetter.
The exercises start with just root position chords for the first exercise and mostl... | ### TL;DR
The curriculum for one modern course (ca. 2012) is based on:
1. Fux, *The Study of Counterpoint*
2. Morris, *Figured Harmony at the Keyboard*
3. Kearney, *Figured Bass for Beginners*
---
I took a course in figured bass as part of a university music degree program. It was considered an upper-level course a... |
35,440,719 | I have to manage a cash register from PHP. If I run the following commands via cmd there are no problems. The cash register print the string perfectly.
I write the commands in this order:
```
powershell
[System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$por... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35440719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5267909/"
] | Have you installed Django on the instance? It looks like Django is either not installed or is not being picked up.
If you you using a virtualenv, you'll need to add the path to it in your config file:
```
WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python2.7/site-packages
```
Here is some more docume... | You can deploy with nginx and gunicorn.
There is a great example to do this:
[How To Install and Configure Django with Postgres, Nginx, and Gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn)
and one more:
[Setting up Django with Nginx, Gunic... |
35,440,719 | I have to manage a cash register from PHP. If I run the following commands via cmd there are no problems. The cash register print the string perfectly.
I write the commands in this order:
```
powershell
[System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$por... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35440719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5267909/"
] | You can use many web server and app server to deploy Django app but **[here](http://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html)** in this tutorial all instruction are given step by step and there is a **[video tutorial](https://www.youtube.com/watch?v=jN9iPaQzZbQ)** as well to guide through all the inst... | Have you installed Django on the instance? It looks like Django is either not installed or is not being picked up.
If you you using a virtualenv, you'll need to add the path to it in your config file:
```
WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python2.7/site-packages
```
Here is some more docume... |
35,440,719 | I have to manage a cash register from PHP. If I run the following commands via cmd there are no problems. The cash register print the string perfectly.
I write the commands in this order:
```
powershell
[System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$por... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35440719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5267909/"
] | You can use many web server and app server to deploy Django app but **[here](http://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html)** in this tutorial all instruction are given step by step and there is a **[video tutorial](https://www.youtube.com/watch?v=jN9iPaQzZbQ)** as well to guide through all the inst... | You can deploy with nginx and gunicorn.
There is a great example to do this:
[How To Install and Configure Django with Postgres, Nginx, and Gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn)
and one more:
[Setting up Django with Nginx, Gunic... |
35,440,719 | I have to manage a cash register from PHP. If I run the following commands via cmd there are no problems. The cash register print the string perfectly.
I write the commands in this order:
```
powershell
[System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$por... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35440719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5267909/"
] | This is one of the most daunting tasks, especially if you want to deploy it with celery and migrations.
I suggest you use AWS Elastic Beanstalk, a managed to deploy your django app. You can use container commands to run migrations before each deployment too.
The following tutorial worked really well for me: <https:/... | You can deploy with nginx and gunicorn.
There is a great example to do this:
[How To Install and Configure Django with Postgres, Nginx, and Gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn)
and one more:
[Setting up Django with Nginx, Gunic... |
35,440,719 | I have to manage a cash register from PHP. If I run the following commands via cmd there are no problems. The cash register print the string perfectly.
I write the commands in this order:
```
powershell
[System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$por... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35440719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5267909/"
] | You can use many web server and app server to deploy Django app but **[here](http://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html)** in this tutorial all instruction are given step by step and there is a **[video tutorial](https://www.youtube.com/watch?v=jN9iPaQzZbQ)** as well to guide through all the inst... | This is one of the most daunting tasks, especially if you want to deploy it with celery and migrations.
I suggest you use AWS Elastic Beanstalk, a managed to deploy your django app. You can use container commands to run migrations before each deployment too.
The following tutorial worked really well for me: <https:/... |
24,506 | Is there anyway for me to play a music stream (google play music, I already got the streamURL) in the raspberry pi via node? (and also, output it to audio port). | 2014/11/17 | [
"https://raspberrypi.stackexchange.com/questions/24506",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7943/"
] | If you are using nodejs, try using the [nodejs groove module](https://www.npmjs.com/package/groove) which supports network streams and playback control. This module contains native code which requires `libgroove`.
To install libgroove for raspbian, I have followed the following guide and succeeded: [Turn Your Raspberr... | Use Simon Weber's [gmusicapi](http://unofficial-google-music-api.readthedocs.org/en/latest/) python library to access Google Play Music
First install gmusicapi and mplayer
```
pip install gmusicapi
apt-get install mplayer
```
Then use my sample code. Any comments are welcome. I couldn't solve the 'device\_id' probl... |
58,005,512 | First, I installed and configured Bazel, now I am able to succesfully compile and deploy app, using that [tutorial](https://docs.bazel.build/versions/master/tutorial/android-app.html).
However, I'm stuck with Android Studio. I installed official Bazel plugin, then tried to import my Bazel project to Android studio (im... | 2019/09/19 | [
"https://Stackoverflow.com/questions/58005512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1209216/"
] | I have similar issue. And it seems like it is broken in WKWebView from iOS 12 onwards (even in iOS 13). So, either you reload the data in viewWillAppear or use **PDFKit's PDFView** to render pdf.
But it is for iOS 11 and above. And if your app supports iOS 10 or below, use both because webview works fine for iOS 11 a... | If you add below code line into viewWillAppear when view is will appear load the pdf content for you.
```
if let pdfURL = pdfURLS {
self.webView.loadFileURL(pdfURL,
allowingReadAccessTo: pdfURL.deletingLastPathComponent())
}
```
I think that's solve your issues. |
169,501 | I'm working on a Drupal 7 project. And for this I need to get all the users that have a certain permission for a `node`. I need this info in the `hook_node_update` method, which means that I can currently get the `$node` object just fine but I'm unable to find a way to query a list of users that have edit rights to the... | 2015/08/11 | [
"https://drupal.stackexchange.com/questions/169501",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/50534/"
] | This:
```
node-accommodation-form
```
Is the **HTML ID** of the form, found in `$form['#id']` (confusing I know). You need the **internal ID**, which is
```
node_accommodation_form
```
As in:
```
function zeilschepen_form_alter(&$form, &$form_state, $form_id){
switch ($form_id) {
case 'node_accommodation_f... | I think **hook\_form\_alter()** will help you. Try this:
```
function yourmodule_form_alter(&$form, &$form_state, $form_id){
if($form_id == "your form id") {
drupal_add_js('your js file');
}
}
``` |
169,501 | I'm working on a Drupal 7 project. And for this I need to get all the users that have a certain permission for a `node`. I need this info in the `hook_node_update` method, which means that I can currently get the `$node` object just fine but I'm unable to find a way to query a list of users that have edit rights to the... | 2015/08/11 | [
"https://drupal.stackexchange.com/questions/169501",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/50534/"
] | This:
```
node-accommodation-form
```
Is the **HTML ID** of the form, found in `$form['#id']` (confusing I know). You need the **internal ID**, which is
```
node_accommodation_form
```
As in:
```
function zeilschepen_form_alter(&$form, &$form_state, $form_id){
switch ($form_id) {
case 'node_accommodation_f... | You need to use [hook\_form\_alter(&$form, &$form\_state, $form\_id)](https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_form_alter/7) function. place this function in the `template.php` and print the `$form_id`, So now you can get the ID of the `add/edit` form.
Now you must use [drupal\_add... |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | I don't know if it's the *best* way:
```
Hash[arr.map{ |el| [el, 0] }]
``` | I would do this:
```
arr.inject({}) { |hash, key| hash.update(key => 0) }
``` |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | I don't know if it's the *best* way:
```
Hash[arr.map{ |el| [el, 0] }]
``` | ```
Hash[ *arr.collect { |v| [ v, 0 ] }.flatten ]
``` |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | ```
arr.product([0]).to_h
```
or for versions < 2.0
```
Hash[arr.product([0])]
``` | I don't know if it's the *best* way:
```
Hash[arr.map{ |el| [el, 0] }]
``` |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | I don't know if it's the *best* way:
```
Hash[arr.map{ |el| [el, 0] }]
``` | You can also do
```
arr.each_with_object({}) {|v, h| h[v] = 1}
```
where:
* `v` is the value of each element in the array,
* `h` represents the hash object |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | ```
arr.product([0]).to_h
```
or for versions < 2.0
```
Hash[arr.product([0])]
``` | I would do this:
```
arr.inject({}) { |hash, key| hash.update(key => 0) }
``` |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | I would do this:
```
arr.inject({}) { |hash, key| hash.update(key => 0) }
``` | You can also do
```
arr.each_with_object({}) {|v, h| h[v] = 1}
```
where:
* `v` is the value of each element in the array,
* `h` represents the hash object |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | ```
arr.product([0]).to_h
```
or for versions < 2.0
```
Hash[arr.product([0])]
``` | ```
Hash[ *arr.collect { |v| [ v, 0 ] }.flatten ]
``` |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | ```
Hash[ *arr.collect { |v| [ v, 0 ] }.flatten ]
``` | You can also do
```
arr.each_with_object({}) {|v, h| h[v] = 1}
```
where:
* `v` is the value of each element in the array,
* `h` represents the hash object |
30,497,533 | what is the best way to convert an array of
```
arr = ["one", "two", "three", "four", "five"]
```
to hash of
```
{"one"=>0, "two"=>0, "three"=>0, "four"=>0, "five"=>0}
```
Iam planning to fillup the '0' with my own values later, I just need the technique now.
Thanks. | 2015/05/28 | [
"https://Stackoverflow.com/questions/30497533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551514/"
] | ```
arr.product([0]).to_h
```
or for versions < 2.0
```
Hash[arr.product([0])]
``` | You can also do
```
arr.each_with_object({}) {|v, h| h[v] = 1}
```
where:
* `v` is the value of each element in the array,
* `h` represents the hash object |
6,149,770 | Is there any difference between using `new RegExp("regex");` and `/same_regex/` to test against a target string? I am asking this question because I got different validating result while use these two approaches. Here is the snippet I used to validate an email field:
```
var email="didxga@gmail.comblah@foo.com";
var... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6149770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231010/"
] | If you use the constructor to create a new *RegExp* object instead of the literal syntax, you need to escape the `\` properly:
```
new RegExp("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$")
```
This is necessary as in JavaS... | this will be a help for you
<http://www.regular-expressions.info/javascript.html>
see the 'How to Use The JavaScript RegExp Object' section
if you are using RegExp(regx) regx should be in string format ex:-
\w+ can be created as `regx = /\w+/` or as `regx = new RegExp("\\w+")`. |
6,149,770 | Is there any difference between using `new RegExp("regex");` and `/same_regex/` to test against a target string? I am asking this question because I got different validating result while use these two approaches. Here is the snippet I used to validate an email field:
```
var email="didxga@gmail.comblah@foo.com";
var... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6149770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231010/"
] | `/.../` is called a *regular expression literal*. `new RegExp` uses the RegExp constructor function and creates a Regular Expression Object.
From [Mozilla's developer pages](https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions)
>
> Regular expression literals provide
> compilation of the regular e... | this will be a help for you
<http://www.regular-expressions.info/javascript.html>
see the 'How to Use The JavaScript RegExp Object' section
if you are using RegExp(regx) regx should be in string format ex:-
\w+ can be created as `regx = /\w+/` or as `regx = new RegExp("\\w+")`. |
6,149,770 | Is there any difference between using `new RegExp("regex");` and `/same_regex/` to test against a target string? I am asking this question because I got different validating result while use these two approaches. Here is the snippet I used to validate an email field:
```
var email="didxga@gmail.comblah@foo.com";
var... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6149770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231010/"
] | If you use the constructor to create a new *RegExp* object instead of the literal syntax, you need to escape the `\` properly:
```
new RegExp("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$")
```
This is necessary as in JavaS... | Difference is in escaping at least in your case.
When you use / / notation, you have to escape '/' with '\/', when you're using Regexp notation you escape quotes |
6,149,770 | Is there any difference between using `new RegExp("regex");` and `/same_regex/` to test against a target string? I am asking this question because I got different validating result while use these two approaches. Here is the snippet I used to validate an email field:
```
var email="didxga@gmail.comblah@foo.com";
var... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6149770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231010/"
] | If you use the constructor to create a new *RegExp* object instead of the literal syntax, you need to escape the `\` properly:
```
new RegExp("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$")
```
This is necessary as in JavaS... | `/.../` is called a *regular expression literal*. `new RegExp` uses the RegExp constructor function and creates a Regular Expression Object.
From [Mozilla's developer pages](https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions)
>
> Regular expression literals provide
> compilation of the regular e... |
6,149,770 | Is there any difference between using `new RegExp("regex");` and `/same_regex/` to test against a target string? I am asking this question because I got different validating result while use these two approaches. Here is the snippet I used to validate an email field:
```
var email="didxga@gmail.comblah@foo.com";
var... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6149770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231010/"
] | `/.../` is called a *regular expression literal*. `new RegExp` uses the RegExp constructor function and creates a Regular Expression Object.
From [Mozilla's developer pages](https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions)
>
> Regular expression literals provide
> compilation of the regular e... | Difference is in escaping at least in your case.
When you use / / notation, you have to escape '/' with '\/', when you're using Regexp notation you escape quotes |
5,078 | I'm not a wine man but I believe the general rule is to keep the cork wet, although the story is entirely different with whisky due to the effect of its high alcohol content breaking down the cork.
If the rule for whisky is to store the bottle upright, will it not suffer the same fate as wine stored upright? Assuming ... | 2016/06/10 | [
"https://beer.stackexchange.com/questions/5078",
"https://beer.stackexchange.com",
"https://beer.stackexchange.com/users/5538/"
] | **Hard spirits naturally [degrade over time once opened](http://onlinelibrary.wiley.com/doi/10.1111/j.1530-0277.2009.01116.x/full)**
You've already opened the bottle because you wanted to actually enjoy the drink, here are step you can take to help ensure the slow and unstoppable flavor degradation takes as long as po... | You should **not** keep the cork wet. The high alcohol content of most distilled spirits will begin to dissolve the cork, which is highly undesirable. They should always be stored upright. This applies to metal screw tops as well, as metal catalyzes the breakdown of organic compounds.
To improve the lifespan, the best... |
45,924,477 | This is a function to insert into a sorted linked list but it is showing segmentation fault (SIGSEGV)
```
void sortedInsert(struct node **head_ref, int data) {
struct node *new_node, *prev, *current;
new_node = (struct node*)malloc(sizeof(struct node));
new_node->data = data;
new_node->next = NULL;
... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7817731/"
] | Most likely the segmentation fault here is because of the statement:
```
while(current->data<data&¤t!=NULL)
{
prev=current;
current=current->next;
}
```
The current pointer here is being dereferenced without being checked for NULL. You should try changing the condition to `while(curren... | if this statement fails on the first iteration:
```
while(current->data<data&¤t!=NULL)
```
then this statement:
```
prev->next=new_node;
```
will be accessing an offset from address 0 which will almost always result in a seg fault event. |
45,924,477 | This is a function to insert into a sorted linked list but it is showing segmentation fault (SIGSEGV)
```
void sortedInsert(struct node **head_ref, int data) {
struct node *new_node, *prev, *current;
new_node = (struct node*)malloc(sizeof(struct node));
new_node->data = data;
new_node->next = NULL;
... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7817731/"
] | Most likely the segmentation fault here is because of the statement:
```
while(current->data<data&¤t!=NULL)
{
prev=current;
current=current->next;
}
```
The current pointer here is being dereferenced without being checked for NULL. You should try changing the condition to `while(curren... | The bug is here: `while (current->data < data && current != NULL)`. The pointer must be checked against `NULL` **before** it is dereferenced:
```
while (current != NULL && current->data < data)
```
Note that this function can be simplified with a single loop:
```
void sortedInsert(struct node **head_ref, int data) ... |
45,924,477 | This is a function to insert into a sorted linked list but it is showing segmentation fault (SIGSEGV)
```
void sortedInsert(struct node **head_ref, int data) {
struct node *new_node, *prev, *current;
new_node = (struct node*)malloc(sizeof(struct node));
new_node->data = data;
new_node->next = NULL;
... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45924477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7817731/"
] | The bug is here: `while (current->data < data && current != NULL)`. The pointer must be checked against `NULL` **before** it is dereferenced:
```
while (current != NULL && current->data < data)
```
Note that this function can be simplified with a single loop:
```
void sortedInsert(struct node **head_ref, int data) ... | if this statement fails on the first iteration:
```
while(current->data<data&¤t!=NULL)
```
then this statement:
```
prev->next=new_node;
```
will be accessing an offset from address 0 which will almost always result in a seg fault event. |
73,325,759 | I'm using Django REST framework. I've created a model for items in an inventory system and also a through table (named subassembly) for many-to-many relationship between items themselves, so an item can be a subpart of other items and vice versa.
I'm just not sure I've done it right and I can't seem to get any results... | 2022/08/11 | [
"https://Stackoverflow.com/questions/73325759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13097237/"
] | Dart does not have RAII. You instead would need to use [`try`-`finally`](https://dart.dev/guides/language/language-tour#finally).
(Dart did recently (in 2.17) add [`Finalizer`](https://api.dart.dev/stable/2.17.0/dart-core/Finalizer-class.html)s, but those would fire when objects are garbage collected, which might happ... | And just for the record, an example of using `try`/`finally`:
```dart
void myFunc() async {
await myLock.acquire();
try {
if(...) {
return;
}
...
} finally {
myLock.release();
}
}
```
You'd want to start the `try` *after* allocating the resource, so that you don't try to release if... |
21,043,362 | Main method in Java have the **String[]** as input parameter to the main method, but i want to pass **object** as a parameter. Java and all command line parametrized languages accept only String array of arguments which make sense as our ability to call using command line gives us the ability to enter text that could b... | 2014/01/10 | [
"https://Stackoverflow.com/questions/21043362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2795357/"
] | I now found a solution to this problem at [tex.stackexchange.com](https://tex.stackexchange.com/questions/9707/how-to-left-align-a-table-in-latex). Apparently pandoc inserts `\centering` for every float in the document. This can be cancelled by inserting `\let\centering\relax` in a custom preample to pandoc (as pandoc ... | I was not able to get the solutions here to work--in LaTeX. I created a new longtable environment to make tables the way I wanted them. That was easier in the end. Here's an example Rmd file.
```
---
title: "Custom table"
header-includes:
- \usepackage{longtable,booktabs}
output: pdf_document
---
\newenvironment{my... |
21,043,362 | Main method in Java have the **String[]** as input parameter to the main method, but i want to pass **object** as a parameter. Java and all command line parametrized languages accept only String array of arguments which make sense as our ability to call using command line gives us the ability to enter text that could b... | 2014/01/10 | [
"https://Stackoverflow.com/questions/21043362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2795357/"
] | I now found a solution to this problem at [tex.stackexchange.com](https://tex.stackexchange.com/questions/9707/how-to-left-align-a-table-in-latex). Apparently pandoc inserts `\centering` for every float in the document. This can be cancelled by inserting `\let\centering\relax` in a custom preample to pandoc (as pandoc ... | I've found this solution [here](https://groups.google.com/g/pandoc-discuss/c/X_1tpGufN_w).
a simple `\usepackage` in `header-includes:` that looks doing the job itself...
```
- \usepackage[margins=raggedright]{floatrow}
```
I hope it won't have side effects. Currently, on my pandoc generated pdfs, none, but I don'... |
8,180 | Somehow I have gotten my Mac Mini into a state where every time I press a modifier key - shift, option, command or control - it shows an image of the symbol of the modifier key around the upper right of the screen. This is quite annoying and I do not know what this feature is called so it is difficult for me to find in... | 2011/02/11 | [
"https://apple.stackexchange.com/questions/8180",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/-1/"
] | It sounds like you have the “Sticky Keys” feature enabled.
To control the setting, open the *System Preferences* application ( > System Preferences…), load the *Universal Access* preference pane, goto the *Keyboard* tab. You can turn “Sticky Keys” Off (or On) there. You may also want to disable the “Press the Shift k... | Go to System Preferences then select "Accessibility" then in both "General" and "Keyboard" sections, disable the sticky keys in the Keyboard and de-select the Sticky Keys in the Keyboard section. |
24,347,415 | I'm using [this example](https://stackoverflow.com/a/12575951/2016196) for javascript encryption using a key generated with the php `openssl` library, but `$details = openssl_pkey_get_details($resource)` is returning no public exponent (`$details['rsa']['e']`).
This is how I'm generating it:
```
function genKeys() {
... | 2014/06/22 | [
"https://Stackoverflow.com/questions/24347415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2016196/"
] | Instead of this:
```
when('/friends', {
templateUrl: 'partials/friends.html',
controller: 'controllers/siteController.js'
})
```
You may need to write this:
```
when('/friends', {
templateUrl: 'partials/friends.html',
controller: 'FriendsController'
})
```
And also you need to link all the... | Each time you do this:
```
var socialApp = angular.module('socialApp', []);
```
You are declaring a new module (and blowing away the previous declaration). Your application code only needs to do this once, I would recommend keeping that in config.js
In all the other javascript files that you wish to use the module,... |
24,347,415 | I'm using [this example](https://stackoverflow.com/a/12575951/2016196) for javascript encryption using a key generated with the php `openssl` library, but `$details = openssl_pkey_get_details($resource)` is returning no public exponent (`$details['rsa']['e']`).
This is how I'm generating it:
```
function genKeys() {
... | 2014/06/22 | [
"https://Stackoverflow.com/questions/24347415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2016196/"
] | Instead of this:
```
when('/friends', {
templateUrl: 'partials/friends.html',
controller: 'controllers/siteController.js'
})
```
You may need to write this:
```
when('/friends', {
templateUrl: 'partials/friends.html',
controller: 'FriendsController'
})
```
And also you need to link all the... | I m on phone so i might be wrong but... i dont see You including sitecontroller.js and headercontroller.js in Your html file. I see only config file included. |
16,041,671 | Excel 2010 ships with some functions that contain a period in their name. For example `STDEV.S` and `PERCENTILE.EXC`
Is it possible to assign a name to my own function with a name such as `PERCENTILE.CUSTOM` using VBA?
For example, I would like to reference the following function using the formula `=NAME.SUFFIX()`
`... | 2013/04/16 | [
"https://Stackoverflow.com/questions/16041671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688265/"
] | As @SiddharthRout already suggested, external libraries have fewer restrictions than VBA when it comes to declaring function names, so periods are permitted in external names.
Despite the MSDN documentation, it *is* possible to use *some* special characters in VBA identifiers, including UDFs. The special characters ca... | It is not possible from VBA. [This MSDN article](http://msdn.microsoft.com/en-gb/library/sect4ck6.aspx) shows how to define a function in VBA, and specifically [this article](http://msdn.microsoft.com/en-gb/library/81ed9a62.aspx) lays out the rules for element names. |
44,289,889 | The following code works fine the only problem is that the click event get queued like for example the `setTimeout` gets called for each click and the popup appears multiple times. How to make the popup appear only when user clicks and to ensure that gap between each popup is lets say 4 seconds
```
var showpopup = 1;
... | 2017/05/31 | [
"https://Stackoverflow.com/questions/44289889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7736455/"
] | This is called *function throttling* :
```
function throttle(func){
var timeout=null;
return function(...args){
if(!timeout) func(...args), timeout=setTimeout(_=>timeout=null,4000);//if were not waiting, execute the function and start waiting
}
}
```
So you can do
```
var alert=throttle(window.alert);
al... | Lodash has a [throttle](https://lodash.com/docs/#throttle) function for this.
```
_.throttle(func, [wait=0], [options={}])
``` |
44,289,889 | The following code works fine the only problem is that the click event get queued like for example the `setTimeout` gets called for each click and the popup appears multiple times. How to make the popup appear only when user clicks and to ensure that gap between each popup is lets say 4 seconds
```
var showpopup = 1;
... | 2017/05/31 | [
"https://Stackoverflow.com/questions/44289889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7736455/"
] | This is called *function throttling* :
```
function throttle(func){
var timeout=null;
return function(...args){
if(!timeout) func(...args), timeout=setTimeout(_=>timeout=null,4000);//if were not waiting, execute the function and start waiting
}
}
```
So you can do
```
var alert=throttle(window.alert);
al... | The following code solves the problem without using throttle
// JavaScript Document
```
var showpopup = 1;
var check = true;
var seconds = 4000; // change the frequency here current frequency = 2 seconds
var url = "https://www.fb.com"; // change the url here
var strWindowFeatures = "toolbar=yes,scrollbars... |
4,433,208 | Can somebody please give me some links / tutorials to using SQLite file thatis stored on a SD card? Not implementing the OpenHandler.
/SD CARD//info.db
I want to use an external SQlite database file (not use Android internal data store) because I want to frequently update the database file to provide more up to date... | 2010/12/13 | [
"https://Stackoverflow.com/questions/4433208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186446/"
] | Have you tried using [`SQLiteDatabase.openOrCreateDatabase(String, SQLiteDatabase.CursorFactory)`](http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#openOrCreateDatabase%28java.lang.String,%20android.database.sqlite.SQLiteDatabase.CursorFactory%29)? You can simply pass `"/sdcard/info.db... | I would recommend you NOT to put the database on the SD-card due to partly security issues (everyone who has physical access to the device and the SD-card, including all applications running on the device, will also have more or less full access rights to the database file) but also due to hardware issues (an SD-card h... |
3,887,960 | For simplicity let $\Bbbk$ be a field of characteristic $0$ and let $A$ be a finitely generated unital associative $\Bbbk$-algebra.
Is it true that for any two simple $A$-modules $S\_1, S\_2$, we have that $\operatorname{Ext}^1\_A (S\_1, S\_2)$ is finite-dimensional?
If not, what would be a simple counterexample, and... | 2020/10/30 | [
"https://math.stackexchange.com/questions/3887960",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/33855/"
] | $$797a+50b=292c$$
Here we see that $a$ must be even, and if $a\ge4$ then the LHS is too big for the RHS to match in magnitude (remember that $0\le c\le 9$). Hence $a=2$:
$$1594+50b=292c$$
Now we see that $c$ must be at least $6$ so that the RHS can match the LHS in magnitude, and must be $2$ or $7$ to match in the last... | >
> Not a 'real' answer, but it was too big for a comment.
>
>
>
I wrote and ran some [Mathematica](https://en.wikipedia.org/wiki/Wolfram_Mathematica)-code:
```
In[1]:=ParallelTable[
If[TrueQ[8*(a*100 + b*10 + c*1) == 3*(100*c + 10*b + 1*a)], {a, b,
c}, Nothing], {a, 1, 9}, {b, 1, 9}, {c, 1, 9}] //. {} -> ... |
55,467,193 | EDIT:
I didn't expect this question to gain traction so quickly. Following from the answers I've already received it seems I may have left out an important piece of information. The pattern is **not a fixed amount of bits**. Some letters might have more or fewer bits. I.e, B has 5 bits, but C might use up to 6 bits, b... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55467193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931018/"
] | >
> Ideally I'd want it to start comparing from the most significant bit somehow which should then print it in the correct order
>
>
>
Seems like a fine idea to me. Did you try anything along those lines? If so, what specifically did you try? What specific difficulty did you have?
In the meantime…
What determine... | You can use the opcode `ROL` which rotates bits toward MSB by one and the MSB would be rotated to the location of LSB, eg :
11110000 -> ROL 1 -> 11100001
So that you can do something like :
ROL1 -> test LSB -> ROL1 -> test LSB -> ....
In your case, bl is an 8-bits regitser, loop the ROL, test 8 times to draw the ... |
55,467,193 | EDIT:
I didn't expect this question to gain traction so quickly. Following from the answers I've already received it seems I may have left out an important piece of information. The pattern is **not a fixed amount of bits**. Some letters might have more or fewer bits. I.e, B has 5 bits, but C might use up to 6 bits, b... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55467193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931018/"
] | >
> Ideally I'd want it to start comparing from the most significant bit somehow which should then print it in the correct order
>
>
>
Seems like a fine idea to me. Did you try anything along those lines? If so, what specifically did you try? What specific difficulty did you have?
In the meantime…
What determine... | >
> The problem is the way that AND works.
>
>
>
Your first problem is the way that a right shift works. A right shift would remove the rightmost "pixel" of your "image" and move the pixel left of that pixel into the rightmost position (so that pixel will be the next pixel to be printed):
```
"$$$ $ $ " ->
" $$$ ... |
55,467,193 | EDIT:
I didn't expect this question to gain traction so quickly. Following from the answers I've already received it seems I may have left out an important piece of information. The pattern is **not a fixed amount of bits**. Some letters might have more or fewer bits. I.e, B has 5 bits, but C might use up to 6 bits, b... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55467193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931018/"
] | >
> The problem is the way that AND works.
>
>
>
Your first problem is the way that a right shift works. A right shift would remove the rightmost "pixel" of your "image" and move the pixel left of that pixel into the rightmost position (so that pixel will be the next pixel to be printed):
```
"$$$ $ $ " ->
" $$$ ... | You can use the opcode `ROL` which rotates bits toward MSB by one and the MSB would be rotated to the location of LSB, eg :
11110000 -> ROL 1 -> 11100001
So that you can do something like :
ROL1 -> test LSB -> ROL1 -> test LSB -> ....
In your case, bl is an 8-bits regitser, loop the ROL, test 8 times to draw the ... |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | In my opinion, the phrases:
1. 'the results' - refers to the specific results that will be refined;
2. 'the categories', - refers to the specific (provided) categories; and,
3. 'the left' - refers to the specific side (i.e., not the right side, not the top, etc.).
So, I don't think the word 'the' is overused. | @shin is correct. "The" is used three times in the sentence. Each time "the" is used, the word that follows "the" gets qualified, becomes specific. The sentence is ok. There is no overuse of "the". |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | @shin is correct, the sentence is fine. **To refine results, please use categories on the left.** is equivalent, but the difference is stylistic. | Technically, the sentence is correct but the is overused. I would rearrange the sentence to say "Refine results using the categories on the left". It removes a couple of words and also makes it a more active sentence. Also when writing instructions, avoid using please. These are instructions for performing a task and n... |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | As others have said, your sentence is fine, as-is.
However, you might change it to "To refine *your* results, please use the categories on the left."
This would mitigate your concerns with the repeated "the". | Being strict, it depends on context.
If this message is an instruction provided before any results have been presented, then "the results" doesn't quite make sense because "the" is the *definite article*. That means "the results" refers to a specific set of results. Which specific results? If results don't already exi... |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | In my opinion, the phrases:
1. 'the results' - refers to the specific results that will be refined;
2. 'the categories', - refers to the specific (provided) categories; and,
3. 'the left' - refers to the specific side (i.e., not the right side, not the top, etc.).
So, I don't think the word 'the' is overused. | Being strict, it depends on context.
If this message is an instruction provided before any results have been presented, then "the results" doesn't quite make sense because "the" is the *definite article*. That means "the results" refers to a specific set of results. Which specific results? If results don't already exi... |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | In my opinion, the phrases:
1. 'the results' - refers to the specific results that will be refined;
2. 'the categories', - refers to the specific (provided) categories; and,
3. 'the left' - refers to the specific side (i.e., not the right side, not the top, etc.).
So, I don't think the word 'the' is overused. | As others have said, your sentence is fine, as-is.
However, you might change it to "To refine *your* results, please use the categories on the left."
This would mitigate your concerns with the repeated "the". |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | As a native speaker, I can definitely say 'the' is not overused in this sentence. The is one of the most common words in the English language, so often in fact you might use the word 'the' over 5,000 times *in one day.* | @shin is correct. "The" is used three times in the sentence. Each time "the" is used, the word that follows "the" gets qualified, becomes specific. The sentence is ok. There is no overuse of "the". |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | As others have said, your sentence is fine, as-is.
However, you might change it to "To refine *your* results, please use the categories on the left."
This would mitigate your concerns with the repeated "the". | @shin is correct. "The" is used three times in the sentence. Each time "the" is used, the word that follows "the" gets qualified, becomes specific. The sentence is ok. There is no overuse of "the". |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | As others have said, your sentence is fine, as-is.
However, you might change it to "To refine *your* results, please use the categories on the left."
This would mitigate your concerns with the repeated "the". | Technically, the sentence is correct but the is overused. I would rearrange the sentence to say "Refine results using the categories on the left". It removes a couple of words and also makes it a more active sentence. Also when writing instructions, avoid using please. These are instructions for performing a task and n... |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | In my opinion, the phrases:
1. 'the results' - refers to the specific results that will be refined;
2. 'the categories', - refers to the specific (provided) categories; and,
3. 'the left' - refers to the specific side (i.e., not the right side, not the top, etc.).
So, I don't think the word 'the' is overused. | As a native speaker, I can definitely say 'the' is not overused in this sentence. The is one of the most common words in the English language, so often in fact you might use the word 'the' over 5,000 times *in one day.* |
74,502 | For some reason I feel its overkilling on the use of article(the) here,
>
> To refine the results, please use the categories on the left
>
>
>
Can someone help? | 2015/12/01 | [
"https://ell.stackexchange.com/questions/74502",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/14217/"
] | As a native speaker, I can definitely say 'the' is not overused in this sentence. The is one of the most common words in the English language, so often in fact you might use the word 'the' over 5,000 times *in one day.* | @shin is correct, the sentence is fine. **To refine results, please use categories on the left.** is equivalent, but the difference is stylistic. |
887,062 | Let $p$ be a prime number $q$ a prime number that divides $2^p -1$.
1. Prove that $p|q-1$
2. Deduce that there are infinitely many prime numbers.
---
1. I think I should use that $a^p \ = \ a\mod p $, because it is the only theorem in my book that has something to do with number theory, but I have no idea how I shou... | 2014/08/04 | [
"https://math.stackexchange.com/questions/887062",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/88135/"
] | (1) If $2$ has order $p$ in $(\mathbb{Z}/q\mathbb{Z})^\*$, the order of $2$ must divide the order of $(\mathbb{Z}/q\mathbb{Z})^\*$ due to Lagrange's theorem;
(2) From $(1)$, any prime $q$ that divides $2^p-1$ satisfies $q\equiv 1\pmod{p}$. In particular, $q>p$. | **Hint for 1.** If $q|2^p-1$, $2^p\equiv1\pmod q$. So $\operatorname{ord}\_q2|p$, which means that $\operatorname{ord}\_q2=1\mbox{ or }p.$ But $\operatorname{ord}\_q2$ cannot be 1. Then use $\operatorname{ord}\_q2|\phi(q)=q-1$.
**p.s.** $\operatorname{ord}\_q2$ is a smallest integer $r\ge0$ such that $2^r\equiv1\pmod ... |
104,704 | I am an entry level web developer for a small company in the US. I do full stack web development and lead my own medium sized projects. I have moved from intern to contractor and now recently to full time employee status.
I was very eager to accept the full time salaried offer of roughly ~45k(healthcare stipend inclu... | 2018/01/05 | [
"https://workplace.stackexchange.com/questions/104704",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/81402/"
] | Face the facts, you accepted the offer. Now would not be the time for you to renegotiate an accepted offer, a 6 month review might be a little early, but it is certainly a time to do so if you believe you have made considerable work, a 1 year might be better given the circumstances.
On that note, comparing salary leve... | It is a bit early to renegotiate after 6 months - but you can still do something.
After your trial period is over (if there is one) you should make a 1-1 appointment with your manager where you ask about a fair appraisal of your performance. Now, grouping the responses to this into 3
*1. Your performance is appraised... |
104,704 | I am an entry level web developer for a small company in the US. I do full stack web development and lead my own medium sized projects. I have moved from intern to contractor and now recently to full time employee status.
I was very eager to accept the full time salaried offer of roughly ~45k(healthcare stipend inclu... | 2018/01/05 | [
"https://workplace.stackexchange.com/questions/104704",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/81402/"
] | Face the facts, you accepted the offer. Now would not be the time for you to renegotiate an accepted offer, a 6 month review might be a little early, but it is certainly a time to do so if you believe you have made considerable work, a 1 year might be better given the circumstances.
On that note, comparing salary leve... | Performance and productivity put aside, it is going to depend a great deal on the general policy of your company regarding salaries. Do you know anything about how your coworkers fare in that department ? I don't suggest you ask directly as this is often a touchy subject as best, but if you know ballpark figures, you m... |
271,791 | Situation: I've got some machines with Dell iDRAC6 Enterprises that I need to kickstart remotely.
Usually, I'd go to the datacenter, jam the CD and floppy (with ks.cfg) in the machine, and be on my way. The last build I did, I "burnt" the ISO onto a flash drive with UNetBootin, jammed all the kickstarts on the root o... | 2011/05/20 | [
"https://serverfault.com/questions/271791",
"https://serverfault.com",
"https://serverfault.com/users/25904/"
] | I had the same problem, though it was for installing an ESXi:
* The Virtal Floppy is considered as generic USB storage (seen in /var/log/messages)
* The USB device need to have a FAT16/FAT32 partition (seen in /usr/lib/vmware/weasel/usbmedia.py), but it looks specific.
Context:
* iDRAC 6 v3.2
* VMware-VMvisor-Insta... | <http://support.dell.com/support/edocs/software/smdrac3/idrac/idrac10mono/en/ug/html/racugc1b.htm>
>
> I cannot locate my Virtual
> Floppy/Virtual CD device on a system
> running Red Hat Enterprise Linux or
> the SUSE® Linux operating system. My
> Virtual Media is attached and I am
> connected to my remote flopp... |
224,806 | I have created a block in the backend of Magento and using the below code added it to the category page-
```
<page>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="category.description" remove="true"/>
<referenceContainer name="sidebar.main">
<block class="Magen... | 2018/05/04 | [
"https://magento.stackexchange.com/questions/224806",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/53356/"
] | **X-Magento-Debug is from varnish.**
If you read the vcl file, you will see X-Magento-Debug there. It will change to **X-Magento-Cache-Debug** once you're in **production mode**. | 1. Varnish header request only displays in **developer** mode. [Click Here](https://devdocs.magento.com/guides/v2.2/config-guide/varnish/config-varnish-final.html)
**First, make sure you are using Magento’s developer mode; otherwise, you won’t see the headers.**
2. Make sure the varnish cache set in the backend as a ... |
224,806 | I have created a block in the backend of Magento and using the below code added it to the category page-
```
<page>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="category.description" remove="true"/>
<referenceContainer name="sidebar.main">
<block class="Magen... | 2018/05/04 | [
"https://magento.stackexchange.com/questions/224806",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/53356/"
] | **X-Magento-Debug is from varnish.**
If you read the vcl file, you will see X-Magento-Debug there. It will change to **X-Magento-Cache-Debug** once you're in **production mode**. | **My Response headers are give below:**
```
Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Tue, 08 May 2018 09:21:19 GMT
Expires: Mon, 08 May 2017 09:20:52 GMT
Pragma: no-cache
Server: nginx/1.10.3
Set-Cookie: for... |
224,806 | I have created a block in the backend of Magento and using the below code added it to the category page-
```
<page>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="category.description" remove="true"/>
<referenceContainer name="sidebar.main">
<block class="Magen... | 2018/05/04 | [
"https://magento.stackexchange.com/questions/224806",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/53356/"
] | **X-Magento-Debug is from varnish.**
If you read the vcl file, you will see X-Magento-Debug there. It will change to **X-Magento-Cache-Debug** once you're in **production mode**. | Check this section in /etc/varnish/default.vcl
```
sub vcl_deliver
```
You'll notice that some headers were unset e.g.
```
unset resp.http.X-Varnish
unset resp.http.X-Magento-Debug;
```
Comment them out if you want to see them in the response headers.
Also make sure that you set your Magento 2 environment to 'de... |
259,600 | I have a problem over Steam. When I open the Batman Arkham Asylum game on Steam it shows this error message:
[](https://i.stack.imgur.com/Rt0oM.jpg)
>
> You must logged in to Steam
>
>
>
But I have logged in Steam! It still shows the same error.
I am very confused over thi... | 2016/03/20 | [
"https://gaming.stackexchange.com/questions/259600",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/142479/"
] | You not only need to be logged into Steam, you also need to buy a copy of [Batman Arkham Asylum](http://store.steampowered.com/app/35140/) and add the game to your Steam account. Instead you've used the "Add Non-Steam Game to My Library" option to add a shortcut to your library. This doesn't add the game to your Steam ... | I had this problem for the game Batman Arkham Asylum too.
You have to copy these two files (steam\_api.dll and steam\_api) from the DVD or you can also find them in the internet.
Second thing you have to copy these files and replace them in the game location file. |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Change your if statement to:
`if (submit == false)`
That'll get your error message to pop up | To solve your error display issue,
`submit = false` should be `submit == false`
`=` is for assignment
`==` is for comparison
Also, initialize your variable to avoid null pointer exception:
`boolean submit = false;` |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Instead of painting on [top-level containers](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html) such as `JApplet` directly, you have to use `JPanel` and paint on it. Just override `paintComponent()` method of `JPanel()`. Never forget to call `super.paintComponent(g)` in overridden method.
sample... | Change your if statement to:
`if (submit == false)`
That'll get your error message to pop up |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Should be if (submit == false) rather than if (submit = false). | To solve your error display issue,
`submit = false` should be `submit == false`
`=` is for assignment
`==` is for comparison
Also, initialize your variable to avoid null pointer exception:
`boolean submit = false;` |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Instead of painting on [top-level containers](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html) such as `JApplet` directly, you have to use `JPanel` and paint on it. Just override `paintComponent()` method of `JPanel()`. Never forget to call `super.paintComponent(g)` in overridden method.
sample... | Should be if (submit == false) rather than if (submit = false). |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Instead of painting on [top-level containers](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html) such as `JApplet` directly, you have to use `JPanel` and paint on it. Just override `paintComponent()` method of `JPanel()`. Never forget to call `super.paintComponent(g)` in overridden method.
sample... | To solve your error display issue,
`submit = false` should be `submit == false`
`=` is for assignment
`==` is for comparison
Also, initialize your variable to avoid null pointer exception:
`boolean submit = false;` |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Two issues:
1) Your submit variable is not initialized, you should initialize it to true/false.
If you dont want to initialize it, you can simple try with
```
if(submit!=null && !submit)
```
2)
Secondly, **"="** is used for assigning a value where as **"=="** is used for comparing
Change
```
if (submit = false) /... | To solve your error display issue,
`submit = false` should be `submit == false`
`=` is for assignment
`==` is for comparison
Also, initialize your variable to avoid null pointer exception:
`boolean submit = false;` |
24,933,917 | I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong?
``... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24933917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831362/"
] | Instead of painting on [top-level containers](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html) such as `JApplet` directly, you have to use `JPanel` and paint on it. Just override `paintComponent()` method of `JPanel()`. Never forget to call `super.paintComponent(g)` in overridden method.
sample... | Two issues:
1) Your submit variable is not initialized, you should initialize it to true/false.
If you dont want to initialize it, you can simple try with
```
if(submit!=null && !submit)
```
2)
Secondly, **"="** is used for assigning a value where as **"=="** is used for comparing
Change
```
if (submit = false) /... |
26,336,172 | I have a simple singly linked list, which I'm trying to step through and print the name of the data at each node, in this case the nodes hold fruits which contain a single field, `name`:
```
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct store
{
struct list * inventory;
};
struct list
{
st... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26336172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
snoozeTimer.
schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
onSnoozeTimerExpiry();
}
});
}
}, snoozeDuration);
``` | use
```
new Handler().postDelayed(Runnable, delaytime);
```
**updated answer:**
you might want to do this
```
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
data = parse(c);
}
}, delayMillis);
``` |
109,147 | I am looking for a way to make the image below straight - like in the line. To make it clear - it would be a tattoo template, which will be placed *around* my upper arm.
[](https://i.stack.imgur.com/zDVLA.jpg)
Is there any solution of this, in Photoshop? | 2018/05/09 | [
"https://graphicdesign.stackexchange.com/questions/109147",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/121042/"
] | It won't be perfect but you could use a Polar Coordinates filter (*Filter → Distort → Polar Coordinates...*) set to "Polar to Rectangular" on the image:
[](https://i.stack.imgur.com/HK5db.png)
The result will be "straight", but will be distorted so you'll at least need to adjus... | This can be done. But not done very accurately. There will be some warping and distortion when you straighten it out. That said, here's what I would do.
1. Cut the piece into 3 separate pieces using your favorite selection method. I suggest the pen tool, but you don't really need to be that accurate.
[
I have reprodu... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The compiler goes out hunting for an operator+() that can take a null argument first. None of the standard value types qualify, null is not a valid value for them. The one and only match is System.String.operator+(), there's no ambiguity.
The 2nd argument of that operator is also a string. That goes kapooey, cannot im... | ```
var b = (null + DateTime.Now); // String
var b = (null + 1); // System.Nullable<Int32> | same with System.Single, System.Double, System.Decimal, System.TimeSpan etc
var b = (null + new Object()); // String | same with any ref type
```
Crazy?? No, there must be a reason behind it.
Someone call `Eric Li... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The compiler goes out hunting for an operator+() that can take a null argument first. None of the standard value types qualify, null is not a valid value for them. The one and only match is System.String.operator+(), there's no ambiguity.
The 2nd argument of that operator is also a string. That goes kapooey, cannot im... | The reason for this is convenience (concatenating strings is a common task).
As BoltClock said, the '+' operator is defined on numeric types, strings, and can be defined for our own types as well (operator overloading).
If there is not an overloaded '+' operator on the argument's types and they are not numeric types,... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The compiler goes out hunting for an operator+() that can take a null argument first. None of the standard value types qualify, null is not a valid value for them. The one and only match is System.String.operator+(), there's no ambiguity.
The 2nd argument of that operator is also a string. That goes kapooey, cannot im... | Interestingly, using Reflector to inspect what is generated, the following code:
```
string b = null + true;
Console.WriteLine(b);
```
is transformed into this by the compiler:
```
Console.WriteLine(true);
```
The reasoning behind this "optimization" is a bit weird I must say, and does not rhyme with the operator... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The reason why is because once you introduce the `+` then the C# operator binding rules come into play. It will consider the set of `+` operators available and select the best overload. One of those operators is the following
```
string operator +(string x, object y)
```
This overload is compatible with the argumen... | The compiler goes out hunting for an operator+() that can take a null argument first. None of the standard value types qualify, null is not a valid value for them. The one and only match is System.String.operator+(), there's no ambiguity.
The 2nd argument of that operator is also a string. That goes kapooey, cannot im... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The reason why is because once you introduce the `+` then the C# operator binding rules come into play. It will consider the set of `+` operators available and select the best overload. One of those operators is the following
```
string operator +(string x, object y)
```
This overload is compatible with the argumen... | Interestingly, using Reflector to inspect what is generated, the following code:
```
string b = null + true;
Console.WriteLine(b);
```
is transformed into this by the compiler:
```
Console.WriteLine(true);
```
The reasoning behind this "optimization" is a bit weird I must say, and does not rhyme with the operator... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | Bizarre as this may seem, it's simply following the rules from the C# language spec.
From section 7.3.4:
>
> An operation of the form x op y, where op is an overloadable binary operator, x is an expression of type X, and y is an expression of type Y, is processed as follows:
>
>
> * The set of candidate user-defin... | The compiler goes out hunting for an operator+() that can take a null argument first. None of the standard value types qualify, null is not a valid value for them. The one and only match is System.String.operator+(), there's no ambiguity.
The 2nd argument of that operator is also a string. That goes kapooey, cannot im... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | Bizarre as this may seem, it's simply following the rules from the C# language spec.
From section 7.3.4:
>
> An operation of the form x op y, where op is an overloadable binary operator, x is an expression of type X, and y is an expression of type Y, is processed as follows:
>
>
> * The set of candidate user-defin... | Interestingly, using Reflector to inspect what is generated, the following code:
```
string b = null + true;
Console.WriteLine(b);
```
is transformed into this by the compiler:
```
Console.WriteLine(true);
```
The reasoning behind this "optimization" is a bit weird I must say, and does not rhyme with the operator... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | The reason why is because once you introduce the `+` then the C# operator binding rules come into play. It will consider the set of `+` operators available and select the best overload. One of those operators is the following
```
string operator +(string x, object y)
```
This overload is compatible with the argumen... | `null` will be cast to null string, and there is implicit converter from bool to string so the `true` will be cast to string and then, `+` operator will be applied: it's like: string str = "" + true.ToString();
if you check it with Ildasm:
`string str = null + true;`
it's as bellow:
```
.locals init ([0] string str... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | Bizarre as this may seem, it's simply following the rules from the C# language spec.
From section 7.3.4:
>
> An operation of the form x op y, where op is an overloadable binary operator, x is an expression of type X, and y is an expression of type Y, is processed as follows:
>
>
> * The set of candidate user-defin... | The reason for this is convenience (concatenating strings is a common task).
As BoltClock said, the '+' operator is defined on numeric types, strings, and can be defined for our own types as well (operator overloading).
If there is not an overloaded '+' operator on the argument's types and they are not numeric types,... |
4,472,900 | Since `true` is not a string type, how is `null + true` a string ?
```
string s = true; //Cannot implicitly convert type 'bool' to 'string'
bool b = null + true; //Cannot implicitly convert type 'string' to 'bool'
```
What is the reason behind this? | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479468/"
] | Bizarre as this may seem, it's simply following the rules from the C# language spec.
From section 7.3.4:
>
> An operation of the form x op y, where op is an overloadable binary operator, x is an expression of type X, and y is an expression of type Y, is processed as follows:
>
>
> * The set of candidate user-defin... | ```
var b = (null + DateTime.Now); // String
var b = (null + 1); // System.Nullable<Int32> | same with System.Single, System.Double, System.Decimal, System.TimeSpan etc
var b = (null + new Object()); // String | same with any ref type
```
Crazy?? No, there must be a reason behind it.
Someone call `Eric Li... |
5,674,099 | When a Blackberry phone is connected via USB and in debug mode, calls made to System.out.println() are visible in the log.
But is there any way to get access to "stdout" even from a program not in debug mode? Attaching with some command line program perhaps? | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193892/"
] | You can wrap the `Message` object and implement [Externalizable](http://download.oracle.com/javase/6/docs/api/java/io/Externalizable.html) interface, whereby you can write the serialization/deserialization logic in `readExternal/writeExternal` methods. | The simplest way that I know of is [xStream](http://xstream.codehaus.org). Here is a [FAQ](http://xstream.codehaus.org/faq.html#Serialization) from the xStream website specifically about this |
10,185,624 | So I've done a lot of searching but still can't seem to find the exact reason as to why my SurfaceView won't display. Here's a little background as to what I'm doing:
I have a Linear Layout that is set Horizontally. It contains an ImageView, then a vertical Linear Layout, and finally another ImageView. In the vertical... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10185624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337844/"
] | I am just putting down the changes.
1. Replace surface view in the xml with LinearLayout.
```
<LinearLayout
android:id="@+id/middleSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
```
2. Get an instance of linear layout
LinearLayout surface = (Linear... | I would examine the layout in the Eclipse UI designer to see if everything is placed as you want to. Surface Views are just ordinary views in regards to layout. |
10,185,624 | So I've done a lot of searching but still can't seem to find the exact reason as to why my SurfaceView won't display. Here's a little background as to what I'm doing:
I have a Linear Layout that is set Horizontally. It contains an ImageView, then a vertical Linear Layout, and finally another ImageView. In the vertical... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10185624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337844/"
] | I am just putting down the changes.
1. Replace surface view in the xml with LinearLayout.
```
<LinearLayout
android:id="@+id/middleSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
```
2. Get an instance of linear layout
LinearLayout surface = (Linear... | If I am not wrong, the way I perceived your query is: You want something to be displayed/rendered on top of the surface view along with the other view elements as you mentioned in the xml.
If you want a view on top of surface view, you need to extend it(AFAIK there is no other way). Then you need to override the onDra... |
10,185,624 | So I've done a lot of searching but still can't seem to find the exact reason as to why my SurfaceView won't display. Here's a little background as to what I'm doing:
I have a Linear Layout that is set Horizontally. It contains an ImageView, then a vertical Linear Layout, and finally another ImageView. In the vertical... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10185624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337844/"
] | I am just putting down the changes.
1. Replace surface view in the xml with LinearLayout.
```
<LinearLayout
android:id="@+id/middleSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
```
2. Get an instance of linear layout
LinearLayout surface = (Linear... | 1. Remove the surface view from the xml and place a linearlayout in place of that and associate an id with it.
2. Get an instance of linearlayout.
3. add child view i.e., magnet view in this case to the linearlayout using
addView()
This solved the problem. |
10,185,624 | So I've done a lot of searching but still can't seem to find the exact reason as to why my SurfaceView won't display. Here's a little background as to what I'm doing:
I have a Linear Layout that is set Horizontally. It contains an ImageView, then a vertical Linear Layout, and finally another ImageView. In the vertical... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10185624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337844/"
] | I am just putting down the changes.
1. Replace surface view in the xml with LinearLayout.
```
<LinearLayout
android:id="@+id/middleSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
```
2. Get an instance of linear layout
LinearLayout surface = (Linear... | Have you set the background of the SurfaceView? I found that if you set the background of the SurfaceView, it will not display what you draw on the secondary thread. |
10,185,624 | So I've done a lot of searching but still can't seem to find the exact reason as to why my SurfaceView won't display. Here's a little background as to what I'm doing:
I have a Linear Layout that is set Horizontally. It contains an ImageView, then a vertical Linear Layout, and finally another ImageView. In the vertical... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10185624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337844/"
] | I am just putting down the changes.
1. Replace surface view in the xml with LinearLayout.
```
<LinearLayout
android:id="@+id/middleSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
```
2. Get an instance of linear layout
LinearLayout surface = (Linear... | You could try this other way, move `setContentView(R.layout.main);` after `super.onCreate(savedInstanceState);`
```
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
midSurf = new MagnetView(this);
LinearLayout midLL = new LinearLayout(this);
midLL.findViewById(R.id.middlesurface);
midLL.addView(midS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.