qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
480,809 | <p>First I must say that my problem happens when I'm trying to post to another form.</p>
<p>I have 3 controls in a form:
1. text input named "text1".
2. file input named "file1".
3. submit input.</p>
<p>the form itself have a post method to another page.
in the page load of the posted page I'm using Request["text1"] ... | [
{
"answer_id": 480816,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 2,
"selected": false,
"text": "<p>You need <em>enctype="multipart/form-data"</em> in your opening form tag.</p>\n<pre><code><form method=&qu... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First I must say that my problem happens when I'm trying to post to another form.
I have 3 controls in a form:
1. text input named "text1".
2. file input named "file1".
3. submit input.
the form itself have a post method to another page.
in the page load of the posted page I'm using Request["text1"] which gives me th... | You need *enctype="multipart/form-data"* in your opening form tag.
```
<form method="post" action="somepage.php" enctype="multipart/form-data">
...
</form>
```
If that doesn't help, [4GuysFromRolla](https://web.archive.org/web/20211020202742/https://www.4guysfromrolla.com) have an article on this very topic:
### [U... |
480,827 | <p>all the procedure help I find is used for select purposes only.</p>
<p>can I write a table to truncate several tables?</p>
<p>similar to (but this does NOT work)</p>
<pre><code>CREATE PROCEDURE clearall()
BEGIN
truncate tallgrrl.auth;
truncate tallgrrl.factory;
truncate tallgrrl.farm;
truncate t... | [
{
"answer_id": 480831,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 2,
"selected": false,
"text": "<p>Absolutely. One of the purposes of stored procedures is to encapsulate logic/multiple operations.</p>\n"
},
{
... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | all the procedure help I find is used for select purposes only.
can I write a table to truncate several tables?
similar to (but this does NOT work)
```
CREATE PROCEDURE clearall()
BEGIN
truncate tallgrrl.auth;
truncate tallgrrl.factory;
truncate tallgrrl.farm;
truncate tallgrrl.player;
truncate... | Absolutely. One of the purposes of stored procedures is to encapsulate logic/multiple operations. |
480,866 | <p>Refering to a previously asked <a href="https://stackoverflow.com/questions/373020/finding-the-current-active-window-in-mac-os-x-using-python" title="question">question</a>, I would like to know how to get the title of the current active document.</p>
<p>I tried the script mention in the answers to the question abo... | [
{
"answer_id": 481047,
"author": "Koen Bok",
"author_id": 56495,
"author_profile": "https://Stackoverflow.com/users/56495",
"pm_score": 4,
"selected": true,
"text": "<p>As far as I know your best bet is wrapping an AppleScript. But AppleScript is magic to me so I leave it as an exercise ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45959/"
] | Refering to a previously asked [question](https://stackoverflow.com/questions/373020/finding-the-current-active-window-in-mac-os-x-using-python "question"), I would like to know how to get the title of the current active document.
I tried the script mention in the answers to the question above. This works, but only gi... | As far as I know your best bet is wrapping an AppleScript. But AppleScript is magic to me so I leave it as an exercise for the questioner :-)
This might help a little: [A script to resize frontmost two windows to fill screen - Mac OS X Hints](http://hints.macworld.com/article.php?story=20060105082728937) |
480,872 | <p>We have a table that looks roughly like this:</p>
<pre><code>CREATE TABLE Lockers
{
UserID int NOT NULL PRIMARY KEY (foreign key),
LockerStyleID int (foreign key),
NameplateID int (foreign key)
}
</code></pre>
<p>All of the keys relate to other tables, but because of the way the application is distributed, ... | [
{
"answer_id": 480888,
"author": "driAn",
"author_id": 50430,
"author_profile": "https://Stackoverflow.com/users/50430",
"pm_score": 0,
"selected": false,
"text": "<p>You could make an extension method that constructs the entity based on these ID's.</p>\n"
},
{
"answer_id": 56054... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34224/"
] | We have a table that looks roughly like this:
```
CREATE TABLE Lockers
{
UserID int NOT NULL PRIMARY KEY (foreign key),
LockerStyleID int (foreign key),
NameplateID int (foreign key)
}
```
All of the keys relate to other tables, but because of the way the application is distributed, it's easier for us to pass... | This missing feature seems to annoy a lot of people.
* Good news: MS will address the issue with .NET 4.0.
* Bad news: for now, or if you're stuck on 3.5 you have to do a little bit of work, but it IS possible.
You have to do it like this:
```
Locker locker = new Locker();
locker.UserReference.EntityKey = new Syste... |
480,894 | <p>I currently posses a List of Objects(Using Java 1.3), and let's say that I wanted to cast one of the Objects returned from list.get(i) to a type of which I only know the name of the Class as a String. Essentially, how do I
Object o = (classname)list.get(i); where className is a String variable of a className.</p>
... | [
{
"answer_id": 480901,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 3,
"selected": false,
"text": "<p>No, and you can't do this across most languages.</p>\n\n<p>The reason is that the type to cast to has to be known at ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57627/"
] | I currently posses a List of Objects(Using Java 1.3), and let's say that I wanted to cast one of the Objects returned from list.get(i) to a type of which I only know the name of the Class as a String. Essentially, how do I
Object o = (classname)list.get(i); where className is a String variable of a className.
I thoug... | what is the point of casting when all you do is assign the result to object?
All you would achieve is an exception if it did not implement the interface/extend or was the class or do nothing if it did.
For that a simple:
```
public static boolean IsInstance(object x, String className)
{
Class cls = Class.for... |
480,895 | <p>We have a static method in a utility class that will download a file from a URL. An authenticator has been set up so that if a username and password is required, the credentials can be retrieved. The problem is that the credentials from the first successful connection are used for every connection afterwords, as l... | [
{
"answer_id": 480935,
"author": "Ken Henderson",
"author_id": 52136,
"author_profile": "https://Stackoverflow.com/users/52136",
"pm_score": 2,
"selected": false,
"text": "<p>It looks like in your finally block you need to call</p>\n\n<pre><code>Authenticator.setDefault(null);\n</code></... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1322/"
] | We have a static method in a utility class that will download a file from a URL. An authenticator has been set up so that if a username and password is required, the credentials can be retrieved. The problem is that the credentials from the first successful connection are used for every connection afterwords, as long a... | I've figured something out at least. It appears that this behavior is a [bug](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6626700). A workaround is to use a Sun specific class to explicitly reset the cache, like so:
```
import sun.net.www.protocol.http.AuthCacheValue;
import sun.net.www.protocol.http.AuthCacheI... |
480,897 | <p>I'm trying to manage the size of a SQL Server 2008 log file. I have a reporting database that is loaded once a day. The Simple recovery model is the best fit as there are no transactions other than the morning load, and I can re-create those records. My goals are to have the transaction log at a fixed size, large... | [
{
"answer_id": 480917,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 3,
"selected": false,
"text": "<p>create a maintenance job that backups the DB and shrinks the log</p>\n"
},
{
"answer_id": 480977,
"author": "... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47166/"
] | I'm trying to manage the size of a SQL Server 2008 log file. I have a reporting database that is loaded once a day. The Simple recovery model is the best fit as there are no transactions other than the morning load, and I can re-create those records. My goals are to have the transaction log at a fixed size, large enoug... | The log file is used for transactional purposes, even if the database is in SIMPLE RECOVERY MODE. If the LOG size is truly growing beyond 500 MB, then someone is running a query or stored procedure that is requiring that space.
For example, perhaps you are creating indexes against your reporting tables. That will be d... |
480,939 | <p>Here is what i have and I wonder how this works and what it actually does.</p>
<pre><code>#define NUM 5
#define FTIMES(x)(x*5)
int main(void) {
int j = 1;
printf("%d %d\n", FTIMES(j+5), FTIMES((j+5)));
}
</code></pre>
<p>It produces two integers: 26 and 30.</p>
<p>How does it do that?</p>
| [
{
"answer_id": 480948,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 4,
"selected": false,
"text": "<p>The reason this happens is because your macro expands the print to:</p>\n\n<pre><code>printf(\"%d %d\\n\", j+5*... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is what i have and I wonder how this works and what it actually does.
```
#define NUM 5
#define FTIMES(x)(x*5)
int main(void) {
int j = 1;
printf("%d %d\n", FTIMES(j+5), FTIMES((j+5)));
}
```
It produces two integers: 26 and 30.
How does it do that? | The reason this happens is because your macro expands the print to:
```
printf("%d %d\n", j+5*5, (j+5)*5);
```
Meaning:
```
1+5*5 and (1+5)*5
``` |
480,942 | <p>I have this <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a> which runs however, while it is processing, it will randomly stop and require a user to hit the spacebar for it to display the rest of its ongoing output.</p>
<p>How do I figure out why this is happening?</p>
<p>Here... | [
{
"answer_id": 480953,
"author": "EBGreen",
"author_id": 1358,
"author_profile": "https://Stackoverflow.com/users/1358",
"pm_score": 0,
"selected": false,
"text": "<p>Well the first step is to remove any global On Error Resume Next statements. Better feedback would come if we could see t... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] | I have this [VBScript](http://en.wikipedia.org/wiki/VBScript) which runs however, while it is processing, it will randomly stop and require a user to hit the spacebar for it to display the rest of its ongoing output.
How do I figure out why this is happening?
Here is a copy of the script:
```
'On Error Resume Next
... | I was able to run your script several times without it pausing for input. Run your script with the `//X` flag to start it in the debugger:
```
>cscript //nologo //X dpadmin_copy2.vbs"
```
You should be able to then step through the code.
You can also start putting in `wscript.echo` trace statements everywhere and s... |
480,960 | <p>The median of five is sometimes used as an exercise in algorithm design and is known to be computable <strong>using only 6 comparisons</strong>.</p>
<p>What is the best way to implement this <strong>"median of five using 6 comparisons"</strong> in C# ? All of my attempts seem to result in awkward code :( I need nic... | [
{
"answer_id": 481029,
"author": "user50612",
"author_id": 50612,
"author_profile": "https://Stackoverflow.com/users/50612",
"pm_score": 3,
"selected": false,
"text": "<p>An interesting thread here:</p>\n<p><a href=\"http://www.ocf.berkeley.edu/%7Ewwu/cgi-bin/yabb/YaBB.cgi?board=riddles_... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12460/"
] | The median of five is sometimes used as an exercise in algorithm design and is known to be computable **using only 6 comparisons**.
What is the best way to implement this **"median of five using 6 comparisons"** in C# ? All of my attempts seem to result in awkward code :( I need nice and readable code while still usin... | This is basically just factoring out the swapping and sorting code from your C++ example:
```
private static void Swap(ref double a, ref double b) {
double t = a;
a = b;
b = t;
}
private static void Sort(ref double a, ref double b) {
if (a > b) {
double t = a;
a = b;
b = t;
... |
480,963 | <p>I know most of the java development tools for Eclipse will have a short-cut script for adding in JavaDoc blocks for needed elements (including the page-level).</p>
<p>Further, I know that PDT will allow you to "Generate Element Comment" for many things through the Source menu.</p>
<p>Is there an Eclipse plug-in ou... | [
{
"answer_id": 481042,
"author": "Jake McGraw",
"author_id": 302,
"author_profile": "https://Stackoverflow.com/users/302",
"pm_score": 3,
"selected": false,
"text": "<p>In PDT 1.3:</p>\n\n<p>Window > Preferences > PHP > Editor > Typing > Automatically close > Phpdoc and comment regions (... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1120343/"
] | I know most of the java development tools for Eclipse will have a short-cut script for adding in JavaDoc blocks for needed elements (including the page-level).
Further, I know that PDT will allow you to "Generate Element Comment" for many things through the Source menu.
Is there an Eclipse plug-in out there (or perha... | place your text cursor right above your function, class or whatever,
type /\*\* and press enter and you'll have a beginning of PHPDoc written.
Eg.
```
/**
*
* Enter description here ...
* @param unknown_type $book
* @param unknown_type $product
*/
```
You can then write `@` inside the comments, and use `@` fol... |
480,965 | <p>I have been creating a website with Ruby on Rails, and will be hosting it through a friend. He has the space and capacity to host the server, and I have a system to devote to being a dedicated server. And this is my first attempt at a Rails website, plus self-hosting with a friend.</p>
<p>I will be formatting and ... | [
{
"answer_id": 481010,
"author": "Todd",
"author_id": 53036,
"author_profile": "https://Stackoverflow.com/users/53036",
"pm_score": 1,
"selected": false,
"text": "<p>I've found the articles posted at Slicehost.com (a VPS hosting company) to be pretty helpful.</p>\n\n<p>The full list of a... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24950/"
] | I have been creating a website with Ruby on Rails, and will be hosting it through a friend. He has the space and capacity to host the server, and I have a system to devote to being a dedicated server. And this is my first attempt at a Rails website, plus self-hosting with a friend.
I will be formatting and preparing t... | **What build of Linux is most recommended for this configuration?**
Any of the distributions will work fine as long as they can run Apache2 (which is almost all of them) and you can install Passenger (along with ruby and rails).
I personally use CentOS and find its package manger to be ridiculously easy to use ([yum](... |
480,971 | <p>I have a couple of question for you..</p>
<p>Can I install on the same machine visual studio 2008 Professional and Team System ?</p>
<p>the reason is because with Team System already installed I receive an error when I work with ajax and jquery:</p>
<pre><code>Error 1 Error updating JScript IntelliSense: Clie... | [
{
"answer_id": 482230,
"author": "Jim Anderson",
"author_id": 42439,
"author_profile": "https://Stackoverflow.com/users/42439",
"pm_score": 1,
"selected": false,
"text": "<p>I would try to fix the JavaScript Intellisense. (If you have team system, I would try to use it). The <a href=\"ht... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59089/"
] | I have a couple of question for you..
Can I install on the same machine visual studio 2008 Professional and Team System ?
the reason is because with Team System already installed I receive an error when I work with ajax and jquery:
```
Error 1 Error updating JScript IntelliSense: Client-side script IntelliSense ... | I would try to fix the JavaScript Intellisense. (If you have team system, I would try to use it). The [Visual Web Developer Team blog](http://blogs.msdn.com/webdevtools/archive/2007/07/30/workaround-for-beta-2-javascript-intellisense-and-colorization-issue.aspx) has a fix for one (registry) problem that could cause thi... |
480,973 | <p>I have a method which is taking in a parameter that is a Interface object</p>
<p>like this</p>
<pre><code>private void SomeMethod(InterfaceA IUA)
</code></pre>
<p>Inside the method I have a statement like this</p>
<pre><code>ClassD someVar = (ClassD)(((ClassC)((ClassB)IUA)).D);
</code></pre>
<p>everything if fi... | [
{
"answer_id": 480978,
"author": "Joe Phillips",
"author_id": 20471,
"author_profile": "https://Stackoverflow.com/users/20471",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think it's necessary to cast IUA to ClassB. You're not using any of the ClassB methods as far as I can tel... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41685/"
] | I have a method which is taking in a parameter that is a Interface object
like this
```
private void SomeMethod(InterfaceA IUA)
```
Inside the method I have a statement like this
```
ClassD someVar = (ClassD)(((ClassC)((ClassB)IUA)).D);
```
everything if fine and dandy. However, in certain cases the object IUA m... | You *really* shouldn't be writing code like this without good reason.
That said: you can use `is`
```
if (a is ClassB)
{
ClassB b = (ClassB)a;
}
else if (a is ClassZ)
{
ClassZ z = (ClassZ)a;
}
```
...or `as`:
```
ClassB b = a as ClassB;
if (b != null)
{
// ...
}
``` |
480,975 | <p>This should be easy for a pro:</p>
<p>I am using JSF/Facelets/Seam and am trying to display radiobuttons. Then, after the user has clicked on one of the buttons, the value should be saved and the user redirected to another page immediately (i.e. with no needed click on a submit button).</p>
<p>The radio button wor... | [
{
"answer_id": 482548,
"author": "Romain Linsolas",
"author_id": 26457,
"author_profile": "https://Stackoverflow.com/users/26457",
"pm_score": 3,
"selected": false,
"text": "<p>You can indeed use Richfaces to add an <a href=\"http://livedemo.exadel.com/richfaces-demo/richfaces/support.js... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This should be easy for a pro:
I am using JSF/Facelets/Seam and am trying to display radiobuttons. Then, after the user has clicked on one of the buttons, the value should be saved and the user redirected to another page immediately (i.e. with no needed click on a submit button).
The radio button works, but not the f... | You can indeed use Richfaces to add an [a4j:support component](http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf):
```
<h:selectOneRadio value="#{myBean.myValue}" ...>
...
<a4j:support event="onclick" action="#{myBean.doSomething}"/>
</h:selectOneRadio>
```
In your Java code:
```
public String... |
480,979 | <p>This is a followup question to this question:</p>
<p><a href="https://stackoverflow.com/questions/480735/select-all-contents-of-textbox-when-it-receives-focus-javascript-or-jquery">select all contents of textbox when it receives focus (Javascript or jQuery)</a></p>
<p>Basically I am using a textbox in conjunction ... | [
{
"answer_id": 481101,
"author": "user59100",
"author_id": 59100,
"author_profile": "https://Stackoverflow.com/users/59100",
"pm_score": 2,
"selected": false,
"text": "<p>Hey Jon, not too sure about the performance of this, but this should work:</p>\n\n<pre><code> $(function() {\n\n\n... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1950/"
] | This is a followup question to this question:
[select all contents of textbox when it receives focus (Javascript or jQuery)](https://stackoverflow.com/questions/480735/select-all-contents-of-textbox-when-it-receives-focus-javascript-or-jquery)
Basically I am using a textbox in conjunction with the [jQuery masked inpu... | I'm the author of the [Masked Input Plugin](http://digitalbush.com/projects/masked-input-plugin/) for jQuery. I decided that this should be the default behavior for completed masks and I got it into the latest release. You can read the details [here](http://digitalbush.com/2009/03/10/masked-input-plugin-122/) |
480,991 | <p>I need help running a stored procedure from SQL Server in PHP. PHP is running on a Unix/Linux server. We cannot get OUTPUT variables to return in PHP. The following is the PHP code:</p>
<pre><code>$conn = mssql_connect('server', 'user', 'pass');
mssql_select_db('db', $conn);
$procedure = mssql_init('usp... | [
{
"answer_id": 481011,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 0,
"selected": false,
"text": "<p>I doubt this is causing your problem, but why are you using <code>DISTINCT</code>?</p>\n\n<p>That's just a codesmell ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/480991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22475/"
] | I need help running a stored procedure from SQL Server in PHP. PHP is running on a Unix/Linux server. We cannot get OUTPUT variables to return in PHP. The following is the PHP code:
```
$conn = mssql_connect('server', 'user', 'pass');
mssql_select_db('db', $conn);
$procedure = mssql_init('usp_StoredProc', $co... | According to [this page on PHP bugs](http://bugs.php.net/bug.php?id=21089), you have to (emphasis mine):
>
> call `mssql_next_result()` for each
> result set returned by the SP. This
> way you can handle multiple results.
>
>
> **When `mssql_next_result()` returns false
> you will have access to output
> parame... |
481,041 | <p>I am making a CSS file for an XML document. I need to insert an image - the filename of which is contained inside an element.</p>
<p>This is part of the xml code I am referring to:</p>
<pre><code><description>
<text> Club Praia is divided and linked by a foot bridge over the main street which runs
... | [
{
"answer_id": 481078,
"author": "dacracot",
"author_id": 13930,
"author_profile": "https://Stackoverflow.com/users/13930",
"pm_score": 0,
"selected": false,
"text": "<p>You can definitely do this using XSLT, but if there is a pure CSS solution, I would love to see it too.</p>\n"
},
... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58433/"
] | I am making a CSS file for an XML document. I need to insert an image - the filename of which is contained inside an element.
This is part of the xml code I am referring to:
```
<description>
<text> Club Praia is divided and linked by a foot bridge over the main street which runs
through the heart of Praia Da ... | This will probably be possible with [CSS3 named strings](http://www.w3.org/TR/2003/WD-css3-content-20030514/#strings). However, this spec is not even halfway finished, so I'd recommend you go with XSLT. |
481,058 | <p>I am a beginner SQL user (not formally trained; OJT only) and need some assistance with a simple update statement. I would like to write an update statement that allows me to list ID's. The statement shown below is how I am currently writing it. Ideally, the statement would allow me to write it like "where plantu... | [
{
"answer_id": 481062,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 4,
"selected": true,
"text": "<p>Can this work?</p>\n\n<pre><code>update plantfunctiontable set decommissioned=1 where plantunitid between 49 and 57\n</... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59097/"
] | I am a beginner SQL user (not formally trained; OJT only) and need some assistance with a simple update statement. I would like to write an update statement that allows me to list ID's. The statement shown below is how I am currently writing it. Ideally, the statement would allow me to write it like "where plantunitid ... | Can this work?
```
update plantfunctiontable set decommissioned=1 where plantunitid between 49 and 57
``` |
481,073 | <p>Where does eclipse keep it's key-binding settings? I want to transfer them from one system to another. If there is a tool for this that would be good but if not, I'm willing to copy files (really all settings should be the same on both systems.)</p>
| [
{
"answer_id": 481133,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 4,
"selected": false,
"text": "<p>Export: File -> Export -> General -> Preferences -> Keys Preferences</p>\n\n<p>Import: File -> Import -> General -> Prefe... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | Where does eclipse keep it's key-binding settings? I want to transfer them from one system to another. If there is a tool for this that would be good but if not, I'm willing to copy files (really all settings should be the same on both systems.) | export all your Eclipse prefs to a file.
```
File->Export->General->Preferences
```
Import has an option to import only key settings from this file.
```
File->Import->General->Preferences
``` |
481,076 | <p>I have a document with headings and unordered lists.</p>
<p>How can I use JQuery to select a given heading (by its unique class name) AND all content between that heading and the next heading?</p>
<h3>Update:</h3>
<p>Your suggestions are great, but aren't what I'm looking for. In the below code, for example, I would... | [
{
"answer_id": 481190,
"author": "Ricardo Vega",
"author_id": 53246,
"author_profile": "https://Stackoverflow.com/users/53246",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe, with</p>\n\n<pre><code>$(selectorForFirstHeading).nextAll().not(selectorForLastHeading).text()\n</code></pr... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32242/"
] | I have a document with headings and unordered lists.
How can I use JQuery to select a given heading (by its unique class name) AND all content between that heading and the next heading?
### Update:
Your suggestions are great, but aren't what I'm looking for. In the below code, for example, I would like to access onl... | Two methods in particular would be very useful solving this problem: [`.nextUntil`](http://api.jquery.com/nextUntil/), and [`.andSelf`](http://api.jquery.com/andSelf/). The first will grab all of the siblings following your selector, and the latter will lump in whatever is matched by your selector as well, giving you o... |
481,110 | <p>I have the following Django and Flex code:</p>
<p><strong>Django</strong></p>
<pre><code>class Author(models.Model):
name = models.CharField(max_length=30)
class Book(models.Model):
title = models.CharField(max_length=30)
author = models.ForeignKeyField(Author)
</code></pre>
<p><strong>Flex</strong></p>
<... | [
{
"answer_id": 481195,
"author": "Jim Carroll",
"author_id": 35922,
"author_profile": "https://Stackoverflow.com/users/35922",
"pm_score": 0,
"selected": false,
"text": "<p>when you get your book from the database, try using select_related()</p>\n\n<p>which is way down on this page:<br>\... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10040/"
] | I have the following Django and Flex code:
**Django**
```
class Author(models.Model):
name = models.CharField(max_length=30)
class Book(models.Model):
title = models.CharField(max_length=30)
author = models.ForeignKeyField(Author)
```
**Flex**
```
package com.myproject.models.vo
{
[Bindable]
[Remote... | Ok, Here's an example...
Model:
```
class Logger(models.Model):
lname = models.CharField(max_length=80)
def __unicode__(self):
return self.lname
#
#
class DataSource(models.Model):
dsname = models.CharField(max_length=80)
def __unicode__(self):
return self.dsname
#
#
class ... |
481,119 | <p>So, I have this situation where I need to see if an object is in my stl map. If it isn't, I am going to add it.</p>
<pre><code>char symbolName[] = { 'H', 'e', 'l', 'l', 'o', '\0' };
map<string,TheObject> theMap;
if (theMap.find(symbolName)==theMap.end()) {
TheObject theObject(symbolName);
... | [
{
"answer_id": 481147,
"author": "Igor",
"author_id": 44673,
"author_profile": "https://Stackoverflow.com/users/44673",
"pm_score": 1,
"selected": false,
"text": "<p>This code should work fine.</p>\n\n<p>The only possible problem is inside TheObject implementation, but it shouldn't affec... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45581/"
] | So, I have this situation where I need to see if an object is in my stl map. If it isn't, I am going to add it.
```
char symbolName[] = { 'H', 'e', 'l', 'l', 'o', '\0' };
map<string,TheObject> theMap;
if (theMap.find(symbolName)==theMap.end()) {
TheObject theObject(symbolName);
theMap.insert(pa... | It can crash because of many reasons. Without knowing the definition of at least `TheObject`'s constructors, i think we are largely left to guess at the problem. So far, your code looks fine, but it can be simplified:
```
char symbolName[] = "Hello";
map<string,TheObject> theMap;
theMap.insert(make_pair(symbolName, Th... |
481,122 | <p>Does something like this affect performance badly?</p>
<pre><code>var myQuery = from c in Customers select c;
var filter1 = from c in myQuery where c.ID > 2 select c;
myQuery = filter1;
var filter2 = from c in myQuery where c.Name.Contains("r") select c;
myQuery = filter2;
</code></pre>
<p>When I do this it... | [
{
"answer_id": 481129,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>No, it won't execute any queries until you start to actually ask for results. Building up queries this way is fine, a... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32892/"
] | Does something like this affect performance badly?
```
var myQuery = from c in Customers select c;
var filter1 = from c in myQuery where c.ID > 2 select c;
myQuery = filter1;
var filter2 = from c in myQuery where c.Name.Contains("r") select c;
myQuery = filter2;
```
When I do this it seems to only do the actual ... | I would look at using Extension methods to construct the query dynamically. I think that it will do exactly what you need to do. And, yes, the query isn't actually evaluated until an operation is performed that needs results so combining them does not necessarily result in additional trips to the database.
```
var que... |
481,125 | <p>When I specify a <code>height</code> in the style for any element inside of this, IE makes the entire thing 100% width, rather than keeping it "autosized" for width.</p>
<p>Other browsers display it fine, but not IE. How do I fix this?</p>
<pre><code><div style="position:absolute;top:50px;left:50px;background:... | [
{
"answer_id": 481139,
"author": "Akrikos",
"author_id": 54641,
"author_profile": "https://Stackoverflow.com/users/54641",
"pm_score": 2,
"selected": true,
"text": "<p>Here's something that may work for you. It's a little hacky, but if you're trying to find a good width for some text, t... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58249/"
] | When I specify a `height` in the style for any element inside of this, IE makes the entire thing 100% width, rather than keeping it "autosized" for width.
Other browsers display it fine, but not IE. How do I fix this?
```
<div style="position:absolute;top:50px;left:50px;background:green;">
<div>
<div>test</div>
... | Here's something that may work for you. It's a little hacky, but if you're trying to find a good width for some text, this is the only way besides javascript that I know of. We're basically forcing the width by not allowing the line to break. You can put in `<br/>`s if you need line breaks.
```
<div style="position:ab... |
481,138 | <p>I have a website I've built in VS2005, C#, .NET 2.0. This website does transactions against an Access database. It works fine in development. The mdb file resides in App_Data</p>
<p>I have setup IIS on this machine to test the website as it would be deployed. I published the site to my IIS virtual directory. All we... | [
{
"answer_id": 481154,
"author": "H-Man2",
"author_id": 43814,
"author_profile": "https://Stackoverflow.com/users/43814",
"pm_score": 2,
"selected": true,
"text": "<p>The user (impersonated or the asp user) must have the permission to create files in the directory because Access creates ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53409/"
] | I have a website I've built in VS2005, C#, .NET 2.0. This website does transactions against an Access database. It works fine in development. The mdb file resides in App\_Data
I have setup IIS on this machine to test the website as it would be deployed. I published the site to my IIS virtual directory. All went well. ... | The user (impersonated or the asp user) must have the permission to create files in the directory because Access creates a .ldb file.
Other possible reasons are described [in the MS Knowledgebase](http://support.microsoft.com/?scid=kb%3Ben-us%3B175168&x=10&y=8)
**UPDATE:**
Did you check the effective permissions? May... |
481,142 | <p>i have a bit of aspx code that uses Eval to generate a call to a javascript function:</p>
<p><strong>ASP.NET (wrapped for readability):</strong></p>
<pre><code><asp:LinkButton runat="server"
OnClientClick='<%# Eval(
"NodeGUID",
"return DoStuff(this, \"{0}\");") %>'
Text="Do stuff"... | [
{
"answer_id": 481199,
"author": "Robert C. Barth",
"author_id": 9209,
"author_profile": "https://Stackoverflow.com/users/9209",
"pm_score": 1,
"selected": false,
"text": "<p>If the LinkButton is not inside some other thing (like a grid), just set the OnClientClick attribute in the code-... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | i have a bit of aspx code that uses Eval to generate a call to a javascript function:
**ASP.NET (wrapped for readability):**
```
<asp:LinkButton runat="server"
OnClientClick='<%# Eval(
"NodeGUID",
"return DoStuff(this, \"{0}\");") %>'
Text="Do stuff" />
```
this generates javascript similar... | The trick isn't to pass multiple items to an eval, but to pass multiple eval's to whatever you want to use to format the data. You could also have just done it this way - which would have kept the presentation in the aspx file like you wanted...
```
<asp:LinkButton
runat="server"
OnClientClick='<%# string.Form... |
481,157 | <p>I have a report that I created with Crystal Reports 2008. This report uses upwards of 40 parameters to control the layout of the report. All the parameters are boolean and are defaulted to False in the saved report. The report is saved with the save data with the report option <strong>unchecked</strong> as I want... | [
{
"answer_id": 482326,
"author": "Philippe Grondier",
"author_id": 11436,
"author_profile": "https://Stackoverflow.com/users/11436",
"pm_score": 0,
"selected": false,
"text": "<p>This one will not be easy to solve! </p>\n\n<p>What about giving default values to all your parameters before... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19977/"
] | I have a report that I created with Crystal Reports 2008. This report uses upwards of 40 parameters to control the layout of the report. All the parameters are boolean and are defaulted to False in the saved report. The report is saved with the save data with the report option **unchecked** as I want to read the result... | When you have Save Data with Report selected the report does not try to hit the database. It's a static report with saved data. That's why this report doesn't error compared to when you try to pass parameters without saved data.
The error suggests that one or more of the parameter values you're passing at runtime does... |
481,158 | <p>I'm developing a website in PHP and I have large JS files that I want to compress. So, I added this in my .htaccess file: </p>
<pre><code> <FilesMatch "\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
</code></pre>
<p>It works great on my local wamp server install but once I move... | [
{
"answer_id": 481207,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 4,
"selected": true,
"text": "<p>Are you sure mod_deflate is loaded and available? Apache doesn’t throw an error if you set it as filter although it is not... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56409/"
] | I'm developing a website in PHP and I have large JS files that I want to compress. So, I added this in my .htaccess file:
```
<FilesMatch "\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
```
It works great on my local wamp server install but once I move the files on my shared server, the DE... | Are you sure mod\_deflate is loaded and available? Apache doesn’t throw an error if you set it as filter although it is not loaded.
You can use the [`apache_get_modules` function](http://docs.php.net/apache_get_modules) to see what modules are loaded. |
481,175 | <p>I have a List of a "complex" type - an object with a few string properties. The List itself is a property of another object and contains objects of a variety of types, as shown in this abbreviated class structure: </p>
<pre><code>Customer {
public List<Characteristic> Characteristics;
.
.
.
}
Cha... | [
{
"answer_id": 481208,
"author": "Ricardo Villamil",
"author_id": 19314,
"author_profile": "https://Stackoverflow.com/users/19314",
"pm_score": 0,
"selected": false,
"text": "<p>Why not create a <code>Dictionary<string, List<string>></code>, that way you can add \"Interest\" ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8151/"
] | I have a List of a "complex" type - an object with a few string properties. The List itself is a property of another object and contains objects of a variety of types, as shown in this abbreviated class structure:
```
Customer {
public List<Characteristic> Characteristics;
.
.
.
}
Characteristic {
pub... | Here's a generator implementation
```
public static IEnumerable<string> GetInterests(Customer customer)
{
foreach (Characteristic c in customer.Characteristics)
{
if (c.CharacteristicType == "Interest")
yield return c.CharacteristicValue;
}
}
```
sadly 3.5 extension methods and lambda... |
481,179 | <p>I'm working on a bug reporting tool for my application, and I'd like to attach hardware information to bug reports to make pinpointing certain problems easier. Does anyone know of any Win32 API functions to query the OS for information on the graphics and sound cards?</p>
<p>Thanks,
Rob</p>
| [
{
"answer_id": 481265,
"author": "Geoff",
"author_id": 55487,
"author_profile": "https://Stackoverflow.com/users/55487",
"pm_score": 0,
"selected": false,
"text": "<p>I think your best bet is the DirectSound API, documented here:\n<a href=\"http://msdn.microsoft.com/en-us/library/bb21983... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm working on a bug reporting tool for my application, and I'd like to attach hardware information to bug reports to make pinpointing certain problems easier. Does anyone know of any Win32 API functions to query the OS for information on the graphics and sound cards?
Thanks,
Rob | If your willing to dig into WMI the following should get you started.
```
using System;
using System.Management;
namespace WMIData
{
class Program
{
static void Main(string[] args)
{
SelectQuery querySound = new SelectQuery("Win32_SoundDevice");
ManagementObjectSearcher... |
481,191 | <p>I've been programming for the Web for quite some time now, but have only just recently discovered a few new intricacies regarding the use of functions and the weird (or so I view them as) things you can do with them. However, they seem at this point only to be syntactically pretty things. I was hoping somebody might... | [
{
"answer_id": 481215,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 3,
"selected": false,
"text": "<p>What you're basically asking is <em>How can I use functions as first-class objects?</em></p>\n\n<p>The biggest and most c... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59107/"
] | I've been programming for the Web for quite some time now, but have only just recently discovered a few new intricacies regarding the use of functions and the weird (or so I view them as) things you can do with them. However, they seem at this point only to be syntactically pretty things. I was hoping somebody might en... | What you're basically asking is *How can I use functions as first-class objects?*
The biggest and most common usage is closures (or anonymous functions) for event handling. However, just because you can be clever, it doesn't mean you should. Write clear, readable code just as you would in any other language.
Oh, and ... |
481,196 | <p>As part of a numerical library test I need to choose base 10 decimal numbers that can be represented exactly in base 2. How do you detect in C++ if a base 10 decimal number can be represented exactly in base 2?</p>
<p>My first guess is as follows:</p>
<pre><code>bool canBeRepresentedInBase2(const double &pNumb... | [
{
"answer_id": 481227,
"author": "rmeador",
"author_id": 10861,
"author_profile": "https://Stackoverflow.com/users/10861",
"pm_score": 2,
"selected": false,
"text": "<p>If you're checking to see if it's binary, it will always return true. If your method takes a <code>double</code> as th... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51358/"
] | As part of a numerical library test I need to choose base 10 decimal numbers that can be represented exactly in base 2. How do you detect in C++ if a base 10 decimal number can be represented exactly in base 2?
My first guess is as follows:
```
bool canBeRepresentedInBase2(const double &pNumberInBase10)
{
//check... | I think what you are looking for is a number which has a fractional portion which is the sum of a sequence of negative powers of 2 (aka: 1 over a power of 2). I believe this should always be able to be represented exactly in IEEE floats/doubles.
For example:
0.375 = (1/4 + 1/8) which should have an exact representati... |
481,211 | <p>Where I work we're still on .Net 2.0, but I'm somewhat familiar with the 3.0/3.5 stuff. I wanted to get some practice using linq/lambda expression in C# so I wrote a simple Sudoku solver using a lot of generic <code>List<T></code> and lambda expressions with the aggregate methods it provides.</p>
<p>In my so... | [
{
"answer_id": 481227,
"author": "rmeador",
"author_id": 10861,
"author_profile": "https://Stackoverflow.com/users/10861",
"pm_score": 2,
"selected": false,
"text": "<p>If you're checking to see if it's binary, it will always return true. If your method takes a <code>double</code> as th... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | Where I work we're still on .Net 2.0, but I'm somewhat familiar with the 3.0/3.5 stuff. I wanted to get some practice using linq/lambda expression in C# so I wrote a simple Sudoku solver using a lot of generic `List<T>` and lambda expressions with the aggregate methods it provides.
In my solver, I have this at the top... | I think what you are looking for is a number which has a fractional portion which is the sum of a sequence of negative powers of 2 (aka: 1 over a power of 2). I believe this should always be able to be represented exactly in IEEE floats/doubles.
For example:
0.375 = (1/4 + 1/8) which should have an exact representati... |
481,282 | <p>I need a Perl regular expression to match a string. I'm assuming only double-quoted strings, that a \" is a literal quote character and NOT the end of the string, and that a \ is a literal backslash character and should not escape a quote character. If it's not clear, some examples:</p>
<pre><code>"\"" # string ... | [
{
"answer_id": 481294,
"author": "Cal",
"author_id": 59120,
"author_profile": "https://Stackoverflow.com/users/59120",
"pm_score": 6,
"selected": true,
"text": "<p>How about this?</p>\n\n<pre><code>/\"([^\\\\\"]|\\\\\\\\|\\\\\")*\"/\n</code></pre>\n\n<p>matches zero or more characters th... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58897/"
] | I need a Perl regular expression to match a string. I'm assuming only double-quoted strings, that a \" is a literal quote character and NOT the end of the string, and that a \ is a literal backslash character and should not escape a quote character. If it's not clear, some examples:
```
"\"" # string is 1 character... | How about this?
```
/"([^\\"]|\\\\|\\")*"/
```
matches zero or more characters that aren't slashes or quotes OR two slashes OR a slash then a quote |
481,289 | <p>EDIT: now the question becomes, how do I tell Sajax to use POST instead of GET? I've tried some examples from google but they are sketchy, and as I said, they didn't work. I know, we're all jQuery nuts around here.</p>
<p>I've used the following code to try and find a limit to the amount of data that can be sent ... | [
{
"answer_id": 481299,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 0,
"selected": false,
"text": "<p>If you're using GET, there's no defined limit. It depends on both the browser making the request and the server receiving... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57625/"
] | EDIT: now the question becomes, how do I tell Sajax to use POST instead of GET? I've tried some examples from google but they are sketchy, and as I said, they didn't work. I know, we're all jQuery nuts around here.
I've used the following code to try and find a limit to the amount of data that can be sent to the serve... | GET is limited in IE to 2083 chars see <http://support.microsoft.com/kb/208427>
See [here](https://stackoverflow.com/questions/179264/what-is-the-optimum-limit-for-url-length-100-200) for url length for discussion. |
481,305 | <p>Visual Studio complains: <strong>Warning 1 The designer must create an instance of type 'RentalEase.CustomBindingNavForm' but it cannot because the type is declared as abstract.</strong> </p>
<p>Visual Studio won't let me access the Designer for the form. The class already implements all abstract methods from... | [
{
"answer_id": 2406754,
"author": "Allen Rice",
"author_id": 49885,
"author_profile": "https://Stackoverflow.com/users/49885",
"pm_score": 6,
"selected": true,
"text": "<p>I haven't seen the content at urban potato (its down) but Me and <a href=\"https://stackoverflow.com/users/245808/sm... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | Visual Studio complains: **Warning 1 The designer must create an instance of type 'RentalEase.CustomBindingNavForm' but it cannot because the type is declared as abstract.**
Visual Studio won't let me access the Designer for the form. The class already implements all abstract methods from the CustomBindingNavForm. Cu... | I haven't seen the content at urban potato (its down) but Me and [Smelch](https://stackoverflow.com/users/245808/smelch) came up with a solution. **`Form` itself inherits from an abstract class, so** what they dont tell you is that **its only the 1st level of inheritance that can't be abstract, the 2nd on down can.**
... |
481,308 | <p>When my ASP.NET page does a postback in IE7, all the CSS is lost. I am not using Themes and are including the CSS from the Masterpage in code behind.</p>
<pre><code> protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
AddStylesheetInclude("/static/css/global.css");
AddStylesheetInc... | [
{
"answer_id": 481373,
"author": "TStamper",
"author_id": 39809,
"author_profile": "https://Stackoverflow.com/users/39809",
"pm_score": 2,
"selected": true,
"text": "<p>After doing more research on your problem I found out the reason is doesn't work with the link is because (<a href=\"ht... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | When my ASP.NET page does a postback in IE7, all the CSS is lost. I am not using Themes and are including the CSS from the Masterpage in code behind.
```
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
AddStylesheetInclude("/static/css/global.css");
AddStylesheetInclude("/static/css/sifr.... | After doing more research on your problem I found out the reason is doesn't work with the link is because (<http://www.broken-links.com/2007/02/15/ie7-and-import-media-types/> )IE7 isn't compatible with @import. Which is kind of a good thing, because IE7 fixed the '!important' and '\* html' debugging hacks, so without ... |
481,334 | <p>In C# I have a use case where I have a mapping from <code>int</code>s to collections.</p>
<ul>
<li>the <code>int</code>s are a dense (but not packed) set from 1 to n where n is not known.</li>
<li>The cells will be loaded in random order.</li>
<li>the marginal cost of each cell should be ideal (as good as a <code>L... | [
{
"answer_id": 481350,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>A <code>Dictionary<int, Cell></code> sounds like a good match to me. Or you could use a <code>List<Cell></... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | In C# I have a use case where I have a mapping from `int`s to collections.
* the `int`s are a dense (but not packed) set from 1 to n where n is not known.
* The cells will be loaded in random order.
* the marginal cost of each cell should be ideal (as good as a `List<T>` or `T[]`)
* I'd like to have the cells default ... | A `Dictionary<int, Cell>` sounds like a good match to me. Or you could use a `List<Cell>` quite easily, and just make sure that you expand it where necessary:
```
public static void EnsureCount<T>(List<T> list, int count)
{
if (list.Count > count)
{
return;
}
if (list.Capacity < count)
{
... |
481,344 | <p>In my assembly language class, our first assignment was to write a program to print out a simple dollar-terminated string in DOS. It looked something like this:</p>
<pre><code>BITS 32
global _main
section .data
msg db "Hello, world!", 13, 10, ’$’
section .text
_main:
mov ah, 9
mov edx, msg
int 21h
ret
</... | [
{
"answer_id": 481368,
"author": "Calyth",
"author_id": 45144,
"author_profile": "https://Stackoverflow.com/users/45144",
"pm_score": -1,
"selected": false,
"text": "<p>Um. You could write assembly that would taken into account for escaped <code>$</code>, e.g. <code>\\$</code>?\nBut then... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | In my assembly language class, our first assignment was to write a program to print out a simple dollar-terminated string in DOS. It looked something like this:
```
BITS 32
global _main
section .data
msg db "Hello, world!", 13, 10, ’$’
section .text
_main:
mov ah, 9
mov edx, msg
int 21h
ret
```
As I unders... | You can't use DOS's `0x09` service to display `$` signs, you'll need to use `0x02`. See [here](http://spike.scu.edu.au/~barry/interrupts.html#ah02). |
481,351 | <p>Are there any documents/tutorials on how to clip or cut a large image so that the user only sees a small portion of this image? Let's say the source image is 10 frames of animation, stacked end-on-end so that it's really wide. What could I do with Javascript to only display 1 arbitrary frame of animation at a time... | [
{
"answer_id": 481386,
"author": "ForYourOwnGood",
"author_id": 48728,
"author_profile": "https://Stackoverflow.com/users/48728",
"pm_score": 0,
"selected": false,
"text": "<p>The width/height properties of the document's image object are read only. If you could change them, however, you... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1471/"
] | Are there any documents/tutorials on how to clip or cut a large image so that the user only sees a small portion of this image? Let's say the source image is 10 frames of animation, stacked end-on-end so that it's really wide. What could I do with Javascript to only display 1 arbitrary frame of animation at a time?
I'... | This can be done by enclosing your image in a "viewport" div. Set a width and height on the div (according to your needs), then set `position: relative` and `overflow: hidden` on it. Absolutely position your image inside of it and change the position to change which portions are displayed.
To display a 30x40 section o... |
481,356 | <p>I've got a simple function like this:</p>
<pre><code> function CreateFileLink()
{
global $Username;
return date("d-m-y-g-i");
}
</code></pre>
<p>How do you write code to test a function like that where the return data is variable?</p>
| [
{
"answer_id": 481367,
"author": "cbrulak",
"author_id": 29505,
"author_profile": "https://Stackoverflow.com/users/29505",
"pm_score": 0,
"selected": false,
"text": "<p>Well, if you use a unit test, you know which day, month and year you are testing the function. </p>\n\n<p>So, call the ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46782/"
] | I've got a simple function like this:
```
function CreateFileLink()
{
global $Username;
return date("d-m-y-g-i");
}
```
How do you write code to test a function like that where the return data is variable? | You could test it if you could somehow get control over that date() function. For example, in this case, you only care that the date function is being called with "d-m-y-g-i"; you don't really care about the output of it. Maybe something like:
```
function CreateFileLink(DateProvider dateProvider)
{
global $Us... |
481,372 | <p>I'm new to jQueryUI and I think I am overlooking something very basic...</p>
<h3>Quick description of my problem</h3>
<p>I used <a href="http://ui.jquery.com/themeroller" rel="nofollow noreferrer">ThemeRoller</a> to download a jQueryUI theme, which also generates a jQueryUI javascript file. I'd rather use the fil... | [
{
"answer_id": 481442,
"author": "Birk",
"author_id": 56692,
"author_profile": "https://Stackoverflow.com/users/56692",
"pm_score": 0,
"selected": false,
"text": "<p>I had a similar problem the other day when I lost my wireless signal for a moment. Are you sure you had access to Google?... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] | I'm new to jQueryUI and I think I am overlooking something very basic...
### Quick description of my problem
I used [ThemeRoller](http://ui.jquery.com/themeroller) to download a jQueryUI theme, which also generates a jQueryUI javascript file. I'd rather use the file hosted at Google (`http://ajax.googleapis.com/ajax/... | Replicated your setup here.. Themeroller supplied you with `jQuery UI 1.6rc5`, whereas the Google version you're refering seems to be a different version (`1.5.3`?).. Could this be the source of your problem? |
481,385 | <p>What is the best way to handle several different onload scripts spread across many pages?</p>
<p>For example, I have 50 different pages, and on each page I want to set a different button click handler when the dom is ready.</p>
<p>Is it best to set onclicks like this on each individual page,</p>
<pre>
<a id="l... | [
{
"answer_id": 481408,
"author": "cgreeno",
"author_id": 6088,
"author_profile": "https://Stackoverflow.com/users/6088",
"pm_score": 1,
"selected": false,
"text": "<p>I would use <a href=\"http://docs.jquery.com/How_jQuery_Works\" rel=\"nofollow noreferrer\">JQuery's</a> <em>document rea... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191/"
] | What is the best way to handle several different onload scripts spread across many pages?
For example, I have 50 different pages, and on each page I want to set a different button click handler when the dom is ready.
Is it best to set onclicks like this on each individual page,
```
<a id="link1" href="#" onclick="m... | Have you thought about making a class for each type of behavior you'd like to attach to an element? That way you could reuse functionality between pages, just in case there was overlap.
For example, let's say that on some of the pages you want to a have button that pops up some extra information on the page. Your htm... |
481,395 | <p>I have seen various methods used when retrieving the value of a primary key identity field after insert.</p>
<pre><code>declare @t table (
id int identity primary key,
somecol datetime default getdate()
)
insert into @t
default values
select SCOPE_IDENTITY() --returns 1
select @@IDENTITY --returns 1
</code... | [
{
"answer_id": 481412,
"author": "Seibar",
"author_id": 357,
"author_profile": "https://Stackoverflow.com/users/357",
"pm_score": 2,
"selected": false,
"text": "<p>There is another method available in SQL Server 2005 that is outlined <a href=\"http://sqlinthewild.co.za/index.php/2008/12/... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] | I have seen various methods used when retrieving the value of a primary key identity field after insert.
```
declare @t table (
id int identity primary key,
somecol datetime default getdate()
)
insert into @t
default values
select SCOPE_IDENTITY() --returns 1
select @@IDENTITY --returns 1
```
Returning a ta... | It depends on what you are trying to do...
@@IDENTITY
Returns the last IDENTITY value produced on a connection, regardless of the table that produced the value, and regardless of the scope of the statement that produced the value.
@@IDENTITY will return the last identity value entered into a table in your current ses... |
481,416 | <p>I'm having a rough time with this membership stuff. </p>
<p>OK, so, it's really odd. I can register a user. I can register, I can login. However, when I go to register ANOTHER user the user isn't saved in the database and I get a
Membership credential verification failed event when the user tries to login (I assum... | [
{
"answer_id": 481441,
"author": "Kon",
"author_id": 22303,
"author_profile": "https://Stackoverflow.com/users/22303",
"pm_score": 0,
"selected": false,
"text": "<p>My first guess is that <code>ValidatePage()</code> return false.</p>\n"
},
{
"answer_id": 481470,
"author": "GE... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] | I'm having a rough time with this membership stuff.
OK, so, it's really odd. I can register a user. I can register, I can login. However, when I go to register ANOTHER user the user isn't saved in the database and I get a
Membership credential verification failed event when the user tries to login (I assume because ... | Have you checked to see this is not a problem with password complexity? I know I have had issues with this in the past... |
481,433 | <p>I've got an AS3 SWF that I'm going to be loading other SWFs into. These child SWFs all take a single parameter on the URL. I can't seem to get it working when loading an AS2 child, and it needs to be able to handle both. </p>
<p>so I have </p>
<pre><code>var request:URLRequest = new URLRequest();
var loader:URLLoa... | [
{
"answer_id": 481513,
"author": "ForYourOwnGood",
"author_id": 48728,
"author_profile": "https://Stackoverflow.com/users/48728",
"pm_score": -1,
"selected": false,
"text": "<p>You are doing it wrong.</p>\n\n<p>\"<a href=\"http://domain/as2.swf?param=foo\" rel=\"nofollow noreferrer\">htt... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8349/"
] | I've got an AS3 SWF that I'm going to be loading other SWFs into. These child SWFs all take a single parameter on the URL. I can't seem to get it working when loading an AS2 child, and it needs to be able to handle both.
so I have
```
var request:URLRequest = new URLRequest();
var loader:URLLoader = new URLLoader()... | It's not trivial to communicate between AS2 and AS3 since they run in different virtual machines. Check this <http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html> for some hints.
Edit: If you cannot change the loaded as2 content your only options is creating a 'wrapper' as2 loader that uses the linked e... |
481,444 | <p>We have a hosted site that has a CMS we built running on a LAMP stack. We noticed that when you save HTML that has a tag embedded in the HTML the request immediately dies. This does not occur on the staging or local development instances of the CMS, so I'm assuming its a server configuration issue. Any ideas what m... | [
{
"answer_id": 481515,
"author": "Eduard Wirch",
"author_id": 17428,
"author_profile": "https://Stackoverflow.com/users/17428",
"pm_score": 0,
"selected": false,
"text": "<p>Since you have system where this error does not appear it is a configuration error.\nFind the difference between t... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59136/"
] | We have a hosted site that has a CMS we built running on a LAMP stack. We noticed that when you save HTML that has a tag embedded in the HTML the request immediately dies. This does not occur on the staging or local development instances of the CMS, so I'm assuming its a server configuration issue. Any ideas what might... | I've had similar problems caused by apaches mod\_security. If you have mod\_security enabled on the server, you can try something like this (in a .htaccess file):
```
<IfModule mod_security.c>
SecFilterEngine Off
</IfModule>
``` |
481,446 | <p>Is there an elegant way to handle exceptions that are thrown in <code>finally</code> block? </p>
<p>For example:</p>
<pre><code>try {
// Use the resource.
}
catch( Exception ex ) {
// Problem with the resource.
}
finally {
try{
resource.close();
}
catch( Exception ex ) {
// Could not close t... | [
{
"answer_id": 481473,
"author": "Pierre",
"author_id": 58082,
"author_profile": "https://Stackoverflow.com/users/58082",
"pm_score": 2,
"selected": false,
"text": "<p>One solution, if the two Exceptions are two different classes</p>\n\n<pre><code>try {\n ...\n }\ncatch(package1.Ex... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59137/"
] | Is there an elegant way to handle exceptions that are thrown in `finally` block?
For example:
```
try {
// Use the resource.
}
catch( Exception ex ) {
// Problem with the resource.
}
finally {
try{
resource.close();
}
catch( Exception ex ) {
// Could not close the resource?
}
}
```
How do... | I usually do it like this:
```
try {
// Use the resource.
} catch( Exception ex ) {
// Problem with the resource.
} finally {
// Put away the resource.
closeQuietly( resource );
}
```
Elsewhere:
```
protected void closeQuietly( Resource resource ) {
try {
if (resource != null) {
resource.close()... |
481,455 | <p>How can I ignore an output parameter of a stored procedure? I'm calling the procedure from another procedure, e.g.:</p>
<pre><code>DECLARE @param1 integer
EXEC mystoredprocedure
@in_param_1,
@in_param2_,
@param1 OUTPUT,
-- what do I type here to ignore the second output param??
</code></pre>
<... | [
{
"answer_id": 481483,
"author": "Matt Flowers",
"author_id": 57702,
"author_profile": "https://Stackoverflow.com/users/57702",
"pm_score": 0,
"selected": false,
"text": "<p>You'll probably have to just ignore the OUTPUT param yourself by just not doing anything with the value. It's not ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41662/"
] | How can I ignore an output parameter of a stored procedure? I'm calling the procedure from another procedure, e.g.:
```
DECLARE @param1 integer
EXEC mystoredprocedure
@in_param_1,
@in_param2_,
@param1 OUTPUT,
-- what do I type here to ignore the second output param??
```
I'm using T-SQL (MS SQL ... | You can just use NULL as the last parameter, and it should work fine - as long as that parameter isn't expected for input logic in the proc as well.
In your case, you'd call the proc as
```
exec mystoredproc @in_param_1, @in_param2_, @param1 OUTPUT, null
```
Here's another example that for the same scenario...
``... |
481,466 | <p>I am not familiar with PHP at all and had a quick question.</p>
<p>I have 2 variables <code>pricePerUnit</code> and <code>InvoicedUnits</code>. Here's the code that is setting these to values:</p>
<pre><code>$InvoicedUnits = ((string) $InvoiceLineItem->InvoicedUnits);
$pricePerUnit = ((string) $InvoiceLineItem-... | [
{
"answer_id": 481479,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 9,
"selected": true,
"text": "<pre><code>$rootbeer = (float) $InvoicedUnits;\n</code></pre>\n\n<p>Should do it for you. Check out <a href=\"http://us2.ph... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am not familiar with PHP at all and had a quick question.
I have 2 variables `pricePerUnit` and `InvoicedUnits`. Here's the code that is setting these to values:
```
$InvoicedUnits = ((string) $InvoiceLineItem->InvoicedUnits);
$pricePerUnit = ((string) $InvoiceLineItem->PricePerUnit);
```
If I output this, I get ... | ```
$rootbeer = (float) $InvoicedUnits;
```
Should do it for you. Check out [Type-Juggling](http://us2.php.net/language.types.type-juggling). You should also read [String conversion to Numbers](http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion). |
481,468 | <p>I've got a <code><div></code> that needs a gradient background. However, the size of the div is variable, which lands me back in "can't do gradients in CSS" land.</p>
<p>However, I'm pretty sure this is possible in jQuery, I just can't seem to find a decent example. Does anyone have something they can point... | [
{
"answer_id": 481495,
"author": "Hexagon Theory",
"author_id": 59107,
"author_profile": "https://Stackoverflow.com/users/59107",
"pm_score": 2,
"selected": false,
"text": "<p>While <a href=\"http://davidwees.com/myblog/2007/08/gradient_jquery_plugin.html\" rel=\"nofollow noreferrer\">th... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] | I've got a `<div>` that needs a gradient background. However, the size of the div is variable, which lands me back in "can't do gradients in CSS" land.
However, I'm pretty sure this is possible in jQuery, I just can't seem to find a decent example. Does anyone have something they can point my way?
Thanks. | in case that someone needs this, and if you think that the jQuery plugin is too heavy, you can use this
```
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00A622', endColorstr='#00B726'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#00A622), to(#00B726)); /* for w... |
481,494 | <p>I must be doing something wrong. I can't seem to execute my CustomValidator's ServerValidate method.</p>
<p>I've got a Visual Basic ASP.NET page with a CustomValidator...</p>
<pre><code><asp:TextBox ID="TextBox1" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToVal... | [
{
"answer_id": 481498,
"author": "Rob",
"author_id": 7872,
"author_profile": "https://Stackoverflow.com/users/7872",
"pm_score": 1,
"selected": false,
"text": "<p>I know it's a daft question (or might sound like it!). But have you actually entered or changed the value in the textbox? I <... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I must be doing something wrong. I can't seem to execute my CustomValidator's ServerValidate method.
I've got a Visual Basic ASP.NET page with a CustomValidator...
```
<asp:TextBox ID="TextBox1" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="TextBox1"
ErrorMessa... | Add the property:
```
ValidateEmptyText="True"
``` |
481,512 | <p>I'm working on a personal project (C# / ASP.NET) that will use LINQ to SQL. The Solution will have (so far) a Webform project, a Namespace project (business logic), and a Tests project. I'm in the very early stages so far (clearly in Design phase).</p>
<p>Is there a paradigm for 3-Tier Architecture here? It seems l... | [
{
"answer_id": 481530,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 3,
"selected": false,
"text": "<p>You could read up a bit on Domain Driven Design.</p>\n\n<p>With the practice of Domain Driven Design (DDD), y... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11112/"
] | I'm working on a personal project (C# / ASP.NET) that will use LINQ to SQL. The Solution will have (so far) a Webform project, a Namespace project (business logic), and a Tests project. I'm in the very early stages so far (clearly in Design phase).
Is there a paradigm for 3-Tier Architecture here? It seems like the DA... | You can think of LINQ-to-SQL as your DAL, so using it "directly from the business logic" isn't necessarily a bad thing.
<http://dotnetlog.com/archive/2008/03/18/best-practice-and-effective-way-of-using-datacontext-in-linq.aspx> has some popular L2S approaches listed.
On our project, we did not want to pass around the... |
481,518 | <pre><code>this.String = {
Get : function (val) {
return function() {
return val;
}
}
};
</code></pre>
<p>What is the ':' doing?</p>
| [
{
"answer_id": 481534,
"author": "TJ L",
"author_id": 12605,
"author_profile": "https://Stackoverflow.com/users/12605",
"pm_score": 3,
"selected": false,
"text": "<p><code>this.String = {}</code> specifies an object. <code>Get</code> is a property of that object. In javascript, object ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49881/"
] | ```
this.String = {
Get : function (val) {
return function() {
return val;
}
}
};
```
What is the ':' doing? | Others have already explained what this code does. It creates an object (called `this.String`) that contains a single function (called `Get`). I'd like to explain when you could use this function.
This function can be useful in cases where you need a higher order function (that is a function that expects another funct... |
481,541 | <p>When using Grails 1.0.4 together with a MySQL the charsets of the auto-generated database tables seem to default to ISO-8859-1. I'd rather have everything stored as pure UTF-8. Is that possible?</p>
<p>From the auto-generated database definitions:</p>
<pre><code>ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin... | [
{
"answer_id": 481612,
"author": "Michael Borgwardt",
"author_id": 16883,
"author_profile": "https://Stackoverflow.com/users/16883",
"pm_score": 2,
"selected": false,
"text": "<p>Apparently you have to hack your way around by <a href=\"http://hartsock.blogspot.com/2008/05/terrible-hibern... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58394/"
] | When using Grails 1.0.4 together with a MySQL the charsets of the auto-generated database tables seem to default to ISO-8859-1. I'd rather have everything stored as pure UTF-8. Is that possible?
From the auto-generated database definitions:
```
ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
```
Note the "la... | Most MySQL installations default to latin1, so if not instructed otherwise, the driver will go by the default values. It should suffice to prepend the charset directives in the connection URL, for example:
>
> `jdbc:mysql://localhost/databaseName?useUnicode=yes&characterEncoding=UTF-8`
>
>
>
For this to work, the... |
481,565 | <p>I wonder how high traffic websites handle traffic logging, for example a website like myspace.com receives a lot of hits, I can imagine it would take a lot of space to log all those requests, so, do they log every single request or how do they handle this?</p>
| [
{
"answer_id": 481574,
"author": "cbrulak",
"author_id": 29505,
"author_profile": "https://Stackoverflow.com/users/29505",
"pm_score": 1,
"selected": false,
"text": "<p>probably like google analytics. </p>\n\n<p>Use Javascript to load a page on a difference server, etc. </p>\n"
},
{
... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/676066/"
] | I wonder how high traffic websites handle traffic logging, for example a website like myspace.com receives a lot of hits, I can imagine it would take a lot of space to log all those requests, so, do they log every single request or how do they handle this? | If you view source on a MySpace page, you get the answer:
```
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-6293770-1");
pageTracker._setDomainName(".myspace.com");
pageTracker._setSampleRate("1"); //sets sampling rate to 1 percent
pageTracker._trackPageview();
</script>
```
That script mea... |
481,575 | <p>I am using the Asp.net OutputCache on a page containing a usercontrol that in certain circumstances when the usercontrol is edited i want to be able to expire the page cache and reload the page with fresh data.</p>
<p>Is there any way i can do this from within the usercontrol?</p>
<p>If not, what are some other me... | [
{
"answer_id": 481771,
"author": "Andre Gallo",
"author_id": 14401,
"author_profile": "https://Stackoverflow.com/users/14401",
"pm_score": 1,
"selected": false,
"text": "<p>You could try this:</p>\n\n<pre><code>private void RemoveButton_Click(object sender, System.EventArgs e)\n{\n Ht... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2847/"
] | I am using the Asp.net OutputCache on a page containing a usercontrol that in certain circumstances when the usercontrol is edited i want to be able to expire the page cache and reload the page with fresh data.
Is there any way i can do this from within the usercontrol?
If not, what are some other methods of caching ... | After some more research I found a method that seems to work well.
```
Dim cachekey As String = String.Format("Calendar-{0}", calendarID)
HttpContext.Current.Cache.Insert(cachekey, DateTime.Now, Nothing, System.DateTime.MaxValue, System.TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, Nothing)
Respons... |
481,588 | <p>Imagine the following tables:</p>
<p>create table boxes( id int, name text, ...);</p>
<p>create table thingsinboxes( id int, box_id int, thing enum('apple,'banana','orange'); </p>
<p>And the tables look like:</p>
<pre>
Boxes:
id | name
1 | orangesOnly
2 | orangesOnly2
3 | orangesBananas
4 | misc
thingsinbox... | [
{
"answer_id": 481627,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 4,
"selected": true,
"text": "<pre><code>SELECT b.*\nFROM boxes b JOIN thingsinboxes t ON (b.id = t.box_id)\nGROUP BY b.id\nHAVING COUNT(DISTINCT t.t... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59145/"
] | Imagine the following tables:
create table boxes( id int, name text, ...);
create table thingsinboxes( id int, box\_id int, thing enum('apple,'banana','orange');
And the tables look like:
```
Boxes:
id | name
1 | orangesOnly
2 | orangesOnly2
3 | orangesBananas
4 | misc
thingsinboxes:
id | box_id | thing
1 |... | ```
SELECT b.*
FROM boxes b JOIN thingsinboxes t ON (b.id = t.box_id)
GROUP BY b.id
HAVING COUNT(DISTINCT t.thing) = 1 AND SUM(t.thing = 'orange') > 0;
```
---
Here's another solution that does not use GROUP BY:
```
SELECT DISTINCT b.*
FROM boxes b
JOIN thingsinboxes t1
ON (b.id = t1.box_id AND t1.thing = 'o... |
481,592 | <p>I hope you know, because I don't see it. Bonus points for whoever figures out how one can achieve what this test is trying to achieve.</p>
<pre><code>using NUnit.Framework;
using Moq;
[TestFixture]
public class MoqHuh
{
public class A {}
public class B : A {}
public interface IHelper
{
voi... | [
{
"answer_id": 481788,
"author": "Simon Laroche",
"author_id": 33318,
"author_profile": "https://Stackoverflow.com/users/33318",
"pm_score": 0,
"selected": false,
"text": "<p>This test works fine.</p>\n\n<p>Since there is no system under test, you are testing that moq works as expected.<... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47901/"
] | I hope you know, because I don't see it. Bonus points for whoever figures out how one can achieve what this test is trying to achieve.
```
using NUnit.Framework;
using Moq;
[TestFixture]
public class MoqHuh
{
public class A {}
public class B : A {}
public interface IHelper
{
void DoIt(A a);
... | Turns out this was sort of pilot error. I incorrectly assumed Moq working fine on Mono.
(which it looks like it does just fine). This issue only happens when compiled with mono's gmcs, not when compiled with Microsofts csc.
I have reported the appropriate bugs with the mono team, and will continue towards making sure ... |
481,599 | <p>In some Rails model definitions, there is a comment block at the top that contains the schema information. </p>
<pre><code># == Schema Information
# Schema version: 20090122060318
#
# Table name: t... | [
{
"answer_id": 481642,
"author": "Milan Novota",
"author_id": 26123,
"author_profile": "https://Stackoverflow.com/users/26123",
"pm_score": 6,
"selected": true,
"text": "<p>Seems like output of the <a href=\"https://github.com/ctran/annotate_models\" rel=\"noreferrer\">annotate_models</a... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | In some Rails model definitions, there is a comment block at the top that contains the schema information.
```
# == Schema Information
# Schema version: 20090122060318
#
# Table name: table_name
# ... | Seems like output of the [annotate\_models](https://github.com/ctran/annotate_models) plugin. Just install it and run `annotate` in your rails root and the schema information will update automatically. Ideally, run it after each migration. |
481,601 | <p>I'm trying to iterate through an array of elements. jQuery's documentation says:</p>
<p><a href="http://docs.jquery.com/Utilities/jQuery.each#objectcallback" rel="noreferrer">jquery.Each() documentation</a></p>
<blockquote>
<p>Returning non-false is the same as a continue statement in a for loop, it will skip im... | [
{
"answer_id": 481611,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 11,
"selected": true,
"text": "<p>What they mean by non-false is:</p>\n\n<pre><code>return true;\n</code></pre>\n\n<p>So this code:</p>\n\n<p><d... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59143/"
] | I'm trying to iterate through an array of elements. jQuery's documentation says:
[jquery.Each() documentation](http://docs.jquery.com/Utilities/jQuery.each#objectcallback)
>
> Returning non-false is the same as a continue statement in a for loop, it will skip immediately to the next iteration.
>
>
>
I've tried c... | What they mean by non-false is:
```
return true;
```
So this code:
```js
var arr = ["one", "two", "three", "four", "five"];
$.each(arr, function(i) {
if (arr[i] == 'three') {
return true;
}
console.log(arr[i]);
});
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.... |
481,603 | <p>Given a <code>List<T></code> in c# is there a way to extend it (within its capacity) and set the new elements to <code>null</code>? I'd like something that works like a <code>memset</code>. I'm not looking for sugar here, I want fast code. I known that in C the operation could be done in something like 1-3 asm... | [
{
"answer_id": 481622,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": -1,
"selected": false,
"text": "<p>Why do you want to do that ?\nThe main advantage of a List is that it can grow as needed, so why do you want... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | Given a `List<T>` in c# is there a way to extend it (within its capacity) and set the new elements to `null`? I'd like something that works like a `memset`. I'm not looking for sugar here, I want fast code. I known that in C the operation could be done in something like 1-3 asm ops per entry.
The best solution I've fo... | The simplest way is probably by creating a temporary array:
```
list.AddRange(new T[size - count]);
```
Where `size` is the required new size, and `count` is the count of items in the list. ~~However, for relatively large values of `size - count`, this can have bad performance, since it can cause the list to realloc... |
481,645 | <p>I'm trying to generate a sales reports which lists each product + total sales in a given month. Its a little tricky because the prices of products can change throughout the month. For example:</p>
<ul>
<li>Between Jan-01 and Jan-15, my company sells 50 Widgets at a cost of $10 each</li>
<li>Between Jan-15 and Jan-3... | [
{
"answer_id": 481666,
"author": "Eduard Wirch",
"author_id": 17428,
"author_profile": "https://Stackoverflow.com/users/17428",
"pm_score": -1,
"selected": false,
"text": "<p>The combination of Product_ID and Sale_Date is your foreign key. Try a select-join on Product_ID, Sale_Date.</p>\... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40516/"
] | I'm trying to generate a sales reports which lists each product + total sales in a given month. Its a little tricky because the prices of products can change throughout the month. For example:
* Between Jan-01 and Jan-15, my company sells 50 Widgets at a cost of $10 each
* Between Jan-15 and Jan-31, my company sells 5... | If you start storing start and end dates, or create a view that includes the start and end dates (you can even create an indexed view) then you can heavily simplify your query. (provided you are certain there are no range overlaps)
```
SELECT
Sale_ID,
Product_ID,
Sale_Date,
Price
FROM Sales
JOIN Price... |
481,673 | <p>I have a function that accepts a char* as one of its parameters. I need to manipulate it, but leave the original char* intact. Essentially, I want to create a working copy of this char*. It seems like this should be easy, but I am really struggling.</p>
<p>My first (naive) attempt was to create another char* and... | [
{
"answer_id": 481685,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 4,
"selected": false,
"text": "<p>You might want to take a look at the strdup (<code>man strdup</code>) function:</p>\n\n<pre><code>char *linkCopy = ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35767/"
] | I have a function that accepts a char\* as one of its parameters. I need to manipulate it, but leave the original char\* intact. Essentially, I want to create a working copy of this char\*. It seems like this should be easy, but I am really struggling.
My first (naive) attempt was to create another char\* and set it e... | The `sizeof` will give you the size of the pointer. Which is often 4 or 8 depending on your processor/compiler, but not the size of the string pointed to. You can use strlen and strcpy:
```
// +1 because of '\0' at the end
char * copy = malloc(strlen(original) + 1);
strcpy(copy, original);
...
free(copy); // at the e... |
481,692 | <p>A regular function can contain a call to itself in its definition, no problem. I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no name to refer back to. Is there a way to do it? How?</p>
| [
{
"answer_id": 481755,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 7,
"selected": true,
"text": "<p>The only way I can think of to do this amounts to giving the function a name:</p>\n\n<pre><code>fact = lambda x: 1 if x... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A regular function can contain a call to itself in its definition, no problem. I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no name to refer back to. Is there a way to do it? How? | The only way I can think of to do this amounts to giving the function a name:
```
fact = lambda x: 1 if x == 0 else x * fact(x-1)
```
or alternately, for earlier versions of python:
```
fact = lambda x: x == 0 and 1 or x * fact(x-1)
```
**Update**: using the ideas from the other answers, I was able to wedge the f... |
481,716 | <p>Im trying to change images on click similar to what SO does with the vote arrows and checkmark. </p>
<p>Im thinking either to :</p>
<p>1- Have each image be an Ajax.ActionLink and return a different image when clicked.</p>
<p>2- Have the images be the background of a Hyperlink and use Ajax.ActionLink to replace t... | [
{
"answer_id": 481775,
"author": "TStamper",
"author_id": 39809,
"author_profile": "https://Stackoverflow.com/users/39809",
"pm_score": 4,
"selected": true,
"text": "<p>jquery is the best because if you use the actionlink in asp.net-mvc then you would have to handle a link for each image... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49632/"
] | Im trying to change images on click similar to what SO does with the vote arrows and checkmark.
Im thinking either to :
1- Have each image be an Ajax.ActionLink and return a different image when clicked.
2- Have the images be the background of a Hyperlink and use Ajax.ActionLink to replace the css class to get a ne... | jquery is the best because if you use the actionlink in asp.net-mvc then you would have to handle a link for each image clicked(Action Method) which can get complicated down the line.
in jquery you have something like this that can minimize the difficulty
```
$(document).ready(function() {
//image is the name... |
481,772 | <p>I've been trying to develop a linq query that returns the ItemNumber column of all my tables in the database, but so far I haven't been able to do it successfully.</p>
<p>Basically I have a table for each kind of hardware component in a computer, and each table has a ItemNumber column. I need to query all of the ta... | [
{
"answer_id": 481795,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 4,
"selected": true,
"text": "<p>What you are describing is a union:</p>\n\n<p>SELECT ItemNumber FROM tbl1 UNION SELECT ItemNumber FROM tbl2</p>\n\n<p>In LINQ:</... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52589/"
] | I've been trying to develop a linq query that returns the ItemNumber column of all my tables in the database, but so far I haven't been able to do it successfully.
Basically I have a table for each kind of hardware component in a computer, and each table has a ItemNumber column. I need to query all of the tables in on... | What you are describing is a union:
SELECT ItemNumber FROM tbl1 UNION SELECT ItemNumber FROM tbl2
In LINQ:
```
var itemCounts = (from hhd in dc.HHD select hhd.ItemNumber)
.Union((from hkb in dc.HKB select hkb.ItemNumber)
.Union(from hmm in dc.HMM select hmm.ItemNumber))
... |
481,789 | <p>I have a table of records in mySql. I need to maintain an order for them as specified by the user. So I've added a 'position' column.</p>
<p>What would be the SQL statement to update all the records when I move a specific record? I've got something like:</p>
<pre><code>UPDATE items SET position = '2' WHERE id ='4'... | [
{
"answer_id": 481806,
"author": "dkretz",
"author_id": 31641,
"author_profile": "https://Stackoverflow.com/users/31641",
"pm_score": 3,
"selected": true,
"text": "<p>Doing this sort of thing for e.g. sales orders with line numbers maintained by the user, I've found it best to handle it ... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38241/"
] | I have a table of records in mySql. I need to maintain an order for them as specified by the user. So I've added a 'position' column.
What would be the SQL statement to update all the records when I move a specific record? I've got something like:
```
UPDATE items SET position = '2' WHERE id ='4';
UPDATE items SET po... | Doing this sort of thing for e.g. sales orders with line numbers maintained by the user, I've found it best to handle it in an array in the BL or UI. Usually they will want to adjust several records, and sometimes want to say "forget it". So the easiest might be to just wait until they hit the "OK" button (or your equi... |
481,802 | <p>Edit--@Uri correctly pointed out that this was an abuse of annotations; trying to actually create the menu data itself in annotations is just silly.</p>
<p>They are good for binding however, I think I'll stick with using them to link the text data to the methods (the @Menu ("File") portion) since it's more explicit... | [
{
"answer_id": 481819,
"author": "Yoni Roit",
"author_id": 34161,
"author_profile": "https://Stackoverflow.com/users/34161",
"pm_score": 0,
"selected": false,
"text": "<ul>\n<li>You can define default value for annotation - here's example <code>String str() default \"text\";</code></li>\... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12943/"
] | Edit--@Uri correctly pointed out that this was an abuse of annotations; trying to actually create the menu data itself in annotations is just silly.
They are good for binding however, I think I'll stick with using them to link the text data to the methods (the @Menu ("File") portion) since it's more explicit and flexi... | The way I've seen multiple annotations attached is to use a container annotation, and then specify the items as an array.
```
@Retention(RetentionPolicy.RUNTIME)
public @interface Menu {
String name();
String[] children();
}
@Retention(RetentionPolicy.RUNTIME)
public @interface MenuBar {
Menu[] value();
}... |
481,803 | <p>I'm reading <a href="http://www.paulgraham.com/spam.html" rel="noreferrer">Paul Graham's A Plan for Spam</a> and want to understand it better but my LISP is really rusty. He has a snippet of code that calculates probability as such:</p>
<pre><code>(let ((g (* 2 (or (gethash word good) 0)))
(b (or (gethash wor... | [
{
"answer_id": 481858,
"author": "Gonzalo Quero",
"author_id": 40996,
"author_profile": "https://Stackoverflow.com/users/40996",
"pm_score": 4,
"selected": true,
"text": "<p>I think it's something like this (warning, possible errors ahead. This snippet is intended as a guide, not a solut... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | I'm reading [Paul Graham's A Plan for Spam](http://www.paulgraham.com/spam.html) and want to understand it better but my LISP is really rusty. He has a snippet of code that calculates probability as such:
```
(let ((g (* 2 (or (gethash word good) 0)))
(b (or (gethash word bad) 0)))
(unless (< (+ g b) 5)
... | I think it's something like this (warning, possible errors ahead. This snippet is intended as a guide, not a solution):
```
var g = 2 * (gethash(word, good) | 0);
var b = gethash(word, bad) | 0;
if( (g + b) >= 5)
{
return Math.Max(
0.01,
Math.Min(0.99,
Math.Min(1, b / nbad) /
... |
481,808 | <p>I have a build file that as part of the build process relies on several taskdefs. These taskdef items (for example, webdoclet and jasper2) use log4j as a logger. Ideally, I'd like to be able to provide a different log4j configuration file for each, but minimally, I'd like to be able to specify which log4j configur... | [
{
"answer_id": 481841,
"author": "James A. N. Stauffer",
"author_id": 6770,
"author_profile": "https://Stackoverflow.com/users/6770",
"pm_score": 0,
"selected": false,
"text": "<p>Can you move the log4j.xml file that is in the current working directory?</p>\n"
},
{
"answer_id": 4... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57752/"
] | I have a build file that as part of the build process relies on several taskdefs. These taskdef items (for example, webdoclet and jasper2) use log4j as a logger. Ideally, I'd like to be able to provide a different log4j configuration file for each, but minimally, I'd like to be able to specify which log4j configuration... | Log4j loads its configuration by looking for the system property log4j.configuration. Failing that, it looks for log4j.properties or log4j.xml on the classpath.
On some ant tasks that fork a new JVM, you can specify the log4j.configuration system property with <jvmarg/> tag. However, on those that don't your best bet ... |
481,813 | <p>I'm implementing <code>compareTo()</code> method for a simple class such as this (to be able to use <code>Collections.sort()</code> and other goodies offered by the Java platform):</p>
<pre><code>public class Metadata implements Comparable<Metadata> {
private String name;
private String value;
// Ima... | [
{
"answer_id": 481822,
"author": "Fabian Steeg",
"author_id": 18154,
"author_profile": "https://Stackoverflow.com/users/18154",
"pm_score": 2,
"selected": false,
"text": "<p>You could design your class to be immutable (Effective Java 2nd Ed. has a great section on this, Item 15: Minimize... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56285/"
] | I'm implementing `compareTo()` method for a simple class such as this (to be able to use `Collections.sort()` and other goodies offered by the Java platform):
```
public class Metadata implements Comparable<Metadata> {
private String name;
private String value;
// Imagine basic constructor and accessors here
... | Using **Java 8**:
```java
private static Comparator<String> nullSafeStringComparator = Comparator
.nullsFirst(String::compareToIgnoreCase);
private static Comparator<Metadata> metadataComparator = Comparator
.comparing(Metadata::getName, nullSafeStringComparator)
.thenComparing(Metadata::getV... |
481,862 | <p>I need to read some large files (from 50k to 100k lines), structured in groups separated by empty lines. Each group start at the same pattern "No.999999999 dd/mm/yyyy ZZZ". Here´s some sample data.</p>
<blockquote>
<p>No.813829461 16/09/1987 270<br>
Tit.SUZANO PAPEL E CELULOSE S.A. (BR/BA)<br>
C.N.P.J./C.... | [
{
"answer_id": 481890,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 1,
"selected": false,
"text": "<p>It would be easier to help if you had a specific concern. Performance will depend greatly on the efficiency of th... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32117/"
] | I need to read some large files (from 50k to 100k lines), structured in groups separated by empty lines. Each group start at the same pattern "No.999999999 dd/mm/yyyy ZZZ". Here´s some sample data.
>
> No.813829461 16/09/1987 270
>
> Tit.SUZANO PAPEL E CELULOSE S.A. (BR/BA)
>
> C.N.P.J./C.I.C./N INPI : 164042... | That is pretty good. Below some suggestions, let me know if you like'em:
```
import re
import pprint
import sys
class Despacho(object):
"""
Class to parse each line, applying the regexp and storing the results
for future use
"""
#used a dict with the keys instead of functions.
regexp = {
... |
481,871 | <p>I'm trying to remove the default decorators on a hidden form element. By default, the hidden element is displayed like this:</p>
<pre><code><dt>Hidden Element Label (if I had set one)</dt>
<dd><input type="hidden" name="foobar" value="1" id="foobar"></dd>
</code></pre>
<p>I don't want... | [
{
"answer_id": 481906,
"author": "drfloob",
"author_id": 10161,
"author_profile": "https://Stackoverflow.com/users/10161",
"pm_score": 5,
"selected": false,
"text": "<p>From the <a href=\"http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.decorators\" rel=\"no... | 2009/01/26 | [
"https://Stackoverflow.com/questions/481871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48523/"
] | I'm trying to remove the default decorators on a hidden form element. By default, the hidden element is displayed like this:
```
<dt>Hidden Element Label (if I had set one)</dt>
<dd><input type="hidden" name="foobar" value="1" id="foobar"></dd>
```
I don't want my hidden element to take up space on my page. I want t... | For hidden field you need only one decorator - ViewHelper:
```
$field = new Zend_Form_Element_Hidden('id');
$field->setDecorators(array('ViewHelper'));
```
This will render only the input field, without Dt-Dd wrapper and label. |
481,883 | <p>Can I write a unit test that make sure that a readonly class I write (a class which has no setters) remains readonly in the future? I do not want that anyone to add a setter property in my classes.</p>
<p>Basically, how do I check if a class is has no setters in C#?</p>
| [
{
"answer_id": 481892,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 3,
"selected": false,
"text": "<p><em>Note: asker originally posed the question \"How do I determine if a class is a Value Type?\" and later changed it.</em></p>... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30917/"
] | Can I write a unit test that make sure that a readonly class I write (a class which has no setters) remains readonly in the future? I do not want that anyone to add a setter property in my classes.
Basically, how do I check if a class is has no setters in C#? | *Note: asker originally posed the question "How do I determine if a class is a Value Type?" and later changed it.*
```
bool isValueType = object.GetType().IsValueType
```
or
```
bool isValueType = typeof(YourClass).IsValueType
```
MSDN: <http://msdn.microsoft.com/en-us/library/system.type.isvaluetype.aspx> |
481,886 | <p>Despite this being one of the best error messages I've ever seen (second only to, "This operation could destabilize the rent in the space-time continuum"), it's also one of the most frustrating.</p>
<p>I have developed an ASP.NET MVC site which works perfectly through VS2008. It works perfectly hosted on a local I... | [
{
"answer_id": 481938,
"author": "Glenn Slaven",
"author_id": 2975,
"author_profile": "https://Stackoverflow.com/users/2975",
"pm_score": 0,
"selected": false,
"text": "<p>What happens if you do this</p>\n\n<pre><code>var result = (from e in db.calendarEvents select e).ToList();\nforeach... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691/"
] | Despite this being one of the best error messages I've ever seen (second only to, "This operation could destabilize the rent in the space-time continuum"), it's also one of the most frustrating.
I have developed an ASP.NET MVC site which works perfectly through VS2008. It works perfectly hosted on a local IIS7 server ... | OK, the end result was that my host was running my site on a server with .NET 3.5 installed (not SP1), and the one table that used the TIME SQL datatype broke with the above error. <http://msdn.microsoft.com/en-us/library/bb386947.aspx> states that LINQ to SQL supports mapping of these new types starting with .NET 3.5 ... |
481,922 | <p>I already started this in javascript so I don't want to use jquery but can somejavascript expert look at my code and tell me what I'm doing wrong and or right? Let me tell you what I am trying to accomplish here. I have a menu that consists of four buttons and when you hover over them, they change color and then und... | [
{
"answer_id": 481960,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 2,
"selected": false,
"text": "<p>Okay, biting the bullet, let's see how this munges my rep :-).</p>\n\n<p>This is not the answer you want but STOP.</p... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | I already started this in javascript so I don't want to use jquery but can somejavascript expert look at my code and tell me what I'm doing wrong and or right? Let me tell you what I am trying to accomplish here. I have a menu that consists of four buttons and when you hover over them, they change color and then undern... | Ok, here's a script that works (at least in ie and firefox) that doesn't use libraries.
Using a library would obviously make this code a lot more succinct.
```
window.onload = createRollover;
function createRollover() {
var button;
var imgPath = 'img/';
var container = document.getElementById( 'ro_cont... |
481,931 | <ul>
<li>Implemented the <strong>Sink</strong> Class - to receive event notifications from COM Server</li>
<li>Event Interface derives from <strong>IDispatch</strong></li>
</ul>
<p>I have an issue whereby an <strong>IConnectionPoint::Advise</strong> call returns <strong>E_NOTIMPL</strong>. This could be because the <s... | [
{
"answer_id": 482064,
"author": "Michael",
"author_id": 56751,
"author_profile": "https://Stackoverflow.com/users/56751",
"pm_score": 1,
"selected": false,
"text": "<p>Please read the MSDN article again.</p>\n\n<p><PRE>\n A connection point that allows only one interface\n can return E_... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51078/"
] | * Implemented the **Sink** Class - to receive event notifications from COM Server
* Event Interface derives from **IDispatch**
I have an issue whereby an **IConnectionPoint::Advise** call returns **E\_NOTIMPL**. This could be because the **connection point** only allows one connection - [MSDN](http://msdn.microsoft.co... | Solved:
-------
* Using **pure C++**
* No ATL
With the following **implementation** of **QI**:
```
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
{
if (iid == __uuidof(IUnknown) || iid == __uuidof(IS8SimulationEvents))
{
*ppvObject = (IS8SimulationEvents*)this;
} else {
... |
481,935 | <p>In Silverlight I noticed that the code-behind Page class inherits from UserControl:</p>
<pre><code>public partial class Page : UserControl
</code></pre>
<p>In WPF the code-behind Page Class inherits from Page:</p>
<pre><code>public partial class Page1 : Page
</code></pre>
<p>I was thinking that Silverlight, bein... | [
{
"answer_id": 481966,
"author": "palehorse",
"author_id": 312,
"author_profile": "https://Stackoverflow.com/users/312",
"pm_score": 2,
"selected": false,
"text": "<p>Have a look at <a href=\"http://blog.kkrankk.com/2008/04/porting-silverlight-20-to-wpf.html\" rel=\"nofollow noreferrer\"... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | In Silverlight I noticed that the code-behind Page class inherits from UserControl:
```
public partial class Page : UserControl
```
In WPF the code-behind Page Class inherits from Page:
```
public partial class Page1 : Page
```
I was thinking that Silverlight, being a subset of WPF, you would be able to copy larg... | The way I understand it is that aside from both using XAML, Silverlight and WPF are essentially different. There does appear to be cross-pollination between them though, so when Silverlight shipped without things like WrapPanel, someone wrote their own implementation in Silverlight (and it eventually got added to the S... |
481,943 | <p>After seeing the abilities and hackibility of wiimotes I really want to use it in my 'Intro to programming' final. Everyone must make a python program and present it to the class.</p>
<p>I want to make a game with pygame incorporating a wiimote. I found <a href="http://sourceforge.net/project/showfiles.php?group_... | [
{
"answer_id": 481974,
"author": "Skeolan",
"author_id": 9640,
"author_profile": "https://Stackoverflow.com/users/9640",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://code.google.com/p/pywiimote/\" rel=\"nofollow noreferrer\">pywiimote</a> on Google Code might be helpful... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | After seeing the abilities and hackibility of wiimotes I really want to use it in my 'Intro to programming' final. Everyone must make a python program and present it to the class.
I want to make a game with pygame incorporating a wiimote. I found [pywiiuse](http://sourceforge.net/project/showfiles.php?group_id=82407&p... | Been searching for a set of Python wrappers to the Wiimote for almost two days now, here's my summary of the state of the art:
pywiimote (from Google): roughly half-finished, didn't compile when I downloaded the latest version (r52), has some nice ideas, but will require significant investment to get working.
pywiius... |
481,984 | <p>I've been researching the difference between these two patterns. </p>
<p>I understand that facade encapsulates access to a sub system and mediator encapsulates the interactions between components.</p>
<p>I understand that sub system components are not aware of the facade, where as components are obviously aware of... | [
{
"answer_id": 482001,
"author": "mmr",
"author_id": 21981,
"author_profile": "https://Stackoverflow.com/users/21981",
"pm_score": 4,
"selected": false,
"text": "<p>I'm using mediator to add log file functionality.</p>\n\n<p>It works like this:</p>\n\n<ul>\n<li>Obj A tells the mediator i... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been researching the difference between these two patterns.
I understand that facade encapsulates access to a sub system and mediator encapsulates the interactions between components.
I understand that sub system components are not aware of the facade, where as components are obviously aware of the mediator.
I... | >
> *...most sites point out that the mediator “adds functionality”...*
>
>
>
The **facade** only exposes the existing functionality from a different perspective.
The **mediator** "adds" functionality because it combines different existing functionality to create a new one.
Take the following example:
You have ... |
481,995 | <p>I am using python-ldap to try to authenticate against an existing Active Directory, and when I use the following code:</p>
<pre><code>import ldap
l = ldap.initialize('LDAP://example.com')
m = l.simple_bind_s(username@example.com,password)
</code></pre>
<p>I get the following back:</p>
<pre><code>print m
(97, [])
... | [
{
"answer_id": 482002,
"author": "Mohamed",
"author_id": 58135,
"author_profile": "https://Stackoverflow.com/users/58135",
"pm_score": 0,
"selected": false,
"text": "<p>here is a forum thread that explains the error and provides work around. \n<a href=\"http://www.velocityreviews.com/for... | 2009/01/27 | [
"https://Stackoverflow.com/questions/481995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40529/"
] | I am using python-ldap to try to authenticate against an existing Active Directory, and when I use the following code:
```
import ldap
l = ldap.initialize('LDAP://example.com')
m = l.simple_bind_s(username@example.com,password)
```
I get the following back:
```
print m
(97, [])
```
What does the 97 and empty list... | According to the [documentation](http://support.microsoft.com/kb/218185), this is:
```
LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 The referral limit was exceeded.
```
Probably
```
ldap.set_option(ldap.OPT_REFERRALS, 0)
```
could help. |
482,008 | <p>I have a MySQL query like this:</p>
<pre><code>SELECT *, SUM(...some SQL removed for brevety) AS Occurrences FROM some_table AS q
WHERE criterion="value" GROUP BY q.P_id ORDER BY Occurrences DESC LIMIT 10;
</code></pre>
<p>I want to restrict the results to rows where Occurrences>0. This seems very simple to me, b... | [
{
"answer_id": 482021,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://Stackoverflow.com/users/15168",
"pm_score": 0,
"selected": false,
"text": "<p>According to the SQL standard, the column aliases are not available in the body of the query, which is a confo... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] | I have a MySQL query like this:
```
SELECT *, SUM(...some SQL removed for brevety) AS Occurrences FROM some_table AS q
WHERE criterion="value" GROUP BY q.P_id ORDER BY Occurrences DESC LIMIT 10;
```
I want to restrict the results to rows where Occurrences>0. This seems very simple to me, but I can't seem to make it ... | I am not as familiar with MySQL as I am with SQL Server, but in T-SQL, you can't use aliases in GROUP BY clauses (I originally thought ORDER BY clauses as well, but that has since been shown to be incorrect). In this case, you want to filter based on the results of a GROUP BY, so I would use a HAVING clause as follows:... |
482,014 | <p>Is there a way to do the following preprocessor directives in Python?</p>
<pre><code>#if DEBUG
< do some code >
#else
< do some other code >
#endif
</code></pre>
| [
{
"answer_id": 482022,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 5,
"selected": false,
"text": "<p>I suspect you're gonna hate this answer. The way you do that in Python is</p>\n\n<pre><code># code here\nif DEB... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/625/"
] | Is there a way to do the following preprocessor directives in Python?
```
#if DEBUG
< do some code >
#else
< do some other code >
#endif
``` | There's `__debug__`, which is a special value that the compiler does preprocess.
```
if __debug__:
print "If this prints, you're not running python -O."
else:
print "If this prints, you are running python -O!"
```
`__debug__` will be replaced with a constant 0 or 1 by the compiler, and the optimizer will remove... |
482,041 | <p>In the past, when one made a <code>JPopupMenu</code> visible it's first item would get selected by default: <a href="http://weblogs.java.net/blog/alexfromsun/archive/2008/02/jtrayicon_updat.html" rel="nofollow noreferrer">http://weblogs.java.net/blog/alexfromsun/archive/2008/02/jtrayicon_updat.html</a></p>
<p>Nowad... | [
{
"answer_id": 482068,
"author": "Zach Scrivena",
"author_id": 20029,
"author_profile": "https://Stackoverflow.com/users/20029",
"pm_score": 2,
"selected": true,
"text": "<blockquote>\n <p>Nowadays the default behavior is to pop up the menu without any item selected.</p>\n</blockquote>\... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14731/"
] | In the past, when one made a `JPopupMenu` visible it's first item would get selected by default: <http://weblogs.java.net/blog/alexfromsun/archive/2008/02/jtrayicon_updat.html>
Nowadays the default behavior is to pop up the menu without any item selected. I would like create a `JPopupMenu` with a single item that will... | >
> Nowadays the default behavior is to pop up the menu without any item selected.
>
>
>
Actually, I would argue that this is the correct behavior, at least in Windows. Other non-Java applications do this too. I don't think it's worth breaking this convention even if there is only one item in the menu. If you feel... |
482,059 | <p>I'm having difficulty in using std::for_each and other algorithms with a multimap, and want to know if someone could help me developing a functor that could pass the appropriate parameter to the "generic" functions.</p>
<p>My specific problem with map/multimap is that their iterators evaluate to a std::pair instead... | [
{
"answer_id": 482081,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 1,
"selected": false,
"text": "<p>I have a boost solution in the starts:</p>\n\n<pre><code>for_each(patches.begin(), patches.end(), \n ... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1608293/"
] | I'm having difficulty in using std::for\_each and other algorithms with a multimap, and want to know if someone could help me developing a functor that could pass the appropriate parameter to the "generic" functions.
My specific problem with map/multimap is that their iterators evaluate to a std::pair instead of the c... | I have a boost solution in the starts:
```
for_each(patches.begin(), patches.end(),
boost::bind(ApplyOnCondition(...),
boost::bind(&map_type::value_type::second, _1)));
```
This takes the ::second member of the pair, and pushes it forward to ApplyOnCondition's operator(). `map_type` is... |
482,073 | <p>Suppose we have the following class hierarchy:</p>
<pre><code>class Base {
...
};
class Derived1 : public Base {
...
};
class Derived2 : public Base {
...
};
</code></pre>
<p>Given a <code>Base*</code> which could point to either a <code>Derived1</code> or <code>Derived2</code> object how can I make ... | [
{
"answer_id": 482087,
"author": "Calyth",
"author_id": 45144,
"author_profile": "https://Stackoverflow.com/users/45144",
"pm_score": 2,
"selected": false,
"text": "<p>I don't think that it would be easy to do. In fact, in Effective C++, Meyers warned that if you have a function that pas... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17009/"
] | Suppose we have the following class hierarchy:
```
class Base {
...
};
class Derived1 : public Base {
...
};
class Derived2 : public Base {
...
};
```
Given a `Base*` which could point to either a `Derived1` or `Derived2` object how can I make a copy of the actual object given that it's concrete type i... | Unfortunately a virtual clone/copy pattern is your only real choice.
There are variations of this, but essentially they all come down to writing functions for each type that can return a new copy. |
482,083 | <p>I noticed using task manager that the following code has a GDI leak in it. The count of GDI object in the process executing this code increases by 1 each time it executes however I can't seem to find the problem.</p>
<p>Any help would be appreciated.</p>
<pre><code>// create new DC based on current
HDC hDC = C... | [
{
"answer_id": 482122,
"author": "geofftnz",
"author_id": 20122,
"author_profile": "https://Stackoverflow.com/users/20122",
"pm_score": 0,
"selected": false,
"text": "<p>(I was about to say this when I noticed there was already a comment with the answer - credit goes to xhantt)</p>\n\n<p... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] | I noticed using task manager that the following code has a GDI leak in it. The count of GDI object in the process executing this code increases by 1 each time it executes however I can't seem to find the problem.
Any help would be appreciated.
```
// create new DC based on current
HDC hDC = CreateCompatibleDC(Get... | Copying from the comment, I didn't put it as answer as I can't test it and I was not sure if it was correct, please test it.
In general it is not a good idea to have nested calls ie
```
HDC hDC1 = GetDC();
HDC hDC2 = CreateCompatibleDC(hDC1);
..
```
instead of
```
HDC hDC = CreateCompatibleDC(GetDC());
```
... |
482,085 | <p>I've recently changed to Mate as a framework for flex. However am running into a few issues.
I want to know how to dispatch events from classes generated via the methodInvoker tag.</p>
<pre><code><resultHandlers>
<MethodInvoker generator="{LoginSuccess}" method="setCurrentUser" arguments="{[resultO... | [
{
"answer_id": 482216,
"author": "Mike Sickler",
"author_id": 16534,
"author_profile": "https://Stackoverflow.com/users/16534",
"pm_score": 2,
"selected": false,
"text": "<p>After some digging around <a href=\"http://mate.asfusion.com/forums/topic.php?id=319\" rel=\"nofollow noreferrer\"... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17510/"
] | I've recently changed to Mate as a framework for flex. However am running into a few issues.
I want to know how to dispatch events from classes generated via the methodInvoker tag.
```
<resultHandlers>
<MethodInvoker generator="{LoginSuccess}" method="setCurrentUser" arguments="{[resultObject]}"/>
```
Then i... | The way it's usually done is to inject the event map's dispatcher into the object:
```
<MethodInvoker generator="{MyClass}" method="someMethod" arguments="{[a, b]}">
<Properties dispatcher="{scope.dispatcher}"/>
</MethodInvoker>
```
The inner `Properties` tag sets properties on the object being created by the `Met... |
482,146 | <p>I have a script that loops through a series of four (or less) characters strings. For example:</p>
<pre><code>aaaa
aaab
aaac
aaad
</code></pre>
<p>If have been able to implement it with nested for loops like so:</p>
<pre><code>chars = string.digits + string.uppercase + string.lowercase
for a in chars:
print... | [
{
"answer_id": 482168,
"author": "Sparr",
"author_id": 13675,
"author_profile": "https://Stackoverflow.com/users/13675",
"pm_score": 1,
"selected": false,
"text": "<p>There are many algorithms for generating every permutation of a set. What you want here is a related problem, but not di... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30190/"
] | I have a script that loops through a series of four (or less) characters strings. For example:
```
aaaa
aaab
aaac
aaad
```
If have been able to implement it with nested for loops like so:
```
chars = string.digits + string.uppercase + string.lowercase
for a in chars:
print '%s' % a
for b in chars:
... | ```
import string
import itertools
chars = string.digits + string.letters
MAX_CHARS = 4
for nletters in range(MAX_CHARS):
for word in itertools.product(chars, repeat=nletters + 1):
print (''.join(word))
```
That'll print all **`15018570`** words you're looking for. If you want more/less words just change... |
482,224 | <p>I'm using the <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow noreferrer">jQuery Validation plugin</a> and I've got a textbox with the class <code>digits</code> to force it to be digits only, but not required. When I call validate on the form it works fine, but if I call <code>valid()</code> on th... | [
{
"answer_id": 482258,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": true,
"text": "<p>Check this, from the <a href=\"http://docs.jquery.com/Plugins/Validation/Methods/digits\" rel=\"noreferrer\">... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2975/"
] | I'm using the [jQuery Validation plugin](http://docs.jquery.com/Plugins/Validation) and I've got a textbox with the class `digits` to force it to be digits only, but not required. When I call validate on the form it works fine, but if I call `valid()` on the textbox when it's empty, it returns 0, despite no error messa... | Check this, from the [documentation](http://docs.jquery.com/Plugins/Validation/Methods/digits):
>
> Makes "field" required and digits
> only.
>
>
>
You could do something like this:
```
var isValid = jQuery('#kiloMetresTravelled').valid() || jQuery('#kiloMetresTravelled').val() == "";
``` |
482,235 | <p>I'm currently designing a site which uses a dark background, and just out of interest, I disabled CSS and took a look at it. Because it's been marked up semantically, without styles it's still a coherent document, except for the fact that my heading images are white, and because the default background colour is also... | [
{
"answer_id": 482251,
"author": "Eddie",
"author_id": 57752,
"author_profile": "https://Stackoverflow.com/users/57752",
"pm_score": 2,
"selected": false,
"text": "<p>No, you shouldn't. Those attributes are deprecated for a reason. There are better ways to work around these sorts of pr... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I'm currently designing a site which uses a dark background, and just out of interest, I disabled CSS and took a look at it. Because it's been marked up semantically, without styles it's still a coherent document, except for the fact that my heading images are white, and because the default background colour is also wh... | I usually insert the heading image via CSS too.
```
<h2 class="my-heading"><span class="hide">My Heading</span></h2>
```
and then
```
.my-heading {
width: 100px;
height: 24px;
display: block;
background: #fff url(image/my-heading.jpg) top left no-repeat;
}
.hide {
display: none;
}
```
so that... |
482,247 | <p>Has anyone had experience with flourineFX?
I have to fix something that uses fluorineFX on the backend to provide typed objects to the a flex presentation layer.</p>
<p>I was under the impression that if I register the objects in Flex like so</p>
<pre><code>registerClassAlias("Kanpeki.Domain.Staff", Staff);
[Bind... | [
{
"answer_id": 482660,
"author": "user17510",
"author_id": 17510,
"author_profile": "https://Stackoverflow.com/users/17510",
"pm_score": 0,
"selected": false,
"text": "<p>Seemed to work if I put</p>\n\n<p>registerClassAlias(\"Kanpeki.Domain.Staff\", Staff);</p>\n\n<p>in the root of the a... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17510/"
] | Has anyone had experience with flourineFX?
I have to fix something that uses fluorineFX on the backend to provide typed objects to the a flex presentation layer.
I was under the impression that if I register the objects in Flex like so
```
registerClassAlias("Kanpeki.Domain.Staff", Staff);
[Bindable]
public class St... | This problem might occur when you do not reference the Staff class anywhere in your application. Even if you add the mapping via registerClassAlias or via RemoteClass metadata, the compiler will not pick up your class and hence when objects come in, they will not be mapped correctly.
If you add registerClassAlias to t... |
482,256 | <p>For example when editing various data files, the backup data is no use and actually trips up our tools. So I'd like to be able to disable backup for files containing a regexp in the name. </p>
<p>justinhj</p>
| [
{
"answer_id": 482261,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 4,
"selected": true,
"text": "<p>I hate to simply reference other online resources for questions like these, but this appears to be a perfect fit for... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53120/"
] | For example when editing various data files, the backup data is no use and actually trips up our tools. So I'd like to be able to disable backup for files containing a regexp in the name.
justinhj | I hate to simply reference other online resources for questions like these, but this appears to be a perfect fit for your needs.
<http://anirudhs.chaosnet.org/blog/2005.01.21.html>
Once you've setup what's described on that page, you could just add this to your `.emacs` or `.emacs.d/init.el` file depending on your ve... |
482,260 | <p>I would like to <code>fadeIn</code> a node over one second. Then leave it on for 10 seconds. Then <code>fadeOut</code> for another 3 seconds. One way of chaining this would be as follows:</p>
<pre><code>dojo.fx.chain([
dojo.fadeIn({node:myNode, duration:1000}), // fading in for 1 second
dojo.fadeIn({node:m... | [
{
"answer_id": 482261,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 4,
"selected": true,
"text": "<p>I hate to simply reference other online resources for questions like these, but this appears to be a perfect fit for... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53747/"
] | I would like to `fadeIn` a node over one second. Then leave it on for 10 seconds. Then `fadeOut` for another 3 seconds. One way of chaining this would be as follows:
```
dojo.fx.chain([
dojo.fadeIn({node:myNode, duration:1000}), // fading in for 1 second
dojo.fadeIn({node:myNode, duration:10000}), // this does n... | I hate to simply reference other online resources for questions like these, but this appears to be a perfect fit for your needs.
<http://anirudhs.chaosnet.org/blog/2005.01.21.html>
Once you've setup what's described on that page, you could just add this to your `.emacs` or `.emacs.d/init.el` file depending on your ve... |
482,263 | <p>As someone new to GUI development in Python (with pyGTK), I've just started learning about threading. To test out my skills, I've written a simple little GTK interface with a start/stop button. The goal is that when it is clicked, a thread starts that quickly increments a number in the text box, while keeping the GU... | [
{
"answer_id": 482369,
"author": "habnabit",
"author_id": 10999,
"author_profile": "https://Stackoverflow.com/users/10999",
"pm_score": 2,
"selected": false,
"text": "<p>Generally it's better to avoid threads when you can. It's very difficult to write a threaded application correctly, an... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33383/"
] | As someone new to GUI development in Python (with pyGTK), I've just started learning about threading. To test out my skills, I've written a simple little GTK interface with a start/stop button. The goal is that when it is clicked, a thread starts that quickly increments a number in the text box, while keeping the GUI r... | Threading with PyGTK is bit tricky if you want to do it right. Basically, you should not update GUI from within any other thread than main thread (common limitation in GUI libs). Usually this is done in PyGTK using mechanism of queued messages (for communication between workers and GUI) which are read periodically usin... |
482,276 | <p>Can I simply use</p>
<pre><code>if(myString == nil)
</code></pre>
<p>For some reason a string that I know is null, is failing this statement.</p>
| [
{
"answer_id": 482298,
"author": "Sophie Alpert",
"author_id": 49485,
"author_profile": "https://Stackoverflow.com/users/49485",
"pm_score": 5,
"selected": false,
"text": "<p>Is it possible that your string is not in fact <code>nil</code>, and is instead just an empty string? You could t... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58843/"
] | Can I simply use
```
if(myString == nil)
```
For some reason a string that I know is null, is failing this statement. | It seems that my string in the debugger was reporting as (null) but that was due to how it was being assigned, I fixed it and now it is reporting as nil. This fixed my issue.
Thanks! |
482,278 | <p>I need to make a 2D convex hull function for a class assignment and I want a more robust test cases than the assignment provides. Does anyone known of a largish test cases (25 < n < 100) with the solution?</p>
| [
{
"answer_id": 482287,
"author": "Matt J",
"author_id": 18528,
"author_profile": "https://Stackoverflow.com/users/18528",
"pm_score": 3,
"selected": true,
"text": "<p>The <a href=\"http://www.qhull.org/\" rel=\"nofollow noreferrer\">Qhull</a> package, including <code>qhull</code>, <code>... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | I need to make a 2D convex hull function for a class assignment and I want a more robust test cases than the assignment provides. Does anyone known of a largish test cases (25 < n < 100) with the solution? | The [Qhull](http://www.qhull.org/) package, including `qhull`, `qconvex`, and `rbox` should do the trick (I've used them for this exact purpose myself). For example, the [qconvex](http://www.qhull.org/html/qconvex.htm) examples page gives the following (tweaked for a larger test case):
```
rbox 100 D3 | qconvex s o TO... |
482,303 | <p>I am trying to use the axis-java2wsdl ant task to create a wsdl from one of my java classes, but I cannot get the classpath correct.</p>
<p>I am using Ubuntu's libaxis-java package which installs axis-ant.jar in $ANT_HOME/lib and axis.jar in /usr/share/java. The interesting parts of my build.xml look like this:</p... | [
{
"answer_id": 482361,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 3,
"selected": false,
"text": "<p>Ant <a href=\"http://ant.apache.org/manual/using.html#external-tasks\" rel=\"noreferrer\">mechanism</a> for adding lib... | 2009/01/27 | [
"https://Stackoverflow.com/questions/482303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75/"
] | I am trying to use the axis-java2wsdl ant task to create a wsdl from one of my java classes, but I cannot get the classpath correct.
I am using Ubuntu's libaxis-java package which installs axis-ant.jar in $ANT\_HOME/lib and axis.jar in /usr/share/java. The interesting parts of my build.xml look like this:
```
<proper... | In general, this works. But you need to check very carefully which classes are where.
**If your task class can be loaded in a classloader higher up in the classloader hierarchy (like CLASSPATH or ANT\_HOME/lib) then your classpathref will simply get ignored**.
Read the [FAQ entry](http://ant.apache.org/faq.html#deleg... |