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 |
|---|---|---|---|---|---|
17,607,459 | So I'm messing around with SailsJS to try to get an API up and running real fast. I haven't setup a data store yet (will probably use mongodb) but I saw that there is what I'm assuming is like a SQLite database or something. So I generated a model and controller for a User. So in the browser I hit user/create. I see cr... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17607459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228833/"
] | Try:
```
set wordDoc to choose file
do shell script "textutil -convert txt " & quoted form of POSIX path of (wordDoc as text)
```
Check out [StefanK's solution using textutil](http://macscripter.net/viewtopic.php?pid=128997#p128997) | This is in response to your comment beginning "Thanks Stefan and bibadiak"
With .txt file formats is that there is no universally used way to specify the encoding of a file inside the file, so either the application has to guess, or you have to know the encoding and the application has to let you tell it.
AFAIK if y... |
202,065 | Is there a way to have a RewriteRule fire on any domain that is requested on a box? For example, I have 5 VirtualHosts that would have the exact same RewriteRule applied to them and currently each VirtualHost directive has the rule, but can I put this somewhere 'global' so that upkeep is easier? | 2008/10/14 | [
"https://Stackoverflow.com/questions/202065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] | No, I'm afraid not | You can, but it is somewhat of a hack.
Create your RewriteRule in a .htaccess somewhere like:
>
> /www/redirects/global/.htaccess
>
>
>
Now just set the DocumentRoot for your virtualhosts to /www/redirects/global/ and every request will be forced through your RewriteRule's. |
202,065 | Is there a way to have a RewriteRule fire on any domain that is requested on a box? For example, I have 5 VirtualHosts that would have the exact same RewriteRule applied to them and currently each VirtualHost directive has the rule, but can I put this somewhere 'global' so that upkeep is easier? | 2008/10/14 | [
"https://Stackoverflow.com/questions/202065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] | No, I'm afraid not | I haven't tested it, but the [mod\_rewrite docs](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html) say that RewriteRule can be used in the server config context.
You may also want to look up how [RewriteMap](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap)s work. Since these are a file, they coul... |
1,547,117 | I've installed Ubuntu 20.04 LTS fresh and noticed these keyboard shortcuts are not working when on desktop : SHIFT+DELETE, CTRL+C/V/X.
Any ideas what might be the reason? | 2020/04/29 | [
"https://superuser.com/questions/1547117",
"https://superuser.com",
"https://superuser.com/users/562543/"
] | The underlying reason why keyboard actions don't work on the desktop with recent versions of Ubuntu is that the desktop icons aren't handled anymore by Nautilus but a GNOME Shell extension called [Desktop Icons](https://gitlab.gnome.org/World/ShellExtensions/desktop-icons) which is part of Ubuntu's default installation... | If the problem wasn't there already when you started the PC session and appeared somewhere in between, then try to log out and log back in to your account. That pretty much solved it for me. If not, I hope more knowledgable users show you the right way to do it. |
29,649,972 | I have a JSON object which looks like this:
```
var allDataJson = [{"Researchers":"Laura, Mikael","Year":"2015"},
{"Researchers":"Mikko","Year":"2013",},
{"Researchers":"Harri","Year":"2015"}, .......] //long list
```
I need to create a JSON object as follows:
```
var myjson = [{"Year": 2015, "Total":60},
... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29649972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738627/"
] | So you are trying to add total number of researchers ?
**Answer**
```
function countPublicationsPerYear(allDataJson){
var lookup = {};
var items = allDataJson;
var result = [];
for (var item, i = 0; item = items[i++];) {
var year = item.Year;
count ++;
if (!(year in lookup)) ... | I would do something like this:
```
var count = {};
for (var x = 0; x < allDataJson.length; x++) {
var current = allDataJson[x];
if (!count[current["Year"]]) count[current["Year"]] = 1;
else
count[current["Year"]] = count[current["Year"]] + 1;
}
var result = []
for(key in count){
result.push({... |
29,649,972 | I have a JSON object which looks like this:
```
var allDataJson = [{"Researchers":"Laura, Mikael","Year":"2015"},
{"Researchers":"Mikko","Year":"2013",},
{"Researchers":"Harri","Year":"2015"}, .......] //long list
```
I need to create a JSON object as follows:
```
var myjson = [{"Year": 2015, "Total":60},
... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29649972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738627/"
] | So you are trying to add total number of researchers ?
**Answer**
```
function countPublicationsPerYear(allDataJson){
var lookup = {};
var items = allDataJson;
var result = [];
for (var item, i = 0; item = items[i++];) {
var year = item.Year;
count ++;
if (!(year in lookup)) ... | I ended up writing this snippet for you:
```
var totals = {};
for (var i=0; i<allDataJson.length; i++) {
var researchYear = allDataJson[i].Year;
if (researchYear in totals){
totals[researchYear]++;
} else {
totals[researchYear] = 1;
}
};
console.log(totals); // your years summaries
console.log(JSON... |
29,649,972 | I have a JSON object which looks like this:
```
var allDataJson = [{"Researchers":"Laura, Mikael","Year":"2015"},
{"Researchers":"Mikko","Year":"2013",},
{"Researchers":"Harri","Year":"2015"}, .......] //long list
```
I need to create a JSON object as follows:
```
var myjson = [{"Year": 2015, "Total":60},
... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29649972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738627/"
] | So you are trying to add total number of researchers ?
**Answer**
```
function countPublicationsPerYear(allDataJson){
var lookup = {};
var items = allDataJson;
var result = [];
for (var item, i = 0; item = items[i++];) {
var year = item.Year;
count ++;
if (!(year in lookup)) ... | ```
var allDataJson = [{"Researchers":"Laura, Mikael","Year":"2015"},
{"Researchers":"Mikko","Year":"2013"},
{"Researchers":"Harri","Year":"2015"},
{"Researchers":"Mikko","Year":"2013"},
{"Researchers":"Harri","Year":"2015"},{"Researchers":"Mikko","Year":"2013"},
{"Researchers":"Harri","Year":"2015"},{"Researchers"... |
50,767,067 | I'm creating a dynamic table row. my data source looks like this
```
data = [
{
"id": 11,
"tests": [{
"id": 2,
"name": "Glucose Level"
},
{
"id": 4,
"name": "Blood Oxygen"
}
],
"carepathway": {
"id": 16,
"name": "General Check-Up",
... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50767067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3013841/"
] | Your regex expression is wrong:
Instead of this:
```
url('complete/<todo_id>', views.completeTodo, name='complete'),
```
try this:
```
url(r'^complete/(?P<todo_id>\d+)$', views.completeTodo, name='complete'),
```
Or in case you want to use [`path`](https://docs.djangoproject.com/en/2.0/ref/urls/#path)
```
path(... | Well you wrote a path like:
```
url('complete/<todo_id>/', views.completeTodo, name='complete'),
```
But here `<todo_id>` is part of the **url**, it does *not* denote a variable, etc. it means that there is only one url that will match: `/complete/<todo_id>`.
In case you use [django-2.x](/questions/tagged/djang... |
50,767,067 | I'm creating a dynamic table row. my data source looks like this
```
data = [
{
"id": 11,
"tests": [{
"id": 2,
"name": "Glucose Level"
},
{
"id": 4,
"name": "Blood Oxygen"
}
],
"carepathway": {
"id": 16,
"name": "General Check-Up",
... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50767067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3013841/"
] | Your regex expression is wrong:
Instead of this:
```
url('complete/<todo_id>', views.completeTodo, name='complete'),
```
try this:
```
url(r'^complete/(?P<todo_id>\d+)$', views.completeTodo, name='complete'),
```
Or in case you want to use [`path`](https://docs.djangoproject.com/en/2.0/ref/urls/#path)
```
path(... | I was facing the same issue, Here is the solution :
As your model name is Todo (Capital T) you are fetching the ID of each Tudo but in the views, URLs & template you are writing small (t). It becomes case sensitive.
Change the name (todo\_id) to (Todo\_id) everywhere in the views URLs and HTML template.
Here it is :... |
50,767,067 | I'm creating a dynamic table row. my data source looks like this
```
data = [
{
"id": 11,
"tests": [{
"id": 2,
"name": "Glucose Level"
},
{
"id": 4,
"name": "Blood Oxygen"
}
],
"carepathway": {
"id": 16,
"name": "General Check-Up",
... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50767067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3013841/"
] | Well you wrote a path like:
```
url('complete/<todo_id>/', views.completeTodo, name='complete'),
```
But here `<todo_id>` is part of the **url**, it does *not* denote a variable, etc. it means that there is only one url that will match: `/complete/<todo_id>`.
In case you use [django-2.x](/questions/tagged/djang... | I was facing the same issue, Here is the solution :
As your model name is Todo (Capital T) you are fetching the ID of each Tudo but in the views, URLs & template you are writing small (t). It becomes case sensitive.
Change the name (todo\_id) to (Todo\_id) everywhere in the views URLs and HTML template.
Here it is :... |
9,725,338 | I'm working on a Spotify app and trying to create a views.List object from some stored information in our database. On initial load, a POST is made to get the necessary info. I store this in localstorage so each subsequent request can avoid hitting the database and retrieve the object locally. What's happening though i... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9725338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1272199/"
] | Using, the local storage, I did it this way :
```
sp = getSpotifyApi(1);
var m = sp.require("sp://import/scripts/api/models");
var v = sp.require("sp://import/scripts/api/views");
var pl;
pl = m.Playlist.fromURI(uri);
var player = new v.Player();
player.track = pl.get(0);
player.context = pl;
var list = new v.List(p... | I think I've actually managed to solve this and I think it's bulletproof.
Basically I was trying to solve this by trying to convince the API that it needed to redraw the playlist by hiding things/scrolling things/moving things which worked occasionally but never consistently. It never occurred to me to change the play... |
9,725,338 | I'm working on a Spotify app and trying to create a views.List object from some stored information in our database. On initial load, a POST is made to get the necessary info. I store this in localstorage so each subsequent request can avoid hitting the database and retrieve the object locally. What's happening though i... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9725338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1272199/"
] | Solved this.
I am using hide() and show() to render the tabs in my app. I was constructing the tracklist and then show()ing the div which led to a blank tracklist. If I simply show() the div and then construct the tracklist it works fine.
The reason (I think) it was working for POSTs is because the tracklist was retr... | I think I've actually managed to solve this and I think it's bulletproof.
Basically I was trying to solve this by trying to convince the API that it needed to redraw the playlist by hiding things/scrolling things/moving things which worked occasionally but never consistently. It never occurred to me to change the play... |
37,983,754 | I am representing a weighted graph as a dictionary where the key represents a vertex and the following lists represent the edges incident on the vertex (first number weight of edge and second number adjacent vertex):
```
wGraph = { 1 : [[2, 2],[3, 4],[3, 3]],
3 : [[3, 2],[5, 4],[7, 5]],
2 : [[2, 1],[4, 4... | 2016/06/23 | [
"https://Stackoverflow.com/questions/37983754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6378573/"
] | To make a random choice from some values, use `random.choice`. You want to choose from the keys of the dictionary, so that's exactly what you pass in:
```
random.choice(wGraph.keys())
``` | ```
import random
visited = []
def random_key():
wGraph = {1: [[2, 2], [3, 4], [3, 3]],
3: [[3, 2], [5, 4], [7, 5]],
2: [[2, 1], [4, 4], [3, 6]],
4: [[3, 1], [4, 2], [1, 6], [5, 3]],
6: [[3, 2], [1, 4], [8, 5]],
5: [[7, 3], [8, 6], [9, 7]],
... |
37,983,754 | I am representing a weighted graph as a dictionary where the key represents a vertex and the following lists represent the edges incident on the vertex (first number weight of edge and second number adjacent vertex):
```
wGraph = { 1 : [[2, 2],[3, 4],[3, 3]],
3 : [[3, 2],[5, 4],[7, 5]],
2 : [[2, 1],[4, 4... | 2016/06/23 | [
"https://Stackoverflow.com/questions/37983754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6378573/"
] | The answer depends on the details -- how many keys do you have, are they always numbers 1...max, do you want to revisit keys you've already visited before, are graph nodes added over time or do they stay constant, will you eventually visit all keys or only a small percentage of them, and so on.
One idea: if your keys ... | ```
import random
visited = []
def random_key():
wGraph = {1: [[2, 2], [3, 4], [3, 3]],
3: [[3, 2], [5, 4], [7, 5]],
2: [[2, 1], [4, 4], [3, 6]],
4: [[3, 1], [4, 2], [1, 6], [5, 3]],
6: [[3, 2], [1, 4], [8, 5]],
5: [[7, 3], [8, 6], [9, 7]],
... |
5,513,613 | i want to develop rails 3 apps using mysql on windows 7 (64 bit) and i have installed mysql via the msi download from the mysql site.
my question is that do i still need to install the mysql gem?
thanks | 2011/04/01 | [
"https://Stackoverflow.com/questions/5513613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/262653/"
] | The mysql gem provides the ruby bindings, so yes, you need to install this.
With Rails 3 you should use the mysql2 gem rather than the mysql gem. | Yes you do. The mysql gem is a ruby driver (interface) to connect to the mysql database.
You should use [mysql2](http://rubygems.org/gems/mysql2) gem instead with Rails3. |
5,513,613 | i want to develop rails 3 apps using mysql on windows 7 (64 bit) and i have installed mysql via the msi download from the mysql site.
my question is that do i still need to install the mysql gem?
thanks | 2011/04/01 | [
"https://Stackoverflow.com/questions/5513613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/262653/"
] | Here is a proper solution for anyone interested, that doesn't mess up your current installation of mysql server
1. Download a zip file with mysql server 5.1 NOT the msi one. Make sure it's 32-bit NOT 64-bit. ([From here](http://dev.mysql.com/downloads/mysql/5.1.html))
2. Since there is no installer file with this, cre... | Yes you do. The mysql gem is a ruby driver (interface) to connect to the mysql database.
You should use [mysql2](http://rubygems.org/gems/mysql2) gem instead with Rails3. |
40,248,119 | Here is my first shell script
```
#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 10000 ]; do
date;
time wget -q 'http://exmple.com/' > /dev/null | grep real;
sleep 3;
let COUNTER=COUNTER+1
done
echo ${COUNTER} Request Sent\n
Average Response Time is :
```
this script download page content... | 2016/10/25 | [
"https://Stackoverflow.com/questions/40248119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3325376/"
] | ```
#!/bin/bash
echo "How many runs would you like to perform?"
read limit
total_time=0
counter=1
while [ ${counter} -le ${limit} ]
do
date
run_time=`(time -p wget -qO- http://exmple.com/) 2>&1 > /dev/null | grep real | awk '{print $2}'`
echo "Run ${counter} completed in ${run_time} seconds"
... | You can record a reasonably precise time with e.g.
```
t1=$(date +%s.%N)
wget ...
t2=$(date +%s.%N)
diff=$(($t2-$t1))
```
For doing stuff after Ctrl+C, which is really a `SIGINT` signal, read up about the `trap` builtin. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | This is pretty much bubble sort. Bubble sort performed on a linked list where the values are swapped. The checks `node!=null` is to confirm whether the end is reached or not. | Its similar to [selection sort](http://en.wikipedia.org/wiki/Selection_sort). In selection sort we find the min value in the list and swap with the first element and repeat the same for other elements in the list. But there we are not swapping after finding the min element, instead everytime we find an element smaller ... |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | This is pretty much bubble sort. Bubble sort performed on a linked list where the values are swapped. The checks `node!=null` is to confirm whether the end is reached or not. | [Insertion sort](http://en.wikipedia.org/wiki/Insertion_sort)
It's very similar to a bubble sort, except that instead of wapping adjacent pairs of items, you move the smallest item to the head of the list, and then the next smallest item into the second position, and so on. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | Let's make the algorithm clearer:
```
Sort {
first = head;
while (first ≠ NULL) {
next = first.next
while (next ≠ NULL) {
if (first.value < next.value)
swap first.value and next.value
advance next
}
advance first
}
}
```
This is a very inefficient implem... | This is pretty much bubble sort. Bubble sort performed on a linked list where the values are swapped. The checks `node!=null` is to confirm whether the end is reached or not. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | This is a kind of a hybrid between a ['classic' bubble sort](http://www.sorting-algorithms.com/bubble-sort) and a [selection sort](http://www.sorting-algorithms.com/selection-sort) - but closer to the classic bubble sort.
In the classic bubble sort, the inner loop swaps adjacent pairs as it walks the list/array.
In t... | This is pretty much bubble sort. Bubble sort performed on a linked list where the values are swapped. The checks `node!=null` is to confirm whether the end is reached or not. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | [Insertion sort](http://en.wikipedia.org/wiki/Insertion_sort)
It's very similar to a bubble sort, except that instead of wapping adjacent pairs of items, you move the smallest item to the head of the list, and then the next smallest item into the second position, and so on. | Its similar to [selection sort](http://en.wikipedia.org/wiki/Selection_sort). In selection sort we find the min value in the list and swap with the first element and repeat the same for other elements in the list. But there we are not swapping after finding the min element, instead everytime we find an element smaller ... |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | Let's make the algorithm clearer:
```
Sort {
first = head;
while (first ≠ NULL) {
next = first.next
while (next ≠ NULL) {
if (first.value < next.value)
swap first.value and next.value
advance next
}
advance first
}
}
```
This is a very inefficient implem... | Its similar to [selection sort](http://en.wikipedia.org/wiki/Selection_sort). In selection sort we find the min value in the list and swap with the first element and repeat the same for other elements in the list. But there we are not swapping after finding the min element, instead everytime we find an element smaller ... |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | This is a kind of a hybrid between a ['classic' bubble sort](http://www.sorting-algorithms.com/bubble-sort) and a [selection sort](http://www.sorting-algorithms.com/selection-sort) - but closer to the classic bubble sort.
In the classic bubble sort, the inner loop swaps adjacent pairs as it walks the list/array.
In t... | Its similar to [selection sort](http://en.wikipedia.org/wiki/Selection_sort). In selection sort we find the min value in the list and swap with the first element and repeat the same for other elements in the list. But there we are not swapping after finding the min element, instead everytime we find an element smaller ... |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | Let's make the algorithm clearer:
```
Sort {
first = head;
while (first ≠ NULL) {
next = first.next
while (next ≠ NULL) {
if (first.value < next.value)
swap first.value and next.value
advance next
}
advance first
}
}
```
This is a very inefficient implem... | [Insertion sort](http://en.wikipedia.org/wiki/Insertion_sort)
It's very similar to a bubble sort, except that instead of wapping adjacent pairs of items, you move the smallest item to the head of the list, and then the next smallest item into the second position, and so on. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | This is a kind of a hybrid between a ['classic' bubble sort](http://www.sorting-algorithms.com/bubble-sort) and a [selection sort](http://www.sorting-algorithms.com/selection-sort) - but closer to the classic bubble sort.
In the classic bubble sort, the inner loop swaps adjacent pairs as it walks the list/array.
In t... | [Insertion sort](http://en.wikipedia.org/wiki/Insertion_sort)
It's very similar to a bubble sort, except that instead of wapping adjacent pairs of items, you move the smallest item to the head of the list, and then the next smallest item into the second position, and so on. |
2,529,999 | Update: OK I see it's a bubble sort, but is it less efficient because it doesn't stop when there's no swap on a particular run? It runs until first is null.
Hi, I have a sorting algorithm as follows. My question is, which sorting algorithm is this? I thought it was bubble sort, but it does not do multiple runs. Any id... | 2010/03/27 | [
"https://Stackoverflow.com/questions/2529999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300414/"
] | Let's make the algorithm clearer:
```
Sort {
first = head;
while (first ≠ NULL) {
next = first.next
while (next ≠ NULL) {
if (first.value < next.value)
swap first.value and next.value
advance next
}
advance first
}
}
```
This is a very inefficient implem... | This is a kind of a hybrid between a ['classic' bubble sort](http://www.sorting-algorithms.com/bubble-sort) and a [selection sort](http://www.sorting-algorithms.com/selection-sort) - but closer to the classic bubble sort.
In the classic bubble sort, the inner loop swaps adjacent pairs as it walks the list/array.
In t... |
59,644,611 | I have an HTML email with standard TD's side by side. However, on mobile I want these to stack. I have used display:block; that works on some email browsers, however on others (Outlook) this does not work.
HTML is as follows:-
```css
@media screen and (max-width: 800px) {
.res-block td {display: block !important;... | 2020/01/08 | [
"https://Stackoverflow.com/questions/59644611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11135642/"
] | We are using the Java libraries from ID automation and generate images on the fly by using the Java libraries with Javascript from inside BIRT.
This is not as elegant as a plugin, but it works fine.
For QR-Codes, we are using Google's ZXing library in a similar way. | I've been using this PLUGIN (source code): <https://code.google.com/archive/p/birt-barcode-extension/>
It's not very sophisticated, but you can insert / EDIT the barcodes on the template with a "default" preview.
It relies on ZXing (you must get it from GITHUB) |
10,720,805 | I am currently coding a C# application that displays a image using PictureBox on a form.
Now, I want to update this image consistently (e.g. every 2 seconds). But I am not able to do this.
Because the new image is also of the same file directory/name and it will be replacing the original image which is loaded. So whe... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10720805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426201/"
] | It sounds as if a stream isn't closed. Try to call `stream.close();` after you have loaded your image. If you are loading your image like this `Image i = new Image(File.Open("blub.png"));` Then you will have to rewrite it a bit like this;
```
FileStream fs = File.Open("blub.png");
Image img = new Image(fs);
fs.Close()... | Just use a timer (called `timeImageChange` in the example below) and rename the files two different files names. Then you could have something like
```
bool imageALoaded = true;
timerImageChange.Interval = 2000;
timerImageChange.Enabled = true;
private void timerImageChange_Tick(object sender, EventArgs e)
{
if ... |
10,720,805 | I am currently coding a C# application that displays a image using PictureBox on a form.
Now, I want to update this image consistently (e.g. every 2 seconds). But I am not able to do this.
Because the new image is also of the same file directory/name and it will be replacing the original image which is loaded. So whe... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10720805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426201/"
] | It sounds as if a stream isn't closed. Try to call `stream.close();` after you have loaded your image. If you are loading your image like this `Image i = new Image(File.Open("blub.png"));` Then you will have to rewrite it a bit like this;
```
FileStream fs = File.Open("blub.png");
Image img = new Image(fs);
fs.Close()... | My best solution for you is to use the executable file, it's called Volume Shadow Copy. This actually is used in windows for backup as it allow you to copy files that are being used. I have actually tried this tool without C# code but it will be easy to use in code.
Here is a link: <http://www.howtogeek.com/howto/wind... |
14,992,666 | I created a working space to include one of my folders, and as soon as I clicked ok, now the ClearCase Navigator shows only that folder, and my vobs and views are gone from the GUI.
How can I bring them back? I selected Window -> Show View -> clear Case navigator, but the navigator only shows that one folder now, and I... | 2013/02/21 | [
"https://Stackoverflow.com/questions/14992666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1179677/"
] | First of all, by "working space" I meant "working set".
After some time trying to figure it out, I just went ahead and removed the "working set" I had created, and immediatelly my vobs and views came back to the ClearCase Navigator box. | That seems to be the intent behind working sets: see "[About working sets in the Rational ClearCase Navigator view](https://publib.boulder.ibm.com/infocenter/cchelp/v7r1m0/index.jsp?topic=/com.ibm.rational.clearcase.ccrc.help.doc/topics/c_filters.htm)".
>
> Use working sets to limit the items that appear in the Clear... |
28,882,026 | It seems that `std::piecewise_constant_distribution` computes the densities wrongly , at least with GCC and its standard library.
According to <http://www.cplusplus.com/reference/random/piecewise_constant_distribution/>:
The densities should be computed as:


As can be seen clearly, the summation applies only to the weights.
It's easy to see that there's something wrong with... | The wording on cplusplus.com is ambiguous. [cppreference.com](http://en.cppreference.com/w/cpp/numeric/random/piecewise_constant_distribution) gives a clearer explanation, and that's exactly what is written in C++ standard:
 |
46,261,410 | I need to extract 2Mil observations out of 23Mil data set. Using the code below it takes a lot of time to get it done. On Xeon CPU with 16GB RAM it's still running after 12 hours. I also noticed that the CPU is running at only 25% and HD is on 43%. How can I make the sampling process run faster?
Attached is the two lin... | 2017/09/17 | [
"https://Stackoverflow.com/questions/46261410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1024441/"
] | The `sample` function called with unequal probabilities and with `replace = FALSE`, probably doesn't exactly do what you want it to do: it draws one sample, then recalculates the remaining probabilities so that they add up to one, then draws one additional sample, etc. This makes is slow, and the probabilities don't ma... | R is built to use only a single CPU core at a time. The easiest way to run your code multi-threaded is [Microsoft R Open](https://mran.microsoft.com/documents/rro/multithread/). I'm not quiet sure if it improves the performance of sampling too, but it's worth a shot. If not, multi-core packages like **parallel** or **m... |
46,261,410 | I need to extract 2Mil observations out of 23Mil data set. Using the code below it takes a lot of time to get it done. On Xeon CPU with 16GB RAM it's still running after 12 hours. I also noticed that the CPU is running at only 25% and HD is on 43%. How can I make the sampling process run faster?
Attached is the two lin... | 2017/09/17 | [
"https://Stackoverflow.com/questions/46261410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1024441/"
] | The bottleneck is from the sampling, as just mentioned by Jan van der Laan.
A solution when you need to sample without replacement (and when the size is at least 5 times less than the initial size) is sampling with rejection.
You could sample with replacement twice the number you need and take only the number of first... | R is built to use only a single CPU core at a time. The easiest way to run your code multi-threaded is [Microsoft R Open](https://mran.microsoft.com/documents/rro/multithread/). I'm not quiet sure if it improves the performance of sampling too, but it's worth a shot. If not, multi-core packages like **parallel** or **m... |
46,261,410 | I need to extract 2Mil observations out of 23Mil data set. Using the code below it takes a lot of time to get it done. On Xeon CPU with 16GB RAM it's still running after 12 hours. I also noticed that the CPU is running at only 25% and HD is on 43%. How can I make the sampling process run faster?
Attached is the two lin... | 2017/09/17 | [
"https://Stackoverflow.com/questions/46261410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1024441/"
] | The `sample` function called with unequal probabilities and with `replace = FALSE`, probably doesn't exactly do what you want it to do: it draws one sample, then recalculates the remaining probabilities so that they add up to one, then draws one additional sample, etc. This makes is slow, and the probabilities don't ma... | The bottleneck is from the sampling, as just mentioned by Jan van der Laan.
A solution when you need to sample without replacement (and when the size is at least 5 times less than the initial size) is sampling with rejection.
You could sample with replacement twice the number you need and take only the number of first... |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | You need to pay attention to the license for the Java version of iText:
* iText `2.1.7`: the latest **official** release by iText Group NV, under the `MPL` & `GPL` license, with `com.lowagie` groupId;
* iText `4.2.1`: the latest **unofficial** release by ymasory/InProTopia, under the `MPL` & `GPL` license, with `com.l... | looks like 5.3.5 is not in repository yet so 5.3.4 works for me:
```
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.3.4</version>
</dependency>
``` |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | You need to pay attention to the license for the Java version of iText:
* iText `2.1.7`: the latest **official** release by iText Group NV, under the `MPL` & `GPL` license, with `com.lowagie` groupId;
* iText `4.2.1`: the latest **unofficial** release by ymasory/InProTopia, under the `MPL` & `GPL` license, with `com.l... | As with many (any?) open-source library, their website contains a changelog. iText's one can be found [here](https://itextpdf.com/posts/changelog).
And as of today, the latest version is ~~[5.5.9](https://itextpdf.com/posts/changelog/559)~~ [7.0.0](https://developers.itextpdf.com/itext-7-java).
The dependency for ver... |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | You need to pay attention to the license for the Java version of iText:
* iText `2.1.7`: the latest **official** release by iText Group NV, under the `MPL` & `GPL` license, with `com.lowagie` groupId;
* iText `4.2.1`: the latest **unofficial** release by ymasory/InProTopia, under the `MPL` & `GPL` license, with `com.l... | ```
This was the latest release as of today
<!-- http://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.9</version>
</dependency>
``` |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | You need to pay attention to the license for the Java version of iText:
* iText `2.1.7`: the latest **official** release by iText Group NV, under the `MPL` & `GPL` license, with `com.lowagie` groupId;
* iText `4.2.1`: the latest **unofficial** release by ymasory/InProTopia, under the `MPL` & `GPL` license, with `com.l... | iText 7 was released in May 2016. iText 7 is no longer one monolithic jar file, like iText 5 used to be. You use only those modules you need.
Put this in your POM file:
```
<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>barcodes</artifactId>
<version>7.0.0</version>
<!-- ba... |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | looks like 5.3.5 is not in repository yet so 5.3.4 works for me:
```
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.3.4</version>
</dependency>
``` | ```
This was the latest release as of today
<!-- http://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.9</version>
</dependency>
``` |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | As with many (any?) open-source library, their website contains a changelog. iText's one can be found [here](https://itextpdf.com/posts/changelog).
And as of today, the latest version is ~~[5.5.9](https://itextpdf.com/posts/changelog/559)~~ [7.0.0](https://developers.itextpdf.com/itext-7-java).
The dependency for ver... | ```
This was the latest release as of today
<!-- http://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.9</version>
</dependency>
``` |
14,213,195 | What is the latest version of iText? And what is the maven dependency for that? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937892/"
] | iText 7 was released in May 2016. iText 7 is no longer one monolithic jar file, like iText 5 used to be. You use only those modules you need.
Put this in your POM file:
```
<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>barcodes</artifactId>
<version>7.0.0</version>
<!-- ba... | ```
This was the latest release as of today
<!-- http://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.9</version>
</dependency>
``` |
6,923,650 | Web have (1) a **web application** where a user creates some tasks and (2) other system (**service** based on Java) that processes the tasks.
The tasks are date/time dependent - user creates the task, sets its start date to e.g. tomorrow 1am and he is done. The Java service tomorrow at 1am starts processing the task a... | 2011/08/03 | [
"https://Stackoverflow.com/questions/6923650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75224/"
] | WE do a similar thing,and use the message queue to hold tasks that need doing in differnet services, if the service dies, the message queue continues to be written to, we don't write to a sql server as we use a different machine AND that could also go down
We don't subscribe to the queue, we simply open and pop and me... | We have built similar systems, in our case we did it slightly differently.
* We used a table instead of a queue. This allowed us to log when the item was processed and resend by changing the status to "not sent"
* We also polled the table with a timer service, instead of a trigger notification
The problem with notifi... |
20,440,578 | i have the fowling code in my project:
```
$title = "In this title we have the word GUN"
$needed_words = array('War', 'Gun', 'Shooting');
foreach($needed_words as $needed_word) {
if (preg_match("/\b$needed_word\b/", $title)) {
$the_word = "ECHO THE WORD THATS FIND INSIDE TITLE";
}
}
```
I want to ... | 2013/12/07 | [
"https://Stackoverflow.com/questions/20440578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3054009/"
] | The trick, of course, is knowing how to combine the two parts of the query:
```
SELECT user_password.UserName, user_password.Password, COUNT(*)
FROM user_password
JOIN (SELECT UserName
FROM user_password
GROUP BY UserName
HAVING COUNT(DISTINCT Password) > 1) multiple_passwords
ON multiple_passwords... | this should work:
```
SELECT username,password,COUNT(*)
FROM t
WHERE username IN (SELECT username FROM t GROUP BY username HAVING COUNT(DISTINCT password>1))
GROUP by username,password
```
you can optimize it if you'll use with clause to prevent the table from being read twice. |
20,440,578 | i have the fowling code in my project:
```
$title = "In this title we have the word GUN"
$needed_words = array('War', 'Gun', 'Shooting');
foreach($needed_words as $needed_word) {
if (preg_match("/\b$needed_word\b/", $title)) {
$the_word = "ECHO THE WORD THATS FIND INSIDE TITLE";
}
}
```
I want to ... | 2013/12/07 | [
"https://Stackoverflow.com/questions/20440578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3054009/"
] | [SQL Fiddle](http://sqlfiddle.com/#!4/07aad/10)
**Query 1**:
```
WITH password_counts AS (
SELECT DISTINCT
UserName,
Password,
COUNT( DISTINCT Password ) OVER ( PARTITION BY UserName ) AS number_of_passwords,
COUNT( Password ) OVER ( PARTITION BY UserName, Password ) AS count_per... | this should work:
```
SELECT username,password,COUNT(*)
FROM t
WHERE username IN (SELECT username FROM t GROUP BY username HAVING COUNT(DISTINCT password>1))
GROUP by username,password
```
you can optimize it if you'll use with clause to prevent the table from being read twice. |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | ```
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
``` | ```
case "$directory" in
/*)
echo "absolute"
;;
*)
echo "relative"
;;
esac
``` |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | A general solution for any `$path`, rather than just `$0`
### POSIX One Liner
```sh
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"
``` | ```
case "$directory" in
/*)
echo "absolute"
;;
*)
echo "relative"
;;
esac
``` |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | ```
case "$directory" in
/*)
echo "absolute"
;;
*)
echo "relative"
;;
esac
``` | ```
if [ ${path:0:1} == / ]
then
echo Absolute path
else
echo Non-absolute path
fi
``` |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | ```
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
``` | A general solution for any `$path`, rather than just `$0`
### POSIX One Liner
```sh
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"
``` |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | ```
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
``` | ```
if [ ${path:0:1} == / ]
then
echo Absolute path
else
echo Non-absolute path
fi
``` |
11,403,820 | As stated in the title, I need to determine when a program is ran if the path is relative or absolute:
```
./program #relative
dir/dir2/program #relative
~User/dir/dir2/program #absolute
/home/User/dir/dir2/program #absolute
```
This are my test cases. How exactly could I go about doing this in a shell program?
Or... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427146/"
] | A general solution for any `$path`, rather than just `$0`
### POSIX One Liner
```sh
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"
``` | ```
if [ ${path:0:1} == / ]
then
echo Absolute path
else
echo Non-absolute path
fi
``` |
472,210 | Скажите, пожалуйста, как лучше оформить текст письма, которое приводится в художественном произведении? Есть ли рекомендации на сей счёт? Например, в книге "Гарри Поттер и Кубок огня" (Джоан Роулинг, изд. "РОСМЭН-ПРЕСС", 2002 г.) тексты писем выделены курсивом и отделены от основного текста пустыми строками.
[![введит... | 2022/09/17 | [
"https://rus.stackexchange.com/questions/472210",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/201456/"
] | Пустые строки называются отбивки. Да, такой вариант оформления совершенно корректен и глазу приятен.
Можете, конечно, и кавычить, и даже (страшно сказать!) сохранить при кавычках и курсив с отбивками, и даже всё перечисленное, исполненное болдом, - нетути криминала, это книжнодизайнерские выкрутасы.
К русскому языку ... | В тексте на снимке цитата должна была начаться с тире, означающем и знак прямой речи, и всякую иную фразу, ранее произнесённую, написанную, мысленную.
Цитаты заключаются в кавычки, независимо от слова, её предваряющего
(*указывал*, *напомнил*, *рекомендовал*, *учил*). Есть исключения из правил
цитирования: стихотвор... |
472,210 | Скажите, пожалуйста, как лучше оформить текст письма, которое приводится в художественном произведении? Есть ли рекомендации на сей счёт? Например, в книге "Гарри Поттер и Кубок огня" (Джоан Роулинг, изд. "РОСМЭН-ПРЕСС", 2002 г.) тексты писем выделены курсивом и отделены от основного текста пустыми строками.
[![введит... | 2022/09/17 | [
"https://rus.stackexchange.com/questions/472210",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/201456/"
] | Пустые строки называются отбивки. Да, такой вариант оформления совершенно корректен и глазу приятен.
Можете, конечно, и кавычить, и даже (страшно сказать!) сохранить при кавычках и курсив с отбивками, и даже всё перечисленное, исполненное болдом, - нетути криминала, это книжнодизайнерские выкрутасы.
К русскому языку ... | **I.** Приведу примеры оформления письма (рукописи, манускрипта) из "Собаки Баскервилей".
**1.** Холмс прислонился к спинке кресла, сложил вместе кончики пальцев обеих рук и закрыл глаза с выражением покорности. Доктор Мортимер повернул рукопись к свету и стал читать высоким, надтреснутым голосом следующий любопытный ... |
472,210 | Скажите, пожалуйста, как лучше оформить текст письма, которое приводится в художественном произведении? Есть ли рекомендации на сей счёт? Например, в книге "Гарри Поттер и Кубок огня" (Джоан Роулинг, изд. "РОСМЭН-ПРЕСС", 2002 г.) тексты писем выделены курсивом и отделены от основного текста пустыми строками.
[![введит... | 2022/09/17 | [
"https://rus.stackexchange.com/questions/472210",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/201456/"
] | **I.** Приведу примеры оформления письма (рукописи, манускрипта) из "Собаки Баскервилей".
**1.** Холмс прислонился к спинке кресла, сложил вместе кончики пальцев обеих рук и закрыл глаза с выражением покорности. Доктор Мортимер повернул рукопись к свету и стал читать высоким, надтреснутым голосом следующий любопытный ... | В тексте на снимке цитата должна была начаться с тире, означающем и знак прямой речи, и всякую иную фразу, ранее произнесённую, написанную, мысленную.
Цитаты заключаются в кавычки, независимо от слова, её предваряющего
(*указывал*, *напомнил*, *рекомендовал*, *учил*). Есть исключения из правил
цитирования: стихотвор... |
18,828,431 | I am attempting to return the hidden input field value above a checked checkbox. As it is at the moment I am finding a value of `undefined`.
This is what I have tried.
```
var checkedTopics = document.getElementsByName("chkRelatedTopics");
for (var i = 0; i < checkedTopics.length; i++) {
if (checkedTopics[i].chec... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18828431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715540/"
] | You can use the `zoo` package. The code below was writen to be reproducible but in actual practice `text="Lines"` would be replaced with `file="fileName"`. Also as shown in the question the Date field is ambiguous and you may need to adjust the percent codes if its not day/month/year.
```
library(zoo)
Lines <- "Date,... | In addition to what has been mentioned as the answer, you can check this link (<http://eclr.humanities.manchester.ac.uk/index.php/R_TSplots>) which discusses the use of 'xts' in this case.
I hope it helps. |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | 1. If you want your content pane to be precisely 400x400, then I would consider setting its preferredSize to 400x400 (although I don't like to force preferred size, on a content pane, it may be acceptable, in some cases).
2. After setting that preferred size and before showing the frame, call `pack()` on the frame.
Th... | If contentPane should be exactly 400 x 400, then create a class that retuns this for its preferredSize and use it as the contentPane:
```
class MyContentPane extends JPanel {
public static final int PREF_W = 400;
public static final int PREF_H = 400;
public Dimension getPreferredSize() {
return new Dime... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | 1. If you want your content pane to be precisely 400x400, then I would consider setting its preferredSize to 400x400 (although I don't like to force preferred size, on a content pane, it may be acceptable, in some cases).
2. After setting that preferred size and before showing the frame, call `pack()` on the frame.
Th... | 1. Make your ui in a panel.
2. Set the preferred size of the panel.
3. Add the panel to frame and call `pack()` |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | 1. If you want your content pane to be precisely 400x400, then I would consider setting its preferredSize to 400x400 (although I don't like to force preferred size, on a content pane, it may be acceptable, in some cases).
2. After setting that preferred size and before showing the frame, call `pack()` on the frame.
Th... | You are misunderstanding what you are working with, so it will seem "wrong".
Insets are not the dimensions of the "stuff" outside of the content pane. They are similar to a "border" around the content pane, where drawing will not be allowed to occur. Unlike borders, insets do not overlap.
The size of the decoration *... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | 1. If you want your content pane to be precisely 400x400, then I would consider setting its preferredSize to 400x400 (although I don't like to force preferred size, on a content pane, it may be acceptable, in some cases).
2. After setting that preferred size and before showing the frame, call `pack()` on the frame.
Th... | * `BorderLayout` (pre\_implemented in the `JFrame API`) to ignore `Insets`,
* most of `LayoutManager` ignore `Insets` too, only required for `AbsoluteLayout`,
basic and common stuff
* `JFrame` (and most of `Containers`) can returns `Insets`, `Bounds`, `Size` only
a) from already visible container
b) after call `JF... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | If contentPane should be exactly 400 x 400, then create a class that retuns this for its preferredSize and use it as the contentPane:
```
class MyContentPane extends JPanel {
public static final int PREF_W = 400;
public static final int PREF_H = 400;
public Dimension getPreferredSize() {
return new Dime... | 1. Make your ui in a panel.
2. Set the preferred size of the panel.
3. Add the panel to frame and call `pack()` |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | If contentPane should be exactly 400 x 400, then create a class that retuns this for its preferredSize and use it as the contentPane:
```
class MyContentPane extends JPanel {
public static final int PREF_W = 400;
public static final int PREF_H = 400;
public Dimension getPreferredSize() {
return new Dime... | You are misunderstanding what you are working with, so it will seem "wrong".
Insets are not the dimensions of the "stuff" outside of the content pane. They are similar to a "border" around the content pane, where drawing will not be allowed to occur. Unlike borders, insets do not overlap.
The size of the decoration *... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | If contentPane should be exactly 400 x 400, then create a class that retuns this for its preferredSize and use it as the contentPane:
```
class MyContentPane extends JPanel {
public static final int PREF_W = 400;
public static final int PREF_H = 400;
public Dimension getPreferredSize() {
return new Dime... | * `BorderLayout` (pre\_implemented in the `JFrame API`) to ignore `Insets`,
* most of `LayoutManager` ignore `Insets` too, only required for `AbsoluteLayout`,
basic and common stuff
* `JFrame` (and most of `Containers`) can returns `Insets`, `Bounds`, `Size` only
a) from already visible container
b) after call `JF... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | 1. Make your ui in a panel.
2. Set the preferred size of the panel.
3. Add the panel to frame and call `pack()` | * `BorderLayout` (pre\_implemented in the `JFrame API`) to ignore `Insets`,
* most of `LayoutManager` ignore `Insets` too, only required for `AbsoluteLayout`,
basic and common stuff
* `JFrame` (and most of `Containers`) can returns `Insets`, `Bounds`, `Size` only
a) from already visible container
b) after call `JF... |
12,711,822 | This is a sample of the code that I am using to instantiate a JFrame:
```
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
Sys... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12711822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199397/"
] | You are misunderstanding what you are working with, so it will seem "wrong".
Insets are not the dimensions of the "stuff" outside of the content pane. They are similar to a "border" around the content pane, where drawing will not be allowed to occur. Unlike borders, insets do not overlap.
The size of the decoration *... | * `BorderLayout` (pre\_implemented in the `JFrame API`) to ignore `Insets`,
* most of `LayoutManager` ignore `Insets` too, only required for `AbsoluteLayout`,
basic and common stuff
* `JFrame` (and most of `Containers`) can returns `Insets`, `Bounds`, `Size` only
a) from already visible container
b) after call `JF... |
5,283 | It has been said that our universe is going to eventually become a de Sitter universe. Expansion will accelerate until their relative speed become higher than the speed of light.
So i want to understand what happens after this point: so from our point of view, we see a progressively shrinking event horizon (each gala... | 2011/02/16 | [
"https://physics.stackexchange.com/questions/5283",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/955/"
] | We are *already* living in a nearly empty de Sitter space - the cosmological constant already represents 73% of the energy density in the Universe - and the Universe won't experience any qualitative change in the future: the percentage will just approach 100%.
However, once the space may be approximated as an empty de... | The final fate of the universe can be computed. The de Sitter spacetime cloaks every region with a cosmological horizon, which is similar in some ways to a Rindler horizon. $10^{100} years from now there will be nothing going on: Black holes will have decayed away and largely the universe is a de Sitter vacuum. There m... |
5,283 | It has been said that our universe is going to eventually become a de Sitter universe. Expansion will accelerate until their relative speed become higher than the speed of light.
So i want to understand what happens after this point: so from our point of view, we see a progressively shrinking event horizon (each gala... | 2011/02/16 | [
"https://physics.stackexchange.com/questions/5283",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/955/"
] | We are *already* living in a nearly empty de Sitter space - the cosmological constant already represents 73% of the energy density in the Universe - and the Universe won't experience any qualitative change in the future: the percentage will just approach 100%.
However, once the space may be approximated as an empty de... | Hawking radiation from a de Sitter horizon is the cosmic microwave background radiation. Both are black body radiation. The Big Bang is a myth. |
5,283 | It has been said that our universe is going to eventually become a de Sitter universe. Expansion will accelerate until their relative speed become higher than the speed of light.
So i want to understand what happens after this point: so from our point of view, we see a progressively shrinking event horizon (each gala... | 2011/02/16 | [
"https://physics.stackexchange.com/questions/5283",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/955/"
] | We are *already* living in a nearly empty de Sitter space - the cosmological constant already represents 73% of the energy density in the Universe - and the Universe won't experience any qualitative change in the future: the percentage will just approach 100%.
However, once the space may be approximated as an empty de... | The Hawking radiation of a deSitter space is given, as always, from the near-horizon metric, consistently redshifted to fill all space. Normalizing the cosmological constant appropriately:
$$ ds^2 = - (1- {\Lambda\over 3} r^2) dt^2 + {dr^2 \over (1 - {\Lambda\over 3} r^2)} + r^2 d\Omega^2 $$
If you flip the sign of $... |
5,283 | It has been said that our universe is going to eventually become a de Sitter universe. Expansion will accelerate until their relative speed become higher than the speed of light.
So i want to understand what happens after this point: so from our point of view, we see a progressively shrinking event horizon (each gala... | 2011/02/16 | [
"https://physics.stackexchange.com/questions/5283",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/955/"
] | The Hawking radiation of a deSitter space is given, as always, from the near-horizon metric, consistently redshifted to fill all space. Normalizing the cosmological constant appropriately:
$$ ds^2 = - (1- {\Lambda\over 3} r^2) dt^2 + {dr^2 \over (1 - {\Lambda\over 3} r^2)} + r^2 d\Omega^2 $$
If you flip the sign of $... | The final fate of the universe can be computed. The de Sitter spacetime cloaks every region with a cosmological horizon, which is similar in some ways to a Rindler horizon. $10^{100} years from now there will be nothing going on: Black holes will have decayed away and largely the universe is a de Sitter vacuum. There m... |
5,283 | It has been said that our universe is going to eventually become a de Sitter universe. Expansion will accelerate until their relative speed become higher than the speed of light.
So i want to understand what happens after this point: so from our point of view, we see a progressively shrinking event horizon (each gala... | 2011/02/16 | [
"https://physics.stackexchange.com/questions/5283",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/955/"
] | The Hawking radiation of a deSitter space is given, as always, from the near-horizon metric, consistently redshifted to fill all space. Normalizing the cosmological constant appropriately:
$$ ds^2 = - (1- {\Lambda\over 3} r^2) dt^2 + {dr^2 \over (1 - {\Lambda\over 3} r^2)} + r^2 d\Omega^2 $$
If you flip the sign of $... | Hawking radiation from a de Sitter horizon is the cosmic microwave background radiation. Both are black body radiation. The Big Bang is a myth. |
2,156,486 | Something that should be very easy has been the quest of my day.
**How do you set a variable attribute of a xml element?**
This is what I expected to work:
```
xmlElement.attribute(variableAttr) = "the variable attribute is set to this string";
```
However, I'm getting some error that this value can only be retrie... | 2010/01/28 | [
"https://Stackoverflow.com/questions/2156486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45974/"
] | You have to enclose your variable name with square bracket `@[my var]` :
`xmlElement.@[variableAttr] = "example";` | Try
```
xmlElement.attributes.variableAttr = "example";
```
example code:`var d:XMLDocument = new XMLDocument();
var e:XMLNode;
d.appendChild(e = d.createElement("Root"));
e.attributes.val = "100";
trace(d.toString()); //prints <Root val="100" />` |
8,025 | I have installed the latest Elementary OS Loki Release (not a BETA version). Sometimes when the system wakes up from sleep, after I log in, I see this behavior of the system. Almost all the text is gone as you can see in the picture: The Application Menu, System Settings, Notifications bubbles, Terminal, Files, (all ap... | 2016/09/20 | [
"https://elementaryos.stackexchange.com/questions/8025",
"https://elementaryos.stackexchange.com",
"https://elementaryos.stackexchange.com/users/6291/"
] | To fix this issue you need to **kill/close** pantheon-mail and then run the command
>
> **dconf reset -f /org/pantheon/mail/**
>
>
>
I believe this is only a temporary solution. If you have Elementary Tweaks installed you can add that command to **Cerbere** so is constantly running in the back. | I had the same issue. I replaced the window and resized it first vertically, which really goes slow. (only some pixels a second) When the window had the correct width again, I could resize it easily to the normal height. |
8,025 | I have installed the latest Elementary OS Loki Release (not a BETA version). Sometimes when the system wakes up from sleep, after I log in, I see this behavior of the system. Almost all the text is gone as you can see in the picture: The Application Menu, System Settings, Notifications bubbles, Terminal, Files, (all ap... | 2016/09/20 | [
"https://elementaryos.stackexchange.com/questions/8025",
"https://elementaryos.stackexchange.com",
"https://elementaryos.stackexchange.com/users/6291/"
] | This is a **bug**. Please [subscribe to its ticket](https://bugs.launchpad.net/pantheon-mail/+bug/1547949) in the bug tracker to receive notifications when the devs need help testing a fix. | I had the same issue. I replaced the window and resized it first vertically, which really goes slow. (only some pixels a second) When the window had the correct width again, I could resize it easily to the normal height. |
8,025 | I have installed the latest Elementary OS Loki Release (not a BETA version). Sometimes when the system wakes up from sleep, after I log in, I see this behavior of the system. Almost all the text is gone as you can see in the picture: The Application Menu, System Settings, Notifications bubbles, Terminal, Files, (all ap... | 2016/09/20 | [
"https://elementaryos.stackexchange.com/questions/8025",
"https://elementaryos.stackexchange.com",
"https://elementaryos.stackexchange.com/users/6291/"
] | To fix this issue you need to **kill/close** pantheon-mail and then run the command
>
> **dconf reset -f /org/pantheon/mail/**
>
>
>
I believe this is only a temporary solution. If you have Elementary Tweaks installed you can add that command to **Cerbere** so is constantly running in the back. | This is a **bug**. Please [subscribe to its ticket](https://bugs.launchpad.net/pantheon-mail/+bug/1547949) in the bug tracker to receive notifications when the devs need help testing a fix. |
29,030,491 | You have identified a solution of finding an area within a bounding box /circle using cross join as below:
```
SELECT A.ID, C.Car
FROM Cars C
CROSS JOIN Areas A
WHERE C.Latitude BETWEEN A.LatitudeMin AND A.LatitudeMax AND
C.Longitude BETWEEN A.LongitudeMin AND A.LongitudeMax
```
at:
[How to cross join in Big Qu... | 2015/03/13 | [
"https://Stackoverflow.com/questions/29030491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4666785/"
] | The problem you're seeing is that the cross join generates too many intermediate values (6 billion x 1k = 6 trillion).
The way to work around this is to generate fewer outputs. If you have additional filters you can apply, you should try applying them before you do the join. If you could do the group by (or part of it... | okey so fake join does work at the end, solution:
```
` select a.B, a.C , count(1) count from ( SELECT B, C, A, lat, long from [GB_Data.PlacesMasterA] WHERE not B
```
is null) a
JOIN (SELECT top\_left\_lat, top\_left\_long, bottom\_right\_lat, bottom\_right\_long, A from
[Places.placeABOXA] ) b on a.A=b.A
where
... |
64,222,700 | I am trying to test a custom hook using `@testing-library/react-hooks` but I have trouble testing the dependency. Let's use `useEffect` as an example:
```
import { renderHook } from '@testing-library/react-hooks';
import { useEffect } from 'react';
test('test dependency', () => {
const callback = jest.fn((value: nu... | 2020/10/06 | [
"https://Stackoverflow.com/questions/64222700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1003886/"
] | It's expected that `renderHook` mounts on every call, doing the opposite would prevent it from being used with unrelated hooks.
As with React Testing Library `render`, [the result](https://react-hooks-testing-library.com/reference/api#renderhook-result) allows to control rendered instance, this includes `unmount` and ... | After some thinking, I came up with the following solution:
```
import { act, renderHook } from '@testing-library/react-hooks';
import { useEffect, useState } from 'react';
test('test dependency', () => {
const callback = jest.fn((value: number) => {});
const renderCounter = jest.fn();
const { result } = rende... |
72,700,378 | I'm trying to send user's data to Realtime Database in SignUpActivity in my project. For that I created a database reference and copied the [url](https://i.stack.imgur.com/8imDB.png) that is written in my Realtime Database with the following code:
```
DatabaseReference databaseReference = FirebaseDatabase.getInstance(... | 2022/06/21 | [
"https://Stackoverflow.com/questions/72700378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17963868/"
] | To solve this, simply change:
```
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl("https://quiz-project-6afd9-default-rtdb.europe-west1.firebasedatabase.app/");
```
Into:
```
DatabaseReference databaseReference = FirebaseDatabase.getInstance("https://quiz-project-6afd9-defau... | I think this may come because you're using the `getReferenceFromUrl` method. Can you try instead passing the URL to `getInstance`:
```
DatabaseReference databaseReference = FirebaseDatabase.getInstance("https://quiz-project-6afd9-default-rtdb.europe-west1.firebasedatabase.app/").getReference();
``` |
32,914,902 | I'm in a bit of a trouble here. My delete query is not properly working.
The thing is i am deleting from 4 tables using inner join. the data is deleted in two tables but not in the rest two.
The thing is the post table contains more than one records and I have to delete all of them.But its deleting only the first one.... | 2015/10/02 | [
"https://Stackoverflow.com/questions/32914902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5333018/"
] | You are missing `ON` conditions on 2 tables `field` and `posts`
```
$dew="DELETE wn,f,p,fd
FROM `workspace_name` AS wn
INNER JOIN `fields` AS f _ON(wn.some_id = f.some_id)_
INNER JOIN `posts` AS p _ON(wn.some_id = c.some_id)_
INNER JOIN `fields_data` AS fd
ON wn.w... | You need to properly join the 4 tables in the delete query and do not use a loop. In the first loop the workspace will be removed with a post, but in the 2nd iteration there is no workspace left, so the inner join will not yield any records from the posts table either.
```
DELETE wn,f,p,fd FROM `workspace_name` AS wn ... |
1,500,479 | I need to upload a file (in this case a csv file) and load the contents of it into the following function:
```
function csv2xml($file, $container = 'data', $rows = 'row')
{
$r = "<{$container}>\n";
$row = 0;
$cols = 0;
$titles = array();
while (($data = fgetcsv($file, 1000, ','... | 2009/09/30 | [
"https://Stackoverflow.com/questions/1500479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115949/"
] | You need to open the file first, eg:
```
$filePointer = fopen($file, "r"); // read-only
```
Then use:
```
while (($data = fgetcsv($filePointer, 1000, ',')) !== FALSE)
```
to retrieve your data.
Note that you'll probably want to check out PHP's [file upload](http://www.php.net/manual/en/features.file-upload.post-... | @richsage already answered the question. If you still have problems, [visit the documentation](http://php.net/fgetcsv) for a working example. I just wanted to point out your function call:
```
csv2xml($_POST['file'], $container = 'wholething', $rows = 'item');
```
Although it works, this is not how you call function... |
64,099,108 | Input\_File:
```
2020-09-24 12:08:18,085.085 INFO 38210f97f184 lCpkydbL6wlNNi0 94rXXKaa3KLamiJ prep - Benchmarking Data function ENDED
2020-09-24 12:08:18,085.085 INFO 38210f97f184 lCpkydbL6wlNNi0 94rXXKaa3KLamiJ prep -
Average_Unit_Price_00 ... | 2020/09/28 | [
"https://Stackoverflow.com/questions/64099108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12851223/"
] | ***EDIT:*** Since OP's samples are changed so adding this solution now.
```
awk '
FNR==NR{
if($0~/38210f97f184.*94rXXKaa3KLamiJ/ && ++count==1){
start=FNR
}
if($0~/38210f97f184.*94rXXKaa3KLamiJ/ && count>1){
end=FNR
}
next
}
FNR>=start && FNR<=end
' Input_file Input_file
```
---
---
***Initial ... | You can use this `awk` solution:
```
awk '!/^[0-9]{4}(-[0-9]{2}){2} / && p;
/^[0-9]{4}(-[0-9]{2}){2} / && p = (/38210f97f184/ && /94rXXKaa3KLamiJ/)' file
```
```
2020-09-24 12:08:18,085.085 INFO 38210f97f184 lCpkydbL6wlNNi0 94rXXKaa3KLamiJ prep - Benchmarking Data function ENDED
2020-09-24 12:08:18,085.085 INFO ... |
32,469,174 | I am trying to use a method from the deque library (from collections). But I get the error "MyQueue instance has no attribute 'append'". But I'm sure that deque has an "append" method. What is causing this error?
```
import copy
from collections import deque
class MyQueue:
def __init__(self):
self = deque... | 2015/09/09 | [
"https://Stackoverflow.com/questions/32469174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3677551/"
] | You can also do this by wrapping a `deque` instance with your `MyQueue`:
```
from collections import deque
class MyQueue(object):
def __init__(self, *args, **kwargs):
self._queue = deque(*args, **kwargs)
def push(self, value):
self._queue.append(value)
def pop(self):
return self.... | You can do this by subclassing `deque`:
```
from collections import deque
class MyQueue(deque):
def push(self, val):
self.append(val)
```
which could then be used like this:
```
>>> q = MyQueue()
>>> q.push(5)
>>> q
deque([5])
```
For more information about classes and inheritance in Python, see the ... |
279,374 | I'm trying to unwrap a few faces of my model at 1:1 scale to fit onto an image that I've prepared to be 1:1 scale as well. Everything I've tried has resulted in a distorted unwrap one way or another. The closest result I've found is to unwrap with Cube Projection - that seems to keep the relative locations of the face ... | 2022/11/17 | [
"https://blender.stackexchange.com/questions/279374",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/140881/"
] | Technically, your UVs seem correctly unwrapped. The issue is the texture you are using isn't 1:1, it is narrower on the X axis. The UVs occupy all the texture space from 0:0 to 1:1 no matter the texture.
[](https://i.stack.imgur.com/xm3az.png)
The simplest solution... | As Lolock says, your image is not square (1:1 aspect ratio), by default it will squeeze the UV when you'll unwrap it. To avoid that, either use Lolock's solution or keep the *Image Texture* node selected when you unwrap, it will keep your UV at its good proportions. |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | Because `finally` block will be executed every time whether you enter in `try` or in `catch`, I think that's why its called **finally** :)
[FROM **JAVA DOCS**](http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html)
>
> The finally block always executes when the try block exits. This
> ensures tha... | Finally will get called last no matter if the catch block is called or not. Perhaps you want to read more documentation. [MSDN Try Catch Finally](http://msdn.microsoft.com/en-us/library/ie/4yahc5d8%28v=vs.94%29.aspx) |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | Because `finally` block will be executed every time whether you enter in `try` or in `catch`, I think that's why its called **finally** :)
[FROM **JAVA DOCS**](http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html)
>
> The finally block always executes when the try block exits. This
> ensures tha... | finally block always executed whether the try catch block execute or not |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | Because `finally` block will be executed every time whether you enter in `try` or in `catch`, I think that's why its called **finally** :)
[FROM **JAVA DOCS**](http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html)
>
> The finally block always executes when the try block exits. This
> ensures tha... | >
> The finally block always executes when the try block exits. This
> ensures that the finally block is executed even if an unexpected
> exception occurs. But finally is useful for more than just exception
> handling — it allows the programmer to avoid having cleanup code
> accidentally bypassed by a return, cont... |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | By design, the return in the `finally` block does always take precedence. | Finally will get called last no matter if the catch block is called or not. Perhaps you want to read more documentation. [MSDN Try Catch Finally](http://msdn.microsoft.com/en-us/library/ie/4yahc5d8%28v=vs.94%29.aspx) |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | finally block always executed whether the try catch block execute or not | Finally will get called last no matter if the catch block is called or not. Perhaps you want to read more documentation. [MSDN Try Catch Finally](http://msdn.microsoft.com/en-us/library/ie/4yahc5d8%28v=vs.94%29.aspx) |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | >
> The finally block always executes when the try block exits. This
> ensures that the finally block is executed even if an unexpected
> exception occurs. But finally is useful for more than just exception
> handling — it allows the programmer to avoid having cleanup code
> accidentally bypassed by a return, cont... | Finally will get called last no matter if the catch block is called or not. Perhaps you want to read more documentation. [MSDN Try Catch Finally](http://msdn.microsoft.com/en-us/library/ie/4yahc5d8%28v=vs.94%29.aspx) |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | By design, the return in the `finally` block does always take precedence. | finally block always executed whether the try catch block execute or not |
15,616,984 | If execution doesn't cause exception then control goes to finally block. **So is the return statement in try block is being ignored by JVM?** . Or if exception occurs then control goes to catch block there also it ignored return statment and control go to finally block and return from finally
```
public class Helper... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15616984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693468/"
] | By design, the return in the `finally` block does always take precedence. | >
> The finally block always executes when the try block exits. This
> ensures that the finally block is executed even if an unexpected
> exception occurs. But finally is useful for more than just exception
> handling — it allows the programmer to avoid having cleanup code
> accidentally bypassed by a return, cont... |
71,994,984 | I know semantic tags were added in HTML5.
So isn't the table tag in HTML4 not a semantic tag?
Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
I'm really curious. | 2022/04/25 | [
"https://Stackoverflow.com/questions/71994984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17220546/"
] | I wouldn’t say that there were no semantic elements in HTML 4 and before. It’s more that they were mixed with elements that control visual presentation, like `<font>`.
Also `<h1>` and other heading elements were already around, that are clearly semantic. Most notably the `<form>` related tags are purely semantic, and ... | well Semantic html is html that introduces meaning to the web page rather than just presentation. For example, a `<p>` tag indicates that the enclosed text is a paragraph. This is both semantic and presentational because people know what paragraphs are, and browsers know how to display them. A semantic element clearly ... |
71,994,984 | I know semantic tags were added in HTML5.
So isn't the table tag in HTML4 not a semantic tag?
Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
I'm really curious. | 2022/04/25 | [
"https://Stackoverflow.com/questions/71994984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17220546/"
] | >
> I know semantic tags were added in HTML5.
>
>
>
HTML 5 did add new semantic elements
>
> So isn't the table tag in HTML4 not a semantic tag?
>
>
>
Incorrect. It is a semantic element.
>
> Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
>
>
>
No.
---
Se... | well Semantic html is html that introduces meaning to the web page rather than just presentation. For example, a `<p>` tag indicates that the enclosed text is a paragraph. This is both semantic and presentational because people know what paragraphs are, and browsers know how to display them. A semantic element clearly ... |
71,994,984 | I know semantic tags were added in HTML5.
So isn't the table tag in HTML4 not a semantic tag?
Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
I'm really curious. | 2022/04/25 | [
"https://Stackoverflow.com/questions/71994984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17220546/"
] | I wouldn’t say that there were no semantic elements in HTML 4 and before. It’s more that they were mixed with elements that control visual presentation, like `<font>`.
Also `<h1>` and other heading elements were already around, that are clearly semantic. Most notably the `<form>` related tags are purely semantic, and ... | >
> I know semantic tags were added in HTML5.
>
>
>
HTML 5 did add new semantic elements
>
> So isn't the table tag in HTML4 not a semantic tag?
>
>
>
Incorrect. It is a semantic element.
>
> Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
>
>
>
No.
---
Se... |
71,994,984 | I know semantic tags were added in HTML5.
So isn't the table tag in HTML4 not a semantic tag?
Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
I'm really curious. | 2022/04/25 | [
"https://Stackoverflow.com/questions/71994984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17220546/"
] | I wouldn’t say that there were no semantic elements in HTML 4 and before. It’s more that they were mixed with elements that control visual presentation, like `<font>`.
Also `<h1>` and other heading elements were already around, that are clearly semantic. Most notably the `<form>` related tags are purely semantic, and ... | HTML5 does not have semantic tags in the meaning of "semantic web" ("data-first web"). HTML5 contains "semantic" tags in the meaning of a graphical user interface (more specifically, a hypertext-oriented interface). Some tags, such as `<address>`, are more "semantic" than interface markup tags, but this is more of an e... |
71,994,984 | I know semantic tags were added in HTML5.
So isn't the table tag in HTML4 not a semantic tag?
Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
I'm really curious. | 2022/04/25 | [
"https://Stackoverflow.com/questions/71994984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17220546/"
] | >
> I know semantic tags were added in HTML5.
>
>
>
HTML 5 did add new semantic elements
>
> So isn't the table tag in HTML4 not a semantic tag?
>
>
>
Incorrect. It is a semantic element.
>
> Can only tags such as header, section, article, etc. added in HTML5 be called semantic tags?
>
>
>
No.
---
Se... | HTML5 does not have semantic tags in the meaning of "semantic web" ("data-first web"). HTML5 contains "semantic" tags in the meaning of a graphical user interface (more specifically, a hypertext-oriented interface). Some tags, such as `<address>`, are more "semantic" than interface markup tags, but this is more of an e... |
9,653,118 | So I want to change a hidden form field's value from False to True when the user enters input data in another form field. This works fine with my select fields (dropdowns) in my form, but for my checkboxes and text input fields it isn't working. This is my code
```
$(function(){
$('#vmake').change(function(){
... | 2012/03/11 | [
"https://Stackoverflow.com/questions/9653118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1161571/"
] | It looks like you're using the wrong selector and event for the checking of a check box. Use the `click` event to see changes in the `checked` state of a check box
```
$('#year').click(function() {
var checked = $(this).is(':checked');
var value = checked ? 'True' : 'False';
$('#carsearch').val(value);
});
``` | IS your CheckBox's ID really "year[]"? That doesn't seem like a good choice for an ID. Remember, you should always have unique ID's. |
23,706,723 | I had a class with private properties:
```
class Ranking {
private:
struct empar {
int id_org;
list <pair <int,int> > l_repr;
};
vector <empar> rank;
};
```
Now, I have changed this class because the integer id\_org doesn't use. Then
Declaration private atributes class:
```
class Rank... | 2014/05/17 | [
"https://Stackoverflow.com/questions/23706723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343410/"
] | For containers templates you need a data type.
So use `typedef` keyword for `l_repr` :
```
typedef list <pair <int,int> > l_repr;
// ^^^
vector <l_repr> rank;
```
There could be other error(s) too. | It should be possible to create a vector of list of pair int, int
```
std::vector<std::list<std::pair<int, int>>> v;
```
But I'm not sure what you would use that for, since it's quite messy. |
42,378 | I recently decided to do fitness and diet more seriously.I am a male 31 years old - 183 cm - 77 Kg
I don't know my body fat but since the confinement, I gained 4 Kg and no exercise during this period ^^
I would like to calculate my daily calorie and macronutrient ratio
For daily calorie I try some simulator for loosin... | 2020/06/27 | [
"https://fitness.stackexchange.com/questions/42378",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/33558/"
] | Best advice I have for a diet beginner is to keep it separate (& simple).
Though nutrition and exercise go hand-in-hand, I advise my clients starting out on a new diet plan, to keep it separate from their workout goals. It’s been established that losing fat is math; you **MUST** be in a caloric deficit to lose fat.
B... | Depends on what you want. Various studies have shown that you can gain muscle while losing fat but a slower rate.
Deficit calories build 20% less muscle mass than surpluss calories but there are other caviats.
If you are already skinny, going into a deficit will turn you into a skinny shredded pole, think Bruce lee.
!... |
33,277,794 | The last exam objective under "Java Streams" section in [1Z0-809 exam](http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-809&p_org_id=1001&lang=US) (Java 8 exam) reads:
>
> Use of `merge()` and `flatMap()` methods of the Streams
>
>
>
There is no `merge()` me... | 2015/10/22 | [
"https://Stackoverflow.com/questions/33277794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475114/"
] | **Workaround Steps Using the Application Loader:**
1. Export your build as a file (Save for iOS App Store Deployment)
2. Go to Xcode > Open Developer Tool > Application Loader
3. In Application Loader log in to your account
4. Select and upload the .ipa file you just exported | I was with the same issue, Using the **Application Loader** works for me.
In Organizer, export your app and select the option **Save for iOS App Store Deployment** I did it and works for me
before that I tried with **Save for Ad Hoc Deployment** but with no success! |
33,277,794 | The last exam objective under "Java Streams" section in [1Z0-809 exam](http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-809&p_org_id=1001&lang=US) (Java 8 exam) reads:
>
> Use of `merge()` and `flatMap()` methods of the Streams
>
>
>
There is no `merge()` me... | 2015/10/22 | [
"https://Stackoverflow.com/questions/33277794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475114/"
] | I was facing the same issue but then i used **Application Loader** and it worked for me. After validating your app Export your app by selecting option as **Save for iOS App Store Deployment** and then Just upload your apps ipa using Application Loader. | This occurred for me when I accidentally left "Include Bitcode" checkmarked (on by default) in my build despite setting the project to not contain bitcode. Uncheckmarking it resolved this issue. |
33,277,794 | The last exam objective under "Java Streams" section in [1Z0-809 exam](http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-809&p_org_id=1001&lang=US) (Java 8 exam) reads:
>
> Use of `merge()` and `flatMap()` methods of the Streams
>
>
>
There is no `merge()` me... | 2015/10/22 | [
"https://Stackoverflow.com/questions/33277794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475114/"
] | Same issue at Xcode 6.4. My workaround.
1. Rename Xcode 6.4 (Xcode64.app)
2. Install Xcode 7.1 (Xcode.app)
3. Build and archive in Xcode 6
4. Auto launch "Organizer" in Xcode 6 and **close**
5. Launch **Xcode 7 and Organizer**
6. Submit to App Store | Okay, I was finally able to upload my application heres what was happening, I had used a third party lib., which had an info.plist of its own
this info.plist was the culprit, It didn't had any `Bundle Identifier`, `CFBundleVersion` or `CFBundleShortVersionString` string, so I manually added These 3 keys into that fram... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.