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 |
|---|---|---|---|---|---|---|
487,360 | <p>I have been searching for some kind of tool to analyse log files that are in custom format (my own format for my own program for example). There are many tools that are designed for web-traffic log analysing, but I haven't found suitable tools for custom log files. I'd be happy to find one where I can collect for ex... | [
{
"answer_id": 487418,
"author": "Benjamin Podszun",
"author_id": 59492,
"author_profile": "https://Stackoverflow.com/users/59492",
"pm_score": 0,
"selected": false,
"text": "<p>This question seems a little bit broad to me, but your one single example (a graph using timestamps to compute... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59352/"
] | I have been searching for some kind of tool to analyse log files that are in custom format (my own format for my own program for example). There are many tools that are designed for web-traffic log analysing, but I haven't found suitable tools for custom log files. I'd be happy to find one where I can collect for examp... | With [Log Parser](http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en) you get info by simple sql query.
At cmd line for text file use like that:
```
LogParser -i:textline "select * from 'c:\path\*.txt' where text like '%TEXT TO FIND%'"
```
or try with [GUI](... |
487,366 | <p>I am migrating data that has to be inserted using stored procedures which already exist. The stored procedures have parameters and a return value (from a select statement) of an id for the row inserted. Within an OLE DB Command in SSIS, I can call the stored procedure passing column values as the parameters and I us... | [
{
"answer_id": 488631,
"author": "John Mo",
"author_id": 38988,
"author_profile": "https://Stackoverflow.com/users/38988",
"pm_score": 3,
"selected": false,
"text": "<p>Don't use the variable names in the SqlCommand property, just the question marks and the \"OUT\" or \"OUTPUT\" label fo... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32455/"
] | I am migrating data that has to be inserted using stored procedures which already exist. The stored procedures have parameters and a return value (from a select statement) of an id for the row inserted. Within an OLE DB Command in SSIS, I can call the stored procedure passing column values as the parameters and I usual... | The way I found I could do this which was actually quite simple:
```
exec ? = dbo.StoredProc @param = ?, @param2 = ?
```
and then a @RETURN\_VALUE will appear on the Available Destination Columns |
487,373 | <p>Given the following generic interface and implementing class:</p>
<pre><code>public interface IRepository<T> {
// U has to be of type T of a subtype of T
IQueryable<U> Find<U>() where U : T;
}
public class PersonRepository : IRepository<Employee> {
}
</code></pre>
<p>How could I c... | [
{
"answer_id": 487381,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 4,
"selected": true,
"text": "<p>How about writing</p>\n\n<pre><code>var people = repository.Find<Employee>();\n</code></pre>\n\n<p>It's saving ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4830/"
] | Given the following generic interface and implementing class:
```
public interface IRepository<T> {
// U has to be of type T of a subtype of T
IQueryable<U> Find<U>() where U : T;
}
public class PersonRepository : IRepository<Employee> {
}
```
How could I call the Find method without specififying U?
```
... | How about writing
```
var people = repository.Find<Employee>();
```
It's saving the same amount of typing but in a different way. |
487,375 | <p>I am trying to convert code from mysql to mysqli.
The code uses a single mysql_connect in a file which is included by every other file.</p>
<p>mysql_connect returns a MySQL link identifier that is a superglobal so you can rely on having a database connection available in any of your own functions.</p>
<p>It looks ... | [
{
"answer_id": 487393,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 2,
"selected": false,
"text": "<p>I usually make a function:</p>\n\n<pre><code>$mysqli = new mysqli(...);\n\nfunction prepare($query) {\n global $mysqli;... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36214/"
] | I am trying to convert code from mysql to mysqli.
The code uses a single mysql\_connect in a file which is included by every other file.
mysql\_connect returns a MySQL link identifier that is a superglobal so you can rely on having a database connection available in any of your own functions.
It looks like with mysql... | Relying on the fact that PHP will use the last opened connection resource if you don't specify one, is probably not a very good idea.
What happens if your application changes and you need two connections, or the connection is not there?
So it seems you need to do some refactoring anyway.
Here's a solution simila... |
487,378 | <p>I am trying to write a script whose efficiency I am trying to measure. I have a couple of questions:-</p>
<ol>
<li>For small applications, is this kind of profiling required? Or am I getting paranoid? (assuming most code is decently efficient/no infinite loops)</li>
<li>Against what should I benchmark this? What sh... | [
{
"answer_id": 487395,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 1,
"selected": false,
"text": "<p>I think this looks like a great job. Way off? I'd say it's way above the norm. </p>\n\n<p>One question is what the lo... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426996/"
] | I am trying to write a script whose efficiency I am trying to measure. I have a couple of questions:-
1. For small applications, is this kind of profiling required? Or am I getting paranoid? (assuming most code is decently efficient/no infinite loops)
2. Against what should I benchmark this? What should I compare agai... | Do you expect 100 concurrent requests? Do you expect to receive 10K requests in 30 seconds?
It's great that you can run this benchmark, but ask yourself what it means. Think about the real amount of traffic you'll be receiving. You really need a question to benchmark against:
* I expect that my site will have 3,000 ... |
487,388 | <p>I've been using the following to return filepath and line number of a method</p>
<pre><code>echo (__METHOD__) . "() - ln : " . (__LINE__) . "<br />";
</code></pre>
<p>I'd really like to update this to a class (say comment.php) </p>
<pre><code>class comment
{
public static function show()
{
... | [
{
"answer_id": 487392,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 0,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>echo __FILE__;\n</code></pre>\n"
},
{
"answer_id": 487399,
"author": "Paul Dixon... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been using the following to return filepath and line number of a method
```
echo (__METHOD__) . "() - ln : " . (__LINE__) . "<br />";
```
I'd really like to update this to a class (say comment.php)
```
class comment
{
public static function show()
{
echo (__METHOD__) . "() - ln : " . (__LIN... | Check out [debug\_backtrace](http://php.net/debug_backtrace) - this can give you the information about the caller that you need.
For example:
```
<?php
class comment
{
public static function show()
{
$trace=debug_backtrace();
print_r($trace);
}
public function test()
{
... |
487,416 | <p>I have several functions in my program that look like this:</p>
<pre><code>void foo(int x, int y)
</code></pre>
<p>Now I want my program to take a string that looks like:</p>
<pre><code>foo(3, 5)
</code></pre>
<p>And execute the corresponding function. What's the most straightforward way to implement this?</p>
... | [
{
"answer_id": 487420,
"author": "Daniel Sloof",
"author_id": 51133,
"author_profile": "https://Stackoverflow.com/users/51133",
"pm_score": 3,
"selected": false,
"text": "<p>You could take a look at <a href=\"http://www.lua.org/\" rel=\"nofollow noreferrer\">Lua</a>.</p>\n"
},
{
... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52844/"
] | I have several functions in my program that look like this:
```
void foo(int x, int y)
```
Now I want my program to take a string that looks like:
```
foo(3, 5)
```
And execute the corresponding function. What's the most straightforward way to implement this?
When I say straightforward, I mean reasonably extensi... | I'd also go for the scripting language answer.
Using pure C++, I would probably use a parser generator, which will will get the token and grammar rules, and will give me C code that exactly can parse the given function call language, and provides me with an syntax tree of that call. [`flex`](https://github.com/westes... |
487,430 | <p>How can I validate some inputs that are not inside a form tag?</p>
<p>All the samples I found have a form tag, but I want to validate some inputs that are not inside a form.</p>
| [
{
"answer_id": 487481,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 2,
"selected": false,
"text": "<p>Provided we're talking about the <a href=\"http://bassistance.de/jquery-plugins/jquery-plugin-validation/\" rel=\"nofollow... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | How can I validate some inputs that are not inside a form tag?
All the samples I found have a form tag, but I want to validate some inputs that are not inside a form. | [The previously accepted answer (since deleted)](https://stackoverflow.com/a/487690/594235) was linking to [a plugin](http://code.google.com/p/jquery-validator/) that was last updated in January 2009. This obsolete plugin is very different than [the plugin the OP was asking about](http://jqueryvalidation.org):
**Title... |
487,451 | <p>I would like to modify the string in a .h file with NAnt before building the solution.</p>
<p>There is a macro in .h file: #define SERVER_ADDRESS "www.customserver.net" and I would like to modify the string before deploying software so each build could be made for custom address by passing the address in command li... | [
{
"answer_id": 487475,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think that's the proper way to be using NAnt. I wouldn't want to modify file contents that way. I don't belie... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22996/"
] | I would like to modify the string in a .h file with NAnt before building the solution.
There is a macro in .h file: #define SERVER\_ADDRESS "www.customserver.net" and I would like to modify the string before deploying software so each build could be made for custom address by passing the address in command line.
Does... | One could use the [loadfile](http://nant.sourceforge.net/release/latest/help/tasks/loadfile.html) task to help with this. This task loads the given file into a property. What is really useful is when you apply a [filterchain](http://nant.sourceforge.net/release/latest/help/types/filterchain.html) with [replacetokens](h... |
487,485 | <p>Similar to <a href="https://stackoverflow.com/questions/401919/is-hard-coding-literals-ever-acceptable">Is hard-coding literals ever acceptable?</a>, but I'm specifically thinking of "magic strings" here.</p>
<p>On a large project, we have a table of configuration options like these:</p>
<pre><code>Name Va... | [
{
"answer_id": 487505,
"author": "Fredrik Jansson",
"author_id": 58237,
"author_profile": "https://Stackoverflow.com/users/58237",
"pm_score": 2,
"selected": false,
"text": "<p>I believe that the two reasons you have mentioned, Possible misspelling in string, that cannot be detected unti... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18747/"
] | Similar to [Is hard-coding literals ever acceptable?](https://stackoverflow.com/questions/401919/is-hard-coding-literals-ever-acceptable), but I'm specifically thinking of "magic strings" here.
On a large project, we have a table of configuration options like these:
```
Name Value
---- -----
FOO_ENABL... | ```
if (config_options.isTrue('FOO_ENABLED')) {...
}
```
Restrict your hard coded Y check to one place, even if it means writing a wrapper class for your Map.
```
if (config_options.isFooEnabled()) {...
}
```
Might seem okay until you have 100 configuration options and 100 methods (so here you can make a judgement... |
487,493 | <p>I'm using <a href="http://ant.apache.org/ivy" rel="noreferrer">Ivy</a> to manage the dependencies on my project.</p>
<p>So far, I've specified a dependency on Hibernate and servlet-api. However, the hibernate jar itself has a lot of dependencies that aren't really needed, such as <a href="http://en.wikipedia.org/wi... | [
{
"answer_id": 497235,
"author": "Jared",
"author_id": 44757,
"author_profile": "https://Stackoverflow.com/users/44757",
"pm_score": 5,
"selected": true,
"text": "<p><strong>How do I make Ivy download Hibernate but not these two?</strong></p>\n\n<p>Ivy does this using what it calls \"con... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15649/"
] | I'm using [Ivy](http://ant.apache.org/ivy) to manage the dependencies on my project.
So far, I've specified a dependency on Hibernate and servlet-api. However, the hibernate jar itself has a lot of dependencies that aren't really needed, such as [jaas](http://en.wikipedia.org/wiki/Java_Authentication_and_Authorization... | **How do I make Ivy download Hibernate but not these two?**
Ivy does this using what it calls "configurations." Your `ivy.xml` that represents Hibernate will need to provide different configurations to represent different use-cases for hibernate. (There is obviously some use of hibernate that does require jaas and jac... |
487,499 | <p>I need to apply formatting - specifically, bold text - to the tooltip used by a DataGridView in virtual mode. I can set the text in the CellToolTipTextNeeded event, but it doesn't support HTML tags; is there some other syntax I should be using? I don't want to have to reimplement tooltip support myself.</p>
| [
{
"answer_id": 488389,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 1,
"selected": false,
"text": "<p>As the name of the event implies, it simply wants the text to display, which will not have formatting.</p>\n\n<p>If y... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I need to apply formatting - specifically, bold text - to the tooltip used by a DataGridView in virtual mode. I can set the text in the CellToolTipTextNeeded event, but it doesn't support HTML tags; is there some other syntax I should be using? I don't want to have to reimplement tooltip support myself. | You can use the HtmlToolTip from
<http://www.codeproject.com/KB/GDI-plus/HtmlRenderer.aspx>
```
To use it with DataGridView create a ToolTip (HtmlToolTip) and add this after the InitalizeComponent() in your form to replace the default tooltip:
System.Reflection.FieldInfo toolTipControlFieldInfo=
typeof(DataGridView).... |
487,509 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex">Escape string for use in Javascript regex</a> </p>
</blockquote>
<p>I have a msg like this:</p>
<blockquote>
<p><strong>Max {0} chars allowed in {1}</strong... | [
{
"answer_id": 487516,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stackoverflow.com/users/31582",
"pm_score": 2,
"selected": false,
"text": "<p>I think your second line is supposed to be</p>\n\n<pre><code>reg = new RegExp('\\{'+i+'\\}', 'gi');\n</code></pre>\n\n<p... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11614/"
] | >
> **Possible Duplicate:**
>
> [Escape string for use in Javascript regex](https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex)
>
>
>
I have a msg like this:
>
> **Max {0} chars allowed in {1}**
>
>
>
And I have a function to create a message using the arguments passed ... | Your regexp is `/{0}/gi` since you create it from a string. And it is not a valid expression.
You need to escape { in the regexp because it has a special meaning in the regexp syntax, so it should be:
```
new RegExp('\\{'+i+'\\}', 'gi');
```
which is `/\\{0\\}/gi`. You need to *escape* the escaping `\\` in the strin... |
487,515 | <p>I have an annoying SQL statement that seem simple but it looks awfull.
I want the sql to return a resultset with userdata ordered so that a certain user is the first row in the resultset if that users emailaddress is in the companies table.</p>
<p>I have this SQL that returns what i want but i think it looks awful:... | [
{
"answer_id": 487529,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": 3,
"selected": false,
"text": "<p>will this work?:</p>\n\n<pre><code>select c.email, * \nfrom Users u\n LEFT JOIN companies c on u.email = c.e... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57855/"
] | I have an annoying SQL statement that seem simple but it looks awfull.
I want the sql to return a resultset with userdata ordered so that a certain user is the first row in the resultset if that users emailaddress is in the companies table.
I have this SQL that returns what i want but i think it looks awful:
```
sele... | You could do something like this..
```
select CASE
WHEN exists (select email from companies c where c.Id = u.ID and c.Email = u.Email) THEN 1
ELSE 2 END as SortMeFirst, *
From Users u
where companyId = 1
order by SortMeFirst
``` |
487,528 | <p>Is there a way to start an ordered list from a specific index while following XHTML Strict? Using start=n works well, but has been <a href="http://www.w3schools.com/tags/tag_ol.asp" rel="nofollow noreferrer">deprecated</a>… The intended purpose is to resume the index with paging.</p>
<p>I saw a few references to ... | [
{
"answer_id": 487569,
"author": "kdgregory",
"author_id": 42126,
"author_profile": "https://Stackoverflow.com/users/42126",
"pm_score": 1,
"selected": false,
"text": "<p>The CSS solution is to use a list counter: <a href=\"http://www.w3.org/TR/CSS2/generate.html#counters\" rel=\"nofollo... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51275/"
] | Is there a way to start an ordered list from a specific index while following XHTML Strict? Using start=n works well, but has been [deprecated](http://www.w3schools.com/tags/tag_ol.asp)… The intended purpose is to resume the index with paging.
I saw a few references to a CSS solution, but the starting index cannot be ... | As [kdgregory](https://stackoverflow.com/questions/487528/ordered-lists-ol-starting-index-with-xhtml-strict#487569) noted, counters would be the way to accomplish this and still maintain a valid document. [This article](http://www.arraystudio.com/as-workshop/make-ol-list-start-from-number-different-than-1-using-css.htm... |
487,549 | <p>Is there an easy way, preferably with a scripting language or a small tool that could be called through a batch file, to operate on a text file, mark an offset, and put everything after the offset into a new file?</p>
<p>I have a text file added to nightly, and I would like to make it so that the end of the file is... | [
{
"answer_id": 487584,
"author": "Michał Niklas",
"author_id": 22595,
"author_profile": "https://Stackoverflow.com/users/22595",
"pm_score": 2,
"selected": false,
"text": "<p>It is simple with python:</p>\n\n<pre><code>import sys\n\ndef divide_file(fname, mark):\n mark_found = 0\n ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Is there an easy way, preferably with a scripting language or a small tool that could be called through a batch file, to operate on a text file, mark an offset, and put everything after the offset into a new file?
I have a text file added to nightly, and I would like to make it so that the end of the file is marked, t... | Assuming you're currently exporting the data from the Access database with a script already:
```
@echo OFF
:: Force a new line and add a marker; assuming your file is data.txt.
@echo. >> data.txt
@echo **MARKER** >> data.txt
:: Run your export here: these lines just simulate the export.
@echo Test Line 1 >> data.txt... |
487,553 | <p>I'm using Pyro in a project, and can't seem to understand how to transfer a complete object over the wire. The object is <strong>not</strong> distributed (my distributed objects works perfectly fine), but should function as an argument to an already available distributed object. </p>
<p>My object is a derived from ... | [
{
"answer_id": 487720,
"author": "Rafał Dowgird",
"author_id": 12166,
"author_profile": "https://Stackoverflow.com/users/12166",
"pm_score": 3,
"selected": true,
"text": "<p>Operations is a class attribute, not the object attribute. That is why it's not transferred. Try setting it in <co... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38218/"
] | I'm using Pyro in a project, and can't seem to understand how to transfer a complete object over the wire. The object is **not** distributed (my distributed objects works perfectly fine), but should function as an argument to an already available distributed object.
My object is a derived from a custom class containi... | Operations is a class attribute, not the object attribute. That is why it's not transferred. Try setting it in `__init__` via `self.operations = <whatever>`. |
487,566 | <p>I create a pointer-to-pointer of a class object and when I try to create a new object using the pointers it seg-faults. Why does this happen?</p>
<pre><code>struct Level
{
int SoldierCount;
Soldier **soldier;
int taskCount;
int *taskPercentage;
int *taskBitmapX;
in... | [
{
"answer_id": 487594,
"author": "arturh",
"author_id": 4186,
"author_profile": "https://Stackoverflow.com/users/4186",
"pm_score": 1,
"selected": false,
"text": "<p>I can not find any segfault related problems in your code.</p>\n\n<p>But I'm confused as to why your case sensitivity does... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I create a pointer-to-pointer of a class object and when I try to create a new object using the pointers it seg-faults. Why does this happen?
```
struct Level
{
int SoldierCount;
Soldier **soldier;
int taskCount;
int *taskPercentage;
int *taskBitmapX;
int *taskBitmapY... | With empty `Soldier` constructor your code works fine (except for corrected typos, like lowercase `level.soldier[]`)
Please post the constructor body. |
487,590 | <p>Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We do not have any constants defined for these anywhere (and neither does java I think) or any other clever thing for dealing with them so they are in plain text littered throughout the code.</p>
<pre><code>String tempFolde... | [
{
"answer_id": 487602,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 4,
"selected": true,
"text": "<p>I would treat this just as any other String constant you have scattered throughout your code and define a constant... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51382/"
] | Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We do not have any constants defined for these anywhere (and neither does java I think) or any other clever thing for dealing with them so they are in plain text littered throughout the code.
```
String tempFolderPath = System... | I would treat this just as any other String constant you have scattered throughout your code and define a constant variable for it. Granted, in this case "java.io.tmpdir" is unlikely to change, but you never know. (I don't mean that Sun might change the meaning of "java.io.tmpdir", or what system property it points to,... |
487,615 | <p>Why is:</p>
<pre><code>(CheckBox)lstControls.Where(x => x.ID == "some_id").SingleOrDefault();
</code></pre>
<p>not as efficient as:</p>
<pre><code>(CheckBox)lstControls.SingleOrDefault(x => x.ID == "some_id");
</code></pre>
<p>And for a not-so-well-formed XML document and you only know the name of the elem... | [
{
"answer_id": 487652,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 3,
"selected": true,
"text": "<p>If I'm not mistaken, in terms of big O efficiency, it's the same. It's just an extra method call.</p>\n\n<p>Regarding... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59517/"
] | Why is:
```
(CheckBox)lstControls.Where(x => x.ID == "some_id").SingleOrDefault();
```
not as efficient as:
```
(CheckBox)lstControls.SingleOrDefault(x => x.ID == "some_id");
```
And for a not-so-well-formed XML document and you only know the name of the element you are looking for is this the best statement you ... | If I'm not mistaken, in terms of big O efficiency, it's the same. It's just an extra method call.
Regarding the second question,
```
var xmlElem = (from n in xDocument.Descendants() where (string)n.Attribute("name") == "some_node_name" select n).SingleOrDefault();
```
can be expressed more simply as
```
var xmlEle... |
487,624 | <p>I have a test project that takes alot of time to test cases. I have configured cruisecontrol.net with Nunit, msbuild. Now if I run my project during the execution of Nunit it kills the process and fail the build. Also if you force a build then results are not updated it shows the last build results and also giving T... | [
{
"answer_id": 487652,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 3,
"selected": true,
"text": "<p>If I'm not mistaken, in terms of big O efficiency, it's the same. It's just an extra method call.</p>\n\n<p>Regarding... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309834/"
] | I have a test project that takes alot of time to test cases. I have configured cruisecontrol.net with Nunit, msbuild. Now if I run my project during the execution of Nunit it kills the process and fail the build. Also if you force a build then results are not updated it shows the last build results and also giving Text... | If I'm not mistaken, in terms of big O efficiency, it's the same. It's just an extra method call.
Regarding the second question,
```
var xmlElem = (from n in xDocument.Descendants() where (string)n.Attribute("name") == "some_node_name" select n).SingleOrDefault();
```
can be expressed more simply as
```
var xmlEle... |
487,635 | <p>We are using Postfix for mail delivery and I am trying to make a shell script handle an email sent to foo-bar-baz-bat@example.org. </p>
<p>Is there a way to do this and how?</p>
<p>I am trying to create an email-based front-end for a bulletin board. The users have split into two factions: those who would like to u... | [
{
"answer_id": 487666,
"author": "Jason Punyon",
"author_id": 6212,
"author_profile": "https://Stackoverflow.com/users/6212",
"pm_score": 1,
"selected": false,
"text": "<p>in /etc/aliases</p>\n\n<p>you should be able to alias to a script like so</p>\n\n<pre><code>foo-bar-baz-bat@example.... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6871/"
] | We are using Postfix for mail delivery and I am trying to make a shell script handle an email sent to foo-bar-baz-bat@example.org.
Is there a way to do this and how?
I am trying to create an email-based front-end for a bulletin board. The users have split into two factions: those who would like to use the forum and ... | in /etc/aliases
you should be able to alias to a script like so
```
foo-bar-baz-bat@example.org: |"/path/to/ScriptOrExecutableHere"
```
I did this with my Trac installation and it worked like a charm...
EDIT: Oh...i didn't realize you were going to be aliasing dynamic addresses...I think you'd need a script to ali... |
487,646 | <p>I'm working on an application that uses mod_plsql with Oracle 10G to generate web pages via PL/SQL stored procedures called directly from the web browser. I'm looking for a way to only accept parameters via POST requests, and not GET requests.</p>
<p>Ie, in PHP I would only want the value of $_POST['parameter_name'... | [
{
"answer_id": 505503,
"author": "Peter Hilton",
"author_id": 2670,
"author_profile": "https://Stackoverflow.com/users/2670",
"pm_score": 1,
"selected": false,
"text": "<p>In the Apache configuration, you can probably use the <a href=\"http://httpd.apache.org/docs/2.2/mod/core.html#limit... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm working on an application that uses mod\_plsql with Oracle 10G to generate web pages via PL/SQL stored procedures called directly from the web browser. I'm looking for a way to only accept parameters via POST requests, and not GET requests.
Ie, in PHP I would only want the value of $\_POST['parameter\_name'] and n... | If you don't have access to the Apache config, you can probably put the following code at the top of your Oracle procedure:
```
if owa_util.get_cgi_env('REQUEST_METHOD') != 'POST' then
raise_application_error(-20001,'Only POST request method is allowed.');
end if;
``` |
487,649 | <p>I am working on a comp based application.
In this application, there are n number of containers that communicate to each other via RMI services they provide to each other.
At a certaion point, one rmi thread connected to my container is lost the connection due to out of memory error, but all other RMI thread connect... | [
{
"answer_id": 505503,
"author": "Peter Hilton",
"author_id": 2670,
"author_profile": "https://Stackoverflow.com/users/2670",
"pm_score": 1,
"selected": false,
"text": "<p>In the Apache configuration, you can probably use the <a href=\"http://httpd.apache.org/docs/2.2/mod/core.html#limit... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am working on a comp based application.
In this application, there are n number of containers that communicate to each other via RMI services they provide to each other.
At a certaion point, one rmi thread connected to my container is lost the connection due to out of memory error, but all other RMI thread connected ... | If you don't have access to the Apache config, you can probably put the following code at the top of your Oracle procedure:
```
if owa_util.get_cgi_env('REQUEST_METHOD') != 'POST' then
raise_application_error(-20001,'Only POST request method is allowed.');
end if;
``` |
487,661 | <p>I have a control which I have to make large modifications to. I'd like to completely prevent it from redrawing while I do that - SuspendLayout and ResumeLayout aren't enough. How do I suspend painting for a control and its children?</p>
| [
{
"answer_id": 487757,
"author": "ng5000",
"author_id": 36860,
"author_profile": "https://Stackoverflow.com/users/36860",
"pm_score": 9,
"selected": true,
"text": "<p>At my previous job, we struggled with getting our rich UI app to paint instantly and smoothly. We were using standard .N... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I have a control which I have to make large modifications to. I'd like to completely prevent it from redrawing while I do that - SuspendLayout and ResumeLayout aren't enough. How do I suspend painting for a control and its children? | At my previous job, we struggled with getting our rich UI app to paint instantly and smoothly. We were using standard .Net controls, custom controls and devexpress controls.
After a lot of googling and reflector usage, I came across the WM\_SETREDRAW win32 message. This really stops controls drawing whilst you update ... |
487,663 | <p>can anyone recommend a TAPI component for use with C++ in the MS Windows environment?
I have tried the standard MS implementations of TAPI 2 and 3 and had problems with both. Mainly recovery from modems been switched off or losing connections.<br>
The latest problem is the TAPI device disappearing after a couple of ... | [
{
"answer_id": 487757,
"author": "ng5000",
"author_id": 36860,
"author_profile": "https://Stackoverflow.com/users/36860",
"pm_score": 9,
"selected": true,
"text": "<p>At my previous job, we struggled with getting our rich UI app to paint instantly and smoothly. We were using standard .N... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25139/"
] | can anyone recommend a TAPI component for use with C++ in the MS Windows environment?
I have tried the standard MS implementations of TAPI 2 and 3 and had problems with both. Mainly recovery from modems been switched off or losing connections.
The latest problem is the TAPI device disappearing after a couple of days... | At my previous job, we struggled with getting our rich UI app to paint instantly and smoothly. We were using standard .Net controls, custom controls and devexpress controls.
After a lot of googling and reflector usage, I came across the WM\_SETREDRAW win32 message. This really stops controls drawing whilst you update ... |
487,671 | <p>What is the best way to build a .NET solution and run MbUnit tests using Rake?</p>
<p>I'm currently invoking commands directly like this:</p>
<pre><code>sh "#{DOT_NET_PATH}msbuild.exe /p:Configuration=#{CONFIG} #{SOLUTION}"
</code></pre>
<p>This works but seems a bit rubbish. Are there any gems people would recom... | [
{
"answer_id": 737762,
"author": "Peter Mounce",
"author_id": 20971,
"author_profile": "https://Stackoverflow.com/users/20971",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://www.neverrunwithscissors.com/development/tools/2009/04/03/raking-it-in-rake-dotnet-hello-world-re... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6369/"
] | What is the best way to build a .NET solution and run MbUnit tests using Rake?
I'm currently invoking commands directly like this:
```
sh "#{DOT_NET_PATH}msbuild.exe /p:Configuration=#{CONFIG} #{SOLUTION}"
```
This works but seems a bit rubbish. Are there any gems people would recommend using? | I just started using [albacore](http://albacorebuild.net/) which is available on <http://github.com/derickbailey/Albacore>.
Full docs at the [wiki](http://wiki.github.com/derickbailey/Albacore)
Your task for executing a build is this simple:
```
msbuild do |msb|
msb.solution = "mysolution.sln"
#... other settings... |
487,684 | <p>I have a number of asp.net AJAX update panels on a page, that can be refreshed independantley. I would like it so that when the refresh button is used, the content in the panel is hidden, and only the loading image is displayed while data is fetched (it takes 5-10 seconds for data to come back from the server). What... | [
{
"answer_id": 487724,
"author": "Richard L",
"author_id": 51017,
"author_profile": "https://Stackoverflow.com/users/51017",
"pm_score": 1,
"selected": false,
"text": "<p>Is the loading image placed at the same location as the updatepanel? </p>\n\n<p>If thats the case just make the loadi... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8768/"
] | I have a number of asp.net AJAX update panels on a page, that can be refreshed independantley. I would like it so that when the refresh button is used, the content in the panel is hidden, and only the loading image is displayed while data is fetched (it takes 5-10 seconds for data to come back from the server). What is... | You can use JavaScript to hide/show the panel on the begin and end functions of the RequestHandler:
```
var panel = new Sys.UI.Control($get("myUpdatePanel"));
function beginRequestHandler(sender, args) {
panel.set_visible(false);
}
function endRequestHandler(sender, args) {
panel.set_visible(tru... |
487,715 | <p>The question is in the title : "Is there an equivalent to java @SuppressWarnings in JSP ?"</p>
| [
{
"answer_id": 487784,
"author": "Eddie",
"author_id": 57752,
"author_profile": "https://Stackoverflow.com/users/57752",
"pm_score": 2,
"selected": false,
"text": "<p>If you are getting warnings in the code generated from a JSP (or in in-line code in a JSP), one solution is to move the p... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26859/"
] | The question is in the title : "Is there an equivalent to java @SuppressWarnings in JSP ?" | Yes, just use:
```
<%! @SuppressWarnings("unchecked") %>
``` |
487,719 | <p>I've registered a control in my web.config file and the .dll for the control has been placed in the application's Bin folder.</p>
<pre><code> <compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3... | [
{
"answer_id": 487878,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 1,
"selected": false,
"text": "<p>Is the folder defined as an application in IIS? That would cause such a problem since in that case IIS will look for... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26126/"
] | I've registered a control in my web.config file and the .dll for the control has been placed in the application's Bin folder.
```
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<a... | I had some similar problems a while back. Only way I was able to get the control working was something like this:
```
<add tagPrefix="cc1" tagName="RichTextEditor" src="~/controls/richtexteditor.ascx">
```
rather than this:
```
<add assembly="RichTextEditor" namespace="RichTextEditor" tagPrefix="cc1" />
```
**EDI... |
487,725 | <p>Sander, has wrote a related article for this...</p>
<p><a href="http://todotnet.com/archive/2005/10/11/2595.aspx" rel="nofollow noreferrer">http://todotnet.com/archive/2005/10/11/2595.aspx</a></p>
<p>unfortunately the code is in C#.</p>
<p>Which is the equivelant to the vb.net version?</p>
| [
{
"answer_id": 487767,
"author": "belaz",
"author_id": 59350,
"author_profile": "https://Stackoverflow.com/users/59350",
"pm_score": 2,
"selected": false,
"text": "<p>Converted with <a href=\"http://www.developerfusion.com/tools/convert/csharp-to-vb/\" rel=\"nofollow noreferrer\">http://... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Sander, has wrote a related article for this...
<http://todotnet.com/archive/2005/10/11/2595.aspx>
unfortunately the code is in C#.
Which is the equivelant to the vb.net version? | Converted with <http://www.developerfusion.com/tools/convert/csharp-to-vb/>
```
Imports System.Net
Imports System.Xml.Xsl
Imports System.Net
Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create("...url to the original publish.htm file..."), HttpWebRequest)
Dim response As HttpWebResponse = DirectCast(re... |
487,734 | <p>I would like to know the best way to save an image from a URL in php.</p>
<p>At the moment I am using </p>
<pre><code>file_put_contents($pk, file_get_contents($PIC_URL));
</code></pre>
<p>which is not ideal. I am unable to use curl. Is there a method specifically for this?</p>
| [
{
"answer_id": 487743,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 4,
"selected": true,
"text": "<p>Using file_get_contents is fine, unless the file is very large. In that case, you don't really need to be holding the e... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I would like to know the best way to save an image from a URL in php.
At the moment I am using
```
file_put_contents($pk, file_get_contents($PIC_URL));
```
which is not ideal. I am unable to use curl. Is there a method specifically for this? | Using file\_get\_contents is fine, unless the file is very large. In that case, you don't really need to be holding the entire thing in memory.
For a large retrieval, you could [fopen](http://php.net/fopen) the remote file, [fread](http://php.net/fread) it, say, 32KB at a time, and [fwrite](http://php.net/fwrite) it l... |
487,753 | <p>I'm using git for a PHP project, I think it's really handy. There is one thing that would be great if I get it to work.</p>
<p>I have created a branch, meant for deployment. It has some differences, like different configuration files and documentation.</p>
<p>I can't just ignore them, because then they will stay i... | [
{
"answer_id": 487769,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 2,
"selected": false,
"text": "<p>Quick answer is, don't ever merge the branches. In fact you don't need to merge them at all, just merge from developmen... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20261/"
] | I'm using git for a PHP project, I think it's really handy. There is one thing that would be great if I get it to work.
I have created a branch, meant for deployment. It has some differences, like different configuration files and documentation.
I can't just ignore them, because then they will stay in both branches, ... | Update Feb. 2021: Git itself is still not a good fit, but [GitHub Action environment could help](https://stackoverflow.com/a/66248867/6309).
2009: I am not sure Git is meant to be used this way.
First a quick [Linus advice](http://www.gelato.unsw.edu.au/archives/git/0701/37960.html), always "colorful" and informative... |
487,770 | <p>I'm going through some old stored procedures at work and constantly come across</p>
<pre><code>CASE MyColumn WHEN 'Y' THEN 'Yes' WHEN 'N' THEN 'No' ELSE 'Unknown' END
</code></pre>
<p>It gets even worse when this is tied not to a word, but instead a colour.</p>
<pre><code>CASE MyColumn WHEN 'Y' THEN 'style="backg... | [
{
"answer_id": 487789,
"author": "Anthony Mastrean",
"author_id": 3619,
"author_profile": "https://Stackoverflow.com/users/3619",
"pm_score": 2,
"selected": false,
"text": "<p>I would be concerned putting this kind of logic in SQL statements. What happens if your database engine changes?... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | I'm going through some old stored procedures at work and constantly come across
```
CASE MyColumn WHEN 'Y' THEN 'Yes' WHEN 'N' THEN 'No' ELSE 'Unknown' END
```
It gets even worse when this is tied not to a word, but instead a colour.
```
CASE MyColumn WHEN 'Y' THEN 'style="background-color:pink"' ELSE '' END
```
... | When speed is of the essence, the SQL case statements might even be the fastest (I'll run a test) but for maintainability, returning the plain values to the presentation layer (or some business layer thingy) is the best option.
[update] ran some quick and dirty tests (code below) and found the C# code variant slightl... |
487,773 | <p>I need to return a complex type from a webservice and had constructed the class MyComplexType which implements the interface IMyComplexType. Now in my webservice I have a method that should return an object that implements IMyComplexType like so:</p>
<pre><code>[WebMethod]
public IMyComplexType GetMyComplexType()
{... | [
{
"answer_id": 487790,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 0,
"selected": false,
"text": "<p>It's been a while, but I believe you need only make your interfaces extend <code>ISerializable</code> and all shou... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | I need to return a complex type from a webservice and had constructed the class MyComplexType which implements the interface IMyComplexType. Now in my webservice I have a method that should return an object that implements IMyComplexType like so:
```
[WebMethod]
public IMyComplexType GetMyComplexType()
{
IMyComplex... | Short answer is no, you can't return an interface through a WebService.
Long answer is that you can kind of get the behaviour you want, but it's a bit hacky. The solution is to use binary serialization. So you serialize your type to bytes, have the web method return a series of bytes and then on the other side you wou... |
487,779 | <p>I'm trying to transform a datetime to a date format yyyy-MM-dd, because I'm using the xsd.exe tool the xs:date datatypes are automatically changed into a datetime datatype, because there is no type in the .NET Framework that matches the type xs:date completely.</p>
<p>But I can't get it to work</p>
<pre><code><... | [
{
"answer_id": 487863,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 3,
"selected": false,
"text": "<p>Frankly, this looks about right to me - sometimes a simple substring is good enough.</p>\n\n<p>However, if you're in .... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49788/"
] | I'm trying to transform a datetime to a date format yyyy-MM-dd, because I'm using the xsd.exe tool the xs:date datatypes are automatically changed into a datetime datatype, because there is no type in the .NET Framework that matches the type xs:date completely.
But I can't get it to work
```
<articles>
<artic... | Thanks to Stesoc and annakata I figured it out
This is the code I'm now using and it works perfect
```
<xsl:template match="*">
<xsl:param name="parentElm">
<xsl:value-of select="name(..)" />
</xsl:param>
<xsl:choose>
<xsl:when test="local-name() = 'deliverydateasked'">
<xsl:ele... |
487,791 | <p>I need to read the system clock (time and date) and display it in a human-readable format in Perl.</p>
<p>Currently, I'm using the following method (which I found <a href="http://perl.about.com/od/perltutorials/a/perllocaltime_2.htm" rel="noreferrer">here</a>):</p>
<pre><code>#!/usr/local/bin/perl
@months = qw(Jan... | [
{
"answer_id": 487804,
"author": "Igor",
"author_id": 44673,
"author_profile": "https://Stackoverflow.com/users/44673",
"pm_score": 5,
"selected": true,
"text": "<p>Use <a href=\"http://perldoc.perl.org/functions/localtime.html\" rel=\"noreferrer\">localtime</a> function:</p>\n\n<blockqu... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I need to read the system clock (time and date) and display it in a human-readable format in Perl.
Currently, I'm using the following method (which I found [here](http://perl.about.com/od/perltutorials/a/perllocaltime_2.htm)):
```
#!/usr/local/bin/perl
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@w... | Use [localtime](http://perldoc.perl.org/functions/localtime.html) function:
>
> In scalar context, localtime() returns
> the ctime(3) value:
>
>
>
> ```
> $now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
>
> ```
>
> |
487,822 | <p>How do I postback whenever a user types in a textbox to filter results in a div tag. </p>
| [
{
"answer_id": 487859,
"author": "Natrium",
"author_id": 59119,
"author_profile": "https://Stackoverflow.com/users/59119",
"pm_score": 2,
"selected": false,
"text": "<p>I think this is an interesting article for you:</p>\n\n<p><a href=\"http://exscale.se/archives/2008/05/16/jquery-live-a... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33054/"
] | How do I postback whenever a user types in a textbox to filter results in a div tag. | ```
<script language=javascript>
$(document).ready(function () {
$("#SearchBox").focus();
$("#SearchBox").keyup(function (event) {
var e = window.event || e
var keyunicode = e.charCode || e.keyCode
//Allow alphabetical keys, plus BACKSPACE and SPACE
if... |
487,826 | <p>Does Java and/or Spring have the concept of properties? I have bunch of domain models, each of which has several properties. Example:</p>
<pre><code>public class Person {
private String name;
private Date dateOfBirth;
private float height;
private float weight;
// getters and setters not shown
}... | [
{
"answer_id": 487867,
"author": "Simon Groenewolt",
"author_id": 31884,
"author_profile": "https://Stackoverflow.com/users/31884",
"pm_score": 0,
"selected": false,
"text": "<p>Some of the info you want to provide fits nicely in a BeanInfo object, originally meant to support JavaBeans s... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] | Does Java and/or Spring have the concept of properties? I have bunch of domain models, each of which has several properties. Example:
```
public class Person {
private String name;
private Date dateOfBirth;
private float height;
private float weight;
// getters and setters not shown
}
```
When di... | If I understand you correctly, you want to be able to put the format and description of some of these properties in an external file. You might want to take a look at Spring's [`MessageSource`](http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#context-functionality-messagesource) (link to [javado... |
487,855 | <p>I have the following situation:</p>
<p>There is a tool that gets an XSLT from a web interface and embeds the XSLT in an XML file (Someone should have been fired). "Unfortunately" I work in a French speaking country and therefore the XSLT has a number of words with accents. When the XSLT is embedded in the XML, the ... | [
{
"answer_id": 487868,
"author": "gpojd",
"author_id": 28071,
"author_profile": "https://Stackoverflow.com/users/28071",
"pm_score": 4,
"selected": true,
"text": "<p>You can try something like <a href=\"http://search.cpan.org/~gaas/HTML-Parser-3.59/lib/HTML/Entities.pm\" rel=\"nofollow n... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59332/"
] | I have the following situation:
There is a tool that gets an XSLT from a web interface and embeds the XSLT in an XML file (Someone should have been fired). "Unfortunately" I work in a French speaking country and therefore the XSLT has a number of words with accents. When the XSLT is embedded in the XML, the tool conve... | You can try something like [HTML::Entities](http://search.cpan.org/~gaas/HTML-Parser-3.59/lib/HTML/Entities.pm). From the POD:
```
use HTML::Entities;
$a = "Våre norske tegn bør æres";
decode_entities($a);
#encode_entities($a, "\200-\377"); ## not needed for what you are doing
```
In response to y... |
487,857 | <p>I'm building a MVC web application (using the Spring MVC framework), and I'm a little stumped on the best way to design a particular area.</p>
<p>The application has to interact with a series of web services which are not really all that greatly designed, and don't offer much abstraction in and of themselves - basi... | [
{
"answer_id": 487912,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 4,
"selected": true,
"text": "<blockquote>\n <p>What kind of strategies do you use when deciding where to break down \"business logic\" versus \"data acc... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] | I'm building a MVC web application (using the Spring MVC framework), and I'm a little stumped on the best way to design a particular area.
The application has to interact with a series of web services which are not really all that greatly designed, and don't offer much abstraction in and of themselves - basically ther... | >
> What kind of strategies do you use when deciding where to break down "business logic" versus "data access logic" when they seem to overlap?
>
>
>
Maybe you can have three layers instead of two: "one extra level of indirection".
At the top layer, you might have business logic which doesn't know about data-acce... |
487,870 | <p>I can't quite work out how to allow a DataGridView populated at runtime to sort (when users click on the column headers) where a LINQ from XML query is the DataSource, via a BindingSource.</p>
<pre><code> Dim QueryReOrder = From Q In Query _
Where ((0 - Q.Qualifier) / cmbTSStakeValue.Text)... | [
{
"answer_id": 511357,
"author": "Lennaert",
"author_id": 57427,
"author_profile": "https://Stackoverflow.com/users/57427",
"pm_score": 2,
"selected": false,
"text": "<p>My default approach is to copy everything into a DataTable and bind the DataGridView to that.</p>\n\n<p>Obviously that... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57087/"
] | I can't quite work out how to allow a DataGridView populated at runtime to sort (when users click on the column headers) where a LINQ from XML query is the DataSource, via a BindingSource.
```
Dim QueryReOrder = From Q In Query _
Where ((0 - Q.Qualifier) / cmbTSStakeValue.Text) <= 0.1 _
... | You need to get the results of the LINQ query into something supports sorting functionality. This is typically done by deriving a class from BindingList and implementing the Sorting Core functionality in the derived class.
There are many examples of implementations out there to choose from and it is a pretty straight... |
487,876 | <p>When a user logs in, I give them a cookie named auth with a value that is a GUID, which expires in 2 weeks. I save the hashed GUID in the database with a salt of their userID and then date when it expires. When a user accesses the site, I check for the cookie and log them in if it matches and hasn't expired in the d... | [
{
"answer_id": 511357,
"author": "Lennaert",
"author_id": 57427,
"author_profile": "https://Stackoverflow.com/users/57427",
"pm_score": 2,
"selected": false,
"text": "<p>My default approach is to copy everything into a DataTable and bind the DataGridView to that.</p>\n\n<p>Obviously that... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26/"
] | When a user logs in, I give them a cookie named auth with a value that is a GUID, which expires in 2 weeks. I save the hashed GUID in the database with a salt of their userID and then date when it expires. When a user accesses the site, I check for the cookie and log them in if it matches and hasn't expired in the data... | You need to get the results of the LINQ query into something supports sorting functionality. This is typically done by deriving a class from BindingList and implementing the Sorting Core functionality in the derived class.
There are many examples of implementations out there to choose from and it is a pretty straight... |
487,894 | <p>I want to add a row of headers to an existing CSV file, editing in place. How can I do this?</p>
<pre><code>echo 'one, two, three' > testfile.csv
</code></pre>
<p>and I want to end up with</p>
<pre><code>column1, column2, column3
one, two, three
</code></pre>
<p>Changing the initial CSV output is out ... | [
{
"answer_id": 487911,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 4,
"selected": false,
"text": "<p>This doesn't use sed, but using >> will append to a file. For example:</p>\n\n<pre><code>echo 'one, two, three' >&g... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4812/"
] | I want to add a row of headers to an existing CSV file, editing in place. How can I do this?
```
echo 'one, two, three' > testfile.csv
```
and I want to end up with
```
column1, column2, column3
one, two, three
```
Changing the initial CSV output is out of my hands.
Any standard command will do. The impo... | This adds custom text at the beginning of your file:
```
echo 'your_custom_escaped_content' > temp_file.csv
cat testfile.csv >> temp_file.csv
mv temp_file.csv testfile.csv
``` |
487,895 | <p>We recently moved our source control from 2005 to 2008 and the web projects builds have stopped copying the resource dlls for referenced (project reference) resx files into the bin folder (they remain at the same level as _publishedWebsites). I cannot see anything different in the build (It is still set to Mixed Pla... | [
{
"answer_id": 487911,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 4,
"selected": false,
"text": "<p>This doesn't use sed, but using >> will append to a file. For example:</p>\n\n<pre><code>echo 'one, two, three' >&g... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45734/"
] | We recently moved our source control from 2005 to 2008 and the web projects builds have stopped copying the resource dlls for referenced (project reference) resx files into the bin folder (they remain at the same level as \_publishedWebsites). I cannot see anything different in the build (It is still set to Mixed Platf... | This adds custom text at the beginning of your file:
```
echo 'your_custom_escaped_content' > temp_file.csv
cat testfile.csv >> temp_file.csv
mv temp_file.csv testfile.csv
``` |
487,901 | <p>I'm preparing a maven2 web project for continuous integration. I use the <a href="http://cargo.codehaus.org/Maven2+plugin" rel="nofollow noreferrer">maven cargo plugin</a> to automatically deploy the WAR to Tomcat6x before running integration tests.</p>
<p>My code depends on some system properties which are set wit... | [
{
"answer_id": 490744,
"author": "maskefjes",
"author_id": 27743,
"author_profile": "https://Stackoverflow.com/users/27743",
"pm_score": 4,
"selected": true,
"text": "<p>You should be able to do this by using the systemProperties tag in the container definition of the plugin:</p>\n\n<pre... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17473/"
] | I'm preparing a maven2 web project for continuous integration. I use the [maven cargo plugin](http://cargo.codehaus.org/Maven2+plugin) to automatically deploy the WAR to Tomcat6x before running integration tests.
My code depends on some system properties which are set with `MAVEN_OPTS=-Dfoo=bar`. Unfortunately these p... | You should be able to do this by using the systemProperties tag in the container definition of the plugin:
```
<container>
[...]
<systemProperties>
<MAVEN_OPTS>-Dfoo=bar</MAVEN_OPTS>
</systemProperties>
</container>
```
Or you can set this in a setenv.sh (on linux) file in your ... |
487,904 | <p>A "non-believer" of C# was asking me what the purpose to extension methods was. I explained that you could then add new methods to objects that were already defined, especially when you don't own/control the source to the original object.</p>
<p>He brought up "Why not just add a method to your own class?" We've bee... | [
{
"answer_id": 487914,
"author": "Tamir",
"author_id": 30879,
"author_profile": "https://Stackoverflow.com/users/30879",
"pm_score": 0,
"selected": false,
"text": "<p>I have only one word to tell about it: <strong>MAINTAINABILITY</strong> this is the key for extension methods use</p>\n"
... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53531/"
] | A "non-believer" of C# was asking me what the purpose to extension methods was. I explained that you could then add new methods to objects that were already defined, especially when you don't own/control the source to the original object.
He brought up "Why not just add a method to your own class?" We've been going ro... | I think extension methods help a lot when writing code, if you add extension methods to basic types you'll get them quicky in the intellisense.
I have a format provider to [format a file size](https://stackoverflow.com/questions/128618/c-file-size-format-provider). To use it I need to write:
```
Console.WriteLine(Str... |
487,906 | <p>I have a database with millions of phone numbers with free-for-all formatting. Ie, the UI does not enforce any constraints and the users are typing in whatever they want.</p>
<p>What I'm looking for is a Java API that can make a best-effort to convert these into a consistent format. Ideally, the API would take the ... | [
{
"answer_id": 487918,
"author": "Olvagor",
"author_id": 17473,
"author_profile": "https://Stackoverflow.com/users/17473",
"pm_score": 2,
"selected": false,
"text": "<p>I don't know of such an API but it looks like could be done by using regular expressions. Probably you can't convert al... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7679/"
] | I have a database with millions of phone numbers with free-for-all formatting. Ie, the UI does not enforce any constraints and the users are typing in whatever they want.
What I'm looking for is a Java API that can make a best-effort to convert these into a consistent format. Ideally, the API would take the free text ... | You could write your own (for US phone # format):
* Strip any non-numeric characters from the string
* Check that the remaining string is ten characters long
* Put parentheses around the first three characters and a dash between the sixth and seventh character.
* Prepend "+1 " to the string
---
### Update:
Google r... |
487,920 | <p>Ok, this is bugging me, and I just can't figure out what is wrong...</p>
<p>I have made two forms. First form just has a simple button on it, which opens the other as a dialog like so:</p>
<pre><code>using (Form2 f = new Form2())
{
if (f.ShowDialog() != DialogResult.OK)
MessageBox.Show("Not OK");
e... | [
{
"answer_id": 487940,
"author": "Samuel",
"author_id": 32465,
"author_profile": "https://Stackoverflow.com/users/32465",
"pm_score": 6,
"selected": false,
"text": "<p>Try setting <code>DialogResult</code> on <code>button1</code></p>\n\n<pre><code>this.button1.DialogResult = System.Windo... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39321/"
] | Ok, this is bugging me, and I just can't figure out what is wrong...
I have made two forms. First form just has a simple button on it, which opens the other as a dialog like so:
```
using (Form2 f = new Form2())
{
if (f.ShowDialog() != DialogResult.OK)
MessageBox.Show("Not OK");
else
MessageBo... | Just setting the `AcceptButton`/`CancelButton` is not enough. This just tells which button should be invoked on `Enter`/`Esc`. You have to set the button's `DialogResult` property. |
487,934 | <p>We have an old legacy PHP application. Now I want to write a new application module using Ruby on Rails. </p>
<p>Deployment is a one problem. I guess that it should be possible to run PHP app (via mod_php) and RoR app (via mod_proxy / mongrel) on a one Apache server. I don't want to use mod_rails because it require... | [
{
"answer_id": 488130,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 1,
"selected": false,
"text": "<p>First, it seems like you're asking for trouble by mixing the two technologies. My first suggestion is \"don't do that... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3315/"
] | We have an old legacy PHP application. Now I want to write a new application module using Ruby on Rails.
Deployment is a one problem. I guess that it should be possible to run PHP app (via mod\_php) and RoR app (via mod\_proxy / mongrel) on a one Apache server. I don't want to use mod\_rails because it requires to ru... | First, if you are placing the rails app in a sub directory it is possible to use mod\_rails. In your configuration for the PHP site you can have a location that has a root for rails.
```
<Location /railsapp>
DocumentRoot /.../app/public
</Location>
```
To get a session over to the rails side, you could either crea... |
487,952 | <p>I'm working on a Silverlight app using the MVVM pattern. My ViewModel currently consists of a property that represents a collection of Model Objects:</p>
<pre><code>public ObservableCollection<IndexEntry> IndexList
{
get;
set;
}
</code></pre>
<p>it also has several me... | [
{
"answer_id": 488012,
"author": "GWLlosa",
"author_id": 18071,
"author_profile": "https://Stackoverflow.com/users/18071",
"pm_score": 4,
"selected": true,
"text": "<p>The only way a reference survives garbage collection is if it is rooted. If there is some other class that is still in u... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26516/"
] | I'm working on a Silverlight app using the MVVM pattern. My ViewModel currently consists of a property that represents a collection of Model Objects:
```
public ObservableCollection<IndexEntry> IndexList
{
get;
set;
}
```
it also has several methods that will populate that col... | The only way a reference survives garbage collection is if it is rooted. If there is some other class that is still in use that contains a reference to the ObservableCollection, then the ObservableCollection will not be destroyed, regardless of whether or not you set it to null. For example, suppose there is one 'in me... |
487,962 | <p>Okay, there is a ton of stuff out there on sanitizing strings but very little, that I can find, on the best methods to prepare user input (like what I'm typing now) for inserting into a content management system then how to filter it coming out.</p>
<p>I'm building two multilingual (Japanese, English + other Romanc... | [
{
"answer_id": 487976,
"author": "fred",
"author_id": 59785,
"author_profile": "https://Stackoverflow.com/users/59785",
"pm_score": 1,
"selected": false,
"text": "<p>Sorry the web page headers got scrubbed by the wysiwyg editor. For clarity's sake:</p>\n\n<p>Web page headers are:</p>\n\n... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59785/"
] | Okay, there is a ton of stuff out there on sanitizing strings but very little, that I can find, on the best methods to prepare user input (like what I'm typing now) for inserting into a content management system then how to filter it coming out.
I'm building two multilingual (Japanese, English + other Romance language... | Sorry the web page headers got scrubbed by the wysiwyg editor. For clarity's sake:
Web page headers are:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
```
And
```
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
`... |
487,971 | <p>Is there a straightforward way to list the names of all modules in a package, without using <code>__all__</code>?</p>
<p>For example, given this package:</p>
<pre><code>/testpkg
/testpkg/__init__.py
/testpkg/modulea.py
/testpkg/moduleb.py
</code></pre>
<p>I'm wondering if there is a standard or built-in way to do... | [
{
"answer_id": 489489,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 5,
"selected": false,
"text": "<pre><code>import module\nhelp(module)\n</code></pre>\n"
},
{
"answer_id": 489649,
"author": "cdleary",
... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51025/"
] | Is there a straightforward way to list the names of all modules in a package, without using `__all__`?
For example, given this package:
```
/testpkg
/testpkg/__init__.py
/testpkg/modulea.py
/testpkg/moduleb.py
```
I'm wondering if there is a standard or built-in way to do something like this:
```
>>> package_conte... | Maybe this will do what you're looking for?
```
import imp
import os
MODULE_EXTENSIONS = ('.py', '.pyc', '.pyo')
def package_contents(package_name):
file, pathname, description = imp.find_module(package_name)
if file:
raise ImportError('Not a package: %r', package_name)
# Use a set because some ma... |
487,978 | <p>I'm trying to create a bookmarklet that will start off an AJAX call to an aspx page I've written.</p>
<p>The code tests out perfectly when I place the javascript in a static html page, but when I try and call it off from a bookmarklet, the code will just hang at the xmlHttp.open("GET", url, true) part.</p>
<p>The... | [
{
"answer_id": 488191,
"author": "meouw",
"author_id": 12161,
"author_profile": "https://Stackoverflow.com/users/12161",
"pm_score": 3,
"selected": true,
"text": "<p>The XMLHttpRequest object is subject to a Same Origin Policy.<br>\nThis is why the script your bookmarklet is loading can'... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261917/"
] | I'm trying to create a bookmarklet that will start off an AJAX call to an aspx page I've written.
The code tests out perfectly when I place the javascript in a static html page, but when I try and call it off from a bookmarklet, the code will just hang at the xmlHttp.open("GET", url, true) part.
The code of the bookm... | The XMLHttpRequest object is subject to a Same Origin Policy.
This is why the script your bookmarklet is loading can't use an XHR to get data from your server unless it's embedded in a page from your server.
Script added by dynamically adding a script tag will work though, as you can tell - your bookmarklet can l... |
487,988 | <p>We have written a number of SSIS packages that import data from CSV files using the Flat File Source. </p>
<p>It now seems that after these packages are deployed into production, the providers of these files may deliver files where the column order of the files changes (Don't ask!). Currently if this happens, our... | [
{
"answer_id": 488185,
"author": "Sheehan Alam",
"author_id": 19875,
"author_profile": "https://Stackoverflow.com/users/19875",
"pm_score": 1,
"selected": false,
"text": "<p>Best approach would be to run a check before the SSIS package imports the CSV data. This may have to be an externa... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78610/"
] | We have written a number of SSIS packages that import data from CSV files using the Flat File Source.
It now seems that after these packages are deployed into production, the providers of these files may deliver files where the column order of the files changes (Don't ask!). Currently if this happens, our packages wi... | Not that I know of.
A possibility to check for the problem in advance is to set up two different connection managers, one with a single flat row. This one can read the first row and tell if it's OK or not and abort.
If you want to do the work, you can take it a step further and make that flat one-field row the only c... |
487,991 | <p><strong>Update: this question, including the title, was rephrased, see history for details</strong> </p>
<p>I know that the following App.config includes a external file:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings configSource="appSettings.config"/>
&... | [
{
"answer_id": 488005,
"author": "Mesh",
"author_id": 15710,
"author_profile": "https://Stackoverflow.com/users/15710",
"pm_score": 1,
"selected": true,
"text": "<p>I think you just remove the configSource attributes and then include all the content within the <code><appSettings></... | 2009/01/28 | [
"https://Stackoverflow.com/questions/487991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | **Update: this question, including the title, was rephrased, see history for details**
I know that the following App.config includes a external file:
```
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings configSource="appSettings.config"/>
<system.net>
<connectionManagement>
<add add... | I think you just remove the configSource attributes and then include all the content within the `<appSettings>` and `<connectionStrings>` elements |
488,019 | <p>Is there any schema language for XML that allows for specifying a constraint that there can be no cyclic references between elements.</p>
<p>As a toy example:</p>
<pre><code><animal name="A" eats="B">
<animal name="B" eats="C">
<animal name="C" eats="D">
</code></pre>
<p>would validate, but </p>... | [
{
"answer_id": 488193,
"author": "Pete Kirkham",
"author_id": 1527,
"author_profile": "https://Stackoverflow.com/users/1527",
"pm_score": 1,
"selected": false,
"text": "<p>You could use schematron, and then post the same question as an xslt/xpath problem.</p>\n"
},
{
"answer_id":... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48658/"
] | Is there any schema language for XML that allows for specifying a constraint that there can be no cyclic references between elements.
As a toy example:
```
<animal name="A" eats="B">
<animal name="B" eats="C">
<animal name="C" eats="D">
```
would validate, but
```
<animal name="A" eats="B">
<animal name="B" eats=... | There are as far as I know no schema languages that are designed to enforce this kind of constraint. If it's possible in a schema language, it'd probably be Schematron. The schema wouldn't be pretty.
To me, that says you shouldn't try to do this using a schema language. Take any programming language that you're comfor... |
488,025 | <p>I have a page that is using a non-standard font and arial as a fail safe. Does anyone know if there is a way to set the font-size conditionally to the font?</p>
<pre><code><style type="text/css">
body {
font-family: Calibri, arial, sans-serif;
font-size: 1em, .9em, .9em;
/* Where 1em would be f... | [
{
"answer_id": 488117,
"author": "Ionuț G. Stan",
"author_id": 58808,
"author_profile": "https://Stackoverflow.com/users/58808",
"pm_score": 0,
"selected": false,
"text": "<p>The solution would be to use <a href=\"http://www.w3schools.com/CSS/pr_font_font-size-adjust.asp\" rel=\"nofollow... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37881/"
] | I have a page that is using a non-standard font and arial as a fail safe. Does anyone know if there is a way to set the font-size conditionally to the font?
```
<style type="text/css">
body {
font-family: Calibri, arial, sans-serif;
font-size: 1em, .9em, .9em;
/* Where 1em would be for Calibri and .9 wou... | Good question but currently you can't do this until the 'font-size-adjust' property is more widely supported. It normalises fonts that have very different native sizes. This is the simplest definition and example I could find:
<http://www.w3schools.com/CSS/pr_font_font-size-adjust.asp>
I'd say there's no harm in usin... |
488,033 | <p>I have an issue regarding WMI connection through asp.net from Computer A (windows 2003 server) to Computer B (Windows XP)..</p>
<p>The error is as follows:</p>
<blockquote>
<p>RPC server is unavailable..</p>
</blockquote>
| [
{
"answer_id": 488049,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "<p>Look at <a href=\"http://support.microsoft.com/kb/875605\" rel=\"nofollow noreferrer\">KB875605</a> (\"How to troublesh... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an issue regarding WMI connection through asp.net from Computer A (windows 2003 server) to Computer B (Windows XP)..
The error is as follows:
>
> RPC server is unavailable..
>
>
> | There are a few steps that you must take in order to successfully leverage WMI connectivity. The basics are you must allow remote management on the target box of course. If you can’t RDP into it, chances are, you can’t remote manage anything else. This can also include Windows firewall issues too. Make sure your reques... |
488,036 | <p>ModelMultipleChoiceField doesn't select initial choices and I can't make the following fix (link below) work in my example:</p>
<p><a href="http://code.djangoproject.com/ticket/5247#comment:6" rel="noreferrer">http://code.djangoproject.com/ticket/5247#comment:6</a></p>
<p>My models and form:</p>
<pre><code>class ... | [
{
"answer_id": 488113,
"author": "Jeff Bauer",
"author_id": 41759,
"author_profile": "https://Stackoverflow.com/users/41759",
"pm_score": 5,
"selected": true,
"text": "<p>You will need to add an <code>__init__</code> method to <code>Action_Form</code> to set your initial values, remember... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59797/"
] | ModelMultipleChoiceField doesn't select initial choices and I can't make the following fix (link below) work in my example:
<http://code.djangoproject.com/ticket/5247#comment:6>
My models and form:
```
class Company(models.Model):
company_name = models.CharField(max_length=200)
class Contact(models.Model):
... | You will need to add an `__init__` method to `Action_Form` to set your initial values, remembering to call `__init__` on the base `ModelForm` class via **super**.
```
class Action_Form(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(Action_Form, self).__init__(*args, **kwargs)
self.fie... |
488,039 | <p>I am setting the datasource of my radGrid to a dataset (that I have stored in session).
I have enabled AllowAutomaticUpdates and EnableViewState, implemented NeedDataSource, set DatakeyNames, etc. (see code below)</p>
<p>However, when I press the Edit button and make a change and press the Update link, the record ... | [
{
"answer_id": 516392,
"author": "Dick Lampard",
"author_id": 59302,
"author_profile": "https://Stackoverflow.com/users/59302",
"pm_score": 2,
"selected": false,
"text": "<p>Your question has already been answered in the Telerik forums:</p>\n\n<p><a href=\"http://www.telerik.com/communit... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8678/"
] | I am setting the datasource of my radGrid to a dataset (that I have stored in session).
I have enabled AllowAutomaticUpdates and EnableViewState, implemented NeedDataSource, set DatakeyNames, etc. (see code below)
However, when I press the Edit button and make a change and press the Update link, the record does not up... | In short, there is one key issue at play here:
The "automatic" operations are only supported when you're using a Data Source control to bind the grid. That *includes* the ObjectDataSource, so you can use your DAL with the ODS and then support auto upserts/updates/deletes.
When binding directly to a data table, you mu... |
488,054 | <p>I am trying to decompress some MMS messages sent to me zipped. The problem is that sometimes it works, and others not. And when it doesnt work, the python zipfile module complains and says that it is a bad zip file. But the zipfile decompresses fine using the unix unzip command.</p>
<p>This is what ive got</p>
<pr... | [
{
"answer_id": 488074,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 4,
"selected": true,
"text": "<p>You should very probably open the file in binary mode, when writing zipped data into it. That is, you should use</p>\n\n<... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42546/"
] | I am trying to decompress some MMS messages sent to me zipped. The problem is that sometimes it works, and others not. And when it doesnt work, the python zipfile module complains and says that it is a bad zip file. But the zipfile decompresses fine using the unix unzip command.
This is what ive got
```
zippedfile = ... | You should very probably open the file in binary mode, when writing zipped data into it. That is, you should use
```
zippedfile = open('%stemp/tempfile.zip' % settings.MEDIA_ROOT, 'wb+')
``` |
488,061 | <p>I'm working on a basic Issue Management System in order to learn ASP.NET MVC. I've gotten it up and running to a fairly decent level but I've run into a problem.</p>
<p>I have a controller named Issue with a view called Open. /Issue/Open lists all of the open issues currently logged on the system. I've defined a ro... | [
{
"answer_id": 488127,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 6,
"selected": true,
"text": "<ol>\n<li>Remove sort from the route. Just use a route without a parameter.</li>\n<li>Add query string parameters to the... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135/"
] | I'm working on a basic Issue Management System in order to learn ASP.NET MVC. I've gotten it up and running to a fairly decent level but I've run into a problem.
I have a controller named Issue with a view called Open. /Issue/Open lists all of the open issues currently logged on the system. I've defined a route like s... | 1. Remove sort from the route. Just use a route without a parameter.
2. Add query string parameters to the query for the sort, filter, etc. So your query will look like:
<http://example.com/Issue/Open?sort=ID&filter=foo>
```
public ActionResult Open(string sort, string filter)
```
The MVC framework will fill in the... |
488,071 | <p>I'm sure this must be a common problem. I've got a class that in an ideal world would have the following constructors</p>
<pre><code>public Thing(string connectionString)
public Thing(string fileName)
</code></pre>
<p>Obviously this isn't allowed because the signatures are the same. Does anybody know of an elegan... | [
{
"answer_id": 488087,
"author": "Gerrie Schenck",
"author_id": 57036,
"author_profile": "https://Stackoverflow.com/users/57036",
"pm_score": 1,
"selected": false,
"text": "<p>Make two public properties ConnectionString and FileName and then use these to fill your object.</p>\n\n<p>In C#... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16786/"
] | I'm sure this must be a common problem. I've got a class that in an ideal world would have the following constructors
```
public Thing(string connectionString)
public Thing(string fileName)
```
Obviously this isn't allowed because the signatures are the same. Does anybody know of an elegant solution to this problem... | You can used the named constructor idiom:
```
public class Thing
{
private string connectionString;
private string filename;
private Thing()
{
/* Make this private to clear things up */
}
public static Thing WithConnection(string connectionString)
{
var thing = new Thing(... |
488,081 | <p>I have a small text file that I'd like to read into a scalar variable exactly as it is in the file (preserving line separators and other whitespace).</p>
<p>The equivalent in Python would be something like</p>
<pre><code>buffer = ""
try:
file = open("fileName", 'rU')
try:
buffer += file.read()
... | [
{
"answer_id": 488101,
"author": "Alex Fort",
"author_id": 12624,
"author_profile": "https://Stackoverflow.com/users/12624",
"pm_score": 1,
"selected": false,
"text": "<p>You could do something like:</p>\n\n<pre><code>$data_file=\"somefile.txt\";\nopen(DAT, $data_file);\n@file_data = <... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I have a small text file that I'd like to read into a scalar variable exactly as it is in the file (preserving line separators and other whitespace).
The equivalent in Python would be something like
```
buffer = ""
try:
file = open("fileName", 'rU')
try:
buffer += file.read()
finally:
fil... | From the [Perl Cookbook](http://oreilly.com/catalog/cookbook/chapter/ch08.html):
```
my $filename = 'file.txt';
open( FILE, '<', $filename ) or die 'Could not open file: ' . $!;
undef $/;
my $whole_file = <FILE>;
```
I would localize the changes though:
```
my $whole_file = '';
{
local $/;
$whole_file =... |
488,108 | <p>I want to implement paging in a gridview or in an html table which I will fill using ajax. How should I write queries to support paging? For example if pagesize is 20 and when the user clicks page 3, rows between 41 and 60 must be shown on table. At first I can get all records and put them into cache but I think thi... | [
{
"answer_id": 488297,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 2,
"selected": false,
"text": "<p>Unfortunately, the methods for restricting the range of rows returned by a query vary from one DBMS to another: Or... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59706/"
] | I want to implement paging in a gridview or in an html table which I will fill using ajax. How should I write queries to support paging? For example if pagesize is 20 and when the user clicks page 3, rows between 41 and 60 must be shown on table. At first I can get all records and put them into cache but I think this i... | As others have suggested, you can use rownum in Oracle. It's a little tricky though and you have to nest your query twice.
For example, to paginate the query
```
select first_name from some_table order by first_name
```
you need to nest it like this
```
select first_name from
(select rownum as rn, first_name fro... |
488,116 | <p>I am wondering which way is the fastest to deliver images via ASP.net:</p>
<pre><code>//get file path
string filepath = GetFilePath();
Response.TransmitFile(f);
</code></pre>
<p>or:</p>
<pre><code>string filepath = GetFilePath();
context.Response.WriteFile(f);
</code></pre>
<p>or</p>
<pre><code>Bitmap bmp = Get... | [
{
"answer_id": 488169,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 0,
"selected": false,
"text": "<p>It's easy enough to test, I recommend you set up three different URLs that will test the different mechanisms and the... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am wondering which way is the fastest to deliver images via ASP.net:
```
//get file path
string filepath = GetFilePath();
Response.TransmitFile(f);
```
or:
```
string filepath = GetFilePath();
context.Response.WriteFile(f);
```
or
```
Bitmap bmp = GetBitmap()
bmp.Save(Response.OutputStream);
```
or any other... | [TransmitFile scales better since it does not load the file into Application memory](http://forums.asp.net/t/1275581.aspx).
You'll need to test with large image files to see a visible difference, but TransmitFile will outputperform WriteFile.
In either case, you should use an ashx handler rather than an aspx page to ... |
488,121 | <p>I'm a big fan of the xUnit.NET framework; I find it light, simple, clean, and extensible.</p>
<p>Now let's say that I have a class like so:</p>
<pre><code>public class AdditionSpecification
{
static int result;
public void Because()
{
result = 2 + 2;
}
public void Result_is_non_zero()
{
Asser... | [
{
"answer_id": 488169,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 0,
"selected": false,
"text": "<p>It's easy enough to test, I recommend you set up three different URLs that will test the different mechanisms and the... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8997/"
] | I'm a big fan of the xUnit.NET framework; I find it light, simple, clean, and extensible.
Now let's say that I have a class like so:
```
public class AdditionSpecification
{
static int result;
public void Because()
{
result = 2 + 2;
}
public void Result_is_non_zero()
{
Assert.True(result <> 0);
... | [TransmitFile scales better since it does not load the file into Application memory](http://forums.asp.net/t/1275581.aspx).
You'll need to test with large image files to see a visible difference, but TransmitFile will outputperform WriteFile.
In either case, you should use an ashx handler rather than an aspx page to ... |
488,143 | <p>I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I am very happy with it, apart from one thing. I have an extra field in the "Users" table. I have an overridden method for CreateUser() that takes in the extra variable and puts it into the DB. </p>
<p>My issue... | [
{
"answer_id": 488316,
"author": "Jon",
"author_id": 6486,
"author_profile": "https://Stackoverflow.com/users/6486",
"pm_score": 1,
"selected": false,
"text": "<p>This is not the answer but I found a work around, would still like to know if someone could answer the question directly...</... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6486/"
] | I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I am very happy with it, apart from one thing. I have an extra field in the "Users" table. I have an overridden method for CreateUser() that takes in the extra variable and puts it into the DB.
My issues is that I wa... | I think your solution is the "easiest" you're going to get. You could create your own wizard and call the correct method, but that's a lot more work.
The only thing I could recommend is using the [OnCreatedUser](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.createuserwizard.oncreateduser.aspx) even... |
488,171 | <p>I've got a very simplistic "game" set up on the iPhone. Things move around, rotate, you can interact with them, etc. In the simulator, it runs fine, but on the device it gets around 0.25 FPS, and it's so slow that it doesn't have time to recognize touches, apparently.</p>
<p>This was originally just using a UIVie... | [
{
"answer_id": 488208,
"author": "Nick Van Brunt",
"author_id": 30470,
"author_profile": "https://Stackoverflow.com/users/30470",
"pm_score": 2,
"selected": false,
"text": "<p>Not sure about the CG animation layer but OpenGLES is the iPhone's answer to high performance graphics. At the ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36007/"
] | I've got a very simplistic "game" set up on the iPhone. Things move around, rotate, you can interact with them, etc. In the simulator, it runs fine, but on the device it gets around 0.25 FPS, and it's so slow that it doesn't have time to recognize touches, apparently.
This was originally just using a UIView with an ar... | I found out the real issue was the necessity to call `[self setNeedsDisplay]`. Redrawing on a frame-by-frame basis is bad mojo. So I am using images instead for the most part, and I can still get away with setting the position on a frame-by-frame basis by setting the actions on the CALayer to null. Specifically:
```
N... |
488,189 | <p>I'm in a curious situation where I previously had no problem achieving what I'm looking for. The following code is a part of an HTML page which is to host a TinyMCE rich textbox:</p>
<pre><code>...
<textarea id="editing_field">This text is supposed to appear in the rich textbox</textarea>
...
</code></p... | [
{
"answer_id": 488228,
"author": "epascarello",
"author_id": 14104,
"author_profile": "https://Stackoverflow.com/users/14104",
"pm_score": 1,
"selected": false,
"text": "<p>That second example <textarea ... /> is empty tag notation. If you want the text to be inside the tage you need ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4055/"
] | I'm in a curious situation where I previously had no problem achieving what I'm looking for. The following code is a part of an HTML page which is to host a TinyMCE rich textbox:
```
...
<textarea id="editing_field">This text is supposed to appear in the rich textbox</textarea>
...
```
At first this worked as intend... | It appears that I have solved the problem, unless there are any edge cases which ruins the solution. I use the following PHP code on page content before I save it to the database:
```
$content = str_replace(chr(10), "", $content);
$content = str_replace(chr(13), "", $content);
$content = str_ireplace('<','​<',$... |
488,194 | <p>We are about to undertake a rather large customization of SharePoint and I wanted to get some feedback prior to jumping in with both feet. One of the issues we are kicking the tires on is do we deploy the jQuery javascript library to the 12 hive directly (making it available in _layouts for each site etc.) or do we ... | [
{
"answer_id": 488243,
"author": "Ric Tokyo",
"author_id": 42019,
"author_profile": "https://Stackoverflow.com/users/42019",
"pm_score": 5,
"selected": true,
"text": "<p>options and commentary on <a href=\"http://www.sharepointblogs.com/rohan/archive/2008/11/20/sharepoint-and-jquery.aspx... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/243/"
] | We are about to undertake a rather large customization of SharePoint and I wanted to get some feedback prior to jumping in with both feet. One of the issues we are kicking the tires on is do we deploy the jQuery javascript library to the 12 hive directly (making it available in \_layouts for each site etc.) or do we wr... | options and commentary on [www.sharepointblogs.com](http://www.sharepointblogs.com/rohan/archive/2008/11/20/sharepoint-and-jquery.aspx)
follow the link above or google it.
Summary is that modifying the 12 hive directly is easy but unsupported (i.e. Microsoft reserves the right to destroy your environment at will)
re... |
488,214 | <p>We have just started using ASP.Net MVC Release Candidate and the test project we have was previously testing Ajax requests with MVC beta.</p>
<p>The old code looked something like this:</p>
<pre><code>Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();
Mock<HttpResponseBase> response = n... | [
{
"answer_id": 488224,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 2,
"selected": false,
"text": "<p>It could be an issue with your web method itself. See how it connects/disconnects to the database. See if you can ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59816/"
] | We have just started using ASP.Net MVC Release Candidate and the test project we have was previously testing Ajax requests with MVC beta.
The old code looked something like this:
```
Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();
Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();
Mock<HttpC... | In a masterstroke of misdirection the answer to this problem resolved due to things other than those mentioned here. Excellent suggestions nonetheless.
In this case it turned out that the problem we were having was with how our system defines the completion of a credit card charge. The system is supposed to wait for t... |
488,239 | <p>I currently have CruiseControl.NET set up with SVN to automatically grab the code source from the repository. After having a problem with our SVN server - I recreated a different SVN location for it and changed the location of it in the ccnet.config file. This caused problems with CruiseControl.NET still trying to g... | [
{
"answer_id": 488255,
"author": "Josh Kodroff",
"author_id": 549,
"author_profile": "https://Stackoverflow.com/users/549",
"pm_score": 3,
"selected": true,
"text": "<p>Try the following:</p>\n\n<ol>\n<li>Stop CCNet</li>\n<li>Verify that there are no references to your old repository loc... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4455/"
] | I currently have CruiseControl.NET set up with SVN to automatically grab the code source from the repository. After having a problem with our SVN server - I recreated a different SVN location for it and changed the location of it in the ccnet.config file. This caused problems with CruiseControl.NET still trying to grab... | Try the following:
1. Stop CCNet
2. Verify that there are no references to your old repository location in ccnet.config
3. Blow away the state files for your projects. The files are called PROJECTNAME.state.
4. Blow away the working directories for your projects.
5. Restart the machine (which I am assuming will restar... |
488,240 | <p>I have a series of checkboxes on an HTML page and I would like to check the checkboxes based on corresponding HTML query string params.</p>
<p>e.g.</p>
<pre><code>...path/page.html?i=1&j=1&x=0
</code></pre>
<p>would cause a page with three checkboxes to check 1 and 2 on load.</p>
<p>Can someone show me h... | [
{
"answer_id": 488285,
"author": "Grant",
"author_id": 30,
"author_profile": "https://Stackoverflow.com/users/30",
"pm_score": 3,
"selected": true,
"text": "<p>Partially from <a href=\"http://www.w3schools.com/JS/tryit.asp?filename=try_dom_input_checked\" rel=\"nofollow noreferrer\">W3Sc... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I have a series of checkboxes on an HTML page and I would like to check the checkboxes based on corresponding HTML query string params.
e.g.
```
...path/page.html?i=1&j=1&x=0
```
would cause a page with three checkboxes to check 1 and 2 on load.
Can someone show me how to do this or point me in the direction of a ... | Partially from [W3Schools](http://www.w3schools.com/JS/tryit.asp?filename=try_dom_input_checked). This file will crate a single checkbox and check it depending on the <http://example.com/index.html?j=>**?** URL
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-t... |
488,249 | <p>How to implement method for IQuariable like below:</p>
<pre><code>var trash = (from a in ContextBase.db.Users
orderby a.FirstName
select a).ToCollatedList();
</code></pre>
<p>In a result I want to see </p>
<pre><code>SELECT * from [User]
ORDER BY FirstName
COLLATE SQL_SwedishStd_P... | [
{
"answer_id": 488285,
"author": "Grant",
"author_id": 30,
"author_profile": "https://Stackoverflow.com/users/30",
"pm_score": 3,
"selected": true,
"text": "<p>Partially from <a href=\"http://www.w3schools.com/JS/tryit.asp?filename=try_dom_input_checked\" rel=\"nofollow noreferrer\">W3Sc... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48963/"
] | How to implement method for IQuariable like below:
```
var trash = (from a in ContextBase.db.Users
orderby a.FirstName
select a).ToCollatedList();
```
In a result I want to see
```
SELECT * from [User]
ORDER BY FirstName
COLLATE SQL_SwedishStd_Pref_Cp1_CI_AS ASC
```
Thanks. | Partially from [W3Schools](http://www.w3schools.com/JS/tryit.asp?filename=try_dom_input_checked). This file will crate a single checkbox and check it depending on the <http://example.com/index.html?j=>**?** URL
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-t... |
488,250 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/390900/cant-operator-be-applied-to-generic-types-in-c">Can’t operator == be applied to generic types in C#?</a> </p>
</blockquote>
<p>I've coded something like this:</p>
<pre><code>public bool IsDataChanged()
... | [
{
"answer_id": 488292,
"author": "CalvinR",
"author_id": 55990,
"author_profile": "https://Stackoverflow.com/users/55990",
"pm_score": 3,
"selected": false,
"text": "<p>That should work for you.</p>\n\n<pre><code>public bool test<T>(T test, T test2) where T : class\n{\n return (... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3056/"
] | >
> **Possible Duplicate:**
>
> [Can’t operator == be applied to generic types in C#?](https://stackoverflow.com/questions/390900/cant-operator-be-applied-to-generic-types-in-c)
>
>
>
I've coded something like this:
```
public bool IsDataChanged()
{
T value1 = GetValue2;
T value2 = GetValue... | You cannot use operators on generic types (except for foo == null which is special cased) unless you add where T : class to indicate it is a reference type (then foo == bar is legal)
Use `EqualityComparer<T>`.Default to do it for you. This will **not** work on types which only supply an operator overload for == withou... |
488,258 | <p>I have a 5 million row table that gets hit with a specific query the most. So I want add a index to speed things up. </p>
<p><strong>Query:</strong></p>
<pre><code>SELECT someID
FROM someTable
WHERE
myVarChar = @myVarChar AND
MyBit = 0 AND
MyBit2 = 1 AND
MyBit3 = 0
</code></pre>
... | [
{
"answer_id": 488277,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 2,
"selected": false,
"text": "<p>If you have a covered index with the four columns that's probably the best it's going to get. You should reindex a... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have a 5 million row table that gets hit with a specific query the most. So I want add a index to speed things up.
**Query:**
```
SELECT someID
FROM someTable
WHERE
myVarChar = @myVarChar AND
MyBit = 0 AND
MyBit2 = 1 AND
MyBit3 = 0
```
Note, the `myVarChar` column is unique.
W... | Is someID the primary key of that table? If not, you should add it to your index to prevent a bookmark lookup.
Also, look at the execution plan for that query, if your index is properly constructed, you should see two icons in the execution plan view: SELECT and an Index Seek. |
488,294 | <p>Is it possible to make a batch file which can make a <strong>persistent</strong> change to an environment variable? </p>
<p>For example my installer.bat script copies some files to a <strong>random location</strong> in the computer's file-system. I'd like to add that location to the PATH environment variable so tha... | [
{
"answer_id": 488312,
"author": "cbeuker",
"author_id": 15952,
"author_profile": "https://Stackoverflow.com/users/15952",
"pm_score": 1,
"selected": false,
"text": "<p>well, you could do:</p>\n\n<p>Set EnvVariableName=\"Some Value\"</p>\n\n<p>as to your calling a seperate batch file fro... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46411/"
] | Is it possible to make a batch file which can make a **persistent** change to an environment variable?
For example my installer.bat script copies some files to a **random location** in the computer's file-system. I'd like to add that location to the PATH environment variable so that the programs can be run in the cur... | In your case, what you want is
```
rem install_and_run.bat
call install.bat
myapplication.exe
```
That is, use `call` to call `install.bat`, so that control will return to `install_and_run.bat`.
I think you don't understand that environment variables are **per-process**. Your batch file is running in an instance ... |
488,302 | <p>What are the cons of some code like this:</p>
<pre><code>public class Class1
{
public object Property1
{
set
{
// Check some invariant , and null
// throw exceptions if not satisfied
// do some more complex logic
//return value
... | [
{
"answer_id": 488332,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 1,
"selected": false,
"text": "<p>Properties are expected be cheap to execute. Code looks tidier if the value of the property doesn't need to be h... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30917/"
] | What are the cons of some code like this:
```
public class Class1
{
public object Property1
{
set
{
// Check some invariant , and null
// throw exceptions if not satisfied
// do some more complex logic
//return value
}
}
}
``` | The con would be that if you are doing excessive logic that takes a great period of time, and/or has side effects which don't logically flow from the setting of the property, you are going to have a pretty convoluted class design.
Methods are traditionally used to indicate that an action with consequence is being perf... |
488,305 | <p>I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this:</p>
<pre><code>$('.myClass', '.myOtherClass').removeClass('theclass');
</code></pre>
<p>Any ideas on how to achieve this? The only other option is to do</p>
<pre><code... | [
{
"answer_id": 488324,
"author": "Erik Bakker",
"author_id": 59174,
"author_profile": "https://Stackoverflow.com/users/59174",
"pm_score": 10,
"selected": true,
"text": "<p>This should work:</p>\n\n<p><code>$('.myClass, .myOtherClass').removeClass('theclass');</code></p>\n\n<p>You must a... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this:
```
$('.myClass', '.myOtherClass').removeClass('theclass');
```
Any ideas on how to achieve this? The only other option is to do
```
$('.myClass').removeClass('theclass'... | This should work:
`$('.myClass, .myOtherClass').removeClass('theclass');`
You must add the multiple selectors all in the first argument to $(), otherwise you are giving jQuery a context in which to search, which is not what you want.
It's the same as you would do in CSS. |
488,310 | <p>Is there a way to change owner of saved file using IIS on Windows Server. The easier the better. It doesn't matter either this will have to be done during saving or changing file owner after file is already saved to disc. An example in ASP.NET is highly apriciated. </p>
| [
{
"answer_id": 488470,
"author": "Vaibhav",
"author_id": 380,
"author_profile": "https://Stackoverflow.com/users/380",
"pm_score": 0,
"selected": false,
"text": "<p>While this is not a customized example, I believe your answer lies in the \n<a href=\"http://msdn.microsoft.com/en-us/libra... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a way to change owner of saved file using IIS on Windows Server. The easier the better. It doesn't matter either this will have to be done during saving or changing file owner after file is already saved to disc. An example in ASP.NET is highly apriciated. | In theory it should be fairly straight forward. You *should* be able to do something like this to change the ownership of an existing file:
```
string domain = "domain";
string user = "username";
FileInfo info = new FileInfo(@"c:\test.txt");
FileSecurity security = info.GetAccessControl();
System.Security.Principal... |
488,333 | <p>Is there is a way to put .mod files, generated by gfortran (GCC), into a separate output directory? I know how to place object files or other output with the -o flag as in:</p>
<pre><code>gfortran -c test.f03 -o /path/to/output/dir/test.o
</code></pre>
<p>But the .mod files (which are generated by the above call) ... | [
{
"answer_id": 574485,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://Stackoverflow.com/users/15168",
"pm_score": 4,
"selected": false,
"text": "<p>The GNU <a href=\"http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gfortran/Directory-Options.html#Directory-Options\" ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there is a way to put .mod files, generated by gfortran (GCC), into a separate output directory? I know how to place object files or other output with the -o flag as in:
```
gfortran -c test.f03 -o /path/to/output/dir/test.o
```
But the .mod files (which are generated by the above call) are not affected by the -o... | The GNU [gfortran](http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gfortran/Directory-Options.html#Directory-Options) documentation indicates that `-M`*dir* or its synonym `-J`*dir* specifies the output directory for `.mod` files. |
488,366 | <p>From what I've read, any changes to the environment variables in a Python instance are only available within that instance, and disappear once the instance is closed. Is there any way to make them stick by committing them to the system?</p>
<p>The reason I need to do this is because at the studio where I work, too... | [
{
"answer_id": 488402,
"author": "Brian",
"author_id": 18192,
"author_profile": "https://Stackoverflow.com/users/18192",
"pm_score": 2,
"selected": false,
"text": "<p>According to <a href=\"http://bytes.com/groups/python/22914-os-environ-os-path-chdir\" rel=\"nofollow noreferrer\">this d... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46914/"
] | From what I've read, any changes to the environment variables in a Python instance are only available within that instance, and disappear once the instance is closed. Is there any way to make them stick by committing them to the system?
The reason I need to do this is because at the studio where I work, tools like May... | Under Windows it's possible for you to make changes to environment variables persistent via the registry with [this recipe](http://code.activestate.com/recipes/416087/), though it seems like overkill.
To echo Brian's question, what are you trying to accomplish? There is probably an easier way. |
488,376 | <p>I can't figure how get the integral & decimal value from a NSDecimalnumber.</p>
<p>For example, if I have 10,5, how get 10 & 5?</p>
<p>And if I have 10 & 5, how return to 10,5?</p>
<hr>
<p>Mmm ok, that is looking better!</p>
<p>However I have the concer about lossing decimals. </p>
<p>This is for a... | [
{
"answer_id": 488452,
"author": "James Hay",
"author_id": 47339,
"author_profile": "https://Stackoverflow.com/users/47339",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure what Math functions objective c has but something like </p>\n\n<pre><code>Math.floor(10.5) = 10\n(10.5 - 10)... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I can't figure how get the integral & decimal value from a NSDecimalnumber.
For example, if I have 10,5, how get 10 & 5?
And if I have 10 & 5, how return to 10,5?
---
Mmm ok, that is looking better!
However I have the concer about lossing decimals.
This is for a app that will be international. If for example a u... | I'm using 2 for the scale since you said this was for currency but you may choose to use another rounding scale. I'm also ignoring any exceptions rounding may bring since this is a pretty simple example.
```
NSDecimalNumberHandler *behavior = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown sca... |
488,377 | <p>( .NET 2.0, System.Windows.FormsDataGridView and DataTable )</p>
<p>I have 1 datagrid connected to 1 datatable.</p>
<p>That datatable contains 1 column: containing objects of my own type "MyObject".<br>
MyObject has a <em>public</em> string property "MyProp".</p>
<p>I want to display 1 column in the grid: showing... | [
{
"answer_id": 488534,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": true,
"text": "<p>Try just putting the Obj.MyProp string value into the datatable row. Putting an object into there will require it to ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1163/"
] | ( .NET 2.0, System.Windows.FormsDataGridView and DataTable )
I have 1 datagrid connected to 1 datatable.
That datatable contains 1 column: containing objects of my own type "MyObject".
MyObject has a *public* string property "MyProp".
I want to display 1 column in the grid: showing the string values of the proper... | Try just putting the Obj.MyProp string value into the datatable row. Putting an object into there will require it to be converted into a string representation (Obj.ToString()) which is getting you the output you are seeing.
A datatable is much like a spreadsheet, not like an Array(Of objects). You have to treat it as... |
488,392 | <p>I'm new to Web Services and XML and was tasked to parse an XML response packet returned.</p>
<p>What's the best way to parse an XML result in C#.NET?</p>
<p>I need to bind to a data grid as the end result from a search query.</p>
| [
{
"answer_id": 488404,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 3,
"selected": true,
"text": "<p>If you have access to the wsdl for the webservice, there is a utility <code>wsdl</code> that will generate the needed clas... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59035/"
] | I'm new to Web Services and XML and was tasked to parse an XML response packet returned.
What's the best way to parse an XML result in C#.NET?
I need to bind to a data grid as the end result from a search query. | If you have access to the wsdl for the webservice, there is a utility `wsdl` that will generate the needed classes and deserialization to call a webservice and parse its response into those classes.
Using the example webservice at [w3schools](http://www.w3schools.com/webservices/tempconvert.asmx), you would just run t... |
488,400 | <p>When using code snippets in Visual Studio that contain multiple lines the following lines will preserve the whitespace that was set in the .snippet file instead of positioning the code relative to the original cursor placement.</p>
<p>When using the foreach snippet you'll get code like this:</p>
<pre><code> for... | [
{
"answer_id": 488432,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>The code portion of a snippet file is contained in a CDATA which preserves whitespace. The best thing I can tell y... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76792/"
] | When using code snippets in Visual Studio that contain multiple lines the following lines will preserve the whitespace that was set in the .snippet file instead of positioning the code relative to the original cursor placement.
When using the foreach snippet you'll get code like this:
```
foreach (var item in col... | The code portion of a snippet file is contained in a CDATA which preserves whitespace. The best thing I can tell you is to go into the file and edit it to suit your needs. Your only other option is to do a quick `Ctrl+K` and `Ctrl+D` after you use the snippet to auto-format the code which will fix the indenting. |
488,448 | <p>I'm having a hard time figuring out how to handle this problem:</p>
<p>I'm developing a web tool for an Italian university, and I have to display words with accents (such as è, ù, ...); sometimes I get these words from a PostgreSql table (UTF8-encoded), but mostly I have to read long passages from a file. These fil... | [
{
"answer_id": 488467,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 4,
"selected": false,
"text": "<p>In the jsp page directive you should try setting your content-type to utf-8, which will set the pageEncoding to utf-... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59836/"
] | I'm having a hard time figuring out how to handle this problem:
I'm developing a web tool for an Italian university, and I have to display words with accents (such as è, ù, ...); sometimes I get these words from a PostgreSql table (UTF8-encoded), but mostly I have to read long passages from a file. These files are enc... | In the jsp page directive you should try setting your content-type to utf-8, which will set the pageEncoding to utf-8 also.
```
<%@page contentType="text/html;charset=UTF-8"%>
```
UTF-8 is *not* default content type in jsp, and there are all sorts of interesting problems that arise from this. The problem is that th... |
488,449 | <p>Following on from my <a href="https://stackoverflow.com/questions/488294/how-can-i-make-a-windows-batch-file-which-changes-an-environment-variable">previous question</a>, is it possible to make a Python script which persistently changes a Windows environment variable? </p>
<p>Changes to os.environ do not persist on... | [
{
"answer_id": 488535,
"author": "DNS",
"author_id": 51025,
"author_profile": "https://Stackoverflow.com/users/51025",
"pm_score": 2,
"selected": true,
"text": "<p>Your long-winded solution is probably the best idea; I don't believe this is possible from Python directly. This article su... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46411/"
] | Following on from my [previous question](https://stackoverflow.com/questions/488294/how-can-i-make-a-windows-batch-file-which-changes-an-environment-variable), is it possible to make a Python script which persistently changes a Windows environment variable?
Changes to os.environ do not persist once the python interpr... | Your long-winded solution is probably the best idea; I don't believe this is possible from Python directly. This article suggests another way, using a temporary batch file:
<http://code.activestate.com/recipes/159462/> |
488,450 | <p>I'm debugging someone else's code for a web page that is made with ASP.NET with some javascript effects. It's a form that we are pre-populating with edit-able data, and one of the text boxes is getting populated with an incorrect value. </p>
<p>I know that the text box is getting filled with the correct value in th... | [
{
"answer_id": 488472,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 3,
"selected": false,
"text": "<p>What you see with \"view source\" is the raw HTML that has been fetched. The HTML doesn't include any changes that w... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17917/"
] | I'm debugging someone else's code for a web page that is made with ASP.NET with some javascript effects. It's a form that we are pre-populating with edit-able data, and one of the text boxes is getting populated with an incorrect value.
I know that the text box is getting filled with the correct value in the code beh... | If you want to see what effect the javascript is having on your page, use IE8 or FireFox/Firebug on the page to see what it is(not) doing.
They will also give you information on the Css Style, if the case is actually that the wrong element is displayed, and the right one is hidden. |
488,492 | <p>Is it possible to replace javascript w/ HTML if JavaScript is not enabled on the user's browser?</p>
<p>I know I can use <code><noscript>this displays in place of javascript</noscript></code></p>
<p>That works fine, but it still runs the javascript.</p>
<p>In theory I would want this:</p>
<p>if javas... | [
{
"answer_id": 488525,
"author": "baretta",
"author_id": 30052,
"author_profile": "https://Stackoverflow.com/users/30052",
"pm_score": 2,
"selected": false,
"text": "<p>It will run scripts if scripts are enabled. If you want to stage the <noscript> behavior, disable JavaScript in your... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | Is it possible to replace javascript w/ HTML if JavaScript is not enabled on the user's browser?
I know I can use `<noscript>this displays in place of javascript</noscript>`
That works fine, but it still runs the javascript.
In theory I would want this:
if javascript is enabled
run javascript
if javascript is... | Somewhat like [Ates's solution](https://stackoverflow.com/questions/488492/noscript-tag-i-need-to-present-alternative-html-if-not-enabled#488536), you can use Javascript to change the content for the users who have it enabled. For example, let's say you have a fancy menu that gives Javascript users super-easy navigatio... |
488,497 | <p>I have a WCF service with three methods. Two of the methods return custom types (these work as expected), and the third method takes a custom type as a parameter and returns a boolean. When calling the third method via a PHP soap client it returns an 'Object reference not set to an instance of an object' exception... | [
{
"answer_id": 488549,
"author": "Randolpho",
"author_id": 12716,
"author_profile": "https://Stackoverflow.com/users/12716",
"pm_score": 1,
"selected": false,
"text": "<p>I'd be willing to bet it's because you're using a Date type as one of your parameters and it's not serializing proper... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23429/"
] | I have a WCF service with three methods. Two of the methods return custom types (these work as expected), and the third method takes a custom type as a parameter and returns a boolean. When calling the third method via a PHP soap client it returns an 'Object reference not set to an instance of an object' exception.
**... | I no longer have XAMPP setup in order to test but here is some example code:
PHP:
```
$wsdl = "https://....../ServiceName.svc?wsdl";
$endpoint = "https://...../ServiceName.svc/endpointName";
$client = new SoapClient($wsdl, array('location'=>$endpoint));
$container = new stdClass();
$container->request->PropertyA = ... |
488,504 | <p>Here is an example of the problem I am running into. I am using the Python Win32 extensions to access an Outlook mailbox and retrieve messages.</p>
<p>Below is a script that should write "hello world" to a text file. I need to grab some messages from an Outlook mailbox and I noticed something weird. After I atta... | [
{
"answer_id": 488546,
"author": "DCNYAM",
"author_id": 30419,
"author_profile": "https://Stackoverflow.com/users/30419",
"pm_score": 0,
"selected": false,
"text": "<p>I do not believe so. The check for password complexity requirements should only occur when the password is created or c... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16148/"
] | Here is an example of the problem I am running into. I am using the Python Win32 extensions to access an Outlook mailbox and retrieve messages.
Below is a script that should write "hello world" to a text file. I need to grab some messages from an Outlook mailbox and I noticed something weird. After I attach to the mai... | You'll be fine. It only checks the complexity when you change it. |
488,518 | <p>I have a basic domain object, say like Person or Campaign or Event that is represented by a single table in the database. However, I also have more complicated versions of these objects say like a PersonCampaign or PersonEvent or even CampaignEvent that could theoretically extend one of the base objects.</p>
<p>How... | [
{
"answer_id": 488654,
"author": "DreamWerx",
"author_id": 15487,
"author_profile": "https://Stackoverflow.com/users/15487",
"pm_score": 0,
"selected": false,
"text": "<p>What about having a setup like: </p>\n\n<p>Table: Person , Sales Person, Customer Person, etc..\nThe person table sto... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20178/"
] | I have a basic domain object, say like Person or Campaign or Event that is represented by a single table in the database. However, I also have more complicated versions of these objects say like a PersonCampaign or PersonEvent or even CampaignEvent that could theoretically extend one of the base objects.
However, for ... | From a OOP perspective a PersonEvent isn't really a object, its a relation.
The Person class could get functions like:
```
get_events()
add_event($Event)
remove_event($Event)
```
and the Event class
```
get_person()
set_person($Person)
unset_person() // set person_id to NULL
```
(Assuming a 1:N relation between ... |
488,587 | <p>When you implement the INotifyPropertyChanged interface, you're responsible for calling the PropertyChanged event each and everytime a property is updated in the class.</p>
<p>This typically leads to the following code :</p>
<pre><code> public class MyClass: INotifyPropertyChanged
private bool myfield;... | [
{
"answer_id": 488590,
"author": "Brann",
"author_id": 47341,
"author_profile": "https://Stackoverflow.com/users/47341",
"pm_score": 2,
"selected": false,
"text": "<p>What I do for now is that I write this in my class :</p>\n\n<pre><code> //AUTOGENERATE INotifyProperty\n private bool myf... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47341/"
] | When you implement the INotifyPropertyChanged interface, you're responsible for calling the PropertyChanged event each and everytime a property is updated in the class.
This typically leads to the following code :
```
public class MyClass: INotifyPropertyChanged
private bool myfield;
public bool ... | Actually, it's only 3-4 lines *per property*; the other lines are *amortized* over all "notifying" properties:
```
class Person : INotifyPropertyChanged
{
#region INotifyPropertyChanged: Shared bit
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(PropertyChangedEven... |
488,592 | <p>I'm trying to use the JPA EntityManager find() method. My primary key is a string which corresponds to a user's name.</p>
<p>I am using JPA / Hibernate / MYSQL.</p>
<p>My problem is a search for user 'David' matches user 'david' due, I assume, to the case insensitive string matching in the underlying MYSQL. This... | [
{
"answer_id": 488590,
"author": "Brann",
"author_id": 47341,
"author_profile": "https://Stackoverflow.com/users/47341",
"pm_score": 2,
"selected": false,
"text": "<p>What I do for now is that I write this in my class :</p>\n\n<pre><code> //AUTOGENERATE INotifyProperty\n private bool myf... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53978/"
] | I'm trying to use the JPA EntityManager find() method. My primary key is a string which corresponds to a user's name.
I am using JPA / Hibernate / MYSQL.
My problem is a search for user 'David' matches user 'david' due, I assume, to the case insensitive string matching in the underlying MYSQL. This causes me a whole ... | Actually, it's only 3-4 lines *per property*; the other lines are *amortized* over all "notifying" properties:
```
class Person : INotifyPropertyChanged
{
#region INotifyPropertyChanged: Shared bit
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(PropertyChangedEven... |
488,600 | <p>I develop a product with a custom database configuration. I use ADO.NET with System.Data.Odbc.OdbcConnection for it. To make some differences between the databases is there a simple solution to detect the current DBMS of a connection.</p>
| [
{
"answer_id": 488632,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 1,
"selected": false,
"text": "<p>connection.Database would work or you can execute </p>\n\n<pre><code>select db_name()\n</code></pre>\n\n<p>to expand on ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12631/"
] | I develop a product with a custom database configuration. I use ADO.NET with System.Data.Odbc.OdbcConnection for it. To make some differences between the databases is there a simple solution to detect the current DBMS of a connection. | I found the follow solution self:
```
DataTable td = conn.GetSchema(DbMetaDataCollectionNames.DataSourceInformation);
DataRow info = td.Rows[0];
String name = info[DbMetaDataColumnNames.DataSourceProductName];
```
For example this returns **Microsoft SQL Server** and is driver independent. |
488,614 | <p><strong>How can I fix this RegEx to optionally capture a file extension?</strong></p>
<p>I am trying to match a string with an optional component, but something appears to be wrong. (The strings being matched are from a printer log.)</p>
<p><br>My RegEx (.NET Flavor) is as follows:</p>
<pre><code>.*(header_\d{10,... | [
{
"answer_id": 488633,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 4,
"selected": true,
"text": "<p>One possibility is that the second to last <code>.*</code> is being greedy. You might try changing it to:</p>\n\n<p... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106/"
] | **How can I fix this RegEx to optionally capture a file extension?**
I am trying to match a string with an optional component, but something appears to be wrong. (The strings being matched are from a printer log.)
My RegEx (.NET Flavor) is as follows:
```
.*(header_\d{10,11}_).*(_.*_\d{8}).*(\.\w{3,4}).*
-----------... | One possibility is that the second to last `.*` is being greedy. You might try changing it to:
```
.*(header_\d*_).*(_.*_.{8}).*?(\.\w{3,4})?.*
^ Added that
```
That wasn't correct, this one will match the input you supplied, but it assumes that the first `.` it encounters is the start o... |
488,670 | <p>I have a range of dates and a measurement on each of those dates. I'd like to calculate an exponential moving average for each of the dates. Does anybody know how to do this?</p>
<p>I'm new to python. It doesn't appear that averages are built into the standard python library, which strikes me as a little odd. M... | [
{
"answer_id": 488695,
"author": "Jason S",
"author_id": 44330,
"author_profile": "https://Stackoverflow.com/users/44330",
"pm_score": 3,
"selected": false,
"text": "<p>I don't know Python, but for the averaging part, do you mean an exponentially decaying low-pass filter of the form</p>\... | 2009/01/28 | [
"https://Stackoverflow.com/questions/488670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] | I have a range of dates and a measurement on each of those dates. I'd like to calculate an exponential moving average for each of the dates. Does anybody know how to do this?
I'm new to python. It doesn't appear that averages are built into the standard python library, which strikes me as a little odd. Maybe I'm not l... | EDIT:
It seems that [`mov_average_expw()`](http://www.scipy.org/scipy/scikits/browser/trunk/timeseries/scikits/timeseries/lib/moving_funcs.py) function from [scikits.timeseries.lib.moving\_funcs](http://pytseries.sourceforge.net/lib/moving_funcs.html) submodule from [SciKits](http://scikits.appspot.com/) (add-on toolki... |