qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
17,649,168 | I used ado.net entity framework to connect database and have an .edmx file in project.. When I tried to reach objects in code side with object initializer I can see the object names but when I tried to enter a value into textarea in throws this error.Title is a table in database and entries is another tables data but b... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17649168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2054556/"
] | Is there any good reason why you just don't use `int`? It's the
default type for integral values in C++, and should be used
unless there is a good reason not to.
Of course, one good reason could be that it might overflow. If
the context is such that you could end up with very large
arrays, you might want to use `ptrdi... | Perhaps the answer is to use `ptrdiff_t`? It...
* can be negative;
* alludes to the difference not being in bytes, but in units of arbitrary size depending on the element type.
What do you think? |
11,317,375 | I recently switched to dreamweaver version CS6 from CS4. In CS4 there was a handy feature that would show tabs of the includes files. CSS PHP Javascript etc. It would show these tabs right above the "code, split, design, live". Does CS6 not have this feature or do I simply have to enable it?
If so, where and how?
Oh ... | 2012/07/03 | [
"https://Stackoverflow.com/questions/11317375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048566/"
] | Nvm. I finally found what I had to change. In the general settings, enable relative files: on. | It's not only there but it works better than it did before because it can scan deeper for PHP files (I think CS5.5 improved it for use with things like Wordpress). When you open a file with includes they should be there next to the file name. Although it's better, it's still not perfect so if you have dynamically creat... |
71,701,021 | How to route to another url with a parameter from laravel's `app/console/commands/myCommand.php's` handler() method?
I want to route to another url/page/route with a parameter from handle() method of custom made command file which(route) later will call a controller and that parameter passed by handle() via route() wi... | 2022/04/01 | [
"https://Stackoverflow.com/questions/71701021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9833623/"
] | There are several options. For instance
```
>file_name
```
ensures that you have afterwards an **empty** file named `file_name`. If you write instead
```
touch file_name
```
then `file_name` will only be generated if it did not exist before. If it existed, it gets its time stamp updated.
You can also do a
```
[... | You could use:
```
echo "file content" > file.txt
```
Or, if you want to see the content while writing the file:
```
echo "file content" | tee file.txt
``` |
58,766,475 | I have 3 classes which are given below:
**Company.kt class:**
```
data class Company(var comCode:String= "",var comName:String=""):Cloneable{
fun copy() : Company {
//uses the fields name and property defined in the constructor
return Company(comCode,comName)
}
override fun clone(){
super.clone()
}
}
```
*... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58766475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4193723/"
] | I assume the outcommented part of the code is where you try making a deep copy and it ended up changing the `emp` object as well, otherwise your question makes no sense, as the code clearly changes `emp` object. In case I assumed right, try changing your `copy()` function to:
```
data class Company(var comCode: String... | Generic clone function:
```
fun <T : Any> clone (obj: T): T {
if (!obj::class.isData) {
println(obj)
throw Error("clone is only supported for data classes")
}
val copy = obj::class.memberFunctions.first { it.name == "copy" }
val instanceParam = copy.instanceParameter!!
return copy.callBy(mapOf(
... |
22,172,175 | I would like to enumerate the strings that are in the **string intern pool**.
That is to say, I want to get the list of all the instances `s` of `string` such that:
```
string.IsInterned(s) != null
```
Does anyone know if it's possible? | 2014/03/04 | [
"https://Stackoverflow.com/questions/22172175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164966/"
] | *Thanks to the advice of @HansPassant, I managed to get the list of string literals in an assembly. Which is extremely close to what I originally wanted.*
You need to use read assembly meta-data, and enumerate user-strings. This can be done with these three methods of `IMetaDataImport`:
```
[ComImport, Guid("7DAC8207... | The SSCLI function that its pointing to is
```
STRINGREF*AppDomainStringLiteralMap::GetStringLiteral(EEStringData *pStringData)
{
...
DWORD dwHash = m_StringToEntryHashTable->GetHash(pStringData);
if (m_StringToEntryHashTable->GetValue(pStringData, &Data, dwHash))
{
STRINGREF *pStrObj = NULL... |
24,570,658 | If I wanted to cast a float or double to an integer type, and I didnt want it to overflow under any circumstances, how should I go about choosing an integer type? | 2014/07/04 | [
"https://Stackoverflow.com/questions/24570658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2489299/"
] | The range for `floats` is almost always larger than the `long long` or `int64` (but it can depend on the implementation).
For example, in .Net the range of `float` is `3.4E +/- 38` , but the range for `long long` and `int64` is –`9,223,372,036,854,775,808` to `9,223,372,036,854,775,807`. You just can't be sure that y... | There is a simple way to cast int to float and back. It is possible because of most modern computers share 32bit storage. What this allows is using a union. for example:
```
union
{
float x;
int i;
} u;
```
Here you are free to assign a float `u.x=391` and then make use of the integer rep... |
19,314 | I have been looking for a book about Indian history. Recently I came across [this answer](https://history.stackexchange.com/a/1334/3866), which suggested reading [India: A History by John Keay](http://rads.stackoverflow.com/amzn/click/0802145582). I wanted to know whether it is historical and accurate. Or is there any ... | 2015/02/10 | [
"https://history.stackexchange.com/questions/19314",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/3866/"
] | I decided to read the book anyway, after waiting for someone to answer the question. I understand this is not a place to review books, but here are my two cents.
The narrative is, in my opinion, as unbiased as it can get. While talking about unclear parts of Indian history like Aryan invasion / migration / indigenous ... | This is a partial answer relating to the book's unbiased status.
No. The book is not unbiased. The book's biases may be historiographically justifiable, but, necessarily, the book is not unbiased. Bias is as unremovable from texts as it is from woven fabric: the fabric of texts produces a bias.
Sources: historiograph... |
19,314 | I have been looking for a book about Indian history. Recently I came across [this answer](https://history.stackexchange.com/a/1334/3866), which suggested reading [India: A History by John Keay](http://rads.stackoverflow.com/amzn/click/0802145582). I wanted to know whether it is historical and accurate. Or is there any ... | 2015/02/10 | [
"https://history.stackexchange.com/questions/19314",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/3866/"
] | I decided to read the book anyway, after waiting for someone to answer the question. I understand this is not a place to review books, but here are my two cents.
The narrative is, in my opinion, as unbiased as it can get. While talking about unclear parts of Indian history like Aryan invasion / migration / indigenous ... | Your question is the rare one that no one even bothers to ask. From the beginning of the creation of Indian history, bias has played an important role. The funny thing is, the history of India being taught in schools are created by the western people of British East India Company. The purpose of creating biased Indian ... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Note:
-----
Please see the end of the post for more information. Since I still believe that it is not a bug, I did not change the main part of the post.
---
**It is not a bug!**
Unless you explicitly state otherwise, `Sum` evaluates generically, ignoring specific conditions. In your case, the result for generic $n$... | Modify the input under consideration:
```
Limit[s[2, n], n -> 10.]
```
[](https://i.stack.imgur.com/aB7d1.png)
Making the value of n in the limit Reals give a slightly different and much more instructive output.
Mathematica assigns internally a jump at the Integ... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Note:
-----
Please see the end of the post for more information. Since I still believe that it is not a bug, I did not change the main part of the post.
---
**It is not a bug!**
Unless you explicitly state otherwise, `Sum` evaluates generically, ignoring specific conditions. In your case, the result for generic $n$... | Abstract
--------
In addition to other answers I'd like to give a more analytically centered approach. I'll show that for $\operatorname{Re}(x')>0.$ it holds that $-(\psi^{(1)}(x'+n)-\psi^{(1)}(x'))=\sum\_{i=1}^{n}\frac{1}{(i-1+x')^2}$. With that we can show why mathematica is "generically right" but wrong in the spec... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Note:
-----
Please see the end of the post for more information. Since I still believe that it is not a bug, I did not change the main part of the post.
---
**It is not a bug!**
Unless you explicitly state otherwise, `Sum` evaluates generically, ignoring specific conditions. In your case, the result for generic $n$... | Abstract
--------
In this answer I'm going to use a numerical approach to answer the question and convince graphically that the sum and the difference of the polygamma functions agree in all of $\mathbb{C}$.
Intro
-----
As stated in my other answer I assume that $-(\psi^{(1)}(z+n)-\psi^{(1)}(z))=\sum\_{i=1}^{n}\frac... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Note:
-----
Please see the end of the post for more information. Since I still believe that it is not a bug, I did not change the main part of the post.
---
**It is not a bug!**
Unless you explicitly state otherwise, `Sum` evaluates generically, ignoring specific conditions. In your case, the result for generic $n$... | This self answer consists of three parts. In the first past we provide closed expression for the sum for all vaues of the parameter $x \gt 0$, the second part shows a close relation between the correct result and the wrong one returned by Mathematica, finally, I briefly discuss a well appreciated but wrong answer.
EDI... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Abstract
--------
In addition to other answers I'd like to give a more analytically centered approach. I'll show that for $\operatorname{Re}(x')>0.$ it holds that $-(\psi^{(1)}(x'+n)-\psi^{(1)}(x'))=\sum\_{i=1}^{n}\frac{1}{(i-1+x')^2}$. With that we can show why mathematica is "generically right" but wrong in the spec... | Modify the input under consideration:
```
Limit[s[2, n], n -> 10.]
```
[](https://i.stack.imgur.com/aB7d1.png)
Making the value of n in the limit Reals give a slightly different and much more instructive output.
Mathematica assigns internally a jump at the Integ... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Abstract
--------
In addition to other answers I'd like to give a more analytically centered approach. I'll show that for $\operatorname{Re}(x')>0.$ it holds that $-(\psi^{(1)}(x'+n)-\psi^{(1)}(x'))=\sum\_{i=1}^{n}\frac{1}{(i-1+x')^2}$. With that we can show why mathematica is "generically right" but wrong in the spec... | Abstract
--------
In this answer I'm going to use a numerical approach to answer the question and convince graphically that the sum and the difference of the polygamma functions agree in all of $\mathbb{C}$.
Intro
-----
As stated in my other answer I assume that $-(\psi^{(1)}(z+n)-\psi^{(1)}(z))=\sum\_{i=1}^{n}\frac... |
221,373 | Revisiting the problem [Limit of partial sums involving inverse squares](https://mathematica.stackexchange.com/questions/95126/limit-of-partial-sums-involving-inverse-squares) I found another difficulty with `Sum[]`
Consider this sum
```
s[x_, n_] := Sum[ 1/(i + (n - i) x)^2, {i, 1, n}]
```
Here we assume `x > 0`,... | 2020/05/07 | [
"https://mathematica.stackexchange.com/questions/221373",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16361/"
] | Abstract
--------
In addition to other answers I'd like to give a more analytically centered approach. I'll show that for $\operatorname{Re}(x')>0.$ it holds that $-(\psi^{(1)}(x'+n)-\psi^{(1)}(x'))=\sum\_{i=1}^{n}\frac{1}{(i-1+x')^2}$. With that we can show why mathematica is "generically right" but wrong in the spec... | This self answer consists of three parts. In the first past we provide closed expression for the sum for all vaues of the parameter $x \gt 0$, the second part shows a close relation between the correct result and the wrong one returned by Mathematica, finally, I briefly discuss a well appreciated but wrong answer.
EDI... |
30,286,867 | I am writing a piece of code that compiles fine but is kind of sloppy and can be optimized. Is there a better or easier way to do this. Also am I using the compareTo() method in the correct way? I am trying to use different ways to make the code cleaner and faster than the example below.
```
import java.util.ArrayLis... | 2015/05/17 | [
"https://Stackoverflow.com/questions/30286867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2984968/"
] | >
>
> >
> > Is there a better or easier way to do this. Also am I using the compareTo() method in the correct way?
> >
> >
> >
>
>
>
Yes couple of issues:
* Comparing string should use equals method and not `==` like `firstName == ((Name) other).firstName`
* From the looks of it you are trying to sort names ... | If you want efficiency I suggest you use the built in sort which `O(N * log N)`
```
// in Java 7
Arrays.sort(names, new Comparator<Name, Name>()) {
public int compare(Name n1, Name n2) {
int cmp = n1.firstName.compareTo(n2.firstName);
if (cmp == 0)
cmp = n1.lastName.compareTo(n2.las... |
9,623,148 | Okkkk...I don't know much about the PHP mail function so don't blast me for this. The problem is this...I'm hosting my own site using the freedns.afraid.org nameservers and when you go to my domain it redirects to my no-ip domain. I am hosting use xampp. I have my domain registered under godaddy and also my email. Here... | 2012/03/08 | [
"https://Stackoverflow.com/questions/9623148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The error that you provided shows that you are attempting to use “relay-hosting.secureserver.net” as the relay server in your application. That address is a gateway for email leaving Go Daddy webhosting servers. It will not be available from a Go Daddy Dedicated server or from a personal server not located within a Go ... | You should comment out the `sendmail_path`... this is from the help <http://uk.php.net/manual/en/mail.configuration.php#ini.sendmail-path>
>
> This directive works also under Windows. If set, smtp, smtp\_port and
> sendmail\_from are ignored and the specified command is executed.
>
>
>
Also check the `debug.log`... |
27,472 | I have a long running SQL statement that I want to run, and no matter what I put in the "timeout=" clause of my connection string, it always seems to end after 30 seconds.
I'm just using `SqlHelper.ExecuteNonQuery()` to execute it, and letting it take care of opening connections, etc.
Is there something else that co... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/489/"
] | What are you using to set the timeout in your connection string? From memory that's "ConnectionTimeout" and only affects the time it takes to actually *connect* to the server.
Each individual command has a separate "CommandTimeout" which would be what you're looking for. Not sure how SqlHelper implements that though. | ~~In addition to timeout in connection string,~~ try using the timeout property of the SQL command. Below is a C# sample, using the SqlCommand class. Its equivalent should be applicable to what you are using.
```
SqlCommand command = new SqlCommand(sqlQuery, _Database.Connection);
command.CommandTimeout = 0;
int rows ... |
92,689 | So I used the old `useradd` command to create a new user on Raspbian Stretch. I copied the .config directory and other dotfiles from the 'pi' user, and started using the new account. However I can't get some software to work. For instance ALSA shows 'no sound card' for my newly created user whereas it works fine with o... | 2019/01/05 | [
"https://raspberrypi.stackexchange.com/questions/92689",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/46544/"
] | On Debian groups are very important to have access to programs. So as user **pi** I look what groups he is in by default:
```
pi@raspberrypi:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
```
You don't show what options you have used with `useradd` to create the new LO... | As you have discovered useradd is not the easiest. It would probably be easier to delete the new user and start again.
Either way you need to set groups for the new user. The following will copy groups from user **pi**
```
sudo adduser username
#copy groups from user pi:-
for GROUP in $(groups pi | sed 's/.*:\spi... |
225,368 | Creating Scratch layer gives me a choice between Polygon and Multipolygon, so I started wondering how should I make use of them.
[](https://i.stack.imgur.com/D4ra0.png)
Reading a new book *"Mastering QGIS"* (through [this answer](https://gis.stackexchange.... | 2017/01/22 | [
"https://gis.stackexchange.com/questions/225368",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/84455/"
] | From a more formal point of view, I report the definition for both a polygon and a multipolygon (the following text and images come from [this](http://portal.opengeospatial.org/files/?artifact_id=25355) document of the [OGC® Standards](http://www.opengeospatial.org/docs/is), all credits to the cited source).
---
Poly... | Shapefile polygons are constructed from one or more closed rings. If a shape has multiple rings, they can be exterior and interior (e.g., form a doughnut), or multiple exterior (e.g., island chain).
[](https://i.stack.imgur.com/8Hk1g.jpg)
Of course, h... |
51,368,762 | I'm trying to write an xpath such that only nodes with text with numbers alone will be returned.
I wanted to use regex and was hoping this would work
```
td[matches(text(),'[\d.]')]
```
Can anyone please help me understand what am I doing wrong here
```
<tr>
<td>1</td>
<td>10</td>
<td>a</td>... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51368762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7753300/"
] | seams that you are missing quantification, `[\d.]` will match only 1 character, so 1 should be selected, 10 on the other site requires something like `+`, so try your regex like:
`td[matches(text(),'\d+')]`
Also that `.` in regex will make it capture non-digit characters, do not add that one.
You can test all your re... | Replace:
```
td[matches(text(),'[\d+]')]
```
with:
```
td[matches(text(),'\d+')]
```
***Note:*** regex works only in `xPath 2.0` |
51,368,762 | I'm trying to write an xpath such that only nodes with text with numbers alone will be returned.
I wanted to use regex and was hoping this would work
```
td[matches(text(),'[\d.]')]
```
Can anyone please help me understand what am I doing wrong here
```
<tr>
<td>1</td>
<td>10</td>
<td>a</td>... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51368762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7753300/"
] | AFAIK so far Selenium support XPath 1.0 only, so `matches()` is not supported.
You can try below instead:
```
//td[number(.) >= 0 or number(.) < 0]
```
To match table cells with integers | Replace:
```
td[matches(text(),'[\d+]')]
```
with:
```
td[matches(text(),'\d+')]
```
***Note:*** regex works only in `xPath 2.0` |
4,245,676 | <http://www.flickr.com/photos/fraserspeirs/4329430635/in/set-72157623224262135/>
The above is a link basically showing the form fill view of the numbers app on the iPad. Any idea as to how to achieve such a functionality which sort of looks like our vanilla tabs on Chrome? | 2010/11/22 | [
"https://Stackoverflow.com/questions/4245676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509255/"
] | You most likely have the same issue as me... The returning data is in JSONP format instead of pure JSON. In other words you will be dealing with something like
```
functionCall({"Name": "Foo", "Id" : 1234, "Rank": 7});
```
instead of just
```
{"Name": "Foo", "Id" : 1234, "Rank": 7}
```
More info [here](http://en.... | actually am not creating the json object by using api am retrieving it..
now i found the reason for that error. am not giving valid json object to covert into nsdictionary...So for getting valid json object we have to produce valid url to retrieve json object.
thanks for your suggestion... |
344,168 | I have a page that allows users to enter a lot of information about them (metadata) they can then click on a icon which opens a modal window containing a googlemap which allows them to add locations, and a title for that location.
Using mootools I can pass the value of a form field back to the original form, using onc... | 2008/12/05 | [
"https://Stackoverflow.com/questions/344168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28241/"
] | I would suggest that you use an object to maintain all of the location data while the user is making their selections. When, when the form is submitted, serialize that data into a hidden field as a JSON object.
So, when the user clicks in the map window, you record the info in the object, in addition to the table. The... | are you looking for something like this?
```
usersLocations.locations[0]["name"] = document.getElementById("location0name").value;
``` |
40,966,821 | LARAVEL 5.0 | APACHE 2.4.7 | PHP 5.5.8
--------------------------------------
I know this is a pretty popular question. A lot of people saying to move public contents to root directory (which i find awkward because of security issues), rewriting the .htaccess, creating virtual host.
I tried creating virtual host beca... | 2016/12/05 | [
"https://Stackoverflow.com/questions/40966821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3549132/"
] | I'm not sure what you mean that lists are not supported, as it seems that [they are supported.](https://firebase.google.com/docs/database/android/read-and-write)
>
> Basic write operations
>
>
> For basic write operations, you can use setValue() to save data to a
> specified reference, replacing any existing data a... | Firebase supports key value mapping. So lists are not supported. Change it to Map type, keep email addresses as key and assign a boolean value true or false. |
2,975,446 | Can someone check whether my solutions for $E(X)$ is okay?
[](https://i.stack.imgur.com/NUhRn.png)
For (a), I found $E(X) = \frac{\theta +1}{\theta}$ and for (b), I applied integration by parts twice to get $2\theta ^{4}$. I feel as though (b) is wro... | 2018/10/28 | [
"https://math.stackexchange.com/questions/2975446",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Your computation can be substantially simplified by writing instead $$\operatorname{E}[X] = \int\_{x=0}^\infty x f(x;\theta) \, dx = \int\_{x=0}^\infty (\theta x)^2 e^{-\theta x} \, dx,$$ then choosing $$t = \theta x, \quad dt = \theta \, dx $$ yields $$\operatorname{E}[X] = \frac{1}{\theta} \int\_{t=0}^\infty t^2 e^{-... | The integral in B can be interpreted as the Laplace transform of the function $f(x) = x^2$, just with $\theta$ as the transform variable instead of the usual $s$ seen in many differential equations texts. Nonetheless, a table lookup gives the Laplace transform of $x^2%$as $\frac{2}{\theta^3}$. Multiplying this by the $... |
3,999,910 | I wanna make a function that erases everything inside of a multiple select using jQuery.
Also if it could remove some text from text fields it'd be good too. | 2010/10/22 | [
"https://Stackoverflow.com/questions/3999910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373515/"
] | Try the following to clear **all** multiple `select` elements:
```
$('select[multiple]').empty();
```
Replace `select` with a specific element if you do not want to clear all of them. The same applies to the following chunk of code. It can be used to clear all text fields:
```
$(':text').val('');
``` | Use .empty() to remove child elements from another element.
**Example:** `$("#selectid1,#selectid2").empty()`
Without your HTML, it's hard to go into any more detail. |
3,999,910 | I wanna make a function that erases everything inside of a multiple select using jQuery.
Also if it could remove some text from text fields it'd be good too. | 2010/10/22 | [
"https://Stackoverflow.com/questions/3999910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373515/"
] | Try the following to clear **all** multiple `select` elements:
```
$('select[multiple]').empty();
```
Replace `select` with a specific element if you do not want to clear all of them. The same applies to the following chunk of code. It can be used to clear all text fields:
```
$(':text').val('');
``` | In case you just want to deselect everything and not remove from the DOM, try
```
$("select").val([]);
```
or something with a more specific selector. |
3,999,910 | I wanna make a function that erases everything inside of a multiple select using jQuery.
Also if it could remove some text from text fields it'd be good too. | 2010/10/22 | [
"https://Stackoverflow.com/questions/3999910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373515/"
] | Try the following to clear **all** multiple `select` elements:
```
$('select[multiple]').empty();
```
Replace `select` with a specific element if you do not want to clear all of them. The same applies to the following chunk of code. It can be used to clear all text fields:
```
$(':text').val('');
``` | Try This Removing Options for Multiple Select Drop Down.
$('#FeatureId').multiselect("deselectAll", false).multiselect("refresh"); |
46,699 | I have a distant memory of once reading a JG Ballard short story in which a character utters a phrase similar to:
>
> "Listen, you can hear the quasars calling!"
>
>
>
or possibly
>
> "Listen, can you hear the quasars calling?"
>
>
>
or something along those lines. Maybe it was actually "cosmos calling" or ... | 2013/12/22 | [
"https://scifi.stackexchange.com/questions/46699",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/789/"
] | In the mini-story cycle [ZODIAC 2000](http://books.google.com/books?id=D2cmHHAMrlEC&pg=PT1014&dq=ballard%20%22sign%20of%20the%20radar%20bowl%22%20quasars&hl=en&sa=X&ei=XRe3Ut_0KKfuyQGAuoCYAQ&ved=0CEYQ6AEwAA#v=onepage&q=ballard%20%22sign%20of%20the%20radar%20bowl%22%20quasars&f=false), *The Sign of the Radar Bowl* had a... | "The University of Death", which is part of "The Atrocity Exhibition" and not in the Complete Short Stories, has the line "All night he watched the sky, listening to the
time-music of the quasars."
"Zodiac 2000", which *is* in the Complete Short Stories, has the line "But at least he could look up at the sky and liste... |
46,699 | I have a distant memory of once reading a JG Ballard short story in which a character utters a phrase similar to:
>
> "Listen, you can hear the quasars calling!"
>
>
>
or possibly
>
> "Listen, can you hear the quasars calling?"
>
>
>
or something along those lines. Maybe it was actually "cosmos calling" or ... | 2013/12/22 | [
"https://scifi.stackexchange.com/questions/46699",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/789/"
] | In the mini-story cycle [ZODIAC 2000](http://books.google.com/books?id=D2cmHHAMrlEC&pg=PT1014&dq=ballard%20%22sign%20of%20the%20radar%20bowl%22%20quasars&hl=en&sa=X&ei=XRe3Ut_0KKfuyQGAuoCYAQ&ved=0CEYQ6AEwAA#v=onepage&q=ballard%20%22sign%20of%20the%20radar%20bowl%22%20quasars&f=false), *The Sign of the Radar Bowl* had a... | "Meat Trademark"'s [answer](https://scifi.stackexchange.com/a/46704/789) pointed the way thanks (and I've accepted that; this is just to elaborate): I'm absolutely sure I'm remembering (badly, almost 3 decades on from when I read it I suspect) this section from Zodiac 2000's "The Sign of the Radar Bowl":
>
> As they ... |
1,241 | Specifically in regard to online games, what is lag compensation? Should it affect the way I play? | 2010/07/09 | [
"https://gaming.stackexchange.com/questions/1241",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/11/"
] | Valve published an [excellent article explaining the multiplayer network details](https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking "Source Multiplayer Networking - Valve Developer Community") (also called "netcode") of their multiplayer games. From this article:
>
> Lag compensation
> ----------... | Lag compensation is a feature of modern games that allows the engine to estimate where players would be, based on their ping.
For example, if a user is running forward at `10 feet per second`, and their ping is `1000ms`, you will see them continue to run `forward` for that `whole second` or until you receive another u... |
61,715,458 | I am a beginner in Python, so I would very appreciate it if you can help me with clear and easy explanations.
In my Python script, I have a function that makes several threads to do an I/O bound task (What it really does is making several Azure requests concurrently using Azure Python SDK), and I also have a list of t... | 2020/05/10 | [
"https://Stackoverflow.com/questions/61715458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12055194/"
] | The main problem I destilate from your question is having a large amount of processes running simultaniously.
You can prevent that by maintaining a list of processes with a maximum length. Something like this.
```
import multiprocessing as mp
from time import sleep
from random import randint
def function(num_threads... | You would also use a timer to do the job like in the following code.
I voluntarily put 15 second to thread 2 in order that one could see it’s effectively ended in last position once time elapsed.
This code sample has two main functions.
The first one your\_process\_here() like it’s name says is waiting for your own co... |
69,870,531 | Hi I am trying to automate <https://www.nextgenerationautomation.com> and unable to click on login / SignUp button using Selenium 4
Steps:
1. Navigate to URL: <https://www.nextgenerationautomation.com>
2. Click on LogIn/SignUp button.
Issue: when I am using `Thread.Sleep`, code is working fine but when I am using ex... | 2021/11/07 | [
"https://Stackoverflow.com/questions/69870531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14151072/"
] | Hi I got the point whats happening here :
1. Manually navigate to URL: [https://www.nextgenerationautomation.com](https://Navigate%20to%20URL:%20https://www.nextgenerationautomation.com) (Selenium also loading this URL)
2. Manually Immediately keep clicking on "LogIn/SignUp button" (Selenium also able to click therefo... | To `click()` on the element with text as *`Log In / SignUp`* you can use either of the following [Locator Strategies](https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver/48376890#48376890):
* `xpath`:
```
driver.findElement(By.xpath("//div[starts-with(@id, 'defaultAvatar')]//fol... |
69,870,531 | Hi I am trying to automate <https://www.nextgenerationautomation.com> and unable to click on login / SignUp button using Selenium 4
Steps:
1. Navigate to URL: <https://www.nextgenerationautomation.com>
2. Click on LogIn/SignUp button.
Issue: when I am using `Thread.Sleep`, code is working fine but when I am using ex... | 2021/11/07 | [
"https://Stackoverflow.com/questions/69870531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14151072/"
] | Hi I got the point whats happening here :
1. Manually navigate to URL: [https://www.nextgenerationautomation.com](https://Navigate%20to%20URL:%20https://www.nextgenerationautomation.com) (Selenium also loading this URL)
2. Manually Immediately keep clicking on "LogIn/SignUp button" (Selenium also able to click therefo... | Actually your code is clicking the login button before the page is loaded properly. please add visibility condition.
```
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
``` |
60,478,513 | This is the error I am facing:
```
djacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
```
I am trying to implement only the admin can see menu 2 and menu 3 so write the code this way:
```
<a>menu 1</a>
{(this.props.person.ADMIN) ?
<a>Menu... | 2020/03/01 | [
"https://Stackoverflow.com/questions/60478513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Use fragment to wrap the two component. You are returning two elements simultaneously which causes that error.
```
<a>menu 1</a>
{(this.props.person.ADMIN)
? <>
<a>Menu 2</a>
<a>Menu 3</a>
</>
:
''
}
```
You can also return an array instead of wrapping the component in one tag.
... | The error message is pretty clear. The solution is just using a `React.Fragment` like so:
```
<a>menu 1</a>
{(this.props.person.ADMIN) ?
<>
<a>Menu 2</a>
<a>Menu 3 </>
</>
:
''
}
``` |
60,478,513 | This is the error I am facing:
```
djacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
```
I am trying to implement only the admin can see menu 2 and menu 3 so write the code this way:
```
<a>menu 1</a>
{(this.props.person.ADMIN) ?
<a>Menu... | 2020/03/01 | [
"https://Stackoverflow.com/questions/60478513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Use fragment to wrap the two component. You are returning two elements simultaneously which causes that error.
```
<a>menu 1</a>
{(this.props.person.ADMIN)
? <>
<a>Menu 2</a>
<a>Menu 3</a>
</>
:
''
}
```
You can also return an array instead of wrapping the component in one tag.
... | I had this eror message and I found [this issue](https://www.giters.com/mdx-js/mdx/issues/767) mentioning compiler issues with empty lines, and yeah... it was an empty line separating my jsx component into two, so I just had to remove the empty line and add a big TROUBLESHOOTING.md file in the repo so everyone knows th... |
60,478,513 | This is the error I am facing:
```
djacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
```
I am trying to implement only the admin can see menu 2 and menu 3 so write the code this way:
```
<a>menu 1</a>
{(this.props.person.ADMIN) ?
<a>Menu... | 2020/03/01 | [
"https://Stackoverflow.com/questions/60478513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The error message is pretty clear. The solution is just using a `React.Fragment` like so:
```
<a>menu 1</a>
{(this.props.person.ADMIN) ?
<>
<a>Menu 2</a>
<a>Menu 3 </>
</>
:
''
}
``` | I had this eror message and I found [this issue](https://www.giters.com/mdx-js/mdx/issues/767) mentioning compiler issues with empty lines, and yeah... it was an empty line separating my jsx component into two, so I just had to remove the empty line and add a big TROUBLESHOOTING.md file in the repo so everyone knows th... |
5,080,832 | Just a general architecture question.
I know that for web sites, one can use the features built in to IIS to encrypt the connection string section. However, what I am not certain of is this... If I do this and then copy the web.config to another project, will the new project still be able to decrypt the connection str... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5080832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124047/"
] | A quick Google search will show you other people's attempts at encrypting some or all of an application configuration file (i.e. Google "ecnrypting application configuration files").
But more often than not, I find that the better answer is properly securing the resource that you are concerned about (usually a databas... | From my understanding the protection of encrypted connection strings as for example presented in the article [Importing and Exporting Protected Configuration RSA Key Containers](http://msdn.microsoft.com/en-us/library/yxw286t2%28VS.80%29.aspx) protected the connection string on a user-level.
This means that only the ... |
5,080,832 | Just a general architecture question.
I know that for web sites, one can use the features built in to IIS to encrypt the connection string section. However, what I am not certain of is this... If I do this and then copy the web.config to another project, will the new project still be able to decrypt the connection str... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5080832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124047/"
] | A quick Google search will show you other people's attempts at encrypting some or all of an application configuration file (i.e. Google "ecnrypting application configuration files").
But more often than not, I find that the better answer is properly securing the resource that you are concerned about (usually a databas... | I would use the SQL DB account management features, with specific permissions only (e.g. at it's most abstract - allow the execution of read only SQL commands) and only from allowed hosts and/or realms. |
5,080,832 | Just a general architecture question.
I know that for web sites, one can use the features built in to IIS to encrypt the connection string section. However, what I am not certain of is this... If I do this and then copy the web.config to another project, will the new project still be able to decrypt the connection str... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5080832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/124047/"
] | From my understanding the protection of encrypted connection strings as for example presented in the article [Importing and Exporting Protected Configuration RSA Key Containers](http://msdn.microsoft.com/en-us/library/yxw286t2%28VS.80%29.aspx) protected the connection string on a user-level.
This means that only the ... | I would use the SQL DB account management features, with specific permissions only (e.g. at it's most abstract - allow the execution of read only SQL commands) and only from allowed hosts and/or realms. |
62,693,916 | * I am new to react and bootstrap. I am using react card bootstrap to generate a card layout and add buttons to it. I am able to change the height and width of the cards and apply padding also.
* I am not getting any reference where should I change the number of cards displayed in a row.
* `CardUI.jsx`
```
import Reac... | 2020/07/02 | [
"https://Stackoverflow.com/questions/62693916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13606342/"
] | At your `<head>` tag at your html file you can use
```
<link rel="shortcut icon" href="favicon.ico" />
``` | To have a `favicon.ico` that will be used as a *default* favicon by browsers, it needs to be present without the hash that parcel.js generates. For that, you would have to *not* include it anywhere as parcel will then generate the file with a hash, i.e. `favicon.f76ab27.ico`.
Try [parcel-plugin-static-files-copy](http... |
62,693,916 | * I am new to react and bootstrap. I am using react card bootstrap to generate a card layout and add buttons to it. I am able to change the height and width of the cards and apply padding also.
* I am not getting any reference where should I change the number of cards displayed in a row.
* `CardUI.jsx`
```
import Reac... | 2020/07/02 | [
"https://Stackoverflow.com/questions/62693916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13606342/"
] | At your `<head>` tag at your html file you can use
```
<link rel="shortcut icon" href="favicon.ico" />
``` | You may want to add the [parcel-plugin-robot plugin](https://www.npmjs.com/package/parcel-plugin-robot) and add the favicon.ico file to the static/ directory.
This plugin will copy all files under `static/` to the root `dist/` directory, so this is also useful for robots.txt, humans.txt, browserconfig.xml and any othe... |
56,217,201 | I am trying to filter an array based on a set of regex expression.If the item in the array matches any of the regex expression,I want o push it to a different array.I read that I can use match() and test() to do this but I'm unable to underetand how to do so.Please help.Thanks in advance.
Here are my regex exp:
```
R... | 2019/05/20 | [
"https://Stackoverflow.com/questions/56217201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11339716/"
] | What I believe you're looking to do is get the `jaccard_similarity` for each list in `list1`. If so, just loop through them. Also, made small corrections to the lines in `jaccard_similarity`.
```
list1=[
['Search','engines','using','machine','learning','pattern','detections'],
['machine','learning','helped','... | You could compute the Jaccard Index between two lists using your function:
```py
jaccard_similarity(list1[0], list2)
```
returns:
```sh
['learning']
Out[7]: 0.09090909090909091
```
You could also use a loop to apply your function to the different sublists in list1 and get the Jaccard Index between the sublists of... |
56,331,486 | Recently I started developing apps in Android studio via Kotlin, because Java seemed a bit harder. I built my first app and now, for the second, I wanna try out data binding. I follow a Udacity tutorial and there it says that I have to include `dataBinding{ enabled=True }` which I did.
The problem is that when I try t... | 2019/05/27 | [
"https://Stackoverflow.com/questions/56331486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11563975/"
] | Firstly I would suggest moving away from `List.Remove` since worst case it needs to check each item to find the one to remove. Instead of removing shards that are being processed from the list of unprocessed shards, you could keep another list of processed shards and add to that. Then your condition checking if the con... | It seems the script slowed down the most at the recursion of the ProcessShard() method so I renamed and rewrote the method as ProcessShards() that uses a while loop and a Queue to process all the shards. The performance was around ten times better on a chunk with 100 shards.
```
// process shards
private void ... |
24,783,564 | I have the following code I found online: <http://code.msdn.microsoft.com/windowsdesktop/VBWinFormExAeroToClient-f0d42b34>
And I've been tweaking it to work with my own application.
I need a Small 500x30 px Form.
I've been reading through the demo code that is provided in that link, but I can't seem to find where to... | 2014/07/16 | [
"https://Stackoverflow.com/questions/24783564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/655947/"
] | It's because you are adding quotes around the values:
```
List<string> headerValues = new List<string>();
foreach (DataColumn column in sourceTable.Columns)
{
headerValues.Add(QuoteValue(column.ColumnName));
}
```
Try without the `QuoteValue` call:
```
List<string> headerValues = new List<string>();
foreach (D... | QuoteValue is a custom method to enclose the value with quotation marks and doubling any quotes found:
```
private static string QuoteValue(string value)
{
return String.Concat("\"", value.Replace("\"", "\"\""), "\"");
}
```
This helps CSV parsers so that extra columns aren't created:
```
CSV fi... |
57,901,352 | I want to create a web app using React as the front end technology. A requirement for the app is that the server will be able to update all the clients with information about changes (not have to be an exact real time, but should update after no more than 10 seconds).
Solutions like clients requesting updates from the... | 2019/09/12 | [
"https://Stackoverflow.com/questions/57901352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164004/"
] | Both SignalR and Pusher Channels ultimately both use websockets to deliver messages to clients, so both should meet your requirements to deliver messages to clients in realtime.
1) Both offerings also meet your requirements for both library support:
SignalR supports .NET:
<https://dotnet.microsoft.com/apps/aspnet/si... | This presentation has some answers [A 10 Minute Guide to Choosing a Realtime Framework](https://leggetter.github.io/realtime-tech-stack/fwd2-2015/) |
32,281,809 | I'm having a weird problem with Kaminari, AJAX pagination and the latest rails.
I see everything is working perfectly underneath, it's doing the right calls, generating the right HTML and JS, but for reasons I don't understand it doesn't update the page after a pagination AJAX call.
The js it produces can be cut&past... | 2015/08/29 | [
"https://Stackoverflow.com/questions/32281809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1584736/"
] | Ok the first part collecting the data it would work for the exercise.
What you would need to tweek is the logic to find the winner. I will start after you collect the times for each of the teams.
What I would suggest to do is:
1. Iterate from 0..N-1 (N = 8 which is the array length) (I didn't saw that loop in your... | Try this, You have already have written for the major part of the question and you add variables cn and fn the count of winning cars of companies and compare them atlast
```
{
//declare varibles
double[] chevy = new double[8];
double[] ford = new double[8];
int x, y;
double ctotal = 0, chevyaverag... |
32,281,809 | I'm having a weird problem with Kaminari, AJAX pagination and the latest rails.
I see everything is working perfectly underneath, it's doing the right calls, generating the right HTML and JS, but for reasons I don't understand it doesn't update the page after a pagination AJAX call.
The js it produces can be cut&past... | 2015/08/29 | [
"https://Stackoverflow.com/questions/32281809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1584736/"
] | Ok the first part collecting the data it would work for the exercise.
What you would need to tweek is the logic to find the winner. I will start after you collect the times for each of the teams.
What I would suggest to do is:
1. Iterate from 0..N-1 (N = 8 which is the array length) (I didn't saw that loop in your... | This is done in LinqPad so you would take out the ".Dump()" but you can use .Zip to do what you are trying to do by comparing both arrays. I have shortened the code for example purpose but you would do your loops and push the items into the arrays then .Zip them to do your comparison.
```
using System.Linq;
void Mai... |
32,703,081 | Is there a way to use typescript 1.6 with amd modules while targeting es6?
This worked in 1.4 and was useful as no browser currently have es6 module support but do have a lot of ES6 features built in. | 2015/09/21 | [
"https://Stackoverflow.com/questions/32703081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72030/"
] | You can't use AMD while targeting ES6, in case of ES6 has it's own module system. So while you are targeting ES6 - it uses SYSTEM modules by default. Use ES5 and choose any of `[amd, common, system, umd]`.
`--target 'ES6'`
or
`--target 'ES5' --module 'amd'`
It was unable to use AMD+ES6 since TS1.5
Use SystemJS to wo... | I would assume that you can use the [compiler options](https://github.com/Microsoft/TypeScript/wiki/Compiler-Options) `--target` to use `'ES6'` and the `--module` option to use `'amd'`.
However, targeting ES6 is an experimental feature:
>
> [1] These options are experimental.
>
>
>
Maybe the TypeScript team has ... |
1,766,842 | i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon | 2009/11/19 | [
"https://Stackoverflow.com/questions/1766842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162345/"
] | You won't be able to do this with a ListBox, because it just creates an HTML < select> element.
You can use a [MenuBar](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/MenuBar.html) that has one menu with [MenuItem](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/goo... | Take a look at the Combobox or Suggestion box in [Advanced GWT Components](http://advanced-gwt.sourceforge.net/text-and-button.html). |
1,766,842 | i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon | 2009/11/19 | [
"https://Stackoverflow.com/questions/1766842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162345/"
] | You won't be able to do this with a ListBox, because it just creates an HTML < select> element.
You can use a [MenuBar](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/MenuBar.html) that has one menu with [MenuItem](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/goo... | Another widget is the DropDownListBox in the GWT incubator. I have not used it, but the stated intent is to provide a rich, stylable ListBox. You can pass raw HTML to the addItem() method.
[DropDownListBox](http://code.google.com/p/google-web-toolkit-incubator/wiki/DropDownListBox) |
1,766,842 | i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon | 2009/11/19 | [
"https://Stackoverflow.com/questions/1766842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162345/"
] | You won't be able to do this with a ListBox, because it just creates an HTML < select> element.
You can use a [MenuBar](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/MenuBar.html) that has one menu with [MenuItem](http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/goo... | it is possible to use Tree inside ScrollPanel, without using nested items
Tree allows TreeItem to be a Widget |
1,766,842 | i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon | 2009/11/19 | [
"https://Stackoverflow.com/questions/1766842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162345/"
] | Take a look at the Combobox or Suggestion box in [Advanced GWT Components](http://advanced-gwt.sourceforge.net/text-and-button.html). | Another widget is the DropDownListBox in the GWT incubator. I have not used it, but the stated intent is to provide a rich, stylable ListBox. You can pass raw HTML to the addItem() method.
[DropDownListBox](http://code.google.com/p/google-web-toolkit-incubator/wiki/DropDownListBox) |
1,766,842 | i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon | 2009/11/19 | [
"https://Stackoverflow.com/questions/1766842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162345/"
] | Take a look at the Combobox or Suggestion box in [Advanced GWT Components](http://advanced-gwt.sourceforge.net/text-and-button.html). | it is possible to use Tree inside ScrollPanel, without using nested items
Tree allows TreeItem to be a Widget |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | Maybe load the options of the second dropdown list on-demand (e.g. using [AutoComplete of the AJAX control toolkit](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx) or a similar control). | If you can, populate the `DropDownList` controls in their respective `Init` events. This way, their options won't be stored in ViewState. That can save quite a few bytes.
Or better yet, can you get away with turning ViewState off altogether? |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | Maybe load the options of the second dropdown list on-demand (e.g. using [AutoComplete of the AJAX control toolkit](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx) or a similar control). | gzip html and json, reduce element count and anidation, simplify html, etceteras to reduce latency of traffic and rendering |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | Maybe load the options of the second dropdown list on-demand (e.g. using [AutoComplete of the AJAX control toolkit](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx) or a similar control). | You can do all sorts of things to eek out performance!
1) Take a look at [Yahoo's performance rules](http://developer.yahoo.com/performance/rules.html) to get you started. These are generally a list of best practices to help speed up your website.
2) Take a look at Chromes Inspector (Settings -> Tools -> Developer to... |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | Maybe load the options of the second dropdown list on-demand (e.g. using [AutoComplete of the AJAX control toolkit](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx) or a similar control). | If the requests accept zip or deflate make your response return it.
```
var response = HttpContext.Current.Response;
string acceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"] ?? "";
if (acceptEncoding.Contains("gzip"))
{
response.Filter =
new System.IO.Compression.GZip... |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | You can disable event validation for the page, which should lighten the load on your viewstate (that's the reason for lots of viewstate on initial load). Event validation ensures that every option available in a constrained input (dropdown, checkbox list, radio button list) has been registered before render. That info ... | If you can, populate the `DropDownList` controls in their respective `Init` events. This way, their options won't be stored in ViewState. That can save quite a few bytes.
Or better yet, can you get away with turning ViewState off altogether? |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | You can disable event validation for the page, which should lighten the load on your viewstate (that's the reason for lots of viewstate on initial load). Event validation ensures that every option available in a constrained input (dropdown, checkbox list, radio button list) has been registered before render. That info ... | gzip html and json, reduce element count and anidation, simplify html, etceteras to reduce latency of traffic and rendering |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | You can disable event validation for the page, which should lighten the load on your viewstate (that's the reason for lots of viewstate on initial load). Event validation ensures that every option available in a constrained input (dropdown, checkbox list, radio button list) has been registered before render. That info ... | You can do all sorts of things to eek out performance!
1) Take a look at [Yahoo's performance rules](http://developer.yahoo.com/performance/rules.html) to get you started. These are generally a list of best practices to help speed up your website.
2) Take a look at Chromes Inspector (Settings -> Tools -> Developer to... |
7,032,981 | I have a ASP.Net WebForms page that has 2 drop-down lists (1 with 10 options, the other with about 600) and about 5 panels. Based on what value is selected from the drop-downs, other panels are made visible or invisible during async postback by querying a database.
My dilemma is this: The page is not fast enough on a ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | You can disable event validation for the page, which should lighten the load on your viewstate (that's the reason for lots of viewstate on initial load). Event validation ensures that every option available in a constrained input (dropdown, checkbox list, radio button list) has been registered before render. That info ... | If the requests accept zip or deflate make your response return it.
```
var response = HttpContext.Current.Response;
string acceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"] ?? "";
if (acceptEncoding.Contains("gzip"))
{
response.Filter =
new System.IO.Compression.GZip... |
967,687 | I came across a situation where I would like to step back through the app's methods up the "tree" until I decided to catch it (if I do) - like an exception; it's raised through all the code until you catch it or hits the roof.
The general concensus is that you only use exception for exceptions. That being the case, wh... | 2009/06/09 | [
"https://Stackoverflow.com/questions/967687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52165/"
] | The design pattern you're looking for is called a continuation, where you pass a point of return as a value to other functions:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
... | You could derive your own inherited exception class and then throw that, this specific exception could then be handled in your own specific way. |
967,687 | I came across a situation where I would like to step back through the app's methods up the "tree" until I decided to catch it (if I do) - like an exception; it's raised through all the code until you catch it or hits the roof.
The general concensus is that you only use exception for exceptions. That being the case, wh... | 2009/06/09 | [
"https://Stackoverflow.com/questions/967687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52165/"
] | You could derive your own inherited exception class and then throw that, this specific exception could then be handled in your own specific way. | Depending on the actual scenario the GoF pattern chain of responcibility might suit your needs.
Chain of responcibility forwards a task along a chain of possible handlers until one eventually handles the task or the chain ends. |
967,687 | I came across a situation where I would like to step back through the app's methods up the "tree" until I decided to catch it (if I do) - like an exception; it's raised through all the code until you catch it or hits the roof.
The general concensus is that you only use exception for exceptions. That being the case, wh... | 2009/06/09 | [
"https://Stackoverflow.com/questions/967687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52165/"
] | The design pattern you're looking for is called a continuation, where you pass a point of return as a value to other functions:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
... | Depending on the actual scenario the GoF pattern chain of responcibility might suit your needs.
Chain of responcibility forwards a task along a chain of possible handlers until one eventually handles the task or the chain ends. |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | The [system\_profiler](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/system_profiler.8.html) command provides a direct answer that’s easily human readable (assuming you are on 10.3 or newer), but you can also use [ioreg](https://developer.apple.com/legacy/library/documentation/... | This also works…
```
ioreg -l | grep IOPlatformSerialNumber
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | C++ example from <https://developer.apple.com/library/archive/technotes/tn1103/_index.html>:
```
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
std::string
getSerialNumber()
{
CFStringRef serial;
char buffer[32] = {0};
std::string seriaNumber;
io_service_t platformExpert = IOSe... | If you don't want to count columns you can rely on the fact that the value is always in the last one and use
```sh
system_profiler SPHardwareDataType | awk '/Serial/{print $NF}'
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | This also works…
```
ioreg -l | grep IOPlatformSerialNumber
``` | To make it easier to remember, use a case insensitive search:
```
ioreg -l | grep -i serialnumber | grep -i platform
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | This also works…
```
ioreg -l | grep IOPlatformSerialNumber
``` | This works in Python 3.10.5 on macOS
```py
import json
import os
import time
# Example MySPHardwareDataType.json created and used by this script
#{
# "SPHardwareDataType" : [
# {
# "_name" : "hardware_overview",
# "activation_lock_status" : "activation_lock_disabled",
# "boot_rom_version" : "7459.1... |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | The [system\_profiler](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/system_profiler.8.html) command provides a direct answer that’s easily human readable (assuming you are on 10.3 or newer), but you can also use [ioreg](https://developer.apple.com/legacy/library/documentation/... | To make it easier to remember, use a case insensitive search:
```
ioreg -l | grep -i serialnumber | grep -i platform
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | This also works…
```
ioreg -l | grep IOPlatformSerialNumber
``` | If you don't want to count columns you can rely on the fact that the value is always in the last one and use
```sh
system_profiler SPHardwareDataType | awk '/Serial/{print $NF}'
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | The [system\_profiler](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/system_profiler.8.html) command provides a direct answer that’s easily human readable (assuming you are on 10.3 or newer), but you can also use [ioreg](https://developer.apple.com/legacy/library/documentation/... | C++ example from <https://developer.apple.com/library/archive/technotes/tn1103/_index.html>:
```
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
std::string
getSerialNumber()
{
CFStringRef serial;
char buffer[32] = {0};
std::string seriaNumber;
io_service_t platformExpert = IOSe... |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | The [system\_profiler](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/system_profiler.8.html) command provides a direct answer that’s easily human readable (assuming you are on 10.3 or newer), but you can also use [ioreg](https://developer.apple.com/legacy/library/documentation/... | If you don't want to count columns you can rely on the fact that the value is always in the last one and use
```sh
system_profiler SPHardwareDataType | awk '/Serial/{print $NF}'
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | This works in Python 3.10.5 on macOS
```py
import json
import os
import time
# Example MySPHardwareDataType.json created and used by this script
#{
# "SPHardwareDataType" : [
# {
# "_name" : "hardware_overview",
# "activation_lock_status" : "activation_lock_disabled",
# "boot_rom_version" : "7459.1... | If you don't want to count columns you can rely on the fact that the value is always in the last one and use
```sh
system_profiler SPHardwareDataType | awk '/Serial/{print $NF}'
``` |
40,243 | What command can I use to retrieve the system's serial number from the unix command line? As `uname` will output some information about the software and hardware, I would like to retrieve the serial number from a command to use in a script. | 2012/02/13 | [
"https://apple.stackexchange.com/questions/40243",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/5472/"
] | This also works…
```
ioreg -l | grep IOPlatformSerialNumber
``` | C++ example from <https://developer.apple.com/library/archive/technotes/tn1103/_index.html>:
```
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
std::string
getSerialNumber()
{
CFStringRef serial;
char buffer[32] = {0};
std::string seriaNumber;
io_service_t platformExpert = IOSe... |
10,515 | I am looking at a section of code that uses this:
```
if ($_item->getProduct()->getTypeId() === Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE)
```
to determine whether a product is configurable. I am now wanting to alter that to detect whether the product is a bundle - but it turns out, there is no `Mage_C... | 2013/11/07 | [
"https://magento.stackexchange.com/questions/10515",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/782/"
] | I'm not sure I understand your question, but here goes. You can try this:
```
$quote = Mage::getSingleton('checkout/session')->getQuote();
$methodCode = 'payment_code_here';
if ($quote->isVirtual()) {
$quote->getBillingAddress()->setPaymentMethod($methodCode);
} else {
$quote->getShippingAddress()->setPaymentM... | Looking at your code I noticed you are putting your variable in quotes. Not sure if you noticed that or not but it should look like.
```
Mage::getSingleton('checkout/session')->setMethod($method);
```
not
```
Mage::getSingleton('checkout/session')->setMethod('$method')
``` |
2,949,548 | I have a small test app that parses a few RSS feeds.
It all goes well for all except for one.
I scanned through the feed's XML and noticed that it fails once it reached a tag that has "&" in it. So, if I have a tag like this:
```
<like>beer & barbeque</like>
```
The log says that it found a string
```
beer
```
... | 2010/06/01 | [
"https://Stackoverflow.com/questions/2949548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/354564/"
] | Since the feed is already failing... do a string replace on '`&<space>` ' to '`&`' while you fight it out with the feed publisher to clean up his act.
The feed must be valid XML. Period. | [Hpple](http://github.com/topfunky/hpple) is supposed to be able to parse "messy" HTML. Maybe it can handle your messy RSS. |
27,745,894 | I need some clarification on how regex with the re.findall method works.
```
pattern = re.compile(r'(?<=\\\\\[-16pt]\n)([\s\S]*?)(?=\\\\\n\\thinhline)')
content= ' '.join(re.findall(pattern, content))
```
So the above prints all the content that the pattern matches with the starting being: `\\[-16pt]` and the endin... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27745894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2224963/"
] | Consider the following runnable program:
```
import re
content="""\\[-16pt]
x = 10
print ("hi")
\\
thinhline
\\[-16pt]
y = 3
print ("bye")
\\
thinhline
\\[-16pt]
z = 7
print ("zap")
\\
thinhline
This is random text.
"""
pattern = re.compile(r"""(\\\[-16pt]\n) # Start. Don't technically need to capture.
... | ```
import re
s=re.findall(r"(?<=\\\\\[-16pt]\n)([\s\S]*?)(?=\\\\\n\\thinhline)",test_str)
```
Findall returns a list of groups matched.
Here `s` is a list.You can access what you want by referring `s[0]` or `s[1]`. |
27,745,894 | I need some clarification on how regex with the re.findall method works.
```
pattern = re.compile(r'(?<=\\\\\[-16pt]\n)([\s\S]*?)(?=\\\\\n\\thinhline)')
content= ' '.join(re.findall(pattern, content))
```
So the above prints all the content that the pattern matches with the starting being: `\\[-16pt]` and the endin... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27745894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2224963/"
] | ```
import re
s=re.findall(r"(?<=\\\\\[-16pt]\n)([\s\S]*?)(?=\\\\\n\\thinhline)",test_str)
```
Findall returns a list of groups matched.
Here `s` is a list.You can access what you want by referring `s[0]` or `s[1]`. | use re.findall
```
pattern=r"""(\\\[-16pt])(\n[a-z]+\s+\={1}\s+[0-9]+)(\nprint\s+\({1}\"[a-z]+\"\){1})\n(\\\nthinhline)\n"""
result=re.findall(pattern,content)
count=1
for item in result:
print("row",count,item[2])
count+=1
```
output:
```
row 1
print ("hi")
row 2
print ("bye")
row 3
print ("zap")
``` |
27,745,894 | I need some clarification on how regex with the re.findall method works.
```
pattern = re.compile(r'(?<=\\\\\[-16pt]\n)([\s\S]*?)(?=\\\\\n\\thinhline)')
content= ' '.join(re.findall(pattern, content))
```
So the above prints all the content that the pattern matches with the starting being: `\\[-16pt]` and the endin... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27745894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2224963/"
] | Consider the following runnable program:
```
import re
content="""\\[-16pt]
x = 10
print ("hi")
\\
thinhline
\\[-16pt]
y = 3
print ("bye")
\\
thinhline
\\[-16pt]
z = 7
print ("zap")
\\
thinhline
This is random text.
"""
pattern = re.compile(r"""(\\\[-16pt]\n) # Start. Don't technically need to capture.
... | use re.findall
```
pattern=r"""(\\\[-16pt])(\n[a-z]+\s+\={1}\s+[0-9]+)(\nprint\s+\({1}\"[a-z]+\"\){1})\n(\\\nthinhline)\n"""
result=re.findall(pattern,content)
count=1
for item in result:
print("row",count,item[2])
count+=1
```
output:
```
row 1
print ("hi")
row 2
print ("bye")
row 3
print ("zap")
``` |
136,318 | There is a question in the second chapter of the book that I'm unable to solve, and unfortunately [algorist.com](https://algorist.com) does not provide a rigorous enough solution, or maybe I can't quite understand it.
Here is the question:
[](https://... | 2021/03/08 | [
"https://cs.stackexchange.com/questions/136318",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/128346/"
] | Both work, so how you do it is up to you. But there are a couple of reasons to consider doing it during a post-parse analysis:
1. While it is certainly possible to define two different types of `block`, one in which `break` is legal and the other one in which it isn't, the result is a lot of duplication in the grammar... | You could do this purely in syntax - you’d have a grammar with two non-terminals for “statement that can contain a break” and one for “statement that may not contain a break”. You duplicate the size of the grammar, making it a right pain.
When you parse a break statement you need semantics anyway to determine what exa... |
65,117 | In my Document Library named `Lists/Documents`, I have some corrupted items. I can see them and their properties in ListView, but I cannot edit or delete items.
This is not a Permission problem. Rather, the files do not exist in the Sharepoint file system.
In my listview
. I can't remember how I got rid of them, but I can think of two possible options I could have used.
1) Delete them with powershell
2) Mount the explorer view as a dri... |
65,117 | In my Document Library named `Lists/Documents`, I have some corrupted items. I can see them and their properties in ListView, but I cannot edit or delete items.
This is not a Permission problem. Rather, the files do not exist in the Sharepoint file system.
In my listview
, and sharepoint allow some illegal charaters for system |
65,117 | In my Document Library named `Lists/Documents`, I have some corrupted items. I can see them and their properties in ListView, but I cannot edit or delete items.
This is not a Permission problem. Rather, the files do not exist in the Sharepoint file system.
In my listview

message("L1: ${L1}")
string(REPLACE ";" "<->" L2 ${L1})
message("L2: ${L2}")
```
this snippet prints:
```
L1: A;B;C
L2:... | 2017/03/31 | [
"https://Stackoverflow.com/questions/43137036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1887976/"
] | Just put `${L1}` in quotes:
```
set(L1 "A" "B" "C")
message("L1: ${L1}")
string(REPLACE ";" "<->" L2 "${L1}")
message("L2: ${L2}")
```
Otherwise the list will be expanded again to a space separated parameter list.
**Reference**
* [cmake: when to quote variables?](https://stackoverflow.com/questions/35847655/cmak... | But `${L1}` *isn't* a string, it's a list. If you want a string then you need to enclose it in double-quotes like `"${L1}"`. |
283,894 | Have you ever tried this feedback calling an external zip.py script to work? My CGITB does not show any error messages. It simply did not invoke external .py script to work. It simply skipped over to gush. I should be grateful if you can assist me in making this zip.py callable in feedback.py.
Regards. David
```
#*... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36900/"
] | * `zip()` is a built-in function in Python. Therefore it is a bad practice to use `zip` as a variable name. `zip_` can be used instead of.
* `execfile()` function reads and executes a Python script.
* It is probably that you actually need just `import zip_` in feedback.py instead of `execfile()`. | Yay ArcGIS.
Just to clarify how are you trying to call this script using popen, can you post some code?
If your invoking this script via another script in the ArcGIS environment, then the thing is, when you use Popen the script wont be invoked within the ArcGIS environment, instead it will be invoked within windows. ... |
38,215,445 | I need to write a function that will list n amount of numbers that are divisible by m. So if I list the function divisibility(10,2) it will list the first 10 numbers divisible by 2. This is in Python 3. Any basic structures that I can manipulate would be helpful. Brand new programmer, so all insight will much appreciat... | 2016/07/06 | [
"https://Stackoverflow.com/questions/38215445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6554132/"
] | If you have the entire file read into memory, you can search multiple lines at once:
```
$file =~ m/^\s*(\d+\.\d+\s+\d+\s+ng)\n\s*(\d+\.\d+\s+\d+\s+b)/ms ;
```
Otherwise you end up writing some kind of state machine.
If the endings are going to be changing, you can even use variables for them:
```
my $end1= 'ng' ;... | As always with this kind of problem, either read the entire file into memory, or keep a copy of the preceding lines you might need in memory.
```
my $prev = <>;
if (defined($prev)) {
while (my $this = <>) {
if ($this =~ /\sb$/ && $prev =~ /\sng$/) {
# Do whatever you want with the two lines here.
... |
320,505 | I wish to write the name of pdfTeX's author:
[](https://i.stack.imgur.com/OotqYm.png)
I am not able to figure out how to write the middle name. I tried`Th\'{\^{e}}`, but it doesn't return the desired output.
It's different from the similar double a... | 2016/07/22 | [
"https://tex.stackexchange.com/questions/320505",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/73743/"
] | It's a vietnamese name so for the best result you need a vietnamese font encoding:
```
\documentclass[]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T5,T1]{fontenc}
\begin{document}
T5: {\fontencoding{T5}\selectfont H\`an Th\'\ecircumflex{} Th\`anh}
T1: H\`an Th\'{ê} Th\`anh
\end{document}
```
['s comment I found the solution:
using [stackengine](https://www.ctan.org/pkg/stackengine?lang=en) package we can write:
```
\documentclass{article}
\usepackage{stackengine}
\renewcommand\stacktype{L}
\begin{document}
H\`an Th\stackon[3p... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | The docs for [thrust::sort](http://wiki.thrust.googlecode.com/hg/html/group__sorting.html) show it accepts a comparison operator. See in their [example](http://code.google.com/p/thrust/source/browse/examples/sort.cu) how those are defined and used. I haven't tested this, but based on the example, all you would need is ... | Up until now you cannot sort custom objects. You can do key based sorting but not of custom objects like the struct you mentioned. There are a couple of other open CUDA based algorithms available for doing this but that too requires some modification etc to make them work for you. |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | Even though you may sort the objects by using special struct definitions, using a struct as functor, it will make thrust to change the sort algorithm from radix-sort to merge-sort. Speed of radix-sort is noticeably faster than merge-sort. So when using thrust, try to use integer types as key values as possible.
I may ... | Up until now you cannot sort custom objects. You can do key based sorting but not of custom objects like the struct you mentioned. There are a couple of other open CUDA based algorithms available for doing this but that too requires some modification etc to make them work for you. |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | you can sort objects by overloading operator< . For example:
```
__host__ __device__ struct Color{
double blue, green, red;
double distance;
void dist()
{
distance = sqrt(blue*blue + green*green + red*red);
}
};
__host__ __device__ bool operator<(const Color &lhs, const Color &rhs)
{
return lhs.dist... | Up until now you cannot sort custom objects. You can do key based sorting but not of custom objects like the struct you mentioned. There are a couple of other open CUDA based algorithms available for doing this but that too requires some modification etc to make them work for you. |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | The docs for [thrust::sort](http://wiki.thrust.googlecode.com/hg/html/group__sorting.html) show it accepts a comparison operator. See in their [example](http://code.google.com/p/thrust/source/browse/examples/sort.cu) how those are defined and used. I haven't tested this, but based on the example, all you would need is ... | I have not tried **Thrust** yet, but there is a similar sort function in [CUDPP](http://code.google.com/p/cudpp/) called **cudppSort**. You cannot directly sort structures using cudppSort, it can only handle integers or floats.
So, one way to sort array of structures is to sort the keys (of your structure) and an inde... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | Even though you may sort the objects by using special struct definitions, using a struct as functor, it will make thrust to change the sort algorithm from radix-sort to merge-sort. Speed of radix-sort is noticeably faster than merge-sort. So when using thrust, try to use integer types as key values as possible.
I may ... | I have not tried **Thrust** yet, but there is a similar sort function in [CUDPP](http://code.google.com/p/cudpp/) called **cudppSort**. You cannot directly sort structures using cudppSort, it can only handle integers or floats.
So, one way to sort array of structures is to sort the keys (of your structure) and an inde... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | you can sort objects by overloading operator< . For example:
```
__host__ __device__ struct Color{
double blue, green, red;
double distance;
void dist()
{
distance = sqrt(blue*blue + green*green + red*red);
}
};
__host__ __device__ bool operator<(const Color &lhs, const Color &rhs)
{
return lhs.dist... | I have not tried **Thrust** yet, but there is a similar sort function in [CUDPP](http://code.google.com/p/cudpp/) called **cudppSort**. You cannot directly sort structures using cudppSort, it can only handle integers or floats.
So, one way to sort array of structures is to sort the keys (of your structure) and an inde... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | The docs for [thrust::sort](http://wiki.thrust.googlecode.com/hg/html/group__sorting.html) show it accepts a comparison operator. See in their [example](http://code.google.com/p/thrust/source/browse/examples/sort.cu) how those are defined and used. I haven't tested this, but based on the example, all you would need is ... | Even though you may sort the objects by using special struct definitions, using a struct as functor, it will make thrust to change the sort algorithm from radix-sort to merge-sort. Speed of radix-sort is noticeably faster than merge-sort. So when using thrust, try to use integer types as key values as possible.
I may ... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | The docs for [thrust::sort](http://wiki.thrust.googlecode.com/hg/html/group__sorting.html) show it accepts a comparison operator. See in their [example](http://code.google.com/p/thrust/source/browse/examples/sort.cu) how those are defined and used. I haven't tested this, but based on the example, all you would need is ... | you can sort objects by overloading operator< . For example:
```
__host__ __device__ struct Color{
double blue, green, red;
double distance;
void dist()
{
distance = sqrt(blue*blue + green*green + red*red);
}
};
__host__ __device__ bool operator<(const Color &lhs, const Color &rhs)
{
return lhs.dist... |
5,282,039 | Is it possible to sort objects using the Thrust library?
I have the following struct:
```
struct OB{
int N;
Cls *C; //CLS is another struct.
}
```
Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able t... | 2011/03/12 | [
"https://Stackoverflow.com/questions/5282039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656491/"
] | Even though you may sort the objects by using special struct definitions, using a struct as functor, it will make thrust to change the sort algorithm from radix-sort to merge-sort. Speed of radix-sort is noticeably faster than merge-sort. So when using thrust, try to use integer types as key values as possible.
I may ... | you can sort objects by overloading operator< . For example:
```
__host__ __device__ struct Color{
double blue, green, red;
double distance;
void dist()
{
distance = sqrt(blue*blue + green*green + red*red);
}
};
__host__ __device__ bool operator<(const Color &lhs, const Color &rhs)
{
return lhs.dist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.