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 |
|---|---|---|---|---|---|
50,084,195 | I'm basically trying to make a math rotation program in C. But the output is always wrong. P(x,y) is rotated about Q(r,s); clockwise (direction=1) or anticlockwise (direction=0). The a,b,c are angles in triple ,I guess question meant c is in hundred's then b is in ten's and a is unit's.
Input:
```
0
7 3
0 1... | 2018/04/29 | [
"https://Stackoverflow.com/questions/50084195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9697479/"
] | This is what finally works, refer to `ownProps` and the order (`connect` statement should be **after** the `graphql` statement)
```
MyComponent = graphql(createItemImage, {
name: "createItemImage",
options: ownProps => ({
refetchQueries: [
{
query: getEntity,
variables: { id: ownProps.ite... | You need to explicitly pass item.id variable to the component. Therefore add in function a variable naming id
```
MyComponent = graphql(createItemImage, {
name: "createItemImage",
options: {
refetchQueries: [
{
query: getEntity,
variables: { id: id }
}
]
}
})(MyComponent, id)... |
6,150,986 | I have Page in my WP7 Application , this page has some text and some input controls like lists and text boxes, some times when text is more , controls at the bottom of the page disappears.
Is there any way to show scroll bar on the page so that user can see the whole page? | 2011/05/27 | [
"https://Stackoverflow.com/questions/6150986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/772897/"
] | Yes, a `ScrollViewer` control can be used to scroll content that is longer than the visible area available to the control ...
```
<ScrollViewer>
... content goes here ...
</ScrollViewer>
``` | Simply wrap the container element that contains all these elements in a `ScrollViewer`. |
2,795,820 | Here's the question:
>
> Let $(x\_n)$ be a sequence. Assume that $x\_n \to 0$. Let $\sigma :
> \mathbb{N} \to \mathbb{N} $ be a bijection. Define a new sequence $y\_n:= x\_{\sigma(n)}$. Show that $y\_n \to 0$.
>
>
>
Here's my attempted proof:
Let $\epsilon >0$ be arbitrary. Then there exists $N\in\mathbb{N}$ su... | 2018/05/25 | [
"https://math.stackexchange.com/questions/2795820",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/151611/"
] | Something slightly strange has happened. I think where you say $n \geq \sigma(M)$ you just want $n \geq M$. Let's see it your way first:
**Your argument**
You say $M = \max A + 1$.
Then you take $n \geq \sigma(M)$.
Now $y\_n = x\_{\sigma(n)}$ and you want $|y\_n| < \epsilon$, i.e. you want $|x\_{\sigma(n)}| < \ep... | Nitpicking. If $N=1$ then $A=\emptyset$ and $\max A$ does not exist.
You can fix this by saying "Then there exists $N\in \Bbb N$ such that $N>1$ and such that $\forall n\geq N\,(|x\_n|<\epsilon).$"
Or you can fix this by saying "Let $M\in \Bbb N$ such that $\forall n\in A\,(M>n).$" (which is logical whether or not $A... |
3,912,983 | I've got a Mercurial repository that contains a subdirectory for design files and a sub directory for code files.
What's the best way for me to deploy the code subdirectories on my server, keeping it secure, without deploying the design files? | 2010/10/12 | [
"https://Stackoverflow.com/questions/3912983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/300289/"
] | Ideally you should have these in separate repos as Kyle pointed out, optionally, using sub repositories.
However, with your setup as is something like this might be all you need:
```
hg archive -X designDocs /path/to/deploymentDir
```
or if you need to transfer it first:
```
hg archive -X designDocs --type zip /pa... | You might try using [subrepositories](http://mercurial.selenic.com/wiki/Subrepositories) for the two subdirectories. |
65,694,945 | I've created a request for my update method called CandidateProfileUpdateRequest.php:
```
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'photo' => ['mimes:jpeg,png,jpg,gif,bmp', 'max:40... | 2021/01/13 | [
"https://Stackoverflow.com/questions/65694945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10368609/"
] | This will be a little bit clearer if we use correct style:
```
public class Node {
int data;
Node next;
Node (int data) {
this.data = data;
}
}
```
`Node` is a class. Each `Node` instance has a field (`data`) to hold an integer value, and a field (`next`) to hold a reference to another `Node... | Sounds like you're mixing up Primitive types with Reference types. It's important going forward to always differentiate between the two. It seems like you're just starting out so you probably were first introduced to Primitive types like int, double, char and so on. Well reference types are ones that we define with the... |
52,194,859 | I have written a `npy` file in my C++ program using `cnpy`:
```
vector < double > vrmsd(max,99.9);
.
.
.
cnpy::npy_save(frmsd,&vrmsd,{nfeat},"w");
```
following the example [here](https://github.com/rogersce/cnpy/blob/master/example1.cpp).
But when I try to load the file using `numpy` I get an error
```
y = np.loa... | 2018/09/06 | [
"https://Stackoverflow.com/questions/52194859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10172482/"
] | Set the `tag` property for each of your `UISegmentedControl`s, and then use the `sender` which is sent as the first argument to the value changed method to get the `tag`:
```
class Flowchart {
//Init segmented controls up here...
func setup() {
segmentedControl1.addTarget(self, action: #selector(answe... | Vacawama's answer works fine, and is a good fit for the question you're asking, but I advise against using tags. They're fragile. You have to remember to set the tags in your storyboard, and if you change things it's easy to forget to maintain them.
Instead, I would suggest using the sender in Vacawama's answer to fig... |
48,060,487 | I have the following JSON:
```
{
"parameters": [{
"value": "somevalue",
"key": "somekey"
},
{
"value": "othervalue",
"key": "otherkey"
}
]
}
```
Note that the contract of this response guarantees that keys are unique.
I would like to deseralize this into the following class:
... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48060487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/747412/"
] | You need to register a deserializer:
```
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(Response.class, new ResponseDeserializer());
mapper.registerModule(module);
Response resp = mapper.readValue(myjson, Response.class);
```
Here is an example:
```
publi... | You will need a [custom deserializer](http://www.baeldung.com/jackson-deserialization) for this. |
48,060,487 | I have the following JSON:
```
{
"parameters": [{
"value": "somevalue",
"key": "somekey"
},
{
"value": "othervalue",
"key": "otherkey"
}
]
}
```
Note that the contract of this response guarantees that keys are unique.
I would like to deseralize this into the following class:
... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48060487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/747412/"
] | Could you change your JSON to the following?
```
{
"parameters": {
"somekey": "somevalue",
"otherkey" : "othervalue"
}
}
```
If so, deserialization should work without any custom deserializer.
(Reference: <https://blog.hackingcode.io/jackson-java-tutorial-deserialize-json-to-map/> ) | You will need a [custom deserializer](http://www.baeldung.com/jackson-deserialization) for this. |
48,060,487 | I have the following JSON:
```
{
"parameters": [{
"value": "somevalue",
"key": "somekey"
},
{
"value": "othervalue",
"key": "otherkey"
}
]
}
```
Note that the contract of this response guarantees that keys are unique.
I would like to deseralize this into the following class:
... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48060487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/747412/"
] | You need to register a deserializer:
```
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(Response.class, new ResponseDeserializer());
mapper.registerModule(module);
Response resp = mapper.readValue(myjson, Response.class);
```
Here is an example:
```
publi... | Could you change your JSON to the following?
```
{
"parameters": {
"somekey": "somevalue",
"otherkey" : "othervalue"
}
}
```
If so, deserialization should work without any custom deserializer.
(Reference: <https://blog.hackingcode.io/jackson-java-tutorial-deserialize-json-to-map/> ) |
48,561,927 | How to dump output of tcptrack into a text file?
I have tried using grep and cut but the output screen of tcptrack is made with curses library and changes dynamically. | 2018/02/01 | [
"https://Stackoverflow.com/questions/48561927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9290649/"
] | Because of the dynamic nature of the data to be posted you can use an array of `Dictionary`
```
[Produces("application/json")]
[Route("api/Default/")]
public class DefaultController : Controller {
[HttpPost]
public JsonResult apc([FromBody]Dictionary<string,string>[] data) {
var value = data[0]["Questi... | Try to send the JSON as string and send it like bellow :
```
[HttpPost]
public JsonResult apc(string s)
{
string str;
//Code Here
return Json(true);
}
```
then handle the json from the .NET side |
8,719,149 | I've searched over SO, but many questions are related to truncating the tables, but I don't want to empty the tables, I need to delete from **all** tables, perhaps with one query instead of multiple queries.
So far I have 34 tables in my database, I need to delete all rows that have an a particular ID when requested. ... | 2012/01/03 | [
"https://Stackoverflow.com/questions/8719149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264795/"
] | The reason you can't find this is because you shouldn't really need it. I don't think there is a way to do this because usually you don't have to if you properly use [foreign key constraints](http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html). The proper way to maintain this is to have your for... | I don't know if this is acceptable solution for you, but you can you
```
DELETE t1, t2, ... FROM table1 t1, table2 t2, ...
WHERE t1.customer_id = 4 AND t2.customer_id = 4 AND ...
``` |
38,924,594 | I'm using the below free text to learn intro to java and I am having trouble understanding the difference between the code segments:
<http://math.hws.edu/eck/cs124/downloads/javanotes7-linked.pdf>
**Example 1**
```
int x;
x = -1;
if (x < 0)
x = 1;
else
x = 2;
```
**Example 2**
```... | 2016/08/12 | [
"https://Stackoverflow.com/questions/38924594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6242520/"
] | Once the second if statement is evaluated, `x` the first has already taken effect--so the value of `x` is now 1.
```
if (x < 0)
x = 1;
if (x >= 0) //x is 1 because you've already evaluated the above!
x = 2;
```
The `else` keyword creates *mutually exclusive* branches: only one can be executed. So if you had t... | In the Example 1, only one of the statements `x = 1;` or `x = 2;` will be executed because it uses an `if...else` statement.
In the Example 2, both statements will be executed because it uses two separate `if` statements, and because both conditions are true at the time they are evaluated. |
38,924,594 | I'm using the below free text to learn intro to java and I am having trouble understanding the difference between the code segments:
<http://math.hws.edu/eck/cs124/downloads/javanotes7-linked.pdf>
**Example 1**
```
int x;
x = -1;
if (x < 0)
x = 1;
else
x = 2;
```
**Example 2**
```... | 2016/08/12 | [
"https://Stackoverflow.com/questions/38924594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6242520/"
] | Once the second if statement is evaluated, `x` the first has already taken effect--so the value of `x` is now 1.
```
if (x < 0)
x = 1;
if (x >= 0) //x is 1 because you've already evaluated the above!
x = 2;
```
The `else` keyword creates *mutually exclusive* branches: only one can be executed. So if you had t... | In the second example; first you go through the first `if` condition:
```
x = -1;
if (x < 0) x = 1;
```
x is less than 0, so x becomes 1.
When you go to the second `if` condition:
```
if (x >= 0) x = 2;
```
x is **still** 1, and 1 is greater than 0, so x becomes 2. |
38,924,594 | I'm using the below free text to learn intro to java and I am having trouble understanding the difference between the code segments:
<http://math.hws.edu/eck/cs124/downloads/javanotes7-linked.pdf>
**Example 1**
```
int x;
x = -1;
if (x < 0)
x = 1;
else
x = 2;
```
**Example 2**
```... | 2016/08/12 | [
"https://Stackoverflow.com/questions/38924594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6242520/"
] | In the Example 1, only one of the statements `x = 1;` or `x = 2;` will be executed because it uses an `if...else` statement.
In the Example 2, both statements will be executed because it uses two separate `if` statements, and because both conditions are true at the time they are evaluated. | In the second example; first you go through the first `if` condition:
```
x = -1;
if (x < 0) x = 1;
```
x is less than 0, so x becomes 1.
When you go to the second `if` condition:
```
if (x >= 0) x = 2;
```
x is **still** 1, and 1 is greater than 0, so x becomes 2. |
1,023 | Does the community want meta.\* to be listed on Google and other search engines?
Surely it would be confusing to noobs - they would find this site that kind of talks about programming, but not really.
Maybe you should log in even to see the questions? | 2009/06/30 | [
"https://meta.stackexchange.com/questions/1023",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/89035/"
] | If you search google for something program related my guess is that it would only turn up results for SO. I don't see how a google search from a normal question would turn a user up here especially since nothing really programing related is even discussed.
If somehow they end up here, it would be my guess that it is w... | There could be a link to SO itself. But is it very likely that Google would rank Meta-SO posts higher that SO posts, if someone googles for an answer? |
1,023 | Does the community want meta.\* to be listed on Google and other search engines?
Surely it would be confusing to noobs - they would find this site that kind of talks about programming, but not really.
Maybe you should log in even to see the questions? | 2009/06/30 | [
"https://meta.stackexchange.com/questions/1023",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/89035/"
] | I would not want this. I like being able to Google meta, and some discussion (maybe `always-friday-in-iceland`) are google-worthy on their own. | There could be a link to SO itself. But is it very likely that Google would rank Meta-SO posts higher that SO posts, if someone googles for an answer? |
1,023 | Does the community want meta.\* to be listed on Google and other search engines?
Surely it would be confusing to noobs - they would find this site that kind of talks about programming, but not really.
Maybe you should log in even to see the questions? | 2009/06/30 | [
"https://meta.stackexchange.com/questions/1023",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/89035/"
] | I would not want this. I like being able to Google meta, and some discussion (maybe `always-friday-in-iceland`) are google-worthy on their own. | If you search google for something program related my guess is that it would only turn up results for SO. I don't see how a google search from a normal question would turn a user up here especially since nothing really programing related is even discussed.
If somehow they end up here, it would be my guess that it is w... |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | I'd really rather not, I don't understand the value in doing so. That seems way to deep down into the sub-sub-versions. We don't have a pathfinder-beta tag, or a dnd-4e-essentials tag. I think their date and content makes it clear it's about the playtest. | I've written a [query](http://data.stackexchange.com/rpg/query/186581/dd-next-playtest-queries) to show all [dnd-next](https://rpg.stackexchange.com/questions/tagged/dnd-next "show questions tagged 'dnd-next'") activity with a last activity before July 31st.
This way, we'll have a simple list of next questions that ha... |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | I'd really rather not, I don't understand the value in doing so. That seems way to deep down into the sub-sub-versions. We don't have a pathfinder-beta tag, or a dnd-4e-essentials tag. I think their date and content makes it clear it's about the playtest. | If a Dnd-Next-Playtest tag is created, it should NOT replace the Dnd-Next tag, and it's even possible that it should be kept seperate from the DnD5e tag.
My reasoning is as follows. The Playtest is now over. One is not able to gain access to the latest playtest rules (they go up to level 20) legally.
However, if you ... |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | After three more years (!) and considerably more questions, it became clear that a division developed between old playtest questions and questions that are or can be made into questions about the current published D&D 5e rules. This lead to some old questions (tagged [dnd-5e](https://rpg.stackexchange.com/questions/tag... | I'd really rather not, I don't understand the value in doing so. That seems way to deep down into the sub-sub-versions. We don't have a pathfinder-beta tag, or a dnd-4e-essentials tag. I think their date and content makes it clear it's about the playtest. |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | I've written a [query](http://data.stackexchange.com/rpg/query/186581/dd-next-playtest-queries) to show all [dnd-next](https://rpg.stackexchange.com/questions/tagged/dnd-next "show questions tagged 'dnd-next'") activity with a last activity before July 31st.
This way, we'll have a simple list of next questions that ha... | If a Dnd-Next-Playtest tag is created, it should NOT replace the Dnd-Next tag, and it's even possible that it should be kept seperate from the DnD5e tag.
My reasoning is as follows. The Playtest is now over. One is not able to gain access to the latest playtest rules (they go up to level 20) legally.
However, if you ... |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | After three more years (!) and considerably more questions, it became clear that a division developed between old playtest questions and questions that are or can be made into questions about the current published D&D 5e rules. This lead to some old questions (tagged [dnd-5e](https://rpg.stackexchange.com/questions/tag... | I've written a [query](http://data.stackexchange.com/rpg/query/186581/dd-next-playtest-queries) to show all [dnd-next](https://rpg.stackexchange.com/questions/tagged/dnd-next "show questions tagged 'dnd-next'") activity with a last activity before July 31st.
This way, we'll have a simple list of next questions that ha... |
3,530 | The 5th release of D&D is due for release in ["Summer 2014"](http://company.wizards.com/content/wizards-coast-announces-thrilling-dungeons-dragons-launch-summer-2014), which means sometime soon. As far as I'm aware, it does not have a definite name yet: it might be D&D 5th Edition, or retain its name of D&D Next.
Curr... | 2014/04/27 | [
"https://rpg.meta.stackexchange.com/questions/3530",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/1204/"
] | After three more years (!) and considerably more questions, it became clear that a division developed between old playtest questions and questions that are or can be made into questions about the current published D&D 5e rules. This lead to some old questions (tagged [dnd-5e](https://rpg.stackexchange.com/questions/tag... | If a Dnd-Next-Playtest tag is created, it should NOT replace the Dnd-Next tag, and it's even possible that it should be kept seperate from the DnD5e tag.
My reasoning is as follows. The Playtest is now over. One is not able to gain access to the latest playtest rules (they go up to level 20) legally.
However, if you ... |
27,687,800 | I'm new to the neo4j platform and I've just started to implement the Neo4j in my server.
I've started to do all the connection between the php and the db with the neo4j functions and not with the Cypher language.
The problem that i'm having is that i feel that the neo4jPhp really lack a lot of options that i could do... | 2014/12/29 | [
"https://Stackoverflow.com/questions/27687800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3890818/"
] | Using the neo4jphp Node/Relationship/Label entities is not required, if you do not wish to use them. If you feel more comfortable using Cypher queries, that is what you should use. Neo4jphp can do Cypher queries. Here are the docs to get you started <https://github.com/jadell/neo4jphp/wiki/Cypher-and-gremlin-queries>.
... | Of course Cypher is more powerful and any driver you'll find can not adapt to all your needs.
If you feel you need to do a lot of Cypher, then you might just go with Cypher, this is what I do with NeoClient <https://github.com/neoxygen/neo4j-neoclient> , you'll only have Cypher and you can build your own application ... |
3,715,390 | I want to change the color of UITableView section header. | 2010/09/15 | [
"https://Stackoverflow.com/questions/3715390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/390423/"
] | Use the below code for your answer
```
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *tempView=[[[UIView alloc]initWithFrame:CGRectMake(0,0,300,44)]autorelease];
tempView.backgroundColor=[UIColor redColor];
UILabel *tempLabel=[[UILabel alloc]initWithFrame:CGRectMak... | Use `- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section`
This method is part of UITableViewDelegate
Return the view with label. you can now configure label color. |
18,637,085 | I have to send report via email every end of the day from my android application . How can I schedule the task to execute once a day. If internet is unavailable the report send when internet comes back.
Kindly help me..
Thanks advance.. | 2013/09/05 | [
"https://Stackoverflow.com/questions/18637085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2042347/"
] | you need to use AlarmManager to trigger alarm at specific peroid or at different intervals..set up a Broadcast Receiver to get the alarm fired....and start an intent service to send emails in the background
an example class to receive alarm in mainactivity:
```
public void setRepeatingAlarm()
{
Intent intent = ... | For the schedule, for sure you must see AlarmManager <http://developer.android.com/reference/android/app/AlarmManager.html>. |
18,637,085 | I have to send report via email every end of the day from my android application . How can I schedule the task to execute once a day. If internet is unavailable the report send when internet comes back.
Kindly help me..
Thanks advance.. | 2013/09/05 | [
"https://Stackoverflow.com/questions/18637085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2042347/"
] | For the schedule, for sure you must see AlarmManager <http://developer.android.com/reference/android/app/AlarmManager.html>. | Have you heared of Services in android.
**1.Create a service**
**2.Use Alarm Manager,BroadCastReciever**
for eg,
```
service.setInexactRepeating(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(), REPEAT_TIME, pending);
```
**3.Boot Action when the tablet is switched on**
for eg,
```
Intent.ACTION_BOOT_COMPLETED.... |
18,637,085 | I have to send report via email every end of the day from my android application . How can I schedule the task to execute once a day. If internet is unavailable the report send when internet comes back.
Kindly help me..
Thanks advance.. | 2013/09/05 | [
"https://Stackoverflow.com/questions/18637085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2042347/"
] | you need to use AlarmManager to trigger alarm at specific peroid or at different intervals..set up a Broadcast Receiver to get the alarm fired....and start an intent service to send emails in the background
an example class to receive alarm in mainactivity:
```
public void setRepeatingAlarm()
{
Intent intent = ... | Have you heared of Services in android.
**1.Create a service**
**2.Use Alarm Manager,BroadCastReciever**
for eg,
```
service.setInexactRepeating(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(), REPEAT_TIME, pending);
```
**3.Boot Action when the tablet is switched on**
for eg,
```
Intent.ACTION_BOOT_COMPLETED.... |
5,083,562 | I am developing an archiving system that stores documents in a database and provides various functionalities to the user. I have added a part to sign and verify any document in the database. However, I am stuck with the logic and wondering where should I place the signing function.
Hints about my aims:
- No docum... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5083562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420689/"
] | As you said, `unpack("%16W*", $string)` gives you an integer. To convert an integer to hex, use [sprintf](http://perldoc.perl.org/functions/sprintf.html):
```
my $string = "this is my string";
my $expected = '0671';
my $checksum = sprintf('%04x', unpack("%16W*", $string));
print "match\n" if $checksum eq $expected;
... | Try `unpack("b*',$string)`.
See the [pack man page](http://perldoc.perl.org/functions/pack.html) for syntax. |
36,520,098 | I played around with `page-break-inside:auto, page-break-inside:avoid, page-break-after:auto, margin-top and margin-bottom` and others for quite a long time, but still can't find a solution how to break rows in my long HTML table, which is meant to be printed.
Page looks like the left screenshot in printing mode (or p... | 2016/04/09 | [
"https://Stackoverflow.com/questions/36520098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4906450/"
] | Roberto Rossi is right (I can't add a comment due to reputation), but I also found this post with more information and it seems this is a potential duplicate question:
[How to deal with page breaks when printing a large HTML table](https://stackoverflow.com/questions/1763639/how-to-deal-with-page-breaks-when-printing-... | I changed one rule in your stylesheet, it works that way, at least here on Firefox:
```
@page {
size: 18cm 26.7cm;
margin: 1.5cm;
}
```
So I defined the margin in centimeters and subtracted those from the page size. Printed out fine... |
36,520,098 | I played around with `page-break-inside:auto, page-break-inside:avoid, page-break-after:auto, margin-top and margin-bottom` and others for quite a long time, but still can't find a solution how to break rows in my long HTML table, which is meant to be printed.
Page looks like the left screenshot in printing mode (or p... | 2016/04/09 | [
"https://Stackoverflow.com/questions/36520098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4906450/"
] | Roberto Rossi is right (I can't add a comment due to reputation), but I also found this post with more information and it seems this is a potential duplicate question:
[How to deal with page breaks when printing a large HTML table](https://stackoverflow.com/questions/1763639/how-to-deal-with-page-breaks-when-printing-... | You should use page break after :
```
<div class="breakafter"></div>
```
and css style :
```
div.breakafter {
page-break-after: always;
}
``` |
51,911,391 | I am using windows 10 and Python 3.6.5 through Anaconda.
I am trying to create a CSV and then add a list to said CSV but I cannot get it to create the CSV in the first place. No error codes, just nothing. I have disabled all antivirus protection to make sure that wasnt the issue. I have tried on two different PCs. I ... | 2018/08/18 | [
"https://Stackoverflow.com/questions/51911391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10212754/"
] | Why are you trying to save a drawable in a database that is already stored in your app?
You can just save its name as a string: `"fc1"` and retrieve it as a string, say in a variable `name`.
After that by:
```
int id = resources.getIdentifier(name, "drawable", context.getPackageName());
```
you get its id... | I have one solution instead of save byte[] in db try to store image in internal memory of your application directory [Check here](https://stackoverflow.com/questions/17674634/saving-and-reading-bitmaps-images-from-internal-memory-in-android) and then save the image path in your table. |
28,652,595 | So, here's my code(not all of it, just what you need to understand):
HTML:
```
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
jQuery(document).ready(function(){
jQuery("nav ul ul").each(function(){
var navWidth=jQuery(this).width();
... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28652595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4588115/"
] | I think potentially it is a bug, because the same behavior doesn't occur if you replace
```
foreach (my $x = 0 ; $x < 1 ; $x++) {
```
with
```
foreach my $x (0 .. 0) {
```
I don't understand *exactly* what's happening, but by comparing the optrees of the two different versions, I think that a `nextstate` op is ge... | I suspect this may be down to statement separators (semicolons). As you may have spotted - with the code you're running, the line number reported by `caller` is the same as the `foreach` loop.
So I *think* what is happening, is because there's no semicolons.
If you were to do a multi-line sub call, `caller` would r... |
28,652,595 | So, here's my code(not all of it, just what you need to understand):
HTML:
```
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
jQuery(document).ready(function(){
jQuery("nav ul ul").each(function(){
var navWidth=jQuery(this).width();
... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28652595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4588115/"
] | ```
$ perl -MO=Concise a.pl
j <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 6 a.pl:5) v:*,&,{,x*,x&,x$,$ ->3
5 <2> sassign vKS/2 ->6
3 <$> const[IV 0] s ->4
4 <0> padsv[$x:3,5] sRM*/LVINTRO ->5
6 <0> unstack v* ->7
i <2> leaveloop vK/2 ->j
7 <{> enterlo... | I suspect this may be down to statement separators (semicolons). As you may have spotted - with the code you're running, the line number reported by `caller` is the same as the `foreach` loop.
So I *think* what is happening, is because there's no semicolons.
If you were to do a multi-line sub call, `caller` would r... |
28,652,595 | So, here's my code(not all of it, just what you need to understand):
HTML:
```
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
jQuery(document).ready(function(){
jQuery("nav ul ul").each(function(){
var navWidth=jQuery(this).width();
... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28652595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4588115/"
] | ```
$ perl -MO=Concise a.pl
j <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 6 a.pl:5) v:*,&,{,x*,x&,x$,$ ->3
5 <2> sassign vKS/2 ->6
3 <$> const[IV 0] s ->4
4 <0> padsv[$x:3,5] sRM*/LVINTRO ->5
6 <0> unstack v* ->7
i <2> leaveloop vK/2 ->j
7 <{> enterlo... | I think potentially it is a bug, because the same behavior doesn't occur if you replace
```
foreach (my $x = 0 ; $x < 1 ; $x++) {
```
with
```
foreach my $x (0 .. 0) {
```
I don't understand *exactly* what's happening, but by comparing the optrees of the two different versions, I think that a `nextstate` op is ge... |
28,652,595 | So, here's my code(not all of it, just what you need to understand):
HTML:
```
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
jQuery(document).ready(function(){
jQuery("nav ul ul").each(function(){
var navWidth=jQuery(this).width();
... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28652595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4588115/"
] | I think potentially it is a bug, because the same behavior doesn't occur if you replace
```
foreach (my $x = 0 ; $x < 1 ; $x++) {
```
with
```
foreach my $x (0 .. 0) {
```
I don't understand *exactly* what's happening, but by comparing the optrees of the two different versions, I think that a `nextstate` op is ge... | As has been pointed out this is really a bug in Perl going back at least to 5.10 or 11 years, but in reality I think longer.
It has been reported as Perl bug [perl #133239](https://rt.perl.org/Public/Bug/Display.html?id=133239) and although it is alleged that it is not *that* hard to fix, it hasn't been. It may not a... |
28,652,595 | So, here's my code(not all of it, just what you need to understand):
HTML:
```
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
jQuery(document).ready(function(){
jQuery("nav ul ul").each(function(){
var navWidth=jQuery(this).width();
... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28652595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4588115/"
] | ```
$ perl -MO=Concise a.pl
j <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 6 a.pl:5) v:*,&,{,x*,x&,x$,$ ->3
5 <2> sassign vKS/2 ->6
3 <$> const[IV 0] s ->4
4 <0> padsv[$x:3,5] sRM*/LVINTRO ->5
6 <0> unstack v* ->7
i <2> leaveloop vK/2 ->j
7 <{> enterlo... | As has been pointed out this is really a bug in Perl going back at least to 5.10 or 11 years, but in reality I think longer.
It has been reported as Perl bug [perl #133239](https://rt.perl.org/Public/Bug/Display.html?id=133239) and although it is alleged that it is not *that* hard to fix, it hasn't been. It may not a... |
47,388,822 | I'm creating simple slide with jQuery and its work fine i just want to use fade function as well with below code. I used fade function but it's working it's not fading an image while change.
```
var mainImage = $('#mainImage');
var imageData = ['_images/gallery/beach_houses.jpg','_images/gallery/golden_gate.jpg','_ima... | 2017/11/20 | [
"https://Stackoverflow.com/questions/47388822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4012106/"
] | You've used `fadeIn` already, but in order for the image fade *in* it has to be hidden, the easiest way is to fade it *out* first.
Using the fadeOut callback, you can wait for the fadeOut to complete, set the src and then fadeIn:
```
var mainImage = $('#mainImage');
var imageData = ['_images/gallery/beach_houses.jpg... | Check the code below.For production purposes you still gonna have to 'polish' it.Good luck
```js
var mainImage = $('#mainImage');
var imageData = ['https://www.maxcdn.com/blog/blog-assets/2016/01/firefox-subresource-integrity-error.png','https://www.typesettercms.com/data/_addondata/x_Addons/screenshots/5/245/thumbna... |
47,388,822 | I'm creating simple slide with jQuery and its work fine i just want to use fade function as well with below code. I used fade function but it's working it's not fading an image while change.
```
var mainImage = $('#mainImage');
var imageData = ['_images/gallery/beach_houses.jpg','_images/gallery/golden_gate.jpg','_ima... | 2017/11/20 | [
"https://Stackoverflow.com/questions/47388822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4012106/"
] | See my code follow 3 step, hope this can help you!
1. You need hide `mainImage` before use fadeIn
2. You need find target image source and set to `mainImage`
3. When you got all data needed, you can fadeIn your image at this step
Note: Index of the last item in your array is `imageData.length - 1`, reset `imageIndex`... | Check the code below.For production purposes you still gonna have to 'polish' it.Good luck
```js
var mainImage = $('#mainImage');
var imageData = ['https://www.maxcdn.com/blog/blog-assets/2016/01/firefox-subresource-integrity-error.png','https://www.typesettercms.com/data/_addondata/x_Addons/screenshots/5/245/thumbna... |
47,388,822 | I'm creating simple slide with jQuery and its work fine i just want to use fade function as well with below code. I used fade function but it's working it's not fading an image while change.
```
var mainImage = $('#mainImage');
var imageData = ['_images/gallery/beach_houses.jpg','_images/gallery/golden_gate.jpg','_ima... | 2017/11/20 | [
"https://Stackoverflow.com/questions/47388822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4012106/"
] | You've used `fadeIn` already, but in order for the image fade *in* it has to be hidden, the easiest way is to fade it *out* first.
Using the fadeOut callback, you can wait for the fadeOut to complete, set the src and then fadeIn:
```
var mainImage = $('#mainImage');
var imageData = ['_images/gallery/beach_houses.jpg... | See my code follow 3 step, hope this can help you!
1. You need hide `mainImage` before use fadeIn
2. You need find target image source and set to `mainImage`
3. When you got all data needed, you can fadeIn your image at this step
Note: Index of the last item in your array is `imageData.length - 1`, reset `imageIndex`... |
41,983,270 | I want to display a text with 2 links inside the text in MVC view!
The text link are dynamic from server side and looks like this in controller:
```
Model.Message = "You have used up all your credits for this month (see your credit balance {FirstLink}). You can buy credits {SecondLink}";
```
In view I have someth... | 2017/02/01 | [
"https://Stackoverflow.com/questions/41983270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525054/"
] | In order to solve the syntax error, your view model would need to include a property for the html attributes, either
```
public IDictionary<string, object> LinkAttributeValues { get; set; }
```
if `LinkRouteValues` is typeof `RouteValueDictionary`, or
```
public object LinkAttributeValues { get; set; }
```
if `L... | You don't need to prefix an '@' before the ActionLink when you're inside a code block. Remove that and I'm sure the syntax error will disappear. |
1,340,540 | i want users can log in my website throw FB connect ON MOBILE
but it's seem that it work only on smart Phone (exmple iphone )
is it possibale that it will work in all Phone that use wap ?
thanks | 2009/08/27 | [
"https://Stackoverflow.com/questions/1340540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/146864/"
] | To anyone reading this thread in 2011 - the link to the mobile web documentation above no longer works - it is a circular redirect loop that always takes you back to the regular desktop documentation. | I believe you can, I suggest taking a look over at their documentation.
<http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_Mobile_Web>
It seems the only difference is that instead of a popup or modal you just redirect them to facebook and then are redirected back after authorizing, sort of twitter li... |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | Those examples are fine in my opinion, though preferences vary. A classic example in England is
* [St James's Park](http://en.wikipedia.org/wiki/St._James%27s_Park) in London
* [St James' Park](http://en.wikipedia.org/wiki/St_James%27_Park) in Newcastle
* [St James Park](http://en.wikipedia.org/wiki/St_James_Park,_Ex... | As an American English teacher I teach students not to use s's.
Strunk and White provide interesting and useful hints, but be careful as it's almost 100 years old and doesn't keep up with a lot of modern usage. |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | Those examples are fine in my opinion, though preferences vary. A classic example in England is
* [St James's Park](http://en.wikipedia.org/wiki/St._James%27s_Park) in London
* [St James' Park](http://en.wikipedia.org/wiki/St_James%27_Park) in Newcastle
* [St James Park](http://en.wikipedia.org/wiki/St_James_Park,_Ex... | Your question requires a two-part answer. You want to know if it is *still* the case that “Charles’s” is grammatically correct, as prescribed by Strunk and White over fifty years ago.
1. It is the case that “Charles’s” is still grammatically correct, because writing reflects speech and most native speakers still prono... |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | It's down to personal preference -- but the modern convention, in my opinion, is to omit the final *s*. I'd always advocate omitting the final *s* because it's simply unnecessary: the apostrophe, by itself, clearly denotes possession. Whether or not American English adopts this is another matter...
But with British us... | As an American English teacher I teach students not to use s's.
Strunk and White provide interesting and useful hints, but be careful as it's almost 100 years old and doesn't keep up with a lot of modern usage. |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | It's down to personal preference -- but the modern convention, in my opinion, is to omit the final *s*. I'd always advocate omitting the final *s* because it's simply unnecessary: the apostrophe, by itself, clearly denotes possession. Whether or not American English adopts this is another matter...
But with British us... | Your question requires a two-part answer. You want to know if it is *still* the case that “Charles’s” is grammatically correct, as prescribed by Strunk and White over fifty years ago.
1. It is the case that “Charles’s” is still grammatically correct, because writing reflects speech and most native speakers still prono... |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | As an American English teacher I teach students not to use s's.
Strunk and White provide interesting and useful hints, but be careful as it's almost 100 years old and doesn't keep up with a lot of modern usage. | Your question requires a two-part answer. You want to know if it is *still* the case that “Charles’s” is grammatically correct, as prescribed by Strunk and White over fifty years ago.
1. It is the case that “Charles’s” is still grammatically correct, because writing reflects speech and most native speakers still prono... |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | The rule is very simple, and it has no exceptions: that you add an *s* **if you say** the *s*, which is almost always.
That said, because we don’t say the extra *s* when speaking certain limited phrases like these following examples, they therefore necessarily take no added *s* in spelling:
* that species’ name
* th... | As an American English teacher I teach students not to use s's.
Strunk and White provide interesting and useful hints, but be careful as it's almost 100 years old and doesn't keep up with a lot of modern usage. |
62,257 | >
> **Possible Duplicate:**
>
> [What is the correct possessive for nouns ending in s?](https://english.stackexchange.com/questions/1073/what-is-the-correct-possessive-for-nouns-ending-in-s)
>
> [When did it become correct to add an 's' to a singular possessive already ending in 's'?](https://english.stackexchan... | 2012/03/25 | [
"https://english.stackexchange.com/questions/62257",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6877/"
] | The rule is very simple, and it has no exceptions: that you add an *s* **if you say** the *s*, which is almost always.
That said, because we don’t say the extra *s* when speaking certain limited phrases like these following examples, they therefore necessarily take no added *s* in spelling:
* that species’ name
* th... | Your question requires a two-part answer. You want to know if it is *still* the case that “Charles’s” is grammatically correct, as prescribed by Strunk and White over fifty years ago.
1. It is the case that “Charles’s” is still grammatically correct, because writing reflects speech and most native speakers still prono... |
33,426,138 | I have a particular issue that I'm working on where I need to parse the changes ***NOT*** staged for commit.
If you do `git status --porcelain` you can get an output like this:
```
M change1
M change2
MM change3
M change4
M change5
```
Changes 1 and 2 are staged, changes 3 to 5 are not. `MM` means something els... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33426138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68788/"
] | You can get which *tracked* files have unstaged changes with `git diff --name-only` or `git ls-files . -m`.
You can get *untracked but not ignored* files with `git ls-files . --exclude-standard --others`. ([From this answer](https://stackoverflow.com/a/4855096/14660)).
Put them together to get all files which are not... | The `MM` state means there are some changes staged, and some changes not-staged.
More precisely, it means that the index version of that path differs from the `HEAD` version—this is the first `M`—and that the work-tree version of that path differs from the index version.
For instance, suppose you have a README and yo... |
1,445,816 | The application that I'm working on is going to be used to create charts of data contained in a database. Right now objects on the chart are manipulated using a "control panel" - essentially a list of objects and a PropertyGrid to edit values. The users would also like to be able to interact with the objects using mous... | 2009/09/18 | [
"https://Stackoverflow.com/questions/1445816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10637/"
] | The latter - for instance, if it's a pie chart, you're going to have to do most the hit testing work anyway to deal with irregular shaped controls. | Easiest: have a list of objects and their bounding boxes. When mouse event is made check the list for which object is clicked. |
1,445,816 | The application that I'm working on is going to be used to create charts of data contained in a database. Right now objects on the chart are manipulated using a "control panel" - essentially a list of objects and a PropertyGrid to edit values. The users would also like to be able to interact with the objects using mous... | 2009/09/18 | [
"https://Stackoverflow.com/questions/1445816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10637/"
] | The latter - for instance, if it's a pie chart, you're going to have to do most the hit testing work anyway to deal with irregular shaped controls. | The former - if you have it overlaid on a form, then all the hit testing will be done for you by the forms framework. You simply need to create some controls, and then implement event handlers for them.
The above also describes any windows forms (or probably MPF for that matter) program :)
Creating your own list of o... |
1,445,816 | The application that I'm working on is going to be used to create charts of data contained in a database. Right now objects on the chart are manipulated using a "control panel" - essentially a list of objects and a PropertyGrid to edit values. The users would also like to be able to interact with the objects using mous... | 2009/09/18 | [
"https://Stackoverflow.com/questions/1445816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10637/"
] | A good method for hit detection: have another off-screen image. draw every clickable object on this image with a unique color. You have to disable anti-aliasing. When user clicks get the color at that point from the off-screen image and determine the object. If you have a list of objects you can use object index as col... | Easiest: have a list of objects and their bounding boxes. When mouse event is made check the list for which object is clicked. |
1,445,816 | The application that I'm working on is going to be used to create charts of data contained in a database. Right now objects on the chart are manipulated using a "control panel" - essentially a list of objects and a PropertyGrid to edit values. The users would also like to be able to interact with the objects using mous... | 2009/09/18 | [
"https://Stackoverflow.com/questions/1445816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10637/"
] | A good method for hit detection: have another off-screen image. draw every clickable object on this image with a unique color. You have to disable anti-aliasing. When user clicks get the color at that point from the off-screen image and determine the object. If you have a list of objects you can use object index as col... | The former - if you have it overlaid on a form, then all the hit testing will be done for you by the forms framework. You simply need to create some controls, and then implement event handlers for them.
The above also describes any windows forms (or probably MPF for that matter) program :)
Creating your own list of o... |
62,953,642 | ```
class Builder
{
public:
virtual void Build(int a) = 0;
};
class ConcreteBuilder1 : public Builder
{
public:
void Build(int a);
};
class ConcreteBuilder2 : public Builder
{
public:
void Build(int a. struct A* a);
};
```
So My question is how to design Build() method to take both parameters(int,... | 2020/07/17 | [
"https://Stackoverflow.com/questions/62953642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9710517/"
] | In your Logcat debug dropdown view you have multiple choices , so for you you have picked Log.i , which means in your logcat you have to select info
* Here a screenshot of what i mean :
[](https://i.stack.imgur.com/OWnd1.png)
* Here are the different... | `Log.i:` Use this to post useful information to the log. For example: that you have successfully connected to a server. Basically use it to report successes.
`Log.d:` Use this for debugging purposes. If you want to print out a bunch of messages so you can log the exact flow of your program, use this. If you want to ke... |
62,953,642 | ```
class Builder
{
public:
virtual void Build(int a) = 0;
};
class ConcreteBuilder1 : public Builder
{
public:
void Build(int a);
};
class ConcreteBuilder2 : public Builder
{
public:
void Build(int a. struct A* a);
};
```
So My question is how to design Build() method to take both parameters(int,... | 2020/07/17 | [
"https://Stackoverflow.com/questions/62953642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9710517/"
] | In your Logcat debug dropdown view you have multiple choices , so for you you have picked Log.i , which means in your logcat you have to select info
* Here a screenshot of what i mean :
[](https://i.stack.imgur.com/OWnd1.png)
* Here are the different... | Log.i("Hello","What`s up ?"); is used for showing information in the log but it will not visible in the app screen...
**if u want to show a message in textview, do like below**
**1. define textview in activity\_main.xml**
```
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android... |
50,568 | Use Case
========
My use case is around a scenario where both customer and merchant possess offline wallets with a balance that has had confirmation on the blockchain.
1. To begin with, let us say that, the merchant and the buyer's wallets show balances of 20 BTC and 10 BTC respectively. These balances are the one th... | 2017/01/05 | [
"https://bitcoin.stackexchange.com/questions/50568",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/6975/"
] | I'd say there are number of issues at play here. If the system is "offline" then the only update you'll have to balances is whatever was last stored. The assumption here is both sources are trusted, and the system in the middle is trusted. Might as well make it a centralized asynchronous system. You'd have far more con... | This can be accomplished by using Bluetooth/NFC connectivity with a unique wallet (must be same for both ends) that is capable of storing encrypted offline transactions without actually syncing them with the Blockchain. However, as for the paying side, the initial funds must come from buying and syncing with the blockc... |
37,104,666 | Looking for regex to use with #gsub in Ruby to strip all digits in a string except for ordinals. Assume the following is fine to preserve what I want in a string:
```
string = "100 red balloons"
strip_digits = string.gsub(/[^a-zA-Z\s]/, '')
=> " red balloons"
```
How would I go about modifying the regex in strip\_di... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37104666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4530434/"
] | Just as a "fix" of your regex, I suggest:
```
input.gsub(/(\d+(?:th|[rn]d|st))|[^a-z\s]/i, "\\1")
```
See [IDEONE demo here](http://ideone.com/XBHz3o)
The logic is the following: match and capture into group 1 all the numbers followed with the ordinal numeral suffixes, and then restore this value with the `\1` back... | You can use [word boundaries](http://www.regular-expressions.info/wordboundaries.html) `\b`, i.e.:
```
strip_digits = string.gsub(/\b\d+(?!st|th|rd|nd)\b/, '')
```
---
**Regex explanation:**
```
\b\d+(?!st|th|rd|nd)\b
Assert position at a word boundary (position preceded or followed—but not both—by a Unicode let... |
37,104,666 | Looking for regex to use with #gsub in Ruby to strip all digits in a string except for ordinals. Assume the following is fine to preserve what I want in a string:
```
string = "100 red balloons"
strip_digits = string.gsub(/[^a-zA-Z\s]/, '')
=> " red balloons"
```
How would I go about modifying the regex in strip\_di... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37104666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4530434/"
] | Just as a "fix" of your regex, I suggest:
```
input.gsub(/(\d+(?:th|[rn]d|st))|[^a-z\s]/i, "\\1")
```
See [IDEONE demo here](http://ideone.com/XBHz3o)
The logic is the following: match and capture into group 1 all the numbers followed with the ordinal numeral suffixes, and then restore this value with the `\1` back... | You could use a negative lookahead: (this also collapses extra spaces)
```
t = "And on 3rd day, he created the 1st of his 22 books, not including the 3 that were never published - this was the 2nd time this happened."
print(t.gsub(/\s*\d+(?!st|th|rd|nd)\s*/, " "))#=>And on 3rd day, he created the 1st of his books, n... |
9,539,633 | This may sound stupid but how do I define a global variable in Go? `const myglobalvariable = "Hi there!"` doesn't really work...
I just want to get the command line argument and after this I want to print it. I do this using this code snippet:
```
package main
import (
"flag"
"fmt"
)
func main() {
gette... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9539633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1111794/"
] | I see at least two questions here, maybe three.
1. How do you declare a global variable?
2. How do you declare a global constant?
3. How do you parse command line options and arguments?
I hope the code below demonstrates this in a helpful way. The flag package was one of the first packages I had to cut my teeth on in... | Why do you need a global variable? For example,
```
package main
import (
"flag"
"fmt"
)
func main() {
text := gettext()
fmt.Println(text)
}
func gettext() []string {
flag.Parse()
text := flag.Args()
if len(text) < 1 {
fmt.Println("Please give me some text!")
}
return tex... |
9,539,633 | This may sound stupid but how do I define a global variable in Go? `const myglobalvariable = "Hi there!"` doesn't really work...
I just want to get the command line argument and after this I want to print it. I do this using this code snippet:
```
package main
import (
"flag"
"fmt"
)
func main() {
gette... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9539633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1111794/"
] | The closest thing to a global variable in Go is a *package* variable. You define one like
```
var text string
```
Command line arguments though, are already sitting in a package variable, os.Args, waiting for you to access them. You don't even need the flag package.
```
package main
import (
"fmt"
"os"
)
... | Why do you need a global variable? For example,
```
package main
import (
"flag"
"fmt"
)
func main() {
text := gettext()
fmt.Println(text)
}
func gettext() []string {
flag.Parse()
text := flag.Args()
if len(text) < 1 {
fmt.Println("Please give me some text!")
}
return tex... |
9,539,633 | This may sound stupid but how do I define a global variable in Go? `const myglobalvariable = "Hi there!"` doesn't really work...
I just want to get the command line argument and after this I want to print it. I do this using this code snippet:
```
package main
import (
"flag"
"fmt"
)
func main() {
gette... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9539633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1111794/"
] | I see at least two questions here, maybe three.
1. How do you declare a global variable?
2. How do you declare a global constant?
3. How do you parse command line options and arguments?
I hope the code below demonstrates this in a helpful way. The flag package was one of the first packages I had to cut my teeth on in... | See how [`gofmt`](http://code.google.com/p/go/source/browse/src/cmd/gofmt/gofmt.go), [`godoc`](http://code.google.com/p/go/source/browse/src/cmd/godoc/godoc.go), and [others](http://code.google.com/p/go/source/browse/src/cmd/) handle the same thing. |
9,539,633 | This may sound stupid but how do I define a global variable in Go? `const myglobalvariable = "Hi there!"` doesn't really work...
I just want to get the command line argument and after this I want to print it. I do this using this code snippet:
```
package main
import (
"flag"
"fmt"
)
func main() {
gette... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9539633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1111794/"
] | I see at least two questions here, maybe three.
1. How do you declare a global variable?
2. How do you declare a global constant?
3. How do you parse command line options and arguments?
I hope the code below demonstrates this in a helpful way. The flag package was one of the first packages I had to cut my teeth on in... | The closest thing to a global variable in Go is a *package* variable. You define one like
```
var text string
```
Command line arguments though, are already sitting in a package variable, os.Args, waiting for you to access them. You don't even need the flag package.
```
package main
import (
"fmt"
"os"
)
... |
9,539,633 | This may sound stupid but how do I define a global variable in Go? `const myglobalvariable = "Hi there!"` doesn't really work...
I just want to get the command line argument and after this I want to print it. I do this using this code snippet:
```
package main
import (
"flag"
"fmt"
)
func main() {
gette... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9539633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1111794/"
] | The closest thing to a global variable in Go is a *package* variable. You define one like
```
var text string
```
Command line arguments though, are already sitting in a package variable, os.Args, waiting for you to access them. You don't even need the flag package.
```
package main
import (
"fmt"
"os"
)
... | See how [`gofmt`](http://code.google.com/p/go/source/browse/src/cmd/gofmt/gofmt.go), [`godoc`](http://code.google.com/p/go/source/browse/src/cmd/godoc/godoc.go), and [others](http://code.google.com/p/go/source/browse/src/cmd/) handle the same thing. |
9,129,234 | This is what I have currently (cut down a little):
```
SELECT *, item_prices.price AS minPrice
FROM items
LEFT JOIN item_details USING(item_id)
LEFT JOIN item_prices USING(item_id)
WHERE 1=1
GROUP BY item_id;
```
My issue is that `item_prices` may match more than one row for each item - I only want t... | 2012/02/03 | [
"https://Stackoverflow.com/questions/9129234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/846480/"
] | You should use query:
```sql
SELECT *, MIN(item_prices.price) AS minPrice
FROM items
LEFT JOIN item_details USING(item_id)
LEFT JOIN item_prices USING(item_id)
WHERE 1=1
GROUP BY item_id;
``` | Replace your join to item\_prices with a join to a subquery which gets the minimum price for each item:
`left join (select item_id, min(price) price group by item_id) minprice using (item_id)`
I don't usually use MySQL, but I believe that syntax is valid. It might need tweaking. |
9,129,234 | This is what I have currently (cut down a little):
```
SELECT *, item_prices.price AS minPrice
FROM items
LEFT JOIN item_details USING(item_id)
LEFT JOIN item_prices USING(item_id)
WHERE 1=1
GROUP BY item_id;
```
My issue is that `item_prices` may match more than one row for each item - I only want t... | 2012/02/03 | [
"https://Stackoverflow.com/questions/9129234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/846480/"
] | You should use query:
```sql
SELECT *, MIN(item_prices.price) AS minPrice
FROM items
LEFT JOIN item_details USING(item_id)
LEFT JOIN item_prices USING(item_id)
WHERE 1=1
GROUP BY item_id;
``` | You could do this with a subquery, along the lines of:
```
SELECT *,
(SELECT
MIN(item_price)
FROM
item_prices inner
WHERE inner.item_id = items.item_id) AS minPrice
FROM items
GROUP BY item_id;
``` |
19,501,890 | In Java i am trying to store each `BufferedOutputStream` the server makes into an array aside from the threads in order to broadcast some data to all connected clients.
```
// initialisation
ArrayList<BufferedOutputStream> connections = new ArrayList<BufferedOutputStream>();
// when a client connects
Socket conn... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19501890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1945843/"
] | Maybe the socket has close, or the `i` index in the array is null, so the question is, why don't you utilize the `List<OutputStream>` over `Socket[]`?
with `List<OutputStream>` or `List<OutputStreamWriter>` you will not need to initialize the `OutputStreamWriter` every time you want to send some data. | somehow You should store client socket object.
whenever you want to broadcast, iterate over collection get socket, get ouput stream from that, and write to socket.
Its working for me properly. |
19,501,890 | In Java i am trying to store each `BufferedOutputStream` the server makes into an array aside from the threads in order to broadcast some data to all connected clients.
```
// initialisation
ArrayList<BufferedOutputStream> connections = new ArrayList<BufferedOutputStream>();
// when a client connects
Socket conn... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19501890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1945843/"
] | We can't tell you exactly what is wrong because you've left out important parts of the code. However, if `connections[id] = connection` is throwing an NPE, that can *only* mean that `connections` is `null`. And, on the face of it, you don't appear to have initialized `connections` to a non-null value!
The fix is to in... | somehow You should store client socket object.
whenever you want to broadcast, iterate over collection get socket, get ouput stream from that, and write to socket.
Its working for me properly. |
19,501,890 | In Java i am trying to store each `BufferedOutputStream` the server makes into an array aside from the threads in order to broadcast some data to all connected clients.
```
// initialisation
ArrayList<BufferedOutputStream> connections = new ArrayList<BufferedOutputStream>();
// when a client connects
Socket conn... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19501890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1945843/"
] | We can't tell you exactly what is wrong because you've left out important parts of the code. However, if `connections[id] = connection` is throwing an NPE, that can *only* mean that `connections` is `null`. And, on the face of it, you don't appear to have initialized `connections` to a non-null value!
The fix is to in... | Maybe the socket has close, or the `i` index in the array is null, so the question is, why don't you utilize the `List<OutputStream>` over `Socket[]`?
with `List<OutputStream>` or `List<OutputStreamWriter>` you will not need to initialize the `OutputStreamWriter` every time you want to send some data. |
19,501,890 | In Java i am trying to store each `BufferedOutputStream` the server makes into an array aside from the threads in order to broadcast some data to all connected clients.
```
// initialisation
ArrayList<BufferedOutputStream> connections = new ArrayList<BufferedOutputStream>();
// when a client connects
Socket conn... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19501890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1945843/"
] | Maybe the socket has close, or the `i` index in the array is null, so the question is, why don't you utilize the `List<OutputStream>` over `Socket[]`?
with `List<OutputStream>` or `List<OutputStreamWriter>` you will not need to initialize the `OutputStreamWriter` every time you want to send some data. | EDIT: `Socket[] array = new Socket[#];`
You never initialize your array. That could be the problem.
But I suggest using either a `List` or a `Map`.
Apparently, I'm guessing you wanna store the socket in a way that you could retrieve it by a property later (name or ID). In this case, I suggest using a `HashMap`, with `... |
19,501,890 | In Java i am trying to store each `BufferedOutputStream` the server makes into an array aside from the threads in order to broadcast some data to all connected clients.
```
// initialisation
ArrayList<BufferedOutputStream> connections = new ArrayList<BufferedOutputStream>();
// when a client connects
Socket conn... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19501890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1945843/"
] | We can't tell you exactly what is wrong because you've left out important parts of the code. However, if `connections[id] = connection` is throwing an NPE, that can *only* mean that `connections` is `null`. And, on the face of it, you don't appear to have initialized `connections` to a non-null value!
The fix is to in... | EDIT: `Socket[] array = new Socket[#];`
You never initialize your array. That could be the problem.
But I suggest using either a `List` or a `Map`.
Apparently, I'm guessing you wanna store the socket in a way that you could retrieve it by a property later (name or ID). In this case, I suggest using a `HashMap`, with `... |
24,875,051 | I am trying to generate random base32 numbers that are 6 characters or less. This should give approximately 1 billion different combinations.
I have created a program to generate these “random” numbers. However, it appears that it generates a duplicate on average every 40,000 generations.
Why are these “random” numbe... | 2014/07/21 | [
"https://Stackoverflow.com/questions/24875051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/775706/"
] | This is similar to the [Birthday Problem](http://en.wikipedia.org/wiki/Birthday_problem). Given a group of `n` people, What is the probability that two share the same birthday1? It's higher than you'd think.
In your case, what are the odds that randomly picking a number between 0 and 1,073,741,823 n times will give y... | This is known as the [Birthday Problem](http://en.wikipedia.org/wiki/Birthday_problem) and is just basic probability-theory.
The probability that N random numbers in the range 1 through K *does not* give a duplicate is:

![enter image description ... |
24,875,051 | I am trying to generate random base32 numbers that are 6 characters or less. This should give approximately 1 billion different combinations.
I have created a program to generate these “random” numbers. However, it appears that it generates a duplicate on average every 40,000 generations.
Why are these “random” numbe... | 2014/07/21 | [
"https://Stackoverflow.com/questions/24875051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/775706/"
] | This is similar to the [Birthday Problem](http://en.wikipedia.org/wiki/Birthday_problem). Given a group of `n` people, What is the probability that two share the same birthday1? It's higher than you'd think.
In your case, what are the odds that randomly picking a number between 0 and 1,073,741,823 n times will give y... | The random number generator included in the Framework is pseudo-random without any guarantee of random number distribution. If you are concerned about distribution patterns, consider this article: <http://www.codeproject.com/Articles/15102/NET-random-number-generators-and-distributions>
Nevertheless, my statistics pr... |
24,875,051 | I am trying to generate random base32 numbers that are 6 characters or less. This should give approximately 1 billion different combinations.
I have created a program to generate these “random” numbers. However, it appears that it generates a duplicate on average every 40,000 generations.
Why are these “random” numbe... | 2014/07/21 | [
"https://Stackoverflow.com/questions/24875051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/775706/"
] | This is known as the [Birthday Problem](http://en.wikipedia.org/wiki/Birthday_problem) and is just basic probability-theory.
The probability that N random numbers in the range 1 through K *does not* give a duplicate is:

![enter image description ... | The random number generator included in the Framework is pseudo-random without any guarantee of random number distribution. If you are concerned about distribution patterns, consider this article: <http://www.codeproject.com/Articles/15102/NET-random-number-generators-and-distributions>
Nevertheless, my statistics pr... |
20,387,485 | I'm quite new to Python and overall programming so bear with me.
What I have is a dictionary of `['Male', 'Female', 'Eunuch']` as values and different names for these as keys:
`Persons = { 'Hodor' : 'Male', 'Tyrion': 'Male', 'Theon': 'Male', 'Arya': 'Female', 'Daenerys': 'Female', 'Sansa': 'Female', 'Varys': 'Eunuch}... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20387485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3067742/"
] | Consider
```
from collections import Counter
cnt = Counter(lst)
print {gender: {name: cnt[name] for name in persons if persons[name] == gender}
for gender in set(persons.values())}
# {'Eunuch': {'Varys': 1},
# 'Male': {'Tyrion': 3, 'Hodor': 2, 'Theon': 0},
# 'Female': {'Daenerys': 2, 'Arya': 1, 'Sansa': ... | ```
from collections import defaultdict
gender = {
'Hodor' : 'Male',
'Tyrion': 'Male',
'Theon': 'Male',
'Arya': 'Female',
'Daenerys': 'Female',
'Sansa': 'Female',
'Varys': 'Eunuch'
}
lst = ['Hodor', 'Hodor', 'Tyrion', 'Tyrion', 'Tyrion', 'Arya', 'Daenerys', 'Daenerys', 'Varys']
result = d... |
61,972,635 | C programming: I need to pass a long integer (N) to a function and return a word (string) 'valid' or 'invalid', but i am struggling to corrrectly cast convert the values. Is the code not working because i need to use pointers? Can you please asvise how I should modify the code and why?
```
#include <stdio.h>
int digi... | 2020/05/23 | [
"https://Stackoverflow.com/questions/61972635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12559962/"
] | In C language a string is by convention a null terminated char array. And a `char` is just a single character or byte. So you want `isvalid` to return not a char, but a string.
But arrays are not first class objects, and a function cannot return an array, nor can a programmer assign to an array. You can only return a ... | In C, strings are of type `const char*` or `char*`, so your function should return that:
```cpp
const char* isvalid(long N)
{
if (digitmatch(N) == 51 || digitmatch(N) == 52)
{
return "MasterCard";
}
else
{
return "invalid";
}
}
``` |
61,972,635 | C programming: I need to pass a long integer (N) to a function and return a word (string) 'valid' or 'invalid', but i am struggling to corrrectly cast convert the values. Is the code not working because i need to use pointers? Can you please asvise how I should modify the code and why?
```
#include <stdio.h>
int digi... | 2020/05/23 | [
"https://Stackoverflow.com/questions/61972635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12559962/"
] | In C language a string is by convention a null terminated char array. And a `char` is just a single character or byte. So you want `isvalid` to return not a char, but a string.
But arrays are not first class objects, and a function cannot return an array, nor can a programmer assign to an array. You can only return a ... | See This:
```
#include <stdio.h>
const char* fun(); //return pointer to string
int main()
{
printf("%s",fun());
return 0;
}
const char* fun()
{
const char *ret = "Hello! World"; //This string is not placed in stack it is placed in .rodata, So it is not destroyed upon function return.
retur... |
29,775,981 | This code compiled with Java SE-1.7 gives following output (below). I understand, the inferred type of value should be Object, how does it come that there are String and Integer Types recognized?
```
public class Generics1 {
public class Pocket<T>{
public T value;
public void set( T value ) { this.va... | 2015/04/21 | [
"https://Stackoverflow.com/questions/29775981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2754393/"
] | `value.getClass()` returns the runtime type of the object that `value` refers to.
An `Integer` stored in a field of type `Object` is still an `Integer`. | The variable `public T value` has its type erased, so it is essentially `public Object value`. But even if your *variable* doesn't specify the exact type, the *instance* itself still knows what class it is.
E.g.
```
Object value = "bananas";
System.out.println(value.getClass().getName());
```
Output:
```
java.lan... |
56,488,382 | I am receiving an error when running my program, I think specifically about color manipulation in the OpenCV library.
I'm trying to build a program that takes a video feed from a Raspberry Pi camera and analyze it. I want to find the brightest point in the video and calculate the distance and angle the point is at fro... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56488382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11612263/"
] | As error message said, the image given in input to the color conversion function has an invalid number of channels.
The point is that you are acquiring frames as single 8bit channel
```
Camera.set(cv::CAP_PROP_FORMAT, CV_8UC1)
```
and then you try to convert this frame in grayscale
```
cv::cvtColor(image, gray, cv... | You want to do color manipulation but your image has the type CV\_8U1. It has to be at least a three channel image like CV\_8UC3 or CV\_32F.
Try a different CV\_Type
```
Camera.set(cv::CAP_PROP_FORMAT, CV_32F);
``` |
54,470,890 | I have a list of dates, accounts, and sources of data. I'm taking the latest `max` date for each account and using that number in my window reference.
In my window reference, I'm using `row_number ()` to assign unique rows to each account and sources of data that we're receiving and sorting it by the `max` date for ea... | 2019/01/31 | [
"https://Stackoverflow.com/questions/54470890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10998441/"
] | I believe that your problem is that your connection URL is malformed.
When `DriverManager.getConnection` throws SQLException, the message includes the exact `url` value passed to the function. In your case, that looks like `jdbc:postgres://vuqmbekwlgohkw:******`.
But obviously that is not the URL you are using. You h... | You said you are new so I'm gonna start with the painfully obvious, do you have the driver on your classpath?
it's a jar you add to your project that you can download from <https://jdbc.postgresql.org/>
Otherwise I have an example of the url that worked for me, except I was not exactly using jdbc, it was a spring-boo... |
196,185 | in OneNote 2010 one can encrypt single tabs / categories - but how to encrypt a complete notebook, so that not just all existing tabs but also new tabs become automatically encrypted? | 2010/10/05 | [
"https://superuser.com/questions/196185",
"https://superuser.com",
"https://superuser.com/users/51403/"
] | A OneNote notebook is actually a folder in the file system,
which contains each tab as a .one file.
Maybe you can encrypt the notebook folder with some other methods.
Ex:
[Windows 7 Encrypt Folder with Password](https://superuser.com/questions/159498/windows-7-encrypt-folder-with-password) | You can use TrueCrypt to encrypt your save files, however anyone will still be able to access your information in the cached location. OneNote will not allow you to encrypt the cached location. |
196,185 | in OneNote 2010 one can encrypt single tabs / categories - but how to encrypt a complete notebook, so that not just all existing tabs but also new tabs become automatically encrypted? | 2010/10/05 | [
"https://superuser.com/questions/196185",
"https://superuser.com",
"https://superuser.com/users/51403/"
] | You can use TrueCrypt to create a container. Then, under OneNote Options > Save & Backup, point the following path to a folder in your container.
1. Unfiled Notes Section
2. Backup Folder
3. Default Notebook Location
4. Cache file location
Additional Information
If you have already created notebooks before creating a... | You can use TrueCrypt to encrypt your save files, however anyone will still be able to access your information in the cached location. OneNote will not allow you to encrypt the cached location. |
16,714 | I setup tor relay on Windows 10 see <https://metrics.torproject.org/rs.html#details/AD5B534F1CF8ABD17001817CC2ACF6D11345766F> as windows service.
At service start it use about 15% CPU.
Then when it works correct it can use from 0 to 5 % CPU.
But some times tor service start to use 100% CPU for a long time (10 and mor... | 2018/02/22 | [
"https://tor.stackexchange.com/questions/16714",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/21117/"
] | >
> What are the other things that websites have access to? are there any unique fingerprints/ hardware ID's websites can see?
>
>
>
In Tor Browser? None that are currently known. Tor Browser takes steps to prevent such fingerprinting, through configuration or patches.
>
> How do I overcome this situation? If I ... | Using Tor protects you against a common form of Internet surveillance known as "traffic analysis." Traffic analysis can be used to infer who is talking to whom over a public network. Knowing the source and destination of your Internet traffic allows others to track your behavior and interests. This can impact your chec... |
27,257 | The most recent discussion of what axioms one might drop from the Wightman axioms to allow the construction of realistic models that I'm aware of is [Streater, Rep. Prog. Phys. 1975 **38** 771-846, "Outline of axiomatic relativistic quantum field theory"](http://dx.doi.org/10.1088/0034-4885/38/7/001). I'm looking for a... | 2012/02/21 | [
"https://physics.stackexchange.com/questions/27257",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/1588/"
] | In the last years there has been good progress on incorporating standard methods and results of perturbative Lagrangian QFT into AQFT. A commented list of references is [here](http://ncatlab.org/nlab/show/perturbation+theory#ReferencesInAQFT).
The basic observation is that the Stückelberg-Bogoliubov-Epstein-Glaser per... | Nonperturbative constructive results in 1+3 dimensisons are still completely missing.
(Are you interested in lower dimensions?)
In particular, all realistic field theories are either nonrenormalizable (so that not even perturbation theory defined them well), or gauge theories (for which the Wightman axioms are inapp... |
50,766,015 | I am having some issues with my code and I was hoping you could help.
I am attempting to learn WPF/XAML, and as part of that learning process I decided to make a basic text editor to test my own skills. I want to make a combo box for font size that will resize all text based on the value in the combo box (basically l... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50766015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7330817/"
] | >
> Should database access also be made static with static SqlConnection
>
>
>
Definitely not. Each function invocation should open a new SqlConnection, with the same connection string, in a using block. It's not really clear how many concurrent Function Invocations the runtime will make to a single instance of y... | You can use the configuration settings in [host.json](https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json) to control the level of concurrency your functions execute at per instance and the [max scaleout](https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#websitemaxdy... |
50,766,015 | I am having some issues with my code and I was hoping you could help.
I am attempting to learn WPF/XAML, and as part of that learning process I decided to make a basic text editor to test my own skills. I want to make a combo box for font size that will resize all text based on the value in the combo box (basically l... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50766015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7330817/"
] | >
> Should database access also be made static with static SqlConnection
>
>
>
Definitely not. Each function invocation should open a new SqlConnection, with the same connection string, in a using block. It's not really clear how many concurrent Function Invocations the runtime will make to a single instance of y... | For future readers, [the documentation has been updated with some information about the SQL connection](https://learn.microsoft.com/en-us/azure/azure-functions/manage-connections#sqlclient-connections) stating:
>
> Your function code may use the .NET Framework Data Provider for SQL Server (SqlClient) to make connecti... |
25,829,130 | I have OpenSuse Linux 12.3, and I have a script file that runs every half hour. I know it runs because it generates a log file. The log file as as follows: myscript.sh
I should say that this script runs fine from the command line. It also runs fine in Task Scheduler if I tell it to "run now", it does run, and does gen... | 2014/09/14 | [
"https://Stackoverflow.com/questions/25829130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666206/"
] | Try this:
```
var ids = JToken.Parse(json)
.SelectToken("inventory1.items")
.Select(item => item["id"].ToString())
.ToList();
```
Demo: <https://dotnetfiddle.net/Vadl3I> | Paste your JSON to [json2csharp](http://json2csharp.com/), then create the suggested classes in your project. Then you can deserialize your JSON and get any specific part easily :
```
var myDeserializedJson = JsonConvert.DeserializeObject<RootObject>(myJsonString);
List<Item> result = myDeserializedJson.inventory1
... |
39,095,793 | I'd like to pass a context variable from a view into my template to direct what the template should display.
I have a context list variable `column_headers` that dictates the number of columns in a list page table, along with the header text that should be used.
```
context['column_list'] = [
_('Animal'),
_('... | 2016/08/23 | [
"https://Stackoverflow.com/questions/39095793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/562313/"
] | Try this : Get parent using `parent` method, move to previous `div` and then find `answer_message` to get the text
```js
$(function() {
$(".quote_button").click(function () {
var $parent = $(this).parent('.openticket_footer').prev('.openticket_warper');
var text = $parent.find('.answer_message').text();
... | ```
$(document).on('click', '.quote_button', function(){
alert($(this).parents('.openticket_warper').find('.answer_message').text());
});
``` |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | I think you are looking for Schematic Diagrams - they show the detailed connections between individual components - transistors, resistors, capacitors, etc.
If you are using digital integrated circuits, a schematic will show the gated symbols. In schematics, more complex ICs will be shown as blocks with many connecti... | I read the original requests as the OP wanting some reasonable search terms (for Googling, for instance) to find schematic diagrams of circuits that implement logic gates.
His problem is that unfortunately "logic gate circuits", would generally yield circuits that *use* logic gates rather than circuits that *implement... |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | [](https://i.stack.imgur.com/IanMT.png)
*Figure 1. Simple logic gates made of discrete NPN transistors and resistors.*
This are schematics of simplified logic gates built using discrete components. From left to right they are NOT, NAND and NOR.
](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | I read the original requests as the OP wanting some reasonable search terms (for Googling, for instance) to find schematic diagrams of circuits that implement logic gates.
His problem is that unfortunately "logic gate circuits", would generally yield circuits that *use* logic gates rather than circuits that *implement... | Discrete component transistor port logic.
Or try google [Relay logic](https://en.m.wikipedia.org/wiki/Relay_logic "Relay Logic") |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | I think you are looking for Schematic Diagrams - they show the detailed connections between individual components - transistors, resistors, capacitors, etc.
If you are using digital integrated circuits, a schematic will show the gated symbols. In schematics, more complex ICs will be shown as blocks with many connecti... | It was a simple question. Requires a simple answer...
TTL
Transistor to transistor logic... |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | This looks like a circuit schematic diagram.
What would you like to know about transistors exactly?
The ones shown in your diagram are called NPN transistors.
They consist of three pins: base, collector and emitter.
A small current applied to the base of the transistor creates a much larger current between the col... | Discrete component transistor port logic.
Or try google [Relay logic](https://en.m.wikipedia.org/wiki/Relay_logic "Relay Logic") |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | [](https://i.stack.imgur.com/IanMT.png)
*Figure 1. Simple logic gates made of discrete NPN transistors and resistors.*
This are schematics of simplified logic gates built using discrete components. From left to right they are NOT, NAND and NOR.
 |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | [](https://i.stack.imgur.com/IanMT.png)
*Figure 1. Simple logic gates made of discrete NPN transistors and resistors.*
This are schematics of simplified logic gates built using discrete components. From left to right they are NOT, NAND and NOR.
](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | [](https://i.stack.imgur.com/IanMT.png)
*Figure 1. Simple logic gates made of discrete NPN transistors and resistors.*
This are schematics of simplified logic gates built using discrete components. From left to right they are NOT, NAND and NOR.
](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | I read the original requests as the OP wanting some reasonable search terms (for Googling, for instance) to find schematic diagrams of circuits that implement logic gates.
His problem is that unfortunately "logic gate circuits", would generally yield circuits that *use* logic gates rather than circuits that *implement... | It was a simple question. Requires a simple answer...
TTL
Transistor to transistor logic... |
479,541 | [](https://i.stack.imgur.com/IanMT.png)
They are not quite "logic circuits" because when I look that up I get mostly the ones with logic gates drawn, not the transistors and such like these.
Also if I wanted to find a book that would teach me specifi... | 2020/02/04 | [
"https://electronics.stackexchange.com/questions/479541",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/238702/"
] | This looks like a circuit schematic diagram.
What would you like to know about transistors exactly?
The ones shown in your diagram are called NPN transistors.
They consist of three pins: base, collector and emitter.
A small current applied to the base of the transistor creates a much larger current between the col... | I think you are looking for Schematic Diagrams - they show the detailed connections between individual components - transistors, resistors, capacitors, etc.
If you are using digital integrated circuits, a schematic will show the gated symbols. In schematics, more complex ICs will be shown as blocks with many connecti... |
36,118,111 | So I have created a dataService.j that contains the following:
```
angular.module('dataService', [])
.service('gameDataService', function() {
var _gameData = {
loggedIn: "false",
gameJoined:"false",
tableFull: "false",
username: "",
tableInfo: {},
atTable: ""... | 2016/03/20 | [
"https://Stackoverflow.com/questions/36118111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5919520/"
] | If you register your service using `angular.module().service()` (in contrast to `factory()` or `provider()`) then angular expects the function you hand it to be something that can be `new`ed. So the function should just add the required properties to `this` (as you did).
Please remove your last line `return gameData;... | As the error suggests, you have a problem at the return statement from the gameDataService.
Try `return this.gameData` instead of `return gameData`;
Besides, you may also want to console.log the gData variable that lies on the ClientController scope, like this `console.log($scope.gData)` instead of `console.log(gData... |
248 | From reading Sound Design Meta I'm under the impression that "sound design for music" questions are off-topic for this exchange. Is there an Exchange where these questions are on-topic? I'm aware there are a huge number of forums on the wider web but I do like the stack exchange format. | 2014/09/02 | [
"https://sound.meta.stackexchange.com/questions/248",
"https://sound.meta.stackexchange.com",
"https://sound.meta.stackexchange.com/users/9422/"
] | There's the Sound Design obviously, and there's [Music](https://music.stackexchange.com/).
Sound design questions are on topic here, "even" if they're in a musical context. While I can understand some users' reservations about allowing *all sort of* sound production questions (live mixing etc.), I really can't agree i... | I think that there is a semantic issue underneath this issue, bare with me.
In English there's one word for: music/audio/music-production/a-healthy-state..
That word is 'Sound'.
So 'Sound' has a lot of meanings in different contexts.
-In music production: the sound of a band or a piece of gear
-In film production: so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.