qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
223,880 | *Huge omega thanks to @wasif for emailing me this challenge idea in its basic form*
Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them.
Henceforth, to... | 2021/04/20 | [
"https://codegolf.stackexchange.com/questions/223880",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/78850/"
] | [05AB1E](https://github.com/Adriandmen/05AB1E), ~~60~~ ~~57~~ 56 bytes
======================================================================
```
[N>’¸¸.‚‹º.ŒŒ/›´?€¼=ƒËŠˆ&€®=ÿ’.wD2è'eQ#“e":"“¡¦ε'"¡н]\)
```
Outputs as a list of pages, where each page is a list of tags.
```
[N>’...’.wD2è'eQ#“e":"“¡¦ε'"¡н]\) # trimm... | [Bash](https://www.gnu.org/software/bash/) + wget + jq, 86
==========================================================
Assumes there are no more than 99 pages of results (currently 10 pages).
```bash
wget -qO- api.stackexchange.com/tags?site=codegolf\&page={1..99}|zcat|jq .items[].name
```
Testing this blew through ... |
223,880 | *Huge omega thanks to @wasif for emailing me this challenge idea in its basic form*
Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them.
Henceforth, to... | 2021/04/20 | [
"https://codegolf.stackexchange.com/questions/223880",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/78850/"
] | JavaScript (Firefox chrome), 135 bytes
======================================
```javascript
f=async(i=1)=>(await((await fetch('http://codegolf.stackexchange.com/tags?page='+i)).text())).match(/[\w-]+(?=)/g).map(alert)|f(i+1)
```
1. ~~Open [Browser Console of Firefox](https://developer.mozilla.org/en-US/docs/Tools... | [Bash](https://www.gnu.org/software/bash/) + wget + jq, 86
==========================================================
Assumes there are no more than 99 pages of results (currently 10 pages).
```bash
wget -qO- api.stackexchange.com/tags?site=codegolf\&page={1..99}|zcat|jq .items[].name
```
Testing this blew through ... |
223,880 | *Huge omega thanks to @wasif for emailing me this challenge idea in its basic form*
Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them.
Henceforth, to... | 2021/04/20 | [
"https://codegolf.stackexchange.com/questions/223880",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/78850/"
] | [Jyxal 0.2.0](https://github.com/Vyxal/Jyxal/tree/0.2.0), 44 bytes
==================================================================
```
0{›:`ȯø.⟩β•∵.•⅛/ɾƈ?λ→=%&λẋ=¬⋎»₅`%¨UøJht(ntt,
```
[Jyxal-is-not-hosted-anywhere-so-read-the-readme-to-see-how-to-try-this](https://github.com/Vyxal/Jyxal/blob/master/README.md)
Fi... | [Bash](https://www.gnu.org/software/bash/) + wget + jq, 86
==========================================================
Assumes there are no more than 99 pages of results (currently 10 pages).
```bash
wget -qO- api.stackexchange.com/tags?site=codegolf\&page={1..99}|zcat|jq .items[].name
```
Testing this blew through ... |
13,099 | Thank you for all the help [on my other question](https://salesforce.stackexchange.com/questions/13039/help-with-triggers-classes-for-case-creation-based-on-field-change-in-customer). I was so happy to see a community that doesn't have trolls.
So the good news is that the code compiles with no errors.
The bad news is... | 2013/06/21 | [
"https://salesforce.stackexchange.com/questions/13099",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/3089/"
] | I came across similar situation and ended up with that it is a WAD. This error will be shown when we do not enter data in correct format. eg if in email we enter "abc" instead if we enter "abc@hjds.com" then we don't get error. Client side validation is the only workaround here.
Thanks | Do you have a user "profile" set up for sites users that includes access to your custom object? If not, you won't be able to access those objects from sites and will get an error message of the kind you're seeing.
Are these custom "objects" perhaps instead custom "fields" on say Opportunity or Accounts? If so, that c... |
13,099 | Thank you for all the help [on my other question](https://salesforce.stackexchange.com/questions/13039/help-with-triggers-classes-for-case-creation-based-on-field-change-in-customer). I was so happy to see a community that doesn't have trolls.
So the good news is that the code compiles with no errors.
The bad news is... | 2013/06/21 | [
"https://salesforce.stackexchange.com/questions/13099",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/3089/"
] | I came across similar situation and ended up with that it is a WAD. This error will be shown when we do not enter data in correct format. eg if in email we enter "abc" instead if we enter "abc@hjds.com" then we don't get error. Client side validation is the only workaround here.
Thanks | Please check your field level security and also if you are setting form field values with jquery or javascript than don't make them hidden.
Hope this will help you. |
13,099 | Thank you for all the help [on my other question](https://salesforce.stackexchange.com/questions/13039/help-with-triggers-classes-for-case-creation-based-on-field-change-in-customer). I was so happy to see a community that doesn't have trolls.
So the good news is that the code compiles with no errors.
The bad news is... | 2013/06/21 | [
"https://salesforce.stackexchange.com/questions/13099",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/3089/"
] | I came across similar situation and ended up with that it is a WAD. This error will be shown when we do not enter data in correct format. eg if in email we enter "abc" instead if we enter "abc@hjds.com" then we don't get error. Client side validation is the only workaround here.
Thanks | Do check the Data Type against the input field.
If your data type is number and your submitting a text then
"We're unable to retrieve your data due to an error." messages is shown.
The value should match against the data type of an object and validation
for the same can be done on client side.
May be this should hel... |
13,099 | Thank you for all the help [on my other question](https://salesforce.stackexchange.com/questions/13039/help-with-triggers-classes-for-case-creation-based-on-field-change-in-customer). I was so happy to see a community that doesn't have trolls.
So the good news is that the code compiles with no errors.
The bad news is... | 2013/06/21 | [
"https://salesforce.stackexchange.com/questions/13099",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/3089/"
] | I came across similar situation and ended up with that it is a WAD. This error will be shown when we do not enter data in correct format. eg if in email we enter "abc" instead if we enter "abc@hjds.com" then we don't get error. Client side validation is the only workaround here.
Thanks | There are a few different possibilities that I can think of:
1. It could be that the Site's Guest User does not have the correct permissions on the Object (CRUD) or Object's fields (Field Level Security). Note that this is NOT the Site Contributor or Site Publisher user that you use to construct the Site. You can see ... |
64,085,248 | I have the following doubt
First code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y :
print (i,j)
>>> Output : a b
c d
```
>
> Variable 'i' is : a c , and variable 'j' is : b d
>
>
>
Second code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y,z:
print (i,j)
>>> Output : a b
... | 2020/09/27 | [
"https://Stackoverflow.com/questions/64085248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091910/"
] | The problem is that "in x" iterates through the string, *as a string*. The first iteration returns `a`; the second returns `b`. Each single character is "not enough values to unpack". Simply
```
i, j = x
```
works as you want. Note that, in the other loops, you iterated through a *tuple* of strings; this is not the ... | You can try something like this:
```py
x = 'ab'
y = 'cd'
z = 'ef'
i, j = x
print(i, j)
``` |
64,085,248 | I have the following doubt
First code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y :
print (i,j)
>>> Output : a b
c d
```
>
> Variable 'i' is : a c , and variable 'j' is : b d
>
>
>
Second code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y,z:
print (i,j)
>>> Output : a b
... | 2020/09/27 | [
"https://Stackoverflow.com/questions/64085248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091910/"
] | In the first piece of code, you iterate on the tuple of strings `(x, y)` (you didn't write the parentheses, but the comma makes the tuple, not the parentheses).
So it boils down to:
```
for two_letters_string in (x, y):
...
```
You do a second thing here: instead of `two_letters_string`, you used a tuple `(i, j... | You can try something like this:
```py
x = 'ab'
y = 'cd'
z = 'ef'
i, j = x
print(i, j)
``` |
64,085,248 | I have the following doubt
First code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y :
print (i,j)
>>> Output : a b
c d
```
>
> Variable 'i' is : a c , and variable 'j' is : b d
>
>
>
Second code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y,z:
print (i,j)
>>> Output : a b
... | 2020/09/27 | [
"https://Stackoverflow.com/questions/64085248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091910/"
] | The problem is that "in x" iterates through the string, *as a string*. The first iteration returns `a`; the second returns `b`. Each single character is "not enough values to unpack". Simply
```
i, j = x
```
works as you want. Note that, in the other loops, you iterated through a *tuple* of strings; this is not the ... | that's happening because you are given on the loop 2 items i, j
try this now:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i in x :
print (i)
``` |
64,085,248 | I have the following doubt
First code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y :
print (i,j)
>>> Output : a b
c d
```
>
> Variable 'i' is : a c , and variable 'j' is : b d
>
>
>
Second code:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i,j in x,y,z:
print (i,j)
>>> Output : a b
... | 2020/09/27 | [
"https://Stackoverflow.com/questions/64085248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091910/"
] | In the first piece of code, you iterate on the tuple of strings `(x, y)` (you didn't write the parentheses, but the comma makes the tuple, not the parentheses).
So it boils down to:
```
for two_letters_string in (x, y):
...
```
You do a second thing here: instead of `two_letters_string`, you used a tuple `(i, j... | that's happening because you are given on the loop 2 items i, j
try this now:
```
x= 'ab'
y = 'cd'
z = 'ef'
for i in x :
print (i)
``` |
355,124 | I have a Mac running OS X 10.5 that has a Windows XP boot camp partition that will no longer boots and is throwing me input/output errors when I attempt to view the Bootcamp partition in Terminal. My first priority is backing up everything off this partition.
What are some methods I can use to copy over the files to a... | 2011/11/08 | [
"https://superuser.com/questions/355124",
"https://superuser.com",
"https://superuser.com/users/104577/"
] | A possible link to live video has been reported over the last couple of days. It is possible that you have no firewall set on your router.
Enter this in search - it has an uninstaller at this location:
```
C:\users\Your_User_Name\appdata\local\akamai\
```
I do not know if you should let it pass. That would depend o... | It is reported to be harmless, but no one remembers ever authorizing the software to install. I myself uninstalled it and everything has been running fine since.
I have been told that other people are using this software, bundled with some new virus, it's yet another exploit using someone's harmless software. |
355,124 | I have a Mac running OS X 10.5 that has a Windows XP boot camp partition that will no longer boots and is throwing me input/output errors when I attempt to view the Bootcamp partition in Terminal. My first priority is backing up everything off this partition.
What are some methods I can use to copy over the files to a... | 2011/11/08 | [
"https://superuser.com/questions/355124",
"https://superuser.com",
"https://superuser.com/users/104577/"
] | A possible link to live video has been reported over the last couple of days. It is possible that you have no firewall set on your router.
Enter this in search - it has an uninstaller at this location:
```
C:\users\Your_User_Name\appdata\local\akamai\
```
I do not know if you should let it pass. That would depend o... | Scott Hanselman has a write up of this that can be found [here](http://www.hanselman.com/blog/CSIMyComputerWhatIsNetsessionwinexeFromAkamaiAndHowDidItGetOnMySystem.aspx). He explains how he found it and what he's found out about it.
Summary seems to be that it is signed by Akamai (CDN company) and probably bundled as ... |
994,414 | Call a triple-x number an integer $k$ such that $k=x(x+1)(x+2)$ where $x \in Z$. How many triple-x numbers are there between 0 and 100,000?
I thought by doing $8!$ and $9!$ would work to see how many combinations there would be. I am not sure how to solve this problem. Can someone show me how to solve this? | 2014/10/28 | [
"https://math.stackexchange.com/questions/994414",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187869/"
] | First, let's note that for $x=-3$ or lower the product will be negative and thus, there aren't any values lower than this. $x=-2,-1,0$ all give the same value of 0. Note that $46\*47\*48=103776$ while $45\*46\*47=97290$ which would give 45 as the highest bound and 0 is the lowest, thus producing 46 numbers assuming tha... | Well, there's one with $x = 0$, one with $x = 1$, and keep going until you get something bigger than $100,000$. Equivalently, you're solving the inequality $x(x+1)(x+2) < 100,000$, which can be done in various ways (though there's no really *clean* way of doing it). |
5,449,470 | How do I structure my data such that say, there is one question that associates with 5 choices, and each choice has a vote associated with it? if you think of it like a tree, the question is the root which has 5 leaves,the choices, and each choice has only one leaf, votes.
```
var myJSONObject = {"bindings": [
{... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5449470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624392/"
] | **See update below**
If you have a JavaScript object already, use `JSON.stringify` on it to get the equivalent JSON string. There's an implementation of `JSON.stringify` in json2.js by Douglas Crockford (originator of JSON) [on his github page](https://github.com/douglascrockford/JSON-js/). An increasing number of bro... | Simplest way to convert JSON text to JS object use "eval()".
```
var obj = eval('(' + myJSONtext + ')');
```
However eval() has security issues as we can compile and execute any javascript code within it. Therefore "parse" is recomended to convert JSON text to JS object.
```
var obj = JSON.parse(myJSONtext);
```
... |
119,813 | I would love to make something like this for personal use/as a printable, however, I lack the know-how to space the numbers and to neatly create the circles.
My goal:
Create a pdf file with several circles. One for the months, one for the days (numbers) and names of days. Plus ideally another circle to create an over... | 2019/01/31 | [
"https://graphicdesign.stackexchange.com/questions/119813",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/132644/"
] | I'm not sure about whats your goal but to create a design similar to the examples you provided is quite simple.
1. Create a circle with the Ellipse tool (with the size you want to print) and create two more identical circles. Scale one of these circles down to 75% and the other down to 50%. You should create something... | Obviously you cannot place texts and numbers consistently. This is one way to place them for a reading hole at three o'clock like in your first example:
[](https://i.stack.imgur.com/I5agS.jpg)
1. Write one day name. Be sure it's aligned to middle of ... |
119,813 | I would love to make something like this for personal use/as a printable, however, I lack the know-how to space the numbers and to neatly create the circles.
My goal:
Create a pdf file with several circles. One for the months, one for the days (numbers) and names of days. Plus ideally another circle to create an over... | 2019/01/31 | [
"https://graphicdesign.stackexchange.com/questions/119813",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/132644/"
] | I'm not sure about whats your goal but to create a design similar to the examples you provided is quite simple.
1. Create a circle with the Ellipse tool (with the size you want to print) and create two more identical circles. Scale one of these circles down to 75% and the other down to 50%. You should create something... | Solutions for the problems you run into.
* Type on a path makes the path invisible. Yes you may need to create two more concentric circles in donut shape to get that background.
* Try the below approach to space the text evenly.
Follow the below steps to get the result you wanted in the first link you've given.
**St... |
54,415,854 | I'm fetching the chart dynamically ..
This is `chart` of current month which ranges from 1-31
[](https://i.stack.imgur.com/98trd.png)
I want to have a `range filter` for example:
`2012/01/1 to 2014/01/1`
How can I do this `labels` will be too many? ... | 2019/01/29 | [
"https://Stackoverflow.com/questions/54415854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6725765/"
] | As explained by the logs, the `install.sh` script is trying to locate a profile, which it could not found. (remember that the script provided in user-data is run as root, so $HOME is `/root`.
The solution is to either ensure the profile file will exist before installation, either to manually change the path after the ... | If we are using amazon linux, try to install the `nvm` version 16
```
#!/bin/bash
sudo su
cd ~
amazon-linux-extras install nginx1 -y
systemctl enable nginx
systemctl start nginx
touch ~/.bashrc
cat > /tmp/startup.sh << EOF
echo "Setting up NodeJS Environment"
curl -o- https://raw.githubusercontent.com/creationix/nvm/... |
54,415,854 | I'm fetching the chart dynamically ..
This is `chart` of current month which ranges from 1-31
[](https://i.stack.imgur.com/98trd.png)
I want to have a `range filter` for example:
`2012/01/1 to 2014/01/1`
How can I do this `labels` will be too many? ... | 2019/01/29 | [
"https://Stackoverflow.com/questions/54415854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6725765/"
] | As explained by the logs, the `install.sh` script is trying to locate a profile, which it could not found. (remember that the script provided in user-data is run as root, so $HOME is `/root`.
The solution is to either ensure the profile file will exist before installation, either to manually change the path after the ... | After spending several hours on an exercise, this worked for me.
```bash
#!/bin/bash
touch ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install --lts
``` |
54,415,854 | I'm fetching the chart dynamically ..
This is `chart` of current month which ranges from 1-31
[](https://i.stack.imgur.com/98trd.png)
I want to have a `range filter` for example:
`2012/01/1 to 2014/01/1`
How can I do this `labels` will be too many? ... | 2019/01/29 | [
"https://Stackoverflow.com/questions/54415854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6725765/"
] | If we are using amazon linux, try to install the `nvm` version 16
```
#!/bin/bash
sudo su
cd ~
amazon-linux-extras install nginx1 -y
systemctl enable nginx
systemctl start nginx
touch ~/.bashrc
cat > /tmp/startup.sh << EOF
echo "Setting up NodeJS Environment"
curl -o- https://raw.githubusercontent.com/creationix/nvm/... | After spending several hours on an exercise, this worked for me.
```bash
#!/bin/bash
touch ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install --lts
``` |
36,299,342 | I have a simple form with only 1 input field. For each input a new object is created.This is my method for adding new objects. I am looking for Angular way to add IDs to these objects, what would you suggest?
```
$scope.addToDoItem = function(){
var toDoItems = $scope.toDoItems;
var newToDoItem = {
"id" : // i... | 2016/03/30 | [
"https://Stackoverflow.com/questions/36299342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5426743/"
] | I don't think there is "angular way" of doing it.
However, currently you are using the milliseconds for `createdAt` value, so you can use the same value for Id as well. If you don't have application where new value can be added more frequently you will have your unique value:
```
var currentDate = Date.now();
var new... | if you want a random hash you could also do this
```
$scope.addToDoItem = function() {
var toDoItems = $scope.toDoItems;
var newToDoItem = {
"id": function randString() {
var x = 32; // hashlength
var s = "";
while (s.length < x && x > 0) {
var r = Math.random();
s ... |
34,066,626 | Working on a project for my web design class and can't figure out where all this white space is coming from. Everything needs to touch each other yet I think I have extra padding somewhere but I just can't seem to pinpoint it. Here is all my code. Also, I'd like to know how to get rid of the bullets in my `<ul>` on the... | 2015/12/03 | [
"https://Stackoverflow.com/questions/34066626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346865/"
] | You need a `group by`:
```
SELECT tickets.*, COUNT(sales.ID) AS tcount
FROM tickets LEFT JOIN
sales
ON tickets.ID = sales.ticket_ID
GROUP BY tickets.ID;
``` | Either switch the table orders or do a `RIGHT JOIN` instead. ie:
```
SELECT tickets.*,
COUNT(sales.ID) AS tcount
FROM sales LEFT JOIN tickets ON tickets.ID = sales.ticket_ID
```
or
```
SELECT tickets.*,
COUNT(sales.ID) AS tcount
FROM tickets RIGHT JOIN sales ON tickets.ID = sales.ticket_ID
``` |
33,383 | In the trinity the belief is that the Father is God, the Son is God, and the holy ghost is God.
The Father is a Person, and Son is a Person, and the holy Ghost is a Person.
And they all always existed, no beginning to any of the Persons.
Co-equal, co-substantial, co-eternal.
Now is the understanding that they have ... | 2014/10/01 | [
"https://christianity.stackexchange.com/questions/33383",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/14745/"
] | Edit: removed old answer
I think this link will help explain what you are asking: [Was Jesus Limited While On Earth?](http://gracethrufaith.com/ask-a-bible-teacher/was-jesus-limited-while-on-earth/)
For future reference if that site or page disappears from the internet it is quoted below:
>
> ### Was Jesus Limited ... | In your question you appear to be overlooking two very important things.
1. Jesus was not only God, but he was also human.
2. Humans feel physical pain, even though Spirits do not.
In the Scriptures that you cite it must be remembered that Jesus was in an inordinate state. That is to say that the Deity Jesus was awar... |
33,383 | In the trinity the belief is that the Father is God, the Son is God, and the holy ghost is God.
The Father is a Person, and Son is a Person, and the holy Ghost is a Person.
And they all always existed, no beginning to any of the Persons.
Co-equal, co-substantial, co-eternal.
Now is the understanding that they have ... | 2014/10/01 | [
"https://christianity.stackexchange.com/questions/33383",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/14745/"
] | The question, as it stands, really isn't soluable.
**Reason #1: The Crucifixion raises other Trinitarian questions**
First and foremost, the Trinity itself is hard enough to understand. [There is no good analogy](https://christianity.stackexchange.com/a/13655/1039) and any attempt to make one will necessarily [fail b... | In your question you appear to be overlooking two very important things.
1. Jesus was not only God, but he was also human.
2. Humans feel physical pain, even though Spirits do not.
In the Scriptures that you cite it must be remembered that Jesus was in an inordinate state. That is to say that the Deity Jesus was awar... |
33,383 | In the trinity the belief is that the Father is God, the Son is God, and the holy ghost is God.
The Father is a Person, and Son is a Person, and the holy Ghost is a Person.
And they all always existed, no beginning to any of the Persons.
Co-equal, co-substantial, co-eternal.
Now is the understanding that they have ... | 2014/10/01 | [
"https://christianity.stackexchange.com/questions/33383",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/14745/"
] | **Catholic teaching and understanding** is that Christ has two wills, divine (of which, there is only one1) and human - without the human, to my understanding, he couldn't have redeemed in the manner he redeemed [cf. [Heb 5:8](https://www.biblegateway.com/passage/?search=Hebrews%205%3A8&version=RSVCE) & [Phil 2:7-9](ht... | In your question you appear to be overlooking two very important things.
1. Jesus was not only God, but he was also human.
2. Humans feel physical pain, even though Spirits do not.
In the Scriptures that you cite it must be remembered that Jesus was in an inordinate state. That is to say that the Deity Jesus was awar... |
73,489,249 | I need to show a popup every time when i open the app after 20 sec.
**code:** with this code i can show popup only when i open the app first time after 20 sec.. but **i need to show the same when i close the app and open again**.. how to do that? please guide me.
```
var timer = Timer()
override func viewDidLoad() {
... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19758374/"
] | First of all, you have to locate your `select` element in the script. To do this, you need to provide it with a specific `id`.
```
<select id="test_selector">
<option>test1</option>
<option>test2</option>
</select>
```
Then you can use this `id` to access that *selector* in the JS. In order to get the updated... | Try this
```
select.addEventListener('select',(e)=>{
console.log(e.target.value);
})
``` |
73,489,249 | I need to show a popup every time when i open the app after 20 sec.
**code:** with this code i can show popup only when i open the app first time after 20 sec.. but **i need to show the same when i close the app and open again**.. how to do that? please guide me.
```
var timer = Timer()
override func viewDidLoad() {
... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19758374/"
] | First of all, you have to locate your `select` element in the script. To do this, you need to provide it with a specific `id`.
```
<select id="test_selector">
<option>test1</option>
<option>test2</option>
</select>
```
Then you can use this `id` to access that *selector* in the JS. In order to get the updated... | Another option is to do it on jquery if you feel more comfy with it
Give your select an id
```
<select id="id_selector">
<option>test1</option>
<option>test2</option>
</select>
```
Use a jquery .change function to get the value of the selected option
```
$('#id_selector').change(function(){
console.log(... |
73,489,249 | I need to show a popup every time when i open the app after 20 sec.
**code:** with this code i can show popup only when i open the app first time after 20 sec.. but **i need to show the same when i close the app and open again**.. how to do that? please guide me.
```
var timer = Timer()
override func viewDidLoad() {
... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19758374/"
] | Another option is to do it on jquery if you feel more comfy with it
Give your select an id
```
<select id="id_selector">
<option>test1</option>
<option>test2</option>
</select>
```
Use a jquery .change function to get the value of the selected option
```
$('#id_selector').change(function(){
console.log(... | Try this
```
select.addEventListener('select',(e)=>{
console.log(e.target.value);
})
``` |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | You may want to look at @AfterClass annotation, for Junit 4. This annotation will run when the tests are done.
<http://cwiki.apache.org/DIRxDEV/junit4-primer.html> |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | DNUnit should help you in this regard.
You can create separate data sets for each individual test case if you wish. |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | DBUnit will help a lot with this. You could theoretically turn off autocommits on JDBC, but it will get hairy. The most obvious solution is to use DBUnit to set your data to a known state before you run the tests. IF for some reason you need your data back after the tests are run, you could look at @AfterClass on a sui... |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | One solution that you may want to consider is to use a "manual" rollback or compensating transaction in db tear down. I suppose (and if it's not then it should be a trivial add-on to your Hibernate entities) all your entities have datetime create attribute indicating when they were INSERTed into the table. Your db setu... |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | If you're working with relatively small database, and with a DBMS that can do backups/exports of it relatively fast (like MS SQL Server), you can consider creating a database backup before the tests, and then restore it when all testing is complete. This enables you to set-up a development/testing database and use it a... |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | Is there a reason that you have to have a connection to the database to run your unit tests? It sounds like it might be easier to refactor your class so that you can mock the interaction with the database. You can mock classes (with some exceptions) as well as interfaces with EasyMock (www.easymock.org).
If your clas... |
822,846 | I have a class I'm unit testing that requires fairly extensive database setup before the individual test methods can run. This setup takes a long time: for reasons hopefully not relevant to the question at hand, I need to populate the DB programatically instead of from an SQL dump.
The issue I have is with the tear-do... | 2009/05/05 | [
"https://Stackoverflow.com/questions/822846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84818/"
] | Are you stuck with a specific database vendor? If not, you could use an in-memory database, such as [HSQLDB](http://hsqldb.org/). When you are done with the tests you just throw away the state. This is only appropriate if the tables can be empty at the start of the test suite (before your programmatic setup, that is).
... | Hibernate has a neat little feature that is heavily under-documented and unknown. You can execute an SQL script during the SessionFactory creation right after the database schema generation to import data in a fresh database. You just need to add a file named import.sql in your classpath root and set either create or c... |
71,992,622 | I have two lists, one contains the working days, the other one contains the fees corresponding to the working days:
```
wd = [1, 4, 5, 6]
fees = [1.44, 1.17, 1.21, 1.26]
```
I need a third list with all workdays, filling up fees in the workdays that do not have fees with fees from the previous day:
```
result = [1.... | 2022/04/24 | [
"https://Stackoverflow.com/questions/71992622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18930272/"
] | I'd start by building a dictionary to be able to look up fees by day:
```
>>> wd = [1,4,5,6]
>>> fees = [1.44, 1.17, 1.21, 1.26]
>>> fee_dict = dict(zip(wd, fees))
```
Then build `correspDay` with a simple `range`:
```
>>> correspDay = list(range(1, 7))
```
and build `result` by iterating over `correspDay`, using... | I would put the values in a dictionary, then loop through the days of the week (1-7) checking if we already have a value for that day. If you do have a value for that day store it incase the next day doesn't have a value. If there isn't a value create an item in the dictionary with a key for that day and a value of the... |
71,992,622 | I have two lists, one contains the working days, the other one contains the fees corresponding to the working days:
```
wd = [1, 4, 5, 6]
fees = [1.44, 1.17, 1.21, 1.26]
```
I need a third list with all workdays, filling up fees in the workdays that do not have fees with fees from the previous day:
```
result = [1.... | 2022/04/24 | [
"https://Stackoverflow.com/questions/71992622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18930272/"
] | I'd start by building a dictionary to be able to look up fees by day:
```
>>> wd = [1,4,5,6]
>>> fees = [1.44, 1.17, 1.21, 1.26]
>>> fee_dict = dict(zip(wd, fees))
```
Then build `correspDay` with a simple `range`:
```
>>> correspDay = list(range(1, 7))
```
and build `result` by iterating over `correspDay`, using... | `feeMap` maps `days` to `fee` that has to be paid `prev` is used to store the previous value(fee).
```
#!/usr/bin/env python3.10
wd = [1,4,5,6]
fees = [1.44, 1.17, 1.21, 1.26]
corresDay = list(range(1, 6))
feeMap = dict()
index = 0
for index, day in enumerate(wd):
feeMap[day] = fees[index]
prev = None
for day... |
71,992,622 | I have two lists, one contains the working days, the other one contains the fees corresponding to the working days:
```
wd = [1, 4, 5, 6]
fees = [1.44, 1.17, 1.21, 1.26]
```
I need a third list with all workdays, filling up fees in the workdays that do not have fees with fees from the previous day:
```
result = [1.... | 2022/04/24 | [
"https://Stackoverflow.com/questions/71992622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18930272/"
] | I'd start by building a dictionary to be able to look up fees by day:
```
>>> wd = [1,4,5,6]
>>> fees = [1.44, 1.17, 1.21, 1.26]
>>> fee_dict = dict(zip(wd, fees))
```
Then build `correspDay` with a simple `range`:
```
>>> correspDay = list(range(1, 7))
```
and build `result` by iterating over `correspDay`, using... | I didn't do anything I saw the good people above and I try to make it more clear for you.
```
wd = [1,4,5,6]
fees = [1.44, 1.17, 1.21, 1.26]
fee_dict = dict(zip(wd, fees))
correspDay = list(range(1,8))
result = []
for i in correspDay:
result.append(fee_dict.get(i) or result[-1])
```
I just add this line to make ... |
71,992,622 | I have two lists, one contains the working days, the other one contains the fees corresponding to the working days:
```
wd = [1, 4, 5, 6]
fees = [1.44, 1.17, 1.21, 1.26]
```
I need a third list with all workdays, filling up fees in the workdays that do not have fees with fees from the previous day:
```
result = [1.... | 2022/04/24 | [
"https://Stackoverflow.com/questions/71992622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18930272/"
] | I would put the values in a dictionary, then loop through the days of the week (1-7) checking if we already have a value for that day. If you do have a value for that day store it incase the next day doesn't have a value. If there isn't a value create an item in the dictionary with a key for that day and a value of the... | `feeMap` maps `days` to `fee` that has to be paid `prev` is used to store the previous value(fee).
```
#!/usr/bin/env python3.10
wd = [1,4,5,6]
fees = [1.44, 1.17, 1.21, 1.26]
corresDay = list(range(1, 6))
feeMap = dict()
index = 0
for index, day in enumerate(wd):
feeMap[day] = fees[index]
prev = None
for day... |
71,992,622 | I have two lists, one contains the working days, the other one contains the fees corresponding to the working days:
```
wd = [1, 4, 5, 6]
fees = [1.44, 1.17, 1.21, 1.26]
```
I need a third list with all workdays, filling up fees in the workdays that do not have fees with fees from the previous day:
```
result = [1.... | 2022/04/24 | [
"https://Stackoverflow.com/questions/71992622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18930272/"
] | I would put the values in a dictionary, then loop through the days of the week (1-7) checking if we already have a value for that day. If you do have a value for that day store it incase the next day doesn't have a value. If there isn't a value create an item in the dictionary with a key for that day and a value of the... | I didn't do anything I saw the good people above and I try to make it more clear for you.
```
wd = [1,4,5,6]
fees = [1.44, 1.17, 1.21, 1.26]
fee_dict = dict(zip(wd, fees))
correspDay = list(range(1,8))
result = []
for i in correspDay:
result.append(fee_dict.get(i) or result[-1])
```
I just add this line to make ... |
349,129 | Two ePub books that I've bought won't open in Books.app in macOS Mojave 10.14. The books have social DRM (personal information added to the content of the book), and I don't think this should be a problem for Books.app. If I rename the epub extension to zip, then I can unzip the file using the `unzip` command. Using th... | 2019/01/20 | [
"https://apple.stackexchange.com/questions/349129",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/35070/"
] | If your ebook indeed is unencrypted, you can try to open the ePub with the free Sigil.app (an ePub creator/editor) and write another copy to disk.
Sigil is able to repair a lot of structural problems. You can get a precompiled dmg as well as the full source code [here](https://github.com/Sigil-Ebook/Sigil/releases/tag... | It's hard to know whether the "social DRM" or some other aspect of the epubs you mention is causing the problem with Books app. The best course is to let the publisher know so they can investigate if they wish and in the meantime use Calibre or another epub reader to read the books. |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try to make your regex more restrictive by matching the pattern more closely.
So for example, for the timestamp in the beginning use something like this:
```
\[\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d\]
```
This way you will make sure there are no false positive matches | Your timestamp seems to have a straight forward layout, why not capture that explicitly:
```
var regex = /\[\d{2,4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}(?:,|.)\d+\]/;
'[2016-01-22 22:14:58,235] WARN service.catalog.MediaController - foo2 foo foo foo foo foo]; sdfd sf sd'.match(regex) // -> ["[2016-01-22 22:14:58,235]"]
... |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try this:
```
^\[(.*?)\]
```
[Demo - RegEx101](https://regex101.com/r/oZ2cQ6/1) | Try to make your regex more restrictive by matching the pattern more closely.
So for example, for the timestamp in the beginning use something like this:
```
\[\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d\]
```
This way you will make sure there are no false positive matches |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try to make your regex more restrictive by matching the pattern more closely.
So for example, for the timestamp in the beginning use something like this:
```
\[\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d\]
```
This way you will make sure there are no false positive matches | It is not really clear what you want to achive. My idea is `\d{1,4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2},\d{1,3}`. If you want do capture the brackets either, add `\[` and `\]` to the expression. |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try to make your regex more restrictive by matching the pattern more closely.
So for example, for the timestamp in the beginning use something like this:
```
\[\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d\]
```
This way you will make sure there are no false positive matches | This regex should work for you:
```
/\[[\d-\s:,]+]/gm
```
[demo](https://regex101.com/r/bA0bU7/1)
PD: Your option is not bad idea, is the most specific that can be, and that´s good: [(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d)] |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try this:
```
^\[(.*?)\]
```
[Demo - RegEx101](https://regex101.com/r/oZ2cQ6/1) | Your timestamp seems to have a straight forward layout, why not capture that explicitly:
```
var regex = /\[\d{2,4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}(?:,|.)\d+\]/;
'[2016-01-22 22:14:58,235] WARN service.catalog.MediaController - foo2 foo foo foo foo foo]; sdfd sf sd'.match(regex) // -> ["[2016-01-22 22:14:58,235]"]
... |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try this:
```
^\[(.*?)\]
```
[Demo - RegEx101](https://regex101.com/r/oZ2cQ6/1) | It is not really clear what you want to achive. My idea is `\d{1,4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2},\d{1,3}`. If you want do capture the brackets either, add `\[` and `\]` to the expression. |
35,036,918 | This is the regex I'm using
```
.match(/\[(.*)\]\s*([^\s]+)\s*([^\s]+)\s*(.*)/)
```
and it fails to capture the timestamp properly when there is another close square bracket
```
[2016-01-22 22:14:58,098] WARN service.catalog.MediaController - foo1 foo foo foo foo foo
[2016-01-22 22:14:58,235] WARN service.catalo... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35036918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989155/"
] | Try this:
```
^\[(.*?)\]
```
[Demo - RegEx101](https://regex101.com/r/oZ2cQ6/1) | This regex should work for you:
```
/\[[\d-\s:,]+]/gm
```
[demo](https://regex101.com/r/bA0bU7/1)
PD: Your option is not bad idea, is the most specific that can be, and that´s good: [(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d,\d\d\d)] |
2,872,555 | Summary of environment.
* Asp.net web application (source stored in svn)
* SQL Server database. (Database schema (tables/sprocs) stored in svn)
* db version is synced with web application assembly version. (stored in table 'CurrentVersion')
* CI hudson server that checks out web app from repo and runs custom msbuild ... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2872555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345963/"
] | Have a look at SQL database projects. In VS 2010 they have been enhanced quite a bit and have built in deployment capabilities that can sync your DEV database to other environments.
Here are a few good links about DB projects in vs 2010:
<http://msmvps.com/blogs/deborahk/archive/2010/05/02/vs-2010-database-project-bui... | Try SQL Examiner:
<http://www.sqlaccessories.com/Howto/Version_Control.aspx>
You can automate script collecting with SQL Examiner command-line tool. |
2,872,555 | Summary of environment.
* Asp.net web application (source stored in svn)
* SQL Server database. (Database schema (tables/sprocs) stored in svn)
* db version is synced with web application assembly version. (stored in table 'CurrentVersion')
* CI hudson server that checks out web app from repo and runs custom msbuild ... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2872555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345963/"
] | Have a look at SQL database projects. In VS 2010 they have been enhanced quite a bit and have built in deployment capabilities that can sync your DEV database to other environments.
Here are a few good links about DB projects in vs 2010:
<http://msmvps.com/blogs/deborahk/archive/2010/05/02/vs-2010-database-project-bui... | The solutions available today that target a .NET/SQL Server stack are:
* [DBUp](https://dbup.github.io/) (open source)
* [ReadyRoll](http://www.red-gate.com/products/sql-development/readyroll/) (deeper Visual Studio integration,
auto-generation of scripts)
The latter product is one that we're actively developing here... |
2,872,555 | Summary of environment.
* Asp.net web application (source stored in svn)
* SQL Server database. (Database schema (tables/sprocs) stored in svn)
* db version is synced with web application assembly version. (stored in table 'CurrentVersion')
* CI hudson server that checks out web app from repo and runs custom msbuild ... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2872555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345963/"
] | Integrating SQL changes into an automated build/deploy process is HARD. I know, because I've tried to to it a couple times with limited success. What you're trying to do is roughly on the right track, but I would argue that it's actually a bit too complicated. In your proposal, you suggest collecting the specific SQL s... | Try SQL Examiner:
<http://www.sqlaccessories.com/Howto/Version_Control.aspx>
You can automate script collecting with SQL Examiner command-line tool. |
2,872,555 | Summary of environment.
* Asp.net web application (source stored in svn)
* SQL Server database. (Database schema (tables/sprocs) stored in svn)
* db version is synced with web application assembly version. (stored in table 'CurrentVersion')
* CI hudson server that checks out web app from repo and runs custom msbuild ... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2872555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/345963/"
] | Integrating SQL changes into an automated build/deploy process is HARD. I know, because I've tried to to it a couple times with limited success. What you're trying to do is roughly on the right track, but I would argue that it's actually a bit too complicated. In your proposal, you suggest collecting the specific SQL s... | The solutions available today that target a .NET/SQL Server stack are:
* [DBUp](https://dbup.github.io/) (open source)
* [ReadyRoll](http://www.red-gate.com/products/sql-development/readyroll/) (deeper Visual Studio integration,
auto-generation of scripts)
The latter product is one that we're actively developing here... |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Something like:
```
function buttonToggle(where,pval,nval) {
var display = where.value === nval ? 'none' : 'block'; // or 'table'
document.getElementById('yourTableId').style.display = display;
where.value = (where.value == pval) ? nval : pval;
}
```
---
Or better:
```
function buttonToggle(source, ta... | You will want to change the div's `style.visible` to `visible` or `hidden`, and/or set the `style.display` to `block` or `none`.
See: <http://w3schools.com/css/css_display_visibility.asp> |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | use jQuery. see demo <http://jsfiddle.net/nBJXq/2/> | You will want to change the div's `style.visible` to `visible` or `hidden`, and/or set the `style.display` to `block` or `none`.
See: <http://w3schools.com/css/css_display_visibility.asp> |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Well if you can use jQuery it would be very easy:
```
$('#nextbt').click(function() {
if ($(this).attr('value') == 'show') {
$(this).attr('value', 'hide');
$('#myotherdiv').slideDown();
} else {
$(this).attr('value', 'show');
$('#myotherdiv').slideUp();
}
// or if you d... | You will want to change the div's `style.visible` to `visible` or `hidden`, and/or set the `style.display` to `block` or `none`.
See: <http://w3schools.com/css/css_display_visibility.asp> |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Let's say you add the `id` of the table you want to show/hide as the `rel` attribute of the button:
```
<input type="button" name="button1" id="nextbt"
rel="myTable" value="View "
onclick="buttonToggle(this,'View ','Hide ')">
<table id="myTable">
<tr>
<td>myTable</td>
</tr>
</table>
`... | You will want to change the div's `style.visible` to `visible` or `hidden`, and/or set the `style.display` to `block` or `none`.
See: <http://w3schools.com/css/css_display_visibility.asp> |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Well if you can use jQuery it would be very easy:
```
$('#nextbt').click(function() {
if ($(this).attr('value') == 'show') {
$(this).attr('value', 'hide');
$('#myotherdiv').slideDown();
} else {
$(this).attr('value', 'show');
$('#myotherdiv').slideUp();
}
// or if you d... | Something like:
```
function buttonToggle(where,pval,nval) {
var display = where.value === nval ? 'none' : 'block'; // or 'table'
document.getElementById('yourTableId').style.display = display;
where.value = (where.value == pval) ? nval : pval;
}
```
---
Or better:
```
function buttonToggle(source, ta... |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Well if you can use jQuery it would be very easy:
```
$('#nextbt').click(function() {
if ($(this).attr('value') == 'show') {
$(this).attr('value', 'hide');
$('#myotherdiv').slideDown();
} else {
$(this).attr('value', 'show');
$('#myotherdiv').slideUp();
}
// or if you d... | use jQuery. see demo <http://jsfiddle.net/nBJXq/2/> |
5,238,773 | How can I get my toggle button to not only change names from view to hide but to also display a table that I have in a div tag?
I currently have the following for my script:
```
<script type = "text/javascript">
function buttonToggle(where,pval,nval)
{
where.value = (where.value == pval) ? nval : pval;
}
... | 2011/03/08 | [
"https://Stackoverflow.com/questions/5238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650553/"
] | Well if you can use jQuery it would be very easy:
```
$('#nextbt').click(function() {
if ($(this).attr('value') == 'show') {
$(this).attr('value', 'hide');
$('#myotherdiv').slideDown();
} else {
$(this).attr('value', 'show');
$('#myotherdiv').slideUp();
}
// or if you d... | Let's say you add the `id` of the table you want to show/hide as the `rel` attribute of the button:
```
<input type="button" name="button1" id="nextbt"
rel="myTable" value="View "
onclick="buttonToggle(this,'View ','Hide ')">
<table id="myTable">
<tr>
<td>myTable</td>
</tr>
</table>
`... |
53,093,998 | I'm trying to convert the sine of an angle from radians to degrees and I keep getting inaccurate numbers. My code looks like this:
```
public class PhysicsSolverAttempt2 {
public static void main(String[] args) {
double[] numbers = {60, 30, 0};
double launchAngle = Double.parseDouble(numbers[0]);
... | 2018/11/01 | [
"https://Stackoverflow.com/questions/53093998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9647271/"
] | Seems that your `region` data was double-encoded. In javascript, you'll want to decode that, e.g.
```
const response = {
"result": "ok",
"data": [
{
"idx": 1,
"region": "[\"USA \", \"Mexico \", \"Canada \"]",
"regDate": "2018-10-31T07:53:12.000Z"
}
]
};
const regions = JSON.... | You'd save the results of your JSON query to a variable `data`. Then you'd do this:
```
var countries = "";
for (var i = 0; i < data[0].region.length; i++) {
countries += data[0].region[i];
}
var time = data[0].regDate.split("000Z");
``` |
48,265,971 | I am newish to Java and trying to building a small rocket program.
I have 3 distinct methods that change the size and colour of the rockets exhaust jet on the graphical display when invoked which work great individually.
```
public void pulse1()
{
jet.setDiameter(6);
jet.setColour(OUColour.RED);
jet.setX... | 2018/01/15 | [
"https://Stackoverflow.com/questions/48265971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7052518/"
] | When this error occurs, it generally means that hibernate is having problem mapping foreign keys on a right number of columns.
In above case, the `subject` entity in `StudentSubject` class was not getting mapped to two columns, that is the `name` and `teacher_email`(which is the primary key of `Teacher` table).
To fi... | try to set OneToMany in this way:
```
@OneToMany(
cascade = CascadeType.ALL,
orphanRemoval = true)
private List<StudentSubject> students = new ArrayList<>();
``` |
48,265,971 | I am newish to Java and trying to building a small rocket program.
I have 3 distinct methods that change the size and colour of the rockets exhaust jet on the graphical display when invoked which work great individually.
```
public void pulse1()
{
jet.setDiameter(6);
jet.setColour(OUColour.RED);
jet.setX... | 2018/01/15 | [
"https://Stackoverflow.com/questions/48265971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7052518/"
] | When this error occurs, it generally means that hibernate is having problem mapping foreign keys on a right number of columns.
In above case, the `subject` entity in `StudentSubject` class was not getting mapped to two columns, that is the `name` and `teacher_email`(which is the primary key of `Teacher` table).
To fi... | It is definitely too late but I will answer so maybe it helps some other people. I had similar issue to yours, my error was slightly different though:
```
Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.bla.bl... |
137,537 | ```
left_click = mouse_check_button_pressed (mb_left)
battleMode = true
if (left_click) battleMode = false
if battleMode = false then {
if (key_right) then {
x= x+5
sprite_index= spr_walking
image_speed = 0.5
}
}
```
`battleMode` becomes `true` again once left click is not being held. I tried changing `m... | 2017/02/18 | [
"https://gamedev.stackexchange.com/questions/137537",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/97889/"
] | 1. To set the text you have to use
```
BitmapFontCache.setText(text, x, y);
```
2. In the render method you just do
```
BitmapFontCache.draw(batch);
```
3. You only have to update the score position once in the render method. | Thanks for `Klemmensen` I ended up doing
```
game.font.setColor(Color.WHITE);
game.font.draw(game.batch, "Score: " +score, x, y);
``` |
32,670,720 | I need to find the minimum value in int array, but the answer it gives me is really odd and from that I cannot even judge where the error is, I would really appreciate help. Here is the code I have written:
```
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <conio.h>
#include <rand... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32670720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5001188/"
] | >
>
> ```
> int main(int k, int minimum){
>
> ```
>
>
This is illegal. The only valid signature for `main()` is
```
int main(int argc, char* argv[]) {
// ...
}
```
or leave out any parameters at all
```
int main() {
// ...
}
```
In the first case `argc` contains the number of command line argumen... | Initialize your minimum variable as `minimum = array[0]` so your code will become like follow
```
int minVert(int minimum, int i){
int j, array[20];
minimum = array[0];
for (j = 0; j < 19; j++) {
if (array[i] < minimum ) {
minimum = array[i];
}
}
return minimum;
}
```
A... |
32,670,720 | I need to find the minimum value in int array, but the answer it gives me is really odd and from that I cannot even judge where the error is, I would really appreciate help. Here is the code I have written:
```
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <conio.h>
#include <rand... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32670720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5001188/"
] | I think your trying to populate the array with random numbers and then find the minimum.
First remove those parameters from the main function if your not going to use them. You haven't really called the function you wrote in the main. so either write that inside the main or call that function.
i would suggest this :
... | Initialize your minimum variable as `minimum = array[0]` so your code will become like follow
```
int minVert(int minimum, int i){
int j, array[20];
minimum = array[0];
for (j = 0; j < 19; j++) {
if (array[i] < minimum ) {
minimum = array[i];
}
}
return minimum;
}
```
A... |
32,670,720 | I need to find the minimum value in int array, but the answer it gives me is really odd and from that I cannot even judge where the error is, I would really appreciate help. Here is the code I have written:
```
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <conio.h>
#include <rand... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32670720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5001188/"
] | I think your trying to populate the array with random numbers and then find the minimum.
First remove those parameters from the main function if your not going to use them. You haven't really called the function you wrote in the main. so either write that inside the main or call that function.
i would suggest this :
... | >
>
> ```
> int main(int k, int minimum){
>
> ```
>
>
This is illegal. The only valid signature for `main()` is
```
int main(int argc, char* argv[]) {
// ...
}
```
or leave out any parameters at all
```
int main() {
// ...
}
```
In the first case `argc` contains the number of command line argumen... |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | One thing I would say is the documentation MUST be in the source code files (using whatever markup you want) and then docs generated automatically from these.
At least on your site, you can generate formatted downloads of the docs as part of the source package so the user doesn't need a specific doc tool
The chance... | Markdown Files Hosted with the source works extremely well.
The RST-based [docutils](http://docutils.sourceforge.net/) tools, for example, can create HTML or LaTex (and PDFs) from one set of documents.
This -- in effect -- combines your option 1 and option 3. |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | One thing I would say is the documentation MUST be in the source code files (using whatever markup you want) and then docs generated automatically from these.
At least on your site, you can generate formatted downloads of the docs as part of the source package so the user doesn't need a specific doc tool
The chance... | If your project is a library, nothing beats javadoc-style documentation to document the API syntax from comments within the code itself.
As for the documentation on tutorials, usage examples, etc. I highly recommend using a wiki format. Other projects I've seen have separate pages for different branches. When you star... |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | One thing I would say is the documentation MUST be in the source code files (using whatever markup you want) and then docs generated automatically from these.
At least on your site, you can generate formatted downloads of the docs as part of the source package so the user doesn't need a specific doc tool
The chance... | If you don't mind converting the docs from Markdown to reStructuredText, consider [Sphinx](http://sphinx.pocoo.org)
. It's just as easy as markdown, but it's a lot more powerful. |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | If your project is a library, nothing beats javadoc-style documentation to document the API syntax from comments within the code itself.
As for the documentation on tutorials, usage examples, etc. I highly recommend using a wiki format. Other projects I've seen have separate pages for different branches. When you star... | Markdown Files Hosted with the source works extremely well.
The RST-based [docutils](http://docutils.sourceforge.net/) tools, for example, can create HTML or LaTex (and PDFs) from one set of documents.
This -- in effect -- combines your option 1 and option 3. |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | Markdown Files Hosted with the source works extremely well.
The RST-based [docutils](http://docutils.sourceforge.net/) tools, for example, can create HTML or LaTex (and PDFs) from one set of documents.
This -- in effect -- combines your option 1 and option 3. | If you don't mind converting the docs from Markdown to reStructuredText, consider [Sphinx](http://sphinx.pocoo.org)
. It's just as easy as markdown, but it's a lot more powerful. |
92,959 | I am the creator of a growing open source project. Currently, I'm becoming frusterated trying to figure out the best way to manage documentation. Here are the options I have considered:
* HTML Website
* A Github Wiki
* Markdown Files Hosted On Github
* Placing All Docs in Github README.md
The documentation is already... | 2011/07/14 | [
"https://softwareengineering.stackexchange.com/questions/92959",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/4881/"
] | If your project is a library, nothing beats javadoc-style documentation to document the API syntax from comments within the code itself.
As for the documentation on tutorials, usage examples, etc. I highly recommend using a wiki format. Other projects I've seen have separate pages for different branches. When you star... | If you don't mind converting the docs from Markdown to reStructuredText, consider [Sphinx](http://sphinx.pocoo.org)
. It's just as easy as markdown, but it's a lot more powerful. |
9,646,214 | I have a byte array i.e **from byte[0] to byte[2]**. I want to first split byte[0] into 8 bits. Then bytes[1] and finally bytes[2]. By splitting I mean that if byte[0]=12345678 then i want to split as variable A=8,Variable B=7, variable C=6,Variable D=5,........ Variable H=0. How to split the byte and store the bits in... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9646214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1166690/"
] | well the bitwise operations seem to be almost what you're talking about.
a byte is composed of 8 bits, and so it goes in the rage of 0 to 255.
written in binary that's 00000000 to 11111111.
Bitwise operations are those that basically use masks to get out as much info as possible out of a byte.
Say for instance you ha... | ```
boolean a = (theByte & 0x1) != 0;
boolean b = (theByte & 0x2) != 0;
boolean c = (theByte & 0x4) != 0;
boolean d = (theByte & 0x8) != 0;
boolean e = (theByte & 0x10) != 0;
boolean f = (theByte & 0x20) != 0;
boolean g = (theByte & 0x40) != 0;
boolean h = (theByte & 0x80) != 0;
``` |
59,681,970 | I have complex application with tons of fragments and sub-fragments, and I need listeners to listen in a fragment, not in activity. This usually works, but not with date or time pickers.
Here is the sample application with activity with one fragment inflated - TestFragmentMain. That inflated fragment have two more fra... | 2020/01/10 | [
"https://Stackoverflow.com/questions/59681970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2378249/"
] | Your fragment `TestFragment_DateBox` calls the date picker and inherits `DatePickerDialog.OnDateSetListener`
```
public class TestFragment_DateBox extends Fragment implements DatePickerDialog.OnDateSetListener
```
and show the date picker fragment like so
```
TestFragment_DatePicker().show(this.childFragmentManager... | The problem is that you not inflate your `TestFragment_DatePicker` which is a `DialogFragment` which is a `Fragment` but return a `DatePickerDialog` which is an `AlertDialog` which is a `Dialog` which don't have a `mParentFragment`. That's why `getParentFragment()` return null.
This looks like a bad architecture desi... |
59,681,970 | I have complex application with tons of fragments and sub-fragments, and I need listeners to listen in a fragment, not in activity. This usually works, but not with date or time pickers.
Here is the sample application with activity with one fragment inflated - TestFragmentMain. That inflated fragment have two more fra... | 2020/01/10 | [
"https://Stackoverflow.com/questions/59681970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2378249/"
] | Your fragment `TestFragment_DateBox` calls the date picker and inherits `DatePickerDialog.OnDateSetListener`
```
public class TestFragment_DateBox extends Fragment implements DatePickerDialog.OnDateSetListener
```
and show the date picker fragment like so
```
TestFragment_DatePicker().show(this.childFragmentManager... | I have found a solution.
In TestFragmentMain, TestFragment\_DateBox need to be transacted with same FragmentManager as DatePicker is. And this is the code in TestFragmentMain:
```
TestFragment_DateBox testFragmentDateBox = new TestFragment_DateBox();
FragmentTransaction ft2 = this.getChildFragmentManager().b... |
18,741,271 | I need to create a program that reads a string " A = B" and searchs B in an array of variables. If it doesn't find B, then it asks its value and put it in another array.
Well, I don't know if the idea is clear, but here is an example:
```
while(1){
printf("Get string\n");
gets(L);
if(L[0]=='\0') break;
if(... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18741271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2768645/"
] | Don't (ever) use `gets()`. It's not good.
Use [`fgets()`](http://linux.die.net/man/3/fgets) instead, noting that it stores the linefeed. Use some higher-level function (like [`sscanf()`](http://linux.die.net/man/3/sscanf)) to parse out the input. Likewise, use another `fgets()` + `sscanf()` combo to do the value readi... | You're doing it wrong, since you never check for errors (including end of file). That's why you're reading twice.
Instead do e.g.
```
while ((fgets(L, sizeof(L), stdin) != NULL)
{
/* ... */
}
``` |
18,741,271 | I need to create a program that reads a string " A = B" and searchs B in an array of variables. If it doesn't find B, then it asks its value and put it in another array.
Well, I don't know if the idea is clear, but here is an example:
```
while(1){
printf("Get string\n");
gets(L);
if(L[0]=='\0') break;
if(... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18741271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2768645/"
] | Don't (ever) use `gets()`. It's not good.
Use [`fgets()`](http://linux.die.net/man/3/fgets) instead, noting that it stores the linefeed. Use some higher-level function (like [`sscanf()`](http://linux.die.net/man/3/sscanf)) to parse out the input. Likewise, use another `fgets()` + `sscanf()` combo to do the value readi... | You scanf doesn't consume the line terminator, just what is typed before it. So the gets() then sees the line terminator, and returns an empty string. |
56,670,534 | I'd like to write a decorator that does somewhat different things when it gets a function or a method.
for example, I'd like to write a cache decorator but I don't want to have `self` as part of the key if it's a method.
```py
def cached(f):
def _internal(*args, **kwargs):
if ismethod(f):
key... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56670534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5435818/"
] | This seems like a very good use case for [Step Functions](https://aws.amazon.com/step-functions/).
Step functions allow you to create a workflow with AWS Services including Lambda that allow for decision branches and wait loops.
For example you could create a workflow that is invoked daily at 5am where you invoke the... | I had a similar situation, my lambda needed to change schedule on weekends and this is how I solved it.
```py
def lambda_handler(event, context):
reschedule_event()
keep_working()
REGULAR_SCHEDULE = 'rate(20 minutes)'
WEEKEND_SHEDULE = 'rate(1 hour)'
RULE_NAME = 'My Rule'
def reschedule_event():
"""
... |
6,911,232 | i'm failing miserably trying to work out how to create a toolbar in css. "all" i'm trying to do is create a 22x22 button toolbar of 4 buttons.
I have this png:  and this code:
```
<style>
#nav {background: url(content/images/crtoolbar.png) no-repeat;height: 22px;widt... | 2011/08/02 | [
"https://Stackoverflow.com/questions/6911232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/170902/"
] | Browser might have a default padding for `ul`.
```
#nav { padding: 0; }
``` | Use a CSS reset. Most common:
```
* { margin: 0; padding: 0; }
``` |
6,911,232 | i'm failing miserably trying to work out how to create a toolbar in css. "all" i'm trying to do is create a 22x22 button toolbar of 4 buttons.
I have this png:  and this code:
```
<style>
#nav {background: url(content/images/crtoolbar.png) no-repeat;height: 22px;widt... | 2011/08/02 | [
"https://Stackoverflow.com/questions/6911232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/170902/"
] | Browser might have a default padding for `ul`.
```
#nav { padding: 0; }
``` | Additional to the answers by jimworm and Rikudo:
If you really only have colors as buttons, you may use CSS only:
```
<style>
/* insert css reset here */
nav li {
list-style-type: none;
display: inline; }
nav a {
display: inline-block;
width: 22px; height: 22px;
overflow: hidden;
text-indent:... |
6,911,232 | i'm failing miserably trying to work out how to create a toolbar in css. "all" i'm trying to do is create a 22x22 button toolbar of 4 buttons.
I have this png:  and this code:
```
<style>
#nav {background: url(content/images/crtoolbar.png) no-repeat;height: 22px;widt... | 2011/08/02 | [
"https://Stackoverflow.com/questions/6911232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/170902/"
] | Additional to the answers by jimworm and Rikudo:
If you really only have colors as buttons, you may use CSS only:
```
<style>
/* insert css reset here */
nav li {
list-style-type: none;
display: inline; }
nav a {
display: inline-block;
width: 22px; height: 22px;
overflow: hidden;
text-indent:... | Use a CSS reset. Most common:
```
* { margin: 0; padding: 0; }
``` |
19,683,922 | Chrome has started to warn me about my legacy gradients:
```
Invalid CSS property value: right no-repeat url('../Images/Logo_white.png'),
-moz-linear-gradient(bottom, #899fa6, #3e545c)
```
It is only for the extensions for o, moz and ms:
```
background: right no-repeat url('../Images/CompanyLogo.png'),
-moz-line... | 2013/10/30 | [
"https://Stackoverflow.com/questions/19683922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1107908/"
] | The reason why you're getting warnings from Chrome's dev tool is because the values are indeed invalid for Chrome. However, this should not alarm you because this is the way that it was designed.
In CSS, if something is defined incorrectly or not recognized by the browser then it is simply passed over, nothing is done... | I found this bug on Chrome Developer Tools:
<http://code.google.com/p/chromium/issues/detail?id=309982>
Seems like they will temporarily disable CSS warnings because of too many false positives (including valid CSS for legacy browsers, if we are to go by the ticket author) until they have fixed it.
Chances are that ... |
3,912,319 | Consider the following initial value problem $$y’=x^2+y^2, y(0)=1$$
Which of the following statements is/ are
$1.$ there exist a unique solution in $[0,\frac{\pi}{4}]$.
$2.$ every solution is bounded on $[0,\frac{\pi}{4}]$.
$3.$ The solution has a singularity at some point in $[0,1]$.
$4.$ The solution because unb... | 2020/11/18 | [
"https://math.stackexchange.com/questions/3912319",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/93918/"
] | You don't need to consider any factorisation. Let $p(x)=\sum\_{i=1}^ka\_ix^i$ be any monic polynomial. If $p(A)=0$, then
$$
p(A^T)=\sum\_{i=1}^ka\_i(A^T)^i=\left(\sum\_{i=1}^ka\_iA^i\right)^T=p(A)^T=0.
$$
Since $A=(A^T)^T$, it is also true that $p(A^T)=0\Rightarrow p(A)=0$. Therefore $A$ and $A^T$ share the same set of... | $m\_A$ and $m\_{A^T}$ are the minimal polynomials for $A$ and $A^T$ respectively.
So we have $m\_A(A) = 0$ and $m\_{A^T}(A^T) = 0$ by definition. Let $m\_A(t) = p\_1(t)p\_2(t)...p\_k(t)$ where $p\_i(t)\forall 1\leq i\leq k$ are the irreducible factors of $m\_A(t)$.
$m\_A(A) = 0 \implies (m\_A(A))^T = 0$, which is jus... |
23,000 | I picked up the phrase '*attention whore*' from [this question at ELU](https://english.stackexchange.com/questions/168752/is-there-a-less-colloquial-word-noun-or-adjective-to-describe-an-attention-wh). On the next day I remembered the phrase as '*attention hooker*.' It transformed and this one even sounds better for me... | 2014/05/08 | [
"https://ell.stackexchange.com/questions/23000",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1616/"
] | The difference as far as I am concerned is that while the two words may have an essentially identical dictionary definition, *hooker* is never used as a direct insult; it is actually less pejorative and more literally descriptive.
If I catch my fiancee sleeping with my best friend, I would never say "You hooker! How d... | The established term is *attention whore*.
There is certainly nothing to prevent you from employing the term *attention hooker*; but it has a different rhythm, it will not be familiar to your hearers, and it risks confusion with *The Hook*, which is common in the CW† trade I follow for any attention-grabbing device at... |
23,000 | I picked up the phrase '*attention whore*' from [this question at ELU](https://english.stackexchange.com/questions/168752/is-there-a-less-colloquial-word-noun-or-adjective-to-describe-an-attention-wh). On the next day I remembered the phrase as '*attention hooker*.' It transformed and this one even sounds better for me... | 2014/05/08 | [
"https://ell.stackexchange.com/questions/23000",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1616/"
] | The established term is *attention whore*.
There is certainly nothing to prevent you from employing the term *attention hooker*; but it has a different rhythm, it will not be familiar to your hearers, and it risks confusion with *The Hook*, which is common in the CW† trade I follow for any attention-grabbing device at... | Your term Attention Hooker,appears to be garnering some confused responses from several people.
I assume these are mainly americans.
I am british ,of Irish descent,Yes i have lived there too.
And for me i like the word, it would indeed conjure up an attention seeker,in a more polite way then the word whore.
Culturally ... |
23,000 | I picked up the phrase '*attention whore*' from [this question at ELU](https://english.stackexchange.com/questions/168752/is-there-a-less-colloquial-word-noun-or-adjective-to-describe-an-attention-wh). On the next day I remembered the phrase as '*attention hooker*.' It transformed and this one even sounds better for me... | 2014/05/08 | [
"https://ell.stackexchange.com/questions/23000",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1616/"
] | The difference as far as I am concerned is that while the two words may have an essentially identical dictionary definition, *hooker* is never used as a direct insult; it is actually less pejorative and more literally descriptive.
If I catch my fiancee sleeping with my best friend, I would never say "You hooker! How d... | You shouldn't use the word *whore* in polite company. The correct phrase is *attention seeker*, but you could say *attention whore* if you are sure that you won't offend the company you are in.
The phrase *attention hooker* is just wrong. |
23,000 | I picked up the phrase '*attention whore*' from [this question at ELU](https://english.stackexchange.com/questions/168752/is-there-a-less-colloquial-word-noun-or-adjective-to-describe-an-attention-wh). On the next day I remembered the phrase as '*attention hooker*.' It transformed and this one even sounds better for me... | 2014/05/08 | [
"https://ell.stackexchange.com/questions/23000",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1616/"
] | The difference as far as I am concerned is that while the two words may have an essentially identical dictionary definition, *hooker* is never used as a direct insult; it is actually less pejorative and more literally descriptive.
If I catch my fiancee sleeping with my best friend, I would never say "You hooker! How d... | Your term Attention Hooker,appears to be garnering some confused responses from several people.
I assume these are mainly americans.
I am british ,of Irish descent,Yes i have lived there too.
And for me i like the word, it would indeed conjure up an attention seeker,in a more polite way then the word whore.
Culturally ... |
23,000 | I picked up the phrase '*attention whore*' from [this question at ELU](https://english.stackexchange.com/questions/168752/is-there-a-less-colloquial-word-noun-or-adjective-to-describe-an-attention-wh). On the next day I remembered the phrase as '*attention hooker*.' It transformed and this one even sounds better for me... | 2014/05/08 | [
"https://ell.stackexchange.com/questions/23000",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/1616/"
] | You shouldn't use the word *whore* in polite company. The correct phrase is *attention seeker*, but you could say *attention whore* if you are sure that you won't offend the company you are in.
The phrase *attention hooker* is just wrong. | Your term Attention Hooker,appears to be garnering some confused responses from several people.
I assume these are mainly americans.
I am british ,of Irish descent,Yes i have lived there too.
And for me i like the word, it would indeed conjure up an attention seeker,in a more polite way then the word whore.
Culturally ... |
24,241,285 | I've created a map having a vector as below:
```
map<int,vector<int>> mymap;
```
How can I sort this map according to the *n*th value of the vector contained by map? | 2014/06/16 | [
"https://Stackoverflow.com/questions/24241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3744394/"
] | **You can't.** You can provide a custom comparator to make the underlying data get sorted another way than the default, but this only relates to *keys*, not *values*. If you have a requirement for your container's elements to exist in some specific, value-defined order, then you're using the wrong container.
You can s... | If I have understood correctly you can (build) add elements to the map the following way
```
std::vector<int> v = { 1, 2, 3 };
std::vector<int>::size_type n = 2;
mymap[v[n]] = v;
```
Here is an example
```
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <ctime>... |
24,241,285 | I've created a map having a vector as below:
```
map<int,vector<int>> mymap;
```
How can I sort this map according to the *n*th value of the vector contained by map? | 2014/06/16 | [
"https://Stackoverflow.com/questions/24241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3744394/"
] | If I have understood correctly you can (build) add elements to the map the following way
```
std::vector<int> v = { 1, 2, 3 };
std::vector<int>::size_type n = 2;
mymap[v[n]] = v;
```
Here is an example
```
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <ctime>... | You can abuse the fact a c++ map uses a tree sorted by its keys. This means that you can either create a new map, with as keys the values you wish it to be sorted on, but you can also create a `vector` with references to the items in your map, and sort that vector (or the other way around: you could have a sorted vecto... |
24,241,285 | I've created a map having a vector as below:
```
map<int,vector<int>> mymap;
```
How can I sort this map according to the *n*th value of the vector contained by map? | 2014/06/16 | [
"https://Stackoverflow.com/questions/24241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3744394/"
] | **You can't.** You can provide a custom comparator to make the underlying data get sorted another way than the default, but this only relates to *keys*, not *values*. If you have a requirement for your container's elements to exist in some specific, value-defined order, then you're using the wrong container.
You can s... | You can abuse the fact a c++ map uses a tree sorted by its keys. This means that you can either create a new map, with as keys the values you wish it to be sorted on, but you can also create a `vector` with references to the items in your map, and sort that vector (or the other way around: you could have a sorted vecto... |
24,241,285 | I've created a map having a vector as below:
```
map<int,vector<int>> mymap;
```
How can I sort this map according to the *n*th value of the vector contained by map? | 2014/06/16 | [
"https://Stackoverflow.com/questions/24241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3744394/"
] | **You can't.** You can provide a custom comparator to make the underlying data get sorted another way than the default, but this only relates to *keys*, not *values*. If you have a requirement for your container's elements to exist in some specific, value-defined order, then you're using the wrong container.
You can s... | >
> `map<int,vector<int>> mymap;`
>
>
> How can i sort this map according to the nth value of the vector contained by map?
>
>
>
That's only possible if you're prepared to use that nth value as the integer key too, as in consistently assigning:
```
mymap[v[n - 1]] = v;
```
If you're doing that, you might cons... |
24,241,285 | I've created a map having a vector as below:
```
map<int,vector<int>> mymap;
```
How can I sort this map according to the *n*th value of the vector contained by map? | 2014/06/16 | [
"https://Stackoverflow.com/questions/24241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3744394/"
] | >
> `map<int,vector<int>> mymap;`
>
>
> How can i sort this map according to the nth value of the vector contained by map?
>
>
>
That's only possible if you're prepared to use that nth value as the integer key too, as in consistently assigning:
```
mymap[v[n - 1]] = v;
```
If you're doing that, you might cons... | You can abuse the fact a c++ map uses a tree sorted by its keys. This means that you can either create a new map, with as keys the values you wish it to be sorted on, but you can also create a `vector` with references to the items in your map, and sort that vector (or the other way around: you could have a sorted vecto... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | Below explanation is given for the integer square root calculation:
>
> In number theory, the integer square root of a positive
> integer n is the positive integer m which is the greatest integer less
> than or equal to the square root of n
>
>
>
The approach your started is good but needs several correction to... | This function will calculate the floor of square root if A is not a perfect square.This function basically uses binary search.Two things you know beforehand is that square root of a number will be less or equal to that number and it will be greater or equal to 1. So we can apply binary search in that range.Below is my ... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | This function uses Nested Intervals (untested) and you can define the accuracy:
```
#include <math.h>
#include <stdio.h>
double mySqrt(double r) {
double l=0, m;
do {
m = (l+r)/2;
if (m*m<2) {
l = m;
} else {
r = m;
}
}
while(fabs(m*m-2) > 1e-10);
return m;
}
```
... | The problem with your code, is that it only works if the square root of the number is exactly N\*0.1, where N is an integer, meaning that if the answer is 1.4142 and not 1.400000000 exactly your code will fail. There are better ways , but they're all more complicated and use numerical analysis to approximate the answer... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | This function uses Nested Intervals (untested) and you can define the accuracy:
```
#include <math.h>
#include <stdio.h>
double mySqrt(double r) {
double l=0, m;
do {
m = (l+r)/2;
if (m*m<2) {
l = m;
} else {
r = m;
}
}
while(fabs(m*m-2) > 1e-10);
return m;
}
```
... | Square Root of a number, given that the number is a perfect square.
The complexity is log(n)
```
/**
* Calculate square root if the given number is a perfect square.
*
* Approach: Sum of n odd numbers is equals to the square root of n*n, given
* that n is a perfect square.
*
* @param number
* @return squareR... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | Below explanation is given for the integer square root calculation:
>
> In number theory, the integer square root of a positive
> integer n is the positive integer m which is the greatest integer less
> than or equal to the square root of n
>
>
>
The approach your started is good but needs several correction to... | ```
#include <iostream>
using namespace std;
int main()
{
double x = 1, average, s, r;
cout << "Squareroot a Number: ";
cin >> s;
r = s * 2;
for ( ; ; ) //for ; ; ; is to run the code forever until it breaks
{
average = (x + s / x) / 2;
if (x == average)
{
cou... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | This function uses Nested Intervals (untested) and you can define the accuracy:
```
#include <math.h>
#include <stdio.h>
double mySqrt(double r) {
double l=0, m;
do {
m = (l+r)/2;
if (m*m<2) {
l = m;
} else {
r = m;
}
}
while(fabs(m*m-2) > 1e-10);
return m;
}
```
... | ```
#include <iostream>
using namespace std;
int main()
{
double x = 1, average, s, r;
cout << "Squareroot a Number: ";
cin >> s;
r = s * 2;
for ( ; ; ) //for ; ; ; is to run the code forever until it breaks
{
average = (x + s / x) / 2;
if (x == average)
{
cou... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | This function will calculate the floor of square root if A is not a perfect square.This function basically uses binary search.Two things you know beforehand is that square root of a number will be less or equal to that number and it will be greater or equal to 1. So we can apply binary search in that range.Below is my ... | ```
#include <iostream>
using namespace std;
int main()
{
double x = 1, average, s, r;
cout << "Squareroot a Number: ";
cin >> s;
r = s * 2;
for ( ; ; ) //for ; ; ; is to run the code forever until it breaks
{
average = (x + s / x) / 2;
if (x == average)
{
cou... |
33,299,667 | I am making a C++ program to calculate the square root of a number. This program does not use the "sqrt" math built in operation. There are two variables, one for the number the user will enter and the other for the square root of that number. This program does not work really well and I am sure there is a better way t... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33299667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303568/"
] | The problem with your code, is that it only works if the square root of the number is exactly N\*0.1, where N is an integer, meaning that if the answer is 1.4142 and not 1.400000000 exactly your code will fail. There are better ways , but they're all more complicated and use numerical analysis to approximate the answer... | ```
#include <iostream>
using namespace std;
int main()
{
double x = 1, average, s, r;
cout << "Squareroot a Number: ";
cin >> s;
r = s * 2;
for ( ; ; ) //for ; ; ; is to run the code forever until it breaks
{
average = (x + s / x) / 2;
if (x == average)
{
cou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.