qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
8,190,562 | I have a link on the page that opens a contact form in a modal window.
How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.
Thanks in advance! | 2011/11/18 | [
"https://Stackoverflow.com/questions/8190562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302760/"
] | I guess the fastest would be to use the very database for it: add a new table with the same columns, but with proper constraints (a unique index on hash/real pair?), iterate through the original table and try to insert records in the new table, ignoring constraint violation errors (i.e. continue iterating when exceptio... | If adding a primary key is not an option, then one approach would be to store the duplicates DISTINCT in a temp table, delete all of the duplicated records from the existing table, and then add the records back into the original table from the temp table.
For example (written for SQL Server 2008, but the technique is ... |
8,190,562 | I have a link on the page that opens a contact form in a modal window.
How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.
Thanks in advance! | 2011/11/18 | [
"https://Stackoverflow.com/questions/8190562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302760/"
] | If adding a primary key is not an option, then one approach would be to store the duplicates DISTINCT in a temp table, delete all of the duplicated records from the existing table, and then add the records back into the original table from the temp table.
For example (written for SQL Server 2008, but the technique is ... | The proposed solution was not working for me, so I ended up doing this:
```sql
CREATE TABLE temp_table as SELECT DISTINCT * FROM your_table
DROP TABLE your_table
ALTER TABLE temp_table RENAME TO your_table
``` |
8,190,562 | I have a link on the page that opens a contact form in a modal window.
How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.
Thanks in advance! | 2011/11/18 | [
"https://Stackoverflow.com/questions/8190562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302760/"
] | You need a way to distinguish the rows. Based on your comment, you could use the special [rowid column](http://www.sqlite.org/autoinc.html) for that.
To delete duplicates by keeping the lowest `rowid` per `(hash,d)`:
```
delete from YourTable
where rowid not in
(
select min(rowid)
fro... | I guess the fastest would be to use the very database for it: add a new table with the same columns, but with proper constraints (a unique index on hash/real pair?), iterate through the original table and try to insert records in the new table, ignoring constraint violation errors (i.e. continue iterating when exceptio... |
8,190,562 | I have a link on the page that opens a contact form in a modal window.
How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.
Thanks in advance! | 2011/11/18 | [
"https://Stackoverflow.com/questions/8190562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302760/"
] | You need a way to distinguish the rows. Based on your comment, you could use the special [rowid column](http://www.sqlite.org/autoinc.html) for that.
To delete duplicates by keeping the lowest `rowid` per `(hash,d)`:
```
delete from YourTable
where rowid not in
(
select min(rowid)
fro... | The proposed solution was not working for me, so I ended up doing this:
```sql
CREATE TABLE temp_table as SELECT DISTINCT * FROM your_table
DROP TABLE your_table
ALTER TABLE temp_table RENAME TO your_table
``` |
8,190,562 | I have a link on the page that opens a contact form in a modal window.
How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.
Thanks in advance! | 2011/11/18 | [
"https://Stackoverflow.com/questions/8190562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302760/"
] | I guess the fastest would be to use the very database for it: add a new table with the same columns, but with proper constraints (a unique index on hash/real pair?), iterate through the original table and try to insert records in the new table, ignoring constraint violation errors (i.e. continue iterating when exceptio... | The proposed solution was not working for me, so I ended up doing this:
```sql
CREATE TABLE temp_table as SELECT DISTINCT * FROM your_table
DROP TABLE your_table
ALTER TABLE temp_table RENAME TO your_table
``` |
41,557,681 | I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I k... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41557681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389549/"
] | You can simply do that *(note that I changed the second `cmp` to the shuttle operator `<=>` for numeric values)*:
```
foreach (sort { ($hash{$a}=~s/^\W+//r cmp $hash{$b}=~s/^\W+//r) || ($a <=> $b) } keys %hash) {
print "$hash{$_}\n";
}
```
But if you have a lot of data, it's better to transform your data *(once ... | Use a custom sort function that strips out the characters you want to ignore.
```
foreach (sort {
my ($aa,$bb) = ($hash{$a},$hash{$b});
s/["]//g for $aa,$bb; # ignore " char. Add whatever else you want
$aa cmp $bb # or lc($aa) cmp lc($bb) case-insensitive search
... |
41,557,681 | I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I k... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41557681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389549/"
] | Create a function which truncates special characters (`truncate_special_chars` in my case). Then, use it under your `sort` routine.
```
use strict;
use warnings;
my %hash = (
5328 => 'Adorable',
26191 => '"Giraffe"',
57491 => 'Is Very',
4915 => 'Cute',
);
print join "\n",
map { $hash{$_ -> [... | Use a custom sort function that strips out the characters you want to ignore.
```
foreach (sort {
my ($aa,$bb) = ($hash{$a},$hash{$b});
s/["]//g for $aa,$bb; # ignore " char. Add whatever else you want
$aa cmp $bb # or lc($aa) cmp lc($bb) case-insensitive search
... |
41,557,681 | I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I k... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41557681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389549/"
] | You can simply do that *(note that I changed the second `cmp` to the shuttle operator `<=>` for numeric values)*:
```
foreach (sort { ($hash{$a}=~s/^\W+//r cmp $hash{$b}=~s/^\W+//r) || ($a <=> $b) } keys %hash) {
print "$hash{$_}\n";
}
```
But if you have a lot of data, it's better to transform your data *(once ... | Try as follows
```
use strict;
use warnings;
my %hash = ( 5328 => 'Adorable',
26191 => '"Giraffe"',
57491 => 'Is Very',
4915 => 'Cute',);
foreach (sort{my ($one)=$hash{$a}=~m/([\w\s]+)/; my ($two)=$hash{$b}=~m/([\w\s]+)/; $one cmp $two} keys %hash)
{
print "$hash{$_}\n";
}
```
Group t... |
41,557,681 | I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I k... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41557681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389549/"
] | You can simply do that *(note that I changed the second `cmp` to the shuttle operator `<=>` for numeric values)*:
```
foreach (sort { ($hash{$a}=~s/^\W+//r cmp $hash{$b}=~s/^\W+//r) || ($a <=> $b) } keys %hash) {
print "$hash{$_}\n";
}
```
But if you have a lot of data, it's better to transform your data *(once ... | Create a function which truncates special characters (`truncate_special_chars` in my case). Then, use it under your `sort` routine.
```
use strict;
use warnings;
my %hash = (
5328 => 'Adorable',
26191 => '"Giraffe"',
57491 => 'Is Very',
4915 => 'Cute',
);
print join "\n",
map { $hash{$_ -> [... |
41,557,681 | I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I k... | 2017/01/09 | [
"https://Stackoverflow.com/questions/41557681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389549/"
] | Create a function which truncates special characters (`truncate_special_chars` in my case). Then, use it under your `sort` routine.
```
use strict;
use warnings;
my %hash = (
5328 => 'Adorable',
26191 => '"Giraffe"',
57491 => 'Is Very',
4915 => 'Cute',
);
print join "\n",
map { $hash{$_ -> [... | Try as follows
```
use strict;
use warnings;
my %hash = ( 5328 => 'Adorable',
26191 => '"Giraffe"',
57491 => 'Is Very',
4915 => 'Cute',);
foreach (sort{my ($one)=$hash{$a}=~m/([\w\s]+)/; my ($two)=$hash{$b}=~m/([\w\s]+)/; $one cmp $two} keys %hash)
{
print "$hash{$_}\n";
}
```
Group t... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | **Technology has potentially impacted this answer within the last 10 years.** It's possible now to film a feature-quality film [on a smartphone](https://en.wikipedia.org/wiki/Tangerine_(film)), which dramatically lowers the costs of making an indie film. Even so, making a movie is inevitably an expensive, time-consumin... | ### Star Wars
The [novelization](https://en.wikipedia.org/wiki/Star_Wars:_From_the_Adventures_of_Luke_Skywalker) of the first (released) [film](https://en.wikipedia.org/wiki/Star_Wars_Episode_IV:_A_New_Hope) was actually released before the movie. Others have already discussed the theory behind why this worked. But th... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | ### Star Wars
The [novelization](https://en.wikipedia.org/wiki/Star_Wars:_From_the_Adventures_of_Luke_Skywalker) of the first (released) [film](https://en.wikipedia.org/wiki/Star_Wars_Episode_IV:_A_New_Hope) was actually released before the movie. Others have already discussed the theory behind why this worked. But th... | Do both. First write the script. And then register it with WGA. Then take the script and describe the scenes in words to create the novel. Register both with LOC copyright office.
As a first time writer you will be lucky to get anything for the script. And if you do they will rewrite it with other people. But nobody m... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | Screenplays are collaborative, whether you like it or not.
----------------------------------------------------------
Actors will say the lines. Directors will alter the tone. The photographer will create their own vision. And the producers will hire other screenwriters to "fix" your screenplay because they have spent... | Do both. First write the script. And then register it with WGA. Then take the script and describe the scenes in words to create the novel. Register both with LOC copyright office.
As a first time writer you will be lucky to get anything for the script. And if you do they will rewrite it with other people. But nobody m... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | **Technology has potentially impacted this answer within the last 10 years.** It's possible now to film a feature-quality film [on a smartphone](https://en.wikipedia.org/wiki/Tangerine_(film)), which dramatically lowers the costs of making an indie film. Even so, making a movie is inevitably an expensive, time-consumin... | I agree with all the other answers so far, but let me take a different perspective on the whole thing. If you wish, read this answer as a frame challenge.
You say "there's a movie in your head". What do you mean? Is it *really* a movie - does it fit into ~2 hours, do you see each frame and how it's shot, do you see th... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | **Technology has potentially impacted this answer within the last 10 years.** It's possible now to film a feature-quality film [on a smartphone](https://en.wikipedia.org/wiki/Tangerine_(film)), which dramatically lowers the costs of making an indie film. Even so, making a movie is inevitably an expensive, time-consumin... | In another forum I've actually recommended to writers that they write the novel and the screenplay in parallel, even if you only intend to publish the novel. Writing the screen adaptation for a novel can expose weaknesses in the novel.
For instance, writers are constantly told "show, don't tell", because in the novel ... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | Don't forget that nobody (except perhaps students on a film-making or screenplay-writing courses) ever reads screenplays, even those of classic famous movies. Write one by all means if you feel compelled to, but most likely the only person who will ever see it is *you* - unless someone else makes it into a movie.
As o... | Do both. First write the script. And then register it with WGA. Then take the script and describe the scenes in words to create the novel. Register both with LOC copyright office.
As a first time writer you will be lucky to get anything for the script. And if you do they will rewrite it with other people. But nobody m... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | Screenplays are also very difficult to sell, for a first-timer. Books are quite a bit easier. Unlike a screenplay, a book is in its final form, and relatively easy to produce, big publishers can do it cheap, in the single-digit thousands, and have the contacts to get it reviewed and advertised.
Screenplays can cost t... | In another forum I've actually recommended to writers that they write the novel and the screenplay in parallel, even if you only intend to publish the novel. Writing the screen adaptation for a novel can expose weaknesses in the novel.
For instance, writers are constantly told "show, don't tell", because in the novel ... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | I'm gonna answer to the question in the title:
Ultimately it's up to you. They are different media.
----------------------------------------------------
Your friend must be right on some level.
I too have the habit to imagine my stories as movies (and I suppose it's not uncommon at all). Sometimes is painstalkingly... | Do both. First write the script. And then register it with WGA. Then take the script and describe the scenes in words to create the novel. Register both with LOC copyright office.
As a first time writer you will be lucky to get anything for the script. And if you do they will rewrite it with other people. But nobody m... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | Don't forget that nobody (except perhaps students on a film-making or screenplay-writing courses) ever reads screenplays, even those of classic famous movies. Write one by all means if you feel compelled to, but most likely the only person who will ever see it is *you* - unless someone else makes it into a movie.
As o... | ### Star Wars
The [novelization](https://en.wikipedia.org/wiki/Star_Wars:_From_the_Adventures_of_Luke_Skywalker) of the first (released) [film](https://en.wikipedia.org/wiki/Star_Wars_Episode_IV:_A_New_Hope) was actually released before the movie. Others have already discussed the theory behind why this worked. But th... |
42,405 | Around a decade ago, I had a dream. An actual middle of the night dream. An entire movie played in my head, all I had to do was write it down. I did a fair bit of research on the topic then I spent the next 10 years working it out in my head but not writing much of anything down.
Last year, I joined a writer's group a... | 2019/02/21 | [
"https://writers.stackexchange.com/questions/42405",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/32946/"
] | Screenplays are also very difficult to sell, for a first-timer. Books are quite a bit easier. Unlike a screenplay, a book is in its final form, and relatively easy to produce, big publishers can do it cheap, in the single-digit thousands, and have the contacts to get it reviewed and advertised.
Screenplays can cost t... | Do both. First write the script. And then register it with WGA. Then take the script and describe the scenes in words to create the novel. Register both with LOC copyright office.
As a first time writer you will be lucky to get anything for the script. And if you do they will rewrite it with other people. But nobody m... |
42,065,947 | Here is my code:
```
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObjec... | 2017/02/06 | [
"https://Stackoverflow.com/questions/42065947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6930840/"
] | **FOR SAVING VALUES**
```
SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putString("name", "Hello");
editor.putInt("value", 12);
editor.commit();
```
**FOR FETCHING DATA BACK**
```
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
Strin... | from documentation:
>
> Create a new Editor for these preferences, through which you can make modifications to the data in the preferences and atomically commit those changes back to the SharedPreferences object.
>
>
> |
42,065,947 | Here is my code:
```
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObjec... | 2017/02/06 | [
"https://Stackoverflow.com/questions/42065947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6930840/"
] | For saving the Shared Preference value as a String
```
SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
public void saveValue(String key, String value) {
SharedPreferences.Editor saveValue = prefs.edit();
saveValue.putString(key, value);
saveValue.appl... | from documentation:
>
> Create a new Editor for these preferences, through which you can make modifications to the data in the preferences and atomically commit those changes back to the SharedPreferences object.
>
>
> |
42,065,947 | Here is my code:
```
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObjec... | 2017/02/06 | [
"https://Stackoverflow.com/questions/42065947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6930840/"
] | **FOR SAVING VALUES**
```
SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putString("name", "Hello");
editor.putInt("value", 12);
editor.commit();
```
**FOR FETCHING DATA BACK**
```
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
Strin... | You can try out the following code :
First declare:
```
SharedPreferences myPreference;
```
In onCreate():
```
myPreference =PreferenceManager.getDefaultSharedPreferences(this);
```
In OnResponse():
```
myPreference.edit().putString("mobile",edtmobilenumber.getText().toString()).apply();
``` |
42,065,947 | Here is my code:
```
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObjec... | 2017/02/06 | [
"https://Stackoverflow.com/questions/42065947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6930840/"
] | For saving the Shared Preference value as a String
```
SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
public void saveValue(String key, String value) {
SharedPreferences.Editor saveValue = prefs.edit();
saveValue.putString(key, value);
saveValue.appl... | You can try out the following code :
First declare:
```
SharedPreferences myPreference;
```
In onCreate():
```
myPreference =PreferenceManager.getDefaultSharedPreferences(this);
```
In OnResponse():
```
myPreference.edit().putString("mobile",edtmobilenumber.getText().toString()).apply();
``` |
410,602 | I recently bought [these](https://uk.rs-online.com/web/p/isolated-dc-dc-converters/1616715/?relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D626572266C753D656E266D6D3D6D61746368616C6C26706D3D5E2828282872737C5253295B205D3F293F285C647B337D5B5C2D5C735D3F5C647B332C347D5B705061415D3F29297C283235285C647B387D7C5C647... | 2018/12/05 | [
"https://electronics.stackexchange.com/questions/410602",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/184379/"
] | Try using a lower value resistor. With this one you get 11uA of current, which is close to open line. Try getting 10-20mA of load with resistor of say a couple of hundred ohms (200-300 should work) . | Since you didn't indicate much details in your analysis of your problem, I might be inclined to suggest ESD damage on the input. Something has attenuated the feedback that so that it overdriving the output.
The design input current is specified for NO LOAD.
Write to info@tracopower-solutions.com and
* 1) request tec... |
3,471,911 | I'm trying to find the area of the region bounded by $r =|\sin \theta | $ in the $xy$-plane using the formula:
\begin{align\*}
A &= \frac{1}{2}\int\_{0}^{\pi} (|\sin \theta|)^2 d\theta \\
&=\frac{1}{2}\int\_{0}^{\pi} (1-\cos2\theta)^2 d\theta \\
&= \frac{1}{2}\int\_{0}^{\pi} (1-2\cos\theta + \cos^22\theta)^2 d\theta \... | 2019/12/11 | [
"https://math.stackexchange.com/questions/3471911",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661612/"
] | Hint: square it, then make use of the fact that the 5 fifth roots of unity sum to 0. | Let $w=e^{2\pi i/5}$. Then $w^5=1$ and $w\ne1$ so $w^4+w^3+w^2+w+1=0$, $w^4=w^{-1},$ and $w^3=w^{-2}$.
Also, $\cos(2\pi i/5)=\dfrac{w+w^{-1}}2$,
so $\cos^2(2\pi i/5)=\dfrac{w^2+w^{-2}+2}4=\dfrac{w^2+w^3+2}4=\dfrac{-1-w-w^{-1}+2}4=\dfrac{1-2\cos(2\pi i/5)}{4}.$
Can you take it from here? |
3,471,911 | I'm trying to find the area of the region bounded by $r =|\sin \theta | $ in the $xy$-plane using the formula:
\begin{align\*}
A &= \frac{1}{2}\int\_{0}^{\pi} (|\sin \theta|)^2 d\theta \\
&=\frac{1}{2}\int\_{0}^{\pi} (1-\cos2\theta)^2 d\theta \\
&= \frac{1}{2}\int\_{0}^{\pi} (1-2\cos\theta + \cos^22\theta)^2 d\theta \... | 2019/12/11 | [
"https://math.stackexchange.com/questions/3471911",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661612/"
] | Below I'll show how to find
(1) the minimal polynomial for $\omega+\omega^{-1}$,
(2) the minimal polynomial for $\cos\left(\dfrac{2\pi}{5}\right)$, and
(3) the minimal polynomial for $\sin\left(\dfrac{2\pi}{5}\right)$.
(1) First note that $\omega$ is a root of $x^5-1$, but not of $x-1$. Hence $\omega$ is a root of... | Hint: square it, then make use of the fact that the 5 fifth roots of unity sum to 0. |
3,471,911 | I'm trying to find the area of the region bounded by $r =|\sin \theta | $ in the $xy$-plane using the formula:
\begin{align\*}
A &= \frac{1}{2}\int\_{0}^{\pi} (|\sin \theta|)^2 d\theta \\
&=\frac{1}{2}\int\_{0}^{\pi} (1-\cos2\theta)^2 d\theta \\
&= \frac{1}{2}\int\_{0}^{\pi} (1-2\cos\theta + \cos^22\theta)^2 d\theta \... | 2019/12/11 | [
"https://math.stackexchange.com/questions/3471911",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661612/"
] | $$
\alpha = \frac{\omega+\omega^4}{2}\\
\alpha^2 = \frac{\omega^2 + \omega^3 + 2}{4}\\
2 \alpha + 4 \alpha^2 = \omega+\omega^4 + \omega^2 + \omega^3 + 2\\
4 \alpha^2 + 2 \alpha -1 = 0\\
$$
Do $\alpha^n$ enough times that you see all the powers of $\omega^k$. Then you can see how to combine them that gives you the mini... | Let $w=e^{2\pi i/5}$. Then $w^5=1$ and $w\ne1$ so $w^4+w^3+w^2+w+1=0$, $w^4=w^{-1},$ and $w^3=w^{-2}$.
Also, $\cos(2\pi i/5)=\dfrac{w+w^{-1}}2$,
so $\cos^2(2\pi i/5)=\dfrac{w^2+w^{-2}+2}4=\dfrac{w^2+w^3+2}4=\dfrac{-1-w-w^{-1}+2}4=\dfrac{1-2\cos(2\pi i/5)}{4}.$
Can you take it from here? |
3,471,911 | I'm trying to find the area of the region bounded by $r =|\sin \theta | $ in the $xy$-plane using the formula:
\begin{align\*}
A &= \frac{1}{2}\int\_{0}^{\pi} (|\sin \theta|)^2 d\theta \\
&=\frac{1}{2}\int\_{0}^{\pi} (1-\cos2\theta)^2 d\theta \\
&= \frac{1}{2}\int\_{0}^{\pi} (1-2\cos\theta + \cos^22\theta)^2 d\theta \... | 2019/12/11 | [
"https://math.stackexchange.com/questions/3471911",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661612/"
] | Below I'll show how to find
(1) the minimal polynomial for $\omega+\omega^{-1}$,
(2) the minimal polynomial for $\cos\left(\dfrac{2\pi}{5}\right)$, and
(3) the minimal polynomial for $\sin\left(\dfrac{2\pi}{5}\right)$.
(1) First note that $\omega$ is a root of $x^5-1$, but not of $x-1$. Hence $\omega$ is a root of... | $$
\alpha = \frac{\omega+\omega^4}{2}\\
\alpha^2 = \frac{\omega^2 + \omega^3 + 2}{4}\\
2 \alpha + 4 \alpha^2 = \omega+\omega^4 + \omega^2 + \omega^3 + 2\\
4 \alpha^2 + 2 \alpha -1 = 0\\
$$
Do $\alpha^n$ enough times that you see all the powers of $\omega^k$. Then you can see how to combine them that gives you the mini... |
3,471,911 | I'm trying to find the area of the region bounded by $r =|\sin \theta | $ in the $xy$-plane using the formula:
\begin{align\*}
A &= \frac{1}{2}\int\_{0}^{\pi} (|\sin \theta|)^2 d\theta \\
&=\frac{1}{2}\int\_{0}^{\pi} (1-\cos2\theta)^2 d\theta \\
&= \frac{1}{2}\int\_{0}^{\pi} (1-2\cos\theta + \cos^22\theta)^2 d\theta \... | 2019/12/11 | [
"https://math.stackexchange.com/questions/3471911",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/661612/"
] | Below I'll show how to find
(1) the minimal polynomial for $\omega+\omega^{-1}$,
(2) the minimal polynomial for $\cos\left(\dfrac{2\pi}{5}\right)$, and
(3) the minimal polynomial for $\sin\left(\dfrac{2\pi}{5}\right)$.
(1) First note that $\omega$ is a root of $x^5-1$, but not of $x-1$. Hence $\omega$ is a root of... | Let $w=e^{2\pi i/5}$. Then $w^5=1$ and $w\ne1$ so $w^4+w^3+w^2+w+1=0$, $w^4=w^{-1},$ and $w^3=w^{-2}$.
Also, $\cos(2\pi i/5)=\dfrac{w+w^{-1}}2$,
so $\cos^2(2\pi i/5)=\dfrac{w^2+w^{-2}+2}4=\dfrac{w^2+w^3+2}4=\dfrac{-1-w-w^{-1}+2}4=\dfrac{1-2\cos(2\pi i/5)}{4}.$
Can you take it from here? |
20,797 | Is there any difference between Arabic and Arabian? It's sound same though for me. Any help will be greatly appreciated. | 2014/04/07 | [
"https://ell.stackexchange.com/questions/20797",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/-1/"
] | The area is referred to as **Arabia**. (As in Saudi Arabia)
A person from that area is an **Arab**. (As in the Monty Python's song *Never be rude to an Arab*)
The people there speak **Arabic**. (As in "the word "algebra" comes from Arabic)
Any other stuff coming from Arabia is **Arabian**. (As in the book *Arabian N... | **Arabic** refers to the language of Arab, whereas **Arabian** refers to the people of Arab.
The root word is **"Arab"**, and to form **"Arabic"** and **"Arabian"** two suffixes are used - ***"-ic"*** and ***"-ian"*** respectively.
**-ic :** (suffix) One relating to or characterized by. **Example -** *Academic*
**-... |
46,897,800 | I'm a student , our teacher told us to make a static method called `SOMME` to count the vectors sum , ( it's called `SOMME` in the code ) and he said it should be `static` , I didn't know where the problem is I tried almost every possible way to solve that but no solutions.
here is the Code :
```
import java.util.*;... | 2017/10/23 | [
"https://Stackoverflow.com/questions/46897800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8821494/"
] | If you want it static you will have to do it like this:
```
public static Vecteur somme(Vecteur v1, Vecteur v2)
{
Vecteur u = new Vecteur(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
return u;
}
```
The only way to do it with just one parameter and being able to use your own values is with a non-static method ... | Why the code does not work
==========================
You are trying to access an instance variable from a static method, which will not work.
How you can fix this
====================
There 2 ways to do this:
* Take both vertors as parameters to the method, and get all the values from the parameters
* Make the met... |
52,881,107 | I have setup a 3 node cluster (with no Internet access) with 1 manager and 2 worker-nodes using the standard swarm documentation.
How does the swarm manager in swarm mode know about the images present in worker nodes?
Lets say I have image A in worker-node-1 and image B in worker-node-2 and no images in the manager-n... | 2018/10/18 | [
"https://Stackoverflow.com/questions/52881107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6713075/"
] | The transform attribute needs to evaluate to a string - i.e. `transform="rotate(90deg)"`, so I think you need to concatenate some partial strings:
```
:transform="'rotate(' + deg + ' deg)'"
``` | This is a great place to use javascript's [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
```
:transform="`rotate(${deg} deg)`"
``` |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | The phpMyAdmin which comes with cPanel (in the 3rdparty-directory) is apparently secured with the cpanel-authentication, so the answer is "no".
You could install your own phpMyAdmin (maybe it's even available in the script-center/one-click-installer) and set it up to directly authenticate on the MySQL-server with your... | cPanel user account has a privileges to control all created databases under cPanel account, And because phpMyAdmin in cPanel is using cPanel authentication you are automatically redirected to the phpMyAdmin control page without asking for login info.
Your target could be done with changing cPanel password without chan... |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | The phpMyAdmin which comes with cPanel (in the 3rdparty-directory) is apparently secured with the cpanel-authentication, so the answer is "no".
You could install your own phpMyAdmin (maybe it's even available in the script-center/one-click-installer) and set it up to directly authenticate on the MySQL-server with your... | As I was looking for an answer to this question, I found the following method that did the job for me:
[How to access phpMyAdmin directly from my domain?](http://kb.siteground.com/how_to_access_phpmyadmin_directly_from_my_domain/)
This worked well for me, although I'm using a **different** hosting provider then Site... |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | The phpMyAdmin which comes with cPanel (in the 3rdparty-directory) is apparently secured with the cpanel-authentication, so the answer is "no".
You could install your own phpMyAdmin (maybe it's even available in the script-center/one-click-installer) and set it up to directly authenticate on the MySQL-server with your... | **You cannot give direct access to your phpMyAdmin without providing direct cPanel access as well.**
This is a security measure from cPanel as phpMyAdmin is known to be one of the most exploited PHP applications of all time. It is only available after you start your session by logging into cPanel.
**A nice work-aroun... |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | As I was looking for an answer to this question, I found the following method that did the job for me:
[How to access phpMyAdmin directly from my domain?](http://kb.siteground.com/how_to_access_phpmyadmin_directly_from_my_domain/)
This worked well for me, although I'm using a **different** hosting provider then Site... | cPanel user account has a privileges to control all created databases under cPanel account, And because phpMyAdmin in cPanel is using cPanel authentication you are automatically redirected to the phpMyAdmin control page without asking for login info.
Your target could be done with changing cPanel password without chan... |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | **You cannot give direct access to your phpMyAdmin without providing direct cPanel access as well.**
This is a security measure from cPanel as phpMyAdmin is known to be one of the most exploited PHP applications of all time. It is only available after you start your session by logging into cPanel.
**A nice work-aroun... | cPanel user account has a privileges to control all created databases under cPanel account, And because phpMyAdmin in cPanel is using cPanel authentication you are automatically redirected to the phpMyAdmin control page without asking for login info.
Your target could be done with changing cPanel password without chan... |
7,456,450 | I'm error checking a search index table (asIndex) that is built by a script from 25 tables.
Both the asIndex and Evaluations tables have multiple rows per address.
So this query was an attempt to be sure that everywhere an index row has Evaluation = 'blue' that there was at least one row in Evaluations where Evaluat... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7456450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97767/"
] | As I was looking for an answer to this question, I found the following method that did the job for me:
[How to access phpMyAdmin directly from my domain?](http://kb.siteground.com/how_to_access_phpmyadmin_directly_from_my_domain/)
This worked well for me, although I'm using a **different** hosting provider then Site... | **You cannot give direct access to your phpMyAdmin without providing direct cPanel access as well.**
This is a security measure from cPanel as phpMyAdmin is known to be one of the most exploited PHP applications of all time. It is only available after you start your session by logging into cPanel.
**A nice work-aroun... |
6,176,148 | I have a build bash script running under Hudson build system, which writes its own log file. However, Hudson captures all the stdout and stderr of the build script it executes and displays it as the "console output" of the build. Furthermore, this output is saved in the build history.
How can I access this "console ou... | 2011/05/30 | [
"https://Stackoverflow.com/questions/6176148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219335/"
] | 1. It is saved along with the artifacts (the `log` file in top-level of build's directory, i.e. `jobs/`*jobname*`/builds/`*buildid*`/log`).
2. It is automatically added to the email hudson sends, though truncated from begining.
If you need to get it anywhere else, there are two options:
1. You can have to wrap the sc... | To force line-buffering in tee, just start the program with `unbuffer {command}` which is part of the `expect` package. Another alternative to `unbuffer` is to use `stdbuf -eL -oL {command}` |
4,312,827 | i have this code. the pointer turns 0x0 immediately before using it. short before, it had the correct address.
```
TreeViewColumn *col;
col = preview->get_column(pcFolder); /* col = 0x7fff5fc404a0 */
col->set_resizable(true); /* col = 0x0 */
```
i use Gtkmm 2.4, but it returns the expected value, it just ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371128/"
] | `preview->get_column();` returns NULL, before that, its just some random value, since you didn't initialize the `col` variable | ```
preview->get_column(pcFolder)
```
must be returning 0. |
4,312,827 | i have this code. the pointer turns 0x0 immediately before using it. short before, it had the correct address.
```
TreeViewColumn *col;
col = preview->get_column(pcFolder); /* col = 0x7fff5fc404a0 */
col->set_resizable(true); /* col = 0x0 */
```
i use Gtkmm 2.4, but it returns the expected value, it just ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371128/"
] | The function call:
```
preview->get_column(pcFolder);
```
returns NULL.
When gdb shows the current code line, it hasn't been executed until you type next.
You probably pass an index that is larger than the number of columns in `preview`. Try:
```
p pcFolder
p preview->get_columns().size()
``` | ```
preview->get_column(pcFolder)
```
must be returning 0. |
4,312,827 | i have this code. the pointer turns 0x0 immediately before using it. short before, it had the correct address.
```
TreeViewColumn *col;
col = preview->get_column(pcFolder); /* col = 0x7fff5fc404a0 */
col->set_resizable(true); /* col = 0x0 */
```
i use Gtkmm 2.4, but it returns the expected value, it just ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371128/"
] | Better code would actually be to initialise the variable immediately on use by calling getColumn at the point of declaration:
`TreeViewColumn *col = preview->get_column(pcFolder);`
If this function can return NULL (as it appears to) you must then check before you use the pointer, thus:
```
if( col != NULL )
{
col... | ```
preview->get_column(pcFolder)
```
must be returning 0. |
4,312,827 | i have this code. the pointer turns 0x0 immediately before using it. short before, it had the correct address.
```
TreeViewColumn *col;
col = preview->get_column(pcFolder); /* col = 0x7fff5fc404a0 */
col->set_resizable(true); /* col = 0x0 */
```
i use Gtkmm 2.4, but it returns the expected value, it just ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371128/"
] | The function call:
```
preview->get_column(pcFolder);
```
returns NULL.
When gdb shows the current code line, it hasn't been executed until you type next.
You probably pass an index that is larger than the number of columns in `preview`. Try:
```
p pcFolder
p preview->get_columns().size()
``` | `preview->get_column();` returns NULL, before that, its just some random value, since you didn't initialize the `col` variable |
4,312,827 | i have this code. the pointer turns 0x0 immediately before using it. short before, it had the correct address.
```
TreeViewColumn *col;
col = preview->get_column(pcFolder); /* col = 0x7fff5fc404a0 */
col->set_resizable(true); /* col = 0x0 */
```
i use Gtkmm 2.4, but it returns the expected value, it just ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371128/"
] | The function call:
```
preview->get_column(pcFolder);
```
returns NULL.
When gdb shows the current code line, it hasn't been executed until you type next.
You probably pass an index that is larger than the number of columns in `preview`. Try:
```
p pcFolder
p preview->get_columns().size()
``` | Better code would actually be to initialise the variable immediately on use by calling getColumn at the point of declaration:
`TreeViewColumn *col = preview->get_column(pcFolder);`
If this function can return NULL (as it appears to) you must then check before you use the pointer, thus:
```
if( col != NULL )
{
col... |
65,469 | How can I get Bitcoin receive notifications with Bitcoin Core. I have tried the `walletnotify` and `blocknotify` options. `walletnotify` is fired two times when I send or receive bitcoins. And with `blocknotify` I have to perform below task to detect which account of the wallet has received bitcoin.
* Run `getBlock` c... | 2017/12/16 | [
"https://bitcoin.stackexchange.com/questions/65469",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/64890/"
] | `walletnotify` executes once per every unconfirmed transaction creation (incoming/outgoing) and once more once the transaction is mined into a block (gets it's first confirmation).
I am not sure what are you developing, but as far as I see it both notifications are essential:
The first one to let the customer know tha... | Not sure if this will be efficient enough for you, but when walletnotify is called it can pass along the txid it was called with. Then whatever program is executed, from walletnotify can do something like a decoderawtransaction using that txid and see if the blockHash field is filled in, and confirmations>0.
You can a... |
65,469 | How can I get Bitcoin receive notifications with Bitcoin Core. I have tried the `walletnotify` and `blocknotify` options. `walletnotify` is fired two times when I send or receive bitcoins. And with `blocknotify` I have to perform below task to detect which account of the wallet has received bitcoin.
* Run `getBlock` c... | 2017/12/16 | [
"https://bitcoin.stackexchange.com/questions/65469",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/64890/"
] | I see a solution using [ZMQ](https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md).
[An example](https://github.com/bitcoin/bitcoin/blob/dac2caa371a1c65faf34966c85dbafc30a0c640a/contrib/zmq/zmq_sub.py) of using it is also available on Python.
By enabling ZMQ you can process network updates (blocks, new transacti... | Not sure if this will be efficient enough for you, but when walletnotify is called it can pass along the txid it was called with. Then whatever program is executed, from walletnotify can do something like a decoderawtransaction using that txid and see if the blockHash field is filled in, and confirmations>0.
You can a... |
30,506,897 | I'm communicating with a modem via COM port to recieve CSQ values.
```
response = ser.readline()
csq = response[6:8]
print type(csq)
```
returns the following:
```
<type 'str'> and csq is a string with a value from 10-20
```
For further calculation I try to convert "csq" into an integer, but
```
i=int(csq)
`... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30506897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3455049/"
] | Your error message shows that you are trying to convert an empty string into an `int` which would cause problems.
Wrap your code in an if statement to check for empty strings:
```
if csq:
i = int(csq)
else:
i = None
```
Note that empty objects (empty lists, tuples, sets, strings etc) evaluate to `False` in ... | As alternative you can put your code inside an try-except-block:
```
try:
i = int(csq)
except:
# some magic e.g.
i = False
``` |
30,506,897 | I'm communicating with a modem via COM port to recieve CSQ values.
```
response = ser.readline()
csq = response[6:8]
print type(csq)
```
returns the following:
```
<type 'str'> and csq is a string with a value from 10-20
```
For further calculation I try to convert "csq" into an integer, but
```
i=int(csq)
`... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30506897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3455049/"
] | A slightly more pythonic way:
```python
i = int(csq) if csq else None
``` | Your error message shows that you are trying to convert an empty string into an `int` which would cause problems.
Wrap your code in an if statement to check for empty strings:
```
if csq:
i = int(csq)
else:
i = None
```
Note that empty objects (empty lists, tuples, sets, strings etc) evaluate to `False` in ... |
30,506,897 | I'm communicating with a modem via COM port to recieve CSQ values.
```
response = ser.readline()
csq = response[6:8]
print type(csq)
```
returns the following:
```
<type 'str'> and csq is a string with a value from 10-20
```
For further calculation I try to convert "csq" into an integer, but
```
i=int(csq)
`... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30506897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3455049/"
] | A slightly more pythonic way:
```python
i = int(csq) if csq else None
``` | As alternative you can put your code inside an try-except-block:
```
try:
i = int(csq)
except:
# some magic e.g.
i = False
``` |
46,726 | All
I have created a custom webpart for my list instance. This webpart is inserted within a RenderTemplate for the list. I have several Jquery Libraries loading within the webpart. For the most part it seems that it works but none of the tabs work they actually redirect to entire different page with the same contents.... | 2012/09/28 | [
"https://sharepoint.stackexchange.com/questions/46726",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10978/"
] | OK, finally got. After long hours looking at the ugliest HTML/JS even written and short short periods of insanity, I add an idea that I don't totally like and it isn't the best, but at this point I don't f\*\*\*ing care. I just want to get over this.
So, I simple create a basic .aspx page with the follwing code:
```
... | You can inject the correct markup directly into the DOM, I have tested this myself and it works perfectly. The People Picker does not depend on any document ready or similar. All you have to do is follow the correct markup and include the file **entityeditor.js** which you will find in the layouts folder.
Another opti... |
46,726 | All
I have created a custom webpart for my list instance. This webpart is inserted within a RenderTemplate for the list. I have several Jquery Libraries loading within the webpart. For the most part it seems that it works but none of the tabs work they actually redirect to entire different page with the same contents.... | 2012/09/28 | [
"https://sharepoint.stackexchange.com/questions/46726",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10978/"
] | OK, finally got. After long hours looking at the ugliest HTML/JS even written and short short periods of insanity, I add an idea that I don't totally like and it isn't the best, but at this point I don't f\*\*\*ing care. I just want to get over this.
So, I simple create a basic .aspx page with the follwing code:
```
... | I have a client side jQuery/SPServices/jQueryUI plugin that can do this for custom UI's. Take a look here:
<http://paultavares.wordpress.com/2012/04/28/sharepoint-ui-widgets-upload-and-pickusers/>
I use it today in a custom UI I created for some projects.
Paul. |
46,726 | All
I have created a custom webpart for my list instance. This webpart is inserted within a RenderTemplate for the list. I have several Jquery Libraries loading within the webpart. For the most part it seems that it works but none of the tabs work they actually redirect to entire different page with the same contents.... | 2012/09/28 | [
"https://sharepoint.stackexchange.com/questions/46726",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10978/"
] | OK, finally got. After long hours looking at the ugliest HTML/JS even written and short short periods of insanity, I add an idea that I don't totally like and it isn't the best, but at this point I don't f\*\*\*ing care. I just want to get over this.
So, I simple create a basic .aspx page with the follwing code:
```
... | Just add this to your ascx page but change the version and other necessary details.
```
<%-- _lcid="1033" _version="12.0.4518" _dal="1" --%>
<%-- _LocalBinding --%><%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=... |
18,773 | How can I only let half of the LEDs light up,
for example, LED 1 on, LED 2 off, LED 3 on...and so on.
I did it this way
(this example fades also all LEDs on and off)
```c
int x = 1;
for (int i = 0; i > -1; i = i + x){
leds[0] = CRGB(i,0,0);
leds[1] = CRGB(0,i,0);
leds[2] = CRGB(i,0,0);
l... | 2015/12/17 | [
"https://arduino.stackexchange.com/questions/18773",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/8162/"
] | I don't know much about neopixel but as a general coding practice if you want to do something for every other object, you use the modulus operator like so
```
if(i % 2 == 0)
{
//i is even
//off
}
else
{
//i is odd
//on
}
```
So just wrap your current for loop in another one and to the above with the iteratin... | ```
int x = 1;
for (int i = 0; i > -1; i = i + x){
// using modulo
if(i % 2 == 0){
leds[i] = CRGB(i,0,0)}else{
leds[i] = CRGB(0,i,0);}
Serial.println(i);
FastLED.show();
if (i >= 55) x = -1; // switch direction at peak
delay(10);
}
```
or
```
int x = 2;... |
18,773 | How can I only let half of the LEDs light up,
for example, LED 1 on, LED 2 off, LED 3 on...and so on.
I did it this way
(this example fades also all LEDs on and off)
```c
int x = 1;
for (int i = 0; i > -1; i = i + x){
leds[0] = CRGB(i,0,0);
leds[1] = CRGB(0,i,0);
leds[2] = CRGB(i,0,0);
l... | 2015/12/17 | [
"https://arduino.stackexchange.com/questions/18773",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/8162/"
] | I don't know much about neopixel but as a general coding practice if you want to do something for every other object, you use the modulus operator like so
```
if(i % 2 == 0)
{
//i is even
//off
}
else
{
//i is odd
//on
}
```
So just wrap your current for loop in another one and to the above with the iteratin... | This is, for the most part, exactly what others have said. However, nobody has managed to actually use a `for` loop properly; they've carried forward your inefficiencies for some unknown reason.
The whole point of a `for` loop is to execute a block of code a predetermined number of times. In your code, you create a lo... |
18,773 | How can I only let half of the LEDs light up,
for example, LED 1 on, LED 2 off, LED 3 on...and so on.
I did it this way
(this example fades also all LEDs on and off)
```c
int x = 1;
for (int i = 0; i > -1; i = i + x){
leds[0] = CRGB(i,0,0);
leds[1] = CRGB(0,i,0);
leds[2] = CRGB(i,0,0);
l... | 2015/12/17 | [
"https://arduino.stackexchange.com/questions/18773",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/8162/"
] | ```
int x = 1;
for (int i = 0; i > -1; i = i + x){
// using modulo
if(i % 2 == 0){
leds[i] = CRGB(i,0,0)}else{
leds[i] = CRGB(0,i,0);}
Serial.println(i);
FastLED.show();
if (i >= 55) x = -1; // switch direction at peak
delay(10);
}
```
or
```
int x = 2;... | This is, for the most part, exactly what others have said. However, nobody has managed to actually use a `for` loop properly; they've carried forward your inefficiencies for some unknown reason.
The whole point of a `for` loop is to execute a block of code a predetermined number of times. In your code, you create a lo... |
47,429,795 | What I'm trying to do is to allow the user to search how many `false` or `true` values are saved in a `bool` Vektor It's also important that the program should handle input errors.
I guess I have to use `Convert.Boolean` but I don't know how. At the moment I'm keep getting the same thing whether I search numbers or l... | 2017/11/22 | [
"https://Stackoverflow.com/questions/47429795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8987189/"
] | To search for a value of a certain data type in an array, you need to convert the user input into that datatype. Then you go ahead and compare the converted value in the same manner as you do it now.
The conversion can be done the following way:
```
Console.Write("Skriv in sökOrd: [TRUE|FALSE]");
string searchWord = ... | **I made your current method working and explained some stuff in the comments:**
```
Random newRandom = new Random();
int slumpTal = newRandom.Next( 1, 101 );
bool[] boolVektor = new bool[ slumpTal ];
for ( int i = 0; i < boolVektor.Length; i++ )
{
int slump = newRandom.Next( 0, 2 );
if ( slump == 0 )
... |
38,494,242 | I have a `UITableView` inside a `UIViewController`. I am trying to make it so when the user click the `BarButtonItem` in the `NavigationBar`, that the tableview goes into editing mode, and thus the user can drag and reorder the cells.
However, what happens is that I simply press the editing button, and nothing happen... | 2016/07/21 | [
"https://Stackoverflow.com/questions/38494242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3543848/"
] | Above setup works fine. My issue was with DNS records - I added an A record directing `dev.domain.com` to the IP address of the server I'm running the node apps on. | Faced same issue and solved it by creating file from root user:
```
drwxr-xr-x 6 gitlab-runner gitlab-runner 4096 Sep 12 06:56 .
drwxr-xr-x 4 root root 4096 Sep 12 06:57 ..
-rw-r--r-- 1 root root 11 Sep 12 06:54 .env
-rw-rw-r-- 1 gitlab-runner gitlab-runner 599 Sep 12... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | >
> ***If that so, then why would the hacker recover the password if he already has access to the database?***
>
>
>
Reasons are many. Here are a few:
1. People reuse their passwords, so not leaking everybodys real passwords does limit the impact of such attack.
2. Without the real passwords, the hacker will stil... | Salt is used so that identical passwords have different hashes, making an attempt at figuring out the passwords harder.
Hashing makes it so that generating the password via brute force methods take a very long time (especially with SHA2) so that it makes it "unfeasible" to find out the password.
A hash will do you no... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | >
> ***If that so, then why would the hacker recover the password if he already has access to the database?***
>
>
>
Reasons are many. Here are a few:
1. People reuse their passwords, so not leaking everybodys real passwords does limit the impact of such attack.
2. Without the real passwords, the hacker will stil... | If you have the cleartext passwords and e-mail addresses from the database, you can wreak havoc! It's not about getting credentials to the site that is already hacked, it's about getting login information to other sites.
Most people don't use one password only for one site, so if you have the password for their prima... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | >
> ***If that so, then why would the hacker recover the password if he already has access to the database?***
>
>
>
Reasons are many. Here are a few:
1. People reuse their passwords, so not leaking everybodys real passwords does limit the impact of such attack.
2. Without the real passwords, the hacker will stil... | To be in possession of the user records from the database does not necessarily mean you have access to the database. Through some leak in the website (hello, SQL injection) you may be able to get access to data you shouldn't have access to without necessarily compromising the whole server. Badly handled backups, shared... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | >
> ***If that so, then why would the hacker recover the password if he already has access to the database?***
>
>
>
Reasons are many. Here are a few:
1. People reuse their passwords, so not leaking everybodys real passwords does limit the impact of such attack.
2. Without the real passwords, the hacker will stil... | Suppose an attacker somehow gains access to a backup of the database, containing unrecoverable hashed passwords. Then they have all the data that was in there yesterday, which is quite bad. But at least they don't have access to the data that will be in there tomorrow, and they can't delete anything from the real site,... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | To be in possession of the user records from the database does not necessarily mean you have access to the database. Through some leak in the website (hello, SQL injection) you may be able to get access to data you shouldn't have access to without necessarily compromising the whole server. Badly handled backups, shared... | Salt is used so that identical passwords have different hashes, making an attempt at figuring out the passwords harder.
Hashing makes it so that generating the password via brute force methods take a very long time (especially with SHA2) so that it makes it "unfeasible" to find out the password.
A hash will do you no... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | Salt is used so that identical passwords have different hashes, making an attempt at figuring out the passwords harder.
Hashing makes it so that generating the password via brute force methods take a very long time (especially with SHA2) so that it makes it "unfeasible" to find out the password.
A hash will do you no... | Suppose an attacker somehow gains access to a backup of the database, containing unrecoverable hashed passwords. Then they have all the data that was in there yesterday, which is quite bad. But at least they don't have access to the data that will be in there tomorrow, and they can't delete anything from the real site,... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | To be in possession of the user records from the database does not necessarily mean you have access to the database. Through some leak in the website (hello, SQL injection) you may be able to get access to data you shouldn't have access to without necessarily compromising the whole server. Badly handled backups, shared... | If you have the cleartext passwords and e-mail addresses from the database, you can wreak havoc! It's not about getting credentials to the site that is already hacked, it's about getting login information to other sites.
Most people don't use one password only for one site, so if you have the password for their prima... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | If you have the cleartext passwords and e-mail addresses from the database, you can wreak havoc! It's not about getting credentials to the site that is already hacked, it's about getting login information to other sites.
Most people don't use one password only for one site, so if you have the password for their prima... | Suppose an attacker somehow gains access to a backup of the database, containing unrecoverable hashed passwords. Then they have all the data that was in there yesterday, which is quite bad. But at least they don't have access to the data that will be in there tomorrow, and they can't delete anything from the real site,... |
7,104,060 | I just learned the concept of hashing ("Hey! don't forget the salt!") and using salt to make the password secured.
Hashing it is a one way encryption (actually not encryption but hashing) so it cannot be reversed engineered. Salting is prefixing or appending randomly created values to the password before hashing 'coz ... | 2011/08/18 | [
"https://Stackoverflow.com/questions/7104060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724689/"
] | To be in possession of the user records from the database does not necessarily mean you have access to the database. Through some leak in the website (hello, SQL injection) you may be able to get access to data you shouldn't have access to without necessarily compromising the whole server. Badly handled backups, shared... | Suppose an attacker somehow gains access to a backup of the database, containing unrecoverable hashed passwords. Then they have all the data that was in there yesterday, which is quite bad. But at least they don't have access to the data that will be in there tomorrow, and they can't delete anything from the real site,... |
87,740 | After exporting `HISTTIMEFORMAT='%F %T'` I tried to query `history`
But the result shows all the commands are executed on same day.
How can I check the actual date and time of actual command execution? | 2013/08/22 | [
"https://unix.stackexchange.com/questions/87740",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/38659/"
] | If you set the `HISTTIMEFORMAT` in bash your **new** entries get stored in the history file with a timestamp, older commands that don't have a timestamp (those before you ever set `HISTTIMEFORMAT` will display one and the same date-time-stamp (I assume the one from the first entry found with a real timestamp).
This pr... | I think this is a feature. As you just changed this setting, you can see from `~/.bash_history` that the old command do not have a time-stamp stored. So for these commands, it will just assume the current time.
Try to put the `export` command in `~/.bashrc` and execute a few command. You will see, that in `~/.bash_his... |
61,475,009 | When sending multiple messages at once on the bot, it does not preserve the order in which they were sent.
For example, If i have to send 2 separate messages:
1. Hi, I am market bot.
2. How can I help you ?
On occasion the order comes out to be:
2. How can I help you ?
1. Hi, I am market bot. | 2020/04/28 | [
"https://Stackoverflow.com/questions/61475009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
List<String> store=[];
String name;
void getData() async {
await for(var snapshot in _firestore.collection('users').snapshots()){
for(var phon in snapshot.documents){
name=(phon.data['Name']);
print(name);
}
}
}
```
What you are doing is storing a `String` `(phon.... | You get this error because in `store=(phon.data['Name']);`you try to set the value of the whole list as a string. Instead you should've set only the value of one of the lists fields as a string. For example `store[0]=(phon.data['Name']);` |
61,475,009 | When sending multiple messages at once on the bot, it does not preserve the order in which they were sent.
For example, If i have to send 2 separate messages:
1. Hi, I am market bot.
2. How can I help you ?
On occasion the order comes out to be:
2. How can I help you ?
1. Hi, I am market bot. | 2020/04/28 | [
"https://Stackoverflow.com/questions/61475009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
List<String> store=[];
String name;
void getData() async {
await for(var snapshot in _firestore.collection('users').snapshots()){
for(var phon in snapshot.documents){
name=(phon.data['Name']);
print(name);
}
}
}
```
What you are doing is storing a `String` `(phon.... | Change `store=(phon.data['Name'])` to `store.add(phon.data['Name'])`
You are trying to assign a single string (I assume that is what phon.data['Name'] is) to a List object. |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | Try this:
```
val = raw_input("Type your number please: ")
for i, x in enumerate(val, 1):
print "#{0} digit is {1}".format(i, x)
``` | It was not clear from your question whether you are looking to use `%` for string substitution, or `%` for remainder.
For completeness, the mathsy way using modulus operator on ints would look like this:
```
>>> val = None
>>> while val is None:
... try:
... val = int(raw_input("Type your number please: "))
..... |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | Try this:
```
val = raw_input("Type your number please: ")
for i, x in enumerate(val, 1):
print "#{0} digit is {1}".format(i, x)
``` | Think about the two digit number as though it were a string. It is easier to grab each digit this way. Using str() will change the integer to a string. Modulos allow you to place these strings into your text.
Assuming the user inputs 27 into the variable called num, the code is:
```
print 'The first digit is %s and t... |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | Try this:
```
val = raw_input("Type your number please: ")
for i, x in enumerate(val, 1):
print "#{0} digit is {1}".format(i, x)
``` | Another way of coding Python:
```
val = raw_input("Type your number please: ")
for i in list(val):
print i
```
Note: `val` is read as string. For integer manipulation, use `list(str(integer-value))` instead |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | Try this:
```
val = raw_input("Type your number please: ")
for i, x in enumerate(val, 1):
print "#{0} digit is {1}".format(i, x)
``` | ```
two_digit_number = input("Type a two digit number: ")
print("The first digit is " + two_digit_number[0] + " The second digit is " +
two_digit_number[1])
```
You don't need modules to solve this question. |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | It was not clear from your question whether you are looking to use `%` for string substitution, or `%` for remainder.
For completeness, the mathsy way using modulus operator on ints would look like this:
```
>>> val = None
>>> while val is None:
... try:
... val = int(raw_input("Type your number please: "))
..... | Think about the two digit number as though it were a string. It is easier to grab each digit this way. Using str() will change the integer to a string. Modulos allow you to place these strings into your text.
Assuming the user inputs 27 into the variable called num, the code is:
```
print 'The first digit is %s and t... |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | It was not clear from your question whether you are looking to use `%` for string substitution, or `%` for remainder.
For completeness, the mathsy way using modulus operator on ints would look like this:
```
>>> val = None
>>> while val is None:
... try:
... val = int(raw_input("Type your number please: "))
..... | Another way of coding Python:
```
val = raw_input("Type your number please: ")
for i in list(val):
print i
```
Note: `val` is read as string. For integer manipulation, use `list(str(integer-value))` instead |
15,563,089 | I am currently using Python to create a program that accepts user input for a two digit number and will output the numbers on a single line.
For Example:
My program will get a number from the user, lets just use 27
I want my program to be able to print "The first digit is 2" and "The second digit is 7"
I know I will ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15563089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197867/"
] | It was not clear from your question whether you are looking to use `%` for string substitution, or `%` for remainder.
For completeness, the mathsy way using modulus operator on ints would look like this:
```
>>> val = None
>>> while val is None:
... try:
... val = int(raw_input("Type your number please: "))
..... | ```
two_digit_number = input("Type a two digit number: ")
print("The first digit is " + two_digit_number[0] + " The second digit is " +
two_digit_number[1])
```
You don't need modules to solve this question. |
9,232,101 | I would like to know the best way of parsing an input where multiple parsers can succeed. I have outlined my first failed attempt and an inelegant solution which I hope can be made more idiomatic.
For instance I would like to lex "the", "quick" and "fox" from the following sentence into their own data constructors:
... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9232101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230813/"
] | This is not a particularly common need, but here's an implementation:
```
import Control.Monad
import "parsec3" Text.Parsec
import Data.Maybe
import Data.List
import Data.Ord
longestParse :: [Parsec String () a] -> Parsec String () a
longestParse parsers = do
allParses <- sequence [lookAhead $ optionMaybe $ try $
... | As I understand it, you want to repeatedly parse up to the first interesting word you see. At the moment, you are parsing up to each interesting word and checking to see which interesting word you found is closer.
My suggestion is to define a parser that checks to see if you currently are at an interesting word (only... |
17,010,943 | For example let's say i installed my application at c:\test
Then from c:\test i run my application test.exe
So i want to get in a string in my program the directory c:\test
And if i run test.exe from d:\hello
So the directory in my program will be d:\hello
The installation is made by InnoSetup but thats just to set th... | 2013/06/09 | [
"https://Stackoverflow.com/questions/17010943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2457066/"
] | ```
Assembly.GetExecutingAssembly().Location //is what you need here
``` | The `Path.GetDirectoryName()` method returns the directory path **without trailing slash**. To build a file path using it, you have to add that yourself.
Best is to let the framework do it for you, sometimes it's not the ordinary backslash:
```
ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
``` |
27,859,177 | I have one edittext and for example I put in12345. I want to check if the first two numbers' sum is >0 then do something. I don't know how to check first two elements' sum.
```
if(pirinfouserid.getText().toString().indexOf(2)>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).... | 2015/01/09 | [
"https://Stackoverflow.com/questions/27859177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4222985/"
] | ```
int num1=Integer.parseInt(pirinfouserid.getText().toString().charAt(0));
int num2=Integer.parseInt(pirinfouserid.getText().toString().charAt(1));
int sum=num1+num2;
if(sum>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(), "w... | ```
String input = pirinifouserid.getText().toString();
int firstNumber = Integer.parseInt(input.substring(0,1));
int secondNumber = Integer.parseInt(input.substring(1,2));
int sum = firstNumber + secondNumber;
if (sum > 0) ...
``` |
27,859,177 | I have one edittext and for example I put in12345. I want to check if the first two numbers' sum is >0 then do something. I don't know how to check first two elements' sum.
```
if(pirinfouserid.getText().toString().indexOf(2)>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).... | 2015/01/09 | [
"https://Stackoverflow.com/questions/27859177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4222985/"
] | First get first two char from String input from user:
```
String firstTwoDigit = s.substring(0,
Math.min(pirinfouserid.getText().toString().length(), 1));
```
Now get sum of two digits using [Find Sum of Digits in Java Algorithm](http://java67.blogspot.in/2014/06/write-program-to-find-sum-of-digit... | ```
String input = pirinifouserid.getText().toString();
int firstNumber = Integer.parseInt(input.substring(0,1));
int secondNumber = Integer.parseInt(input.substring(1,2));
int sum = firstNumber + secondNumber;
if (sum > 0) ...
``` |
27,859,177 | I have one edittext and for example I put in12345. I want to check if the first two numbers' sum is >0 then do something. I don't know how to check first two elements' sum.
```
if(pirinfouserid.getText().toString().indexOf(2)>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).... | 2015/01/09 | [
"https://Stackoverflow.com/questions/27859177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4222985/"
] | ```
int num1=Integer.parseInt(pirinfouserid.getText().toString().charAt(0));
int num2=Integer.parseInt(pirinfouserid.getText().toString().charAt(1));
int sum=num1+num2;
if(sum>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(), "w... | Please find relevant comments inline
```
String input = pirinifouserid.getText().toString();
if(input.length()>2){
try{
int num1= Integer.parseInt(input.indexOf(0)); // Handle NumberFormatException
int num2= Integer.parseInt(input.indexOf(1));// Handle NumberFormatException
int sum = num1 +... |
27,859,177 | I have one edittext and for example I put in12345. I want to check if the first two numbers' sum is >0 then do something. I don't know how to check first two elements' sum.
```
if(pirinfouserid.getText().toString().indexOf(2)>0)
Toast.makeText(getApplicationContext(), "ok",
Toast.LENGTH_SHORT).... | 2015/01/09 | [
"https://Stackoverflow.com/questions/27859177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4222985/"
] | First get first two char from String input from user:
```
String firstTwoDigit = s.substring(0,
Math.min(pirinfouserid.getText().toString().length(), 1));
```
Now get sum of two digits using [Find Sum of Digits in Java Algorithm](http://java67.blogspot.in/2014/06/write-program-to-find-sum-of-digit... | Please find relevant comments inline
```
String input = pirinifouserid.getText().toString();
if(input.length()>2){
try{
int num1= Integer.parseInt(input.indexOf(0)); // Handle NumberFormatException
int num2= Integer.parseInt(input.indexOf(1));// Handle NumberFormatException
int sum = num1 +... |
7,523,424 | I'm using [HTML5 selectors API](http://www.w3.org/TR/selectors-api/) aka `querySelector` all the time. Those selectors are really easy to use and handful. If you're not familiar with this API it's pretty much similar to jQuery selector API they get a CSS selector string and select right elements. For example these sele... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7523424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650722/"
] | You can simply use the original [Sizzle](http://sizzlejs.com/) engine which jQuery uses (written by John Resig, author of jQuery).
Here's Sizzle's own description:
>
> A pure-JavaScript CSS selector engine designed to be easily dropped in to a host library.
>
>
>
---
If you want to be sure that you don't use `S... | It is usually a bad idea to use complex selectors to find elements as it tightly binds the script functionality to the layout and presentation of the document. A simpler strategy should be employed, such as using ids, classes or grouping elements in the document.
If you do that, then analyse your requirements, you may... |
1,304,975 | The function $f$ is defined by $f(x)=x/(x^2+1)$, $x$ is an element of a set of real number.
If $a$ is an element of a set of real number and $a$ is not $0$, find the image of $1/a$ under $f$. (This I know how to solve it, but after that... I don't know)
Deduce that $f$ is not one-to-one.(How can we deduce?By diagram?)... | 2015/05/30 | [
"https://math.stackexchange.com/questions/1304975",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/243868/"
] | **Hint:** If you are asking about
$$
f(x)=\frac{x}{x^2+1}
$$
then consider the relation between $f(1/x)$ and $f(x)$. | If $f$ is not one to one, then if $f(x\_1) = f(x\_2)$, it is possible that $x\_1 \neq x\_2$.
So, we can start by saying,
$$ \dfrac{x\_1}{x\_1^2 + 1} = \dfrac{x\_2}{x\_2^2+1}$$
$$ x\_1 x\_2^2 + x\_1 = x\_2 x\_1^2 + x\_2$$
$$x\_1x\_2^2 - x\_2x\_1^2 = x\_2 - x\_1$$
$$ x\_1x\_2(x\_2 - x\_1) = x\_2 - x\_1$$
$$x\_1x\_2 =... |
1,304,975 | The function $f$ is defined by $f(x)=x/(x^2+1)$, $x$ is an element of a set of real number.
If $a$ is an element of a set of real number and $a$ is not $0$, find the image of $1/a$ under $f$. (This I know how to solve it, but after that... I don't know)
Deduce that $f$ is not one-to-one.(How can we deduce?By diagram?)... | 2015/05/30 | [
"https://math.stackexchange.com/questions/1304975",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/243868/"
] | **Hint:** If you are asking about
$$
f(x)=\frac{x}{x^2+1}
$$
then consider the relation between $f(1/x)$ and $f(x)$. | f(0) = 0; f(x) $\leq$ f(1) for all x; limf(x) = 0 when x tends to $\infty$. Hence for all number y of the open intervale (0, 1/2) there are two distinct numbers $x\_1$ and $x\_2$ with f($x\_1$) = f($x\_2$) = y. Thus f is not one-to-one. |
1,304,975 | The function $f$ is defined by $f(x)=x/(x^2+1)$, $x$ is an element of a set of real number.
If $a$ is an element of a set of real number and $a$ is not $0$, find the image of $1/a$ under $f$. (This I know how to solve it, but after that... I don't know)
Deduce that $f$ is not one-to-one.(How can we deduce?By diagram?)... | 2015/05/30 | [
"https://math.stackexchange.com/questions/1304975",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/243868/"
] | Being injective (also badly termed one-to-one) for a function $f$ means that any equation $f(x)=c$ has *at most one* solution $x$, for any given value of$~c$. (A proper term would therefore be at-most-one-to-one.)
So just write down the equation $\frac x{x^2+1}=c$ for some fixed$~c$ and solve for $x$. The equation is ... | If $f$ is not one to one, then if $f(x\_1) = f(x\_2)$, it is possible that $x\_1 \neq x\_2$.
So, we can start by saying,
$$ \dfrac{x\_1}{x\_1^2 + 1} = \dfrac{x\_2}{x\_2^2+1}$$
$$ x\_1 x\_2^2 + x\_1 = x\_2 x\_1^2 + x\_2$$
$$x\_1x\_2^2 - x\_2x\_1^2 = x\_2 - x\_1$$
$$ x\_1x\_2(x\_2 - x\_1) = x\_2 - x\_1$$
$$x\_1x\_2 =... |
1,304,975 | The function $f$ is defined by $f(x)=x/(x^2+1)$, $x$ is an element of a set of real number.
If $a$ is an element of a set of real number and $a$ is not $0$, find the image of $1/a$ under $f$. (This I know how to solve it, but after that... I don't know)
Deduce that $f$ is not one-to-one.(How can we deduce?By diagram?)... | 2015/05/30 | [
"https://math.stackexchange.com/questions/1304975",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/243868/"
] | Being injective (also badly termed one-to-one) for a function $f$ means that any equation $f(x)=c$ has *at most one* solution $x$, for any given value of$~c$. (A proper term would therefore be at-most-one-to-one.)
So just write down the equation $\frac x{x^2+1}=c$ for some fixed$~c$ and solve for $x$. The equation is ... | f(0) = 0; f(x) $\leq$ f(1) for all x; limf(x) = 0 when x tends to $\infty$. Hence for all number y of the open intervale (0, 1/2) there are two distinct numbers $x\_1$ and $x\_2$ with f($x\_1$) = f($x\_2$) = y. Thus f is not one-to-one. |
44,249,649 | I added Spring Security (4.2.2) to my Spring Boot (1.5.3) project and implemented a token authentication that works fine.
Then I tried to add CORS. When I now call the API the preflight `OPTIONS` request returns 400, but the following `GET` request returns 401. If I disable Spring Security CORS works fine. So, I assu... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44249649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3999583/"
] | I finally could solve it by adding the following line to the security configuration:
```
.requestMatchers(new RegexRequestMatcher("/orchestrator/feedback/\\w{2}/applications/\\d+/?\\?_=\\d+", "GET", true)).permitAll()
```
This ensures that the GET request to e.g. ...applications/1?\_=1496393166113 is per... | Security filter ordering changed in Spring Boot 1.5.3. According to [this](https://stackoverflow.com/a/42836521/5810648) and [this](https://github.com/spring-projects/spring-security-oauth/issues/1016), you may try to change spring security filter order by using
@Order(SecurityProperties.ACCESS\_OVERRIDE\_ORDER) on yo... |
44,249,649 | I added Spring Security (4.2.2) to my Spring Boot (1.5.3) project and implemented a token authentication that works fine.
Then I tried to add CORS. When I now call the API the preflight `OPTIONS` request returns 400, but the following `GET` request returns 401. If I disable Spring Security CORS works fine. So, I assu... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44249649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3999583/"
] | Add `@CrossOrigin` to your controller and it will allow CORS | Security filter ordering changed in Spring Boot 1.5.3. According to [this](https://stackoverflow.com/a/42836521/5810648) and [this](https://github.com/spring-projects/spring-security-oauth/issues/1016), you may try to change spring security filter order by using
@Order(SecurityProperties.ACCESS\_OVERRIDE\_ORDER) on yo... |
67,920,365 | Imagine the usual behavior of a toolbar in Android.
You define a `Toolbar` widget in the `Activity`, and can access it using `onCreateOptionsMenu` and `onOptionsItemSelected` inside your fragments.
However, something like this is not possible with normal Jetpack Compose, as there is no way of accessing the `Toolbar` ... | 2021/06/10 | [
"https://Stackoverflow.com/questions/67920365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5437363/"
] | I used an interface I named `ToolbarController` which contained callback methods that could set the value for the variable(s) used in the the call to scaffold's `TopAppBar`:
```
@Composable
fun MyApp(){
var toolbarTitle by remember{ mutableStateOf("") }
// ToolbarController would be some interface you have d... | You can use the `TopAppBar` at a `Scaffold` level and use your current destination to customize the `topBar`.
Something like:
```
topBar = {
// Use your logic here
val currentDestination = navBackStackEntry?.destination
if (currentDestination == ....) {
CustomAppBar()
} else {
TopAppBar(... |
45,482,958 | I am a newbie to Chef.
We are upgrading JDK on all of our servers including CHEF servers also.
I found JDK version (1.6) installed on the chef servers. But I am not sure if it is being used by the Chef servers. OR, Does Chef servers uses its own java.
Thanks in advance | 2017/08/03 | [
"https://Stackoverflow.com/questions/45482958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8411309/"
] | Yes, Chef Server uses Apache Solr as search index ([reference](https://docs.chef.io/server_components.html)). Solr is a Java software.
Usually, Chef Server is installed using the Omnibus installer, which brings all of its dependencies (and installs them to `/opt/opscode`). The JRE shipped by Chef Server is located und... | To the best of my knowledge, Chef Server does not use Java for any of its core components. The Chef [documentation for server system requirements](https://docs.chef.io/chef_system_requirements.html) does not list Java as a requirement, and running [CLOC](http://cloc.sourceforge.net/) on the Chef source code does not tu... |
70,563,093 | Hello I am new to nodejs and mongodb.
I have 3 models:
1. "user" with fields "name phone"
2. "Shop" with fields "name, address"
3. "Member" with fields "shop user status". (shop and user hold the "id" of respective collections).
Now when I create "shops" api to fetch all shop, then I need to add extra field "isShopJ... | 2022/01/03 | [
"https://Stackoverflow.com/questions/70563093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5850369/"
] | Remove semi-colon at the end of the `hire` procedure in package body:
```
CREATE OR REPLACE PACKAGE BODY hr
AS
PROCEDURE hire (enum IN NUMBER,
ename IN VARCHAR2,
sal IN NUMBER,
erole IN VARCHAR2,
age IN NUMBER); --> her... | ```
create table employee(
employee_id number(10) NOT NULL,
employee_name varchar2(50),
employee_sal number(10),
employee_role varchar2(50),
employee_age number(10),
CONSTRAINT employee_pk PRIMARY KEY(employee_id)
);
insert into employee(employee_id, employee_name, employee_sal, employee_role, employee_age)values(12,'... |
70,563,093 | Hello I am new to nodejs and mongodb.
I have 3 models:
1. "user" with fields "name phone"
2. "Shop" with fields "name, address"
3. "Member" with fields "shop user status". (shop and user hold the "id" of respective collections).
Now when I create "shops" api to fetch all shop, then I need to add extra field "isShopJ... | 2022/01/03 | [
"https://Stackoverflow.com/questions/70563093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5850369/"
] | Remove semi-colon at the end of the `hire` procedure in package body:
```
CREATE OR REPLACE PACKAGE BODY hr
AS
PROCEDURE hire (enum IN NUMBER,
ename IN VARCHAR2,
sal IN NUMBER,
erole IN VARCHAR2,
age IN NUMBER); --> her... | Client tools typically need something to separate two PL/SQL blocks, such as a line containing a slash character between the first `END;` and `CREATE OR REPLACE PACKAGE BODY`, so this
```
end;
create or replace package body hr
```
needs to become
```
end;
/
create or replace package body hr
```
otherwise it all... |
70,563,093 | Hello I am new to nodejs and mongodb.
I have 3 models:
1. "user" with fields "name phone"
2. "Shop" with fields "name, address"
3. "Member" with fields "shop user status". (shop and user hold the "id" of respective collections).
Now when I create "shops" api to fetch all shop, then I need to add extra field "isShopJ... | 2022/01/03 | [
"https://Stackoverflow.com/questions/70563093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5850369/"
] | Client tools typically need something to separate two PL/SQL blocks, such as a line containing a slash character between the first `END;` and `CREATE OR REPLACE PACKAGE BODY`, so this
```
end;
create or replace package body hr
```
needs to become
```
end;
/
create or replace package body hr
```
otherwise it all... | ```
create table employee(
employee_id number(10) NOT NULL,
employee_name varchar2(50),
employee_sal number(10),
employee_role varchar2(50),
employee_age number(10),
CONSTRAINT employee_pk PRIMARY KEY(employee_id)
);
insert into employee(employee_id, employee_name, employee_sal, employee_role, employee_age)values(12,'... |
60,098,930 | I have a list with integers that is coming from flask-sqlalchemy database. Im displaying these integers in a list with (li) tags. I wondering how I could take these integers and multiply them by "I". So the result would for example be: 5\*"I", 6\*"I" and that would display:
IIIII
IIIIII
in the list, instead of the... | 2020/02/06 | [
"https://Stackoverflow.com/questions/60098930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12368375/"
] | I think you may be looking for this built-in String method:
```
"I".repeat(5) // IIIII
"I".repeat(6) // IIIIII
``` | I think you want to change your integer to 'I' marks. You can use some JQuery or JavaScript.
```js
let integers = [1,2,3,4,5,6];
integers.forEach(i=> {
$('#myList').append('<li>'+'I'.repeat(i)+'</li>')
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></scrip... |
60,098,930 | I have a list with integers that is coming from flask-sqlalchemy database. Im displaying these integers in a list with (li) tags. I wondering how I could take these integers and multiply them by "I". So the result would for example be: 5\*"I", 6\*"I" and that would display:
IIIII
IIIIII
in the list, instead of the... | 2020/02/06 | [
"https://Stackoverflow.com/questions/60098930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12368375/"
] | I think you may be looking for this built-in String method:
```
"I".repeat(5) // IIIII
"I".repeat(6) // IIIIII
``` | You can use JavaScript's built in `String.repeat` function along with `Array.map`.
```
var numList = [3,5,2,6,7,4,1,2]; // <-- what you get from database
var strList = list.map((e) => "I".repeat(e)); // <-- this is what you need
console.log(is.join(",")); // prints "III,IIIII,II,IIIIII,IIIIIII,IIII,I,II"
```
**St... |
28,963,806 | ```
var dic: [String: [[Item]]] //dic with string key and value of array in array of my Class Object
```
How can i take the values from this dic and store it in an array as this:
```
var array: [[Item]]//Array of array
```
How can I store the values from dic Into this array I tried using the for(key, value) state... | 2015/03/10 | [
"https://Stackoverflow.com/questions/28963806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870583/"
] | If you want to get all the values in dictionary use `dictionary.values`, it will return you an array of all the values.
```
var array = dic.values
```
If you want to go through each value in the dictionary use the following:
```
for value in dic.values {
// println("Value: \(value)")
array.append(value)
}
`... | For your first line i give you suggestion that you should create your dictionary by
```
var array = ["123","456","789"]
var array1 = NSMutableArray()
array1 .addObject(array)
var dict = ["String":array1]
var array3 :NSArray = dict["String"]!
println("value ::\(array3[0])")
```
Output that you get is::
**"value ::(\... |
549,994 | Has anyone successful passed user data to the AWS CLI ?
I have tried various incantations of the following but it does not work.
Docs say string must be base64 encoded : <http://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html>
The instance logs never indicate the script is executed and chef is insta... | 2013/10/31 | [
"https://serverfault.com/questions/549994",
"https://serverfault.com",
"https://serverfault.com/users/48363/"
] | The documentation is inconsistent between the : aws website, the git repo for the tool and the output of the tool itself.
It seems the most up to date info is in the repo pages : <https://github.com/aws/aws-cli>
The answer is the use something like : --user-data file://chef\_user\_data.sh | Yes we have. The parameter works as defined, BUT the problem is that the ec2 treats userdata as an opaque data type - it passes it along as is, with no concrete representation of what it *really* is - that is left to the consuming app process on the instance. The command line nature of the CLI requires this encoding, b... |
25,472,003 | I'll explain what I want using an example. I'm working with DNA sequences. Let's say I want to remove everything between `GUA` and `CAG`(including `GUA` and `CAG`) in a string. So if the input is : `"AAAAGUAGGGGCAGCAGUUUUUGUAAAAACAG"`
The output should be : `["AAAA","CAGUUUUU"]`. I initially used `re.split(r'GUA\w*CAG... | 2014/08/24 | [
"https://Stackoverflow.com/questions/25472003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In regex, by default `*`, `+` and `?` are [greedy](https://stackoverflow.com/questions/2301285/what-do-lazy-and-greedy-mean-in-the-context-of-regular-expressions).
If you don't want that behavior, use their non-greedy counterparts `*?`, `+?` and `??`:
```
re.split(r'GUA\w*?CAG',a)
```
See <https://docs.python.org/2... | You need to add a quantifier `?` and also it's better to use `.*?` instead `\w*?` because `\w` matches only the word charcters.
```
>>> import re
>>> s = "AAAAGUAGGGGCAGCAGUUUUUGUAAAAACAG"
>>> m = re.split(r'GUA.*?CAG', s)
>>> m
['AAAA', 'CAGUUUUU', '']
>>> [x for x in m if x]
['AAAA', 'CAGUUUUU']
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.