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 |
|---|---|---|---|---|---|---|
152,024 | <p>I have a submission table that is very simple: userId, submissionGuid</p>
<p>I want to select the username (simple inner join to get it) of all the users who have more than 10 submissions in the table. </p>
<p>I would do this with embedded queries and a group by to count submissions... but is there a better way of... | [
{
"answer_id": 152030,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 1,
"selected": false,
"text": "<pre><code>select userId, count(*)\nfrom submissions\nhaving count(*) > 10\ngroup by userId\n</code></pre>\n"
},
... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23695/"
] | I have a submission table that is very simple: userId, submissionGuid
I want to select the username (simple inner join to get it) of all the users who have more than 10 submissions in the table.
I would do this with embedded queries and a group by to count submissions... but is there a better way of doing it (withou... | This is the simplest way, I believe:
```
select userId
from submission
group by userId
having count(submissionGuid) > 10
``` |
152,028 | <p>I want to be able to compare an image taken from a webcam to an image stored on my computer.</p>
<p>The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with.</p>
<p>I have tried a demonstration... | [
{
"answer_id": 152059,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 7,
"selected": true,
"text": "<p>You could try this: <a href=\"http://code.google.com/p/aforge/\" rel=\"noreferrer\">http://code.google.com/p/aforge/</a... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20900/"
] | I want to be able to compare an image taken from a webcam to an image stored on my computer.
The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with.
I have tried a demonstration project for [Ima... | You could try this: <http://code.google.com/p/aforge/>
It includes a comparison analysis that will give you a score. There are many other great imaging features of all types included as well.
```
// The class also can be used to get similarity level between two image of the same size, which can be useful to get infor... |
152,068 | <p>I've been working on a very simple crud generator for pylons. I came up with something that inspects </p>
<pre><code>SomeClass._sa_class_manager.mapper.c
</code></pre>
<p>Is it ok to inspect this (or to call methods begining with underscore)? I always kind of assumed this is legal though frowned upon as it relies ... | [
{
"answer_id": 152080,
"author": "pi.",
"author_id": 15274,
"author_profile": "https://Stackoverflow.com/users/15274",
"pm_score": 0,
"selected": false,
"text": "<p>If it works, why not? You could have problems though when _sa_class_manager gets restructured, binding yourself to this spe... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985/"
] | I've been working on a very simple crud generator for pylons. I came up with something that inspects
```
SomeClass._sa_class_manager.mapper.c
```
Is it ok to inspect this (or to call methods begining with underscore)? I always kind of assumed this is legal though frowned upon as it relies heavily on the internal st... | It is intentional (in Python) that there are no "private" scopes. It is a convention that anything that starts with an underscore should not ideally be used, and hence you may not complain if its behavior or definition changes in a next version. |
152,071 | <p>I'm trying to display a boolean field in Report Designer in Visual Studio 2008. When I tried to run it, an error occurred:</p>
<pre><code> "An error has occurred during report processing.
String was not recognized as a valid Boolean."
</code></pre>
<p>I tried to convert it using CBool() but it didn't work. ... | [
{
"answer_id": 152303,
"author": "Jen",
"author_id": 20877,
"author_profile": "https://Stackoverflow.com/users/20877",
"pm_score": 0,
"selected": false,
"text": "<p>I'm using SQL Server 2005. The data type is bit. </p>\n"
},
{
"answer_id": 158565,
"author": "RiskManager",
... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20877/"
] | I'm trying to display a boolean field in Report Designer in Visual Studio 2008. When I tried to run it, an error occurred:
```
"An error has occurred during report processing.
String was not recognized as a valid Boolean."
```
I tried to convert it using CBool() but it didn't work. | ```
=iif(Fields!YourBool.Value, "True", "False")
```
Am I missing anything? |
152,084 | <p>I'm interested in actual examples of using fixed point combinators (such as the <a href="https://stackoverflow.com/questions/93526/what-is-a-y-combinator">y-combinator</a> in C++. Have you ever used a fixed point combinator with <a href="http://p-stade.sourceforge.net/boost/libs/egg/doc/html/boost_egg/function_adapt... | [
{
"answer_id": 154267,
"author": "Ted",
"author_id": 8965,
"author_profile": "https://Stackoverflow.com/users/8965",
"pm_score": 6,
"selected": true,
"text": "<p>Here is the same code converted into <code>boost::bind</code> notice the y-combinator and its application site in the main fun... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3146/"
] | I'm interested in actual examples of using fixed point combinators (such as the [y-combinator](https://stackoverflow.com/questions/93526/what-is-a-y-combinator) in C++. Have you ever used a fixed point combinator with [egg](http://p-stade.sourceforge.net/boost/libs/egg/doc/html/boost_egg/function_adaptors.html#boost_eg... | Here is the same code converted into `boost::bind` notice the y-combinator and its application site in the main function. I hope this helps.
```
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <iostream>
// Y-combinator compatible factorial
int fact(boost::function<int(int)> f,int v)
{
if(v == 0)
... |
152,099 | <p>I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.</p>
<p>Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does no... | [
{
"answer_id": 231265,
"author": "devio",
"author_id": 21336,
"author_profile": "https://Stackoverflow.com/users/21336",
"pm_score": 0,
"selected": false,
"text": "<p>In Page_Load, set the focus on the textbox.</p>\n"
},
{
"answer_id": 233011,
"author": "Timothy Khouri",
... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23697/"
] | I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.
Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does not react an... | This solution is blocking the enter key on the entire page
[Disable Enter Key](http://www.bloggingdeveloper.com/post/Disable-Form-Submit-on-Enter-Key-Press.aspx) |
152,104 | <p>I work on a Webproject using <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a> and CakePHP. I use <a href="http://www.appelsiini.net/projects/jeditable" rel="nofollow noreferrer">jeditable</a> as an inplace edit plugin. For textareas I extend it using the <a href="http://www.appelsiini.net/2008/4/aut... | [
{
"answer_id": 154377,
"author": "Alexander Pendleton",
"author_id": 21201,
"author_profile": "https://Stackoverflow.com/users/21201",
"pm_score": 3,
"selected": true,
"text": "<p>I didn't see any problems using Autogrow with jeditable in any browsers but here is an implementation of Gro... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17981/"
] | I work on a Webproject using [jQuery](http://jquery.com/) and CakePHP. I use [jeditable](http://www.appelsiini.net/projects/jeditable) as an inplace edit plugin. For textareas I extend it using the [autogrow plugin](http://www.appelsiini.net/2008/4/autogrow-textarea-for-jeditable).
Well, I have two problems with this:... | I didn't see any problems using Autogrow with jeditable in any browsers but here is an implementation of Growfield with jeditable. It works much in the same way that the Autogrow plugin for jeditable does. You create a special input type for jeditable and just apply .growfield() to it. The necessary javascript is below... |
152,115 | <p>How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock?</p>
| [
{
"answer_id": 152224,
"author": "Mastermind",
"author_id": 22213,
"author_profile": "https://Stackoverflow.com/users/22213",
"pm_score": 2,
"selected": false,
"text": "<p>If you have trouble generating gaussian distributed random points look up <a href=\"http://en.wikipedia.org/wiki/Box... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22470/"
] | How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock? | The following code generates a gaussian distributed random time (in hours, plus fractions of an hour) centered at a given time, and with a given standard deviation. The random times may 'wrap around' the clock, especially if the standard deviation is several hours: this is handled correctly. A different 'wrapping' algo... |
152,127 | <p>I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of resul... | [
{
"answer_id": 152764,
"author": "Matt Quail",
"author_id": 15790,
"author_profile": "https://Stackoverflow.com/users/15790",
"pm_score": 2,
"selected": false,
"text": "<p>You may want to consider looking through all the documents that match categories using a <a href=\"http://lucene.apa... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of results ... | I don't have enough reputation to comment (!) but in Matt Quail's answer I'm pretty sure you could replace this:
```
int numDocs = 0;
td.seek(terms);
while (td.next()) {
numDocs++;
}
```
with this:
```
int numDocs = terms.docFreq()
```
and then get rid of the td variable altogether. This should make it even f... |
152,137 | <p>I don't need a Link but rather only the href= part of the ActionLink.</p>
<p>But if I call Html.ActionLink(...) I get a back.
Is there a way to just return the URL of the Action while not getting the ?</p>
| [
{
"answer_id": 152165,
"author": "Casper",
"author_id": 18729,
"author_profile": "https://Stackoverflow.com/users/18729",
"pm_score": 2,
"selected": false,
"text": "<p>Edit: in response to commment, now including parameters:</p>\n\n<pre><code><% =Html.BuildUrlFromExpression<YourCon... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21699/"
] | I don't need a Link but rather only the href= part of the ActionLink.
But if I call Html.ActionLink(...) I get a back.
Is there a way to just return the URL of the Action while not getting the ? | MVC also provides a UrlHelper class which can do the same thing:
```
<%=Url.Action(actionName)%>
<%=Url.Action(actionName, htmlValues)%>
<%=Url.Action(actionName, controllerName, htmlValues)%>
``` |
152,138 | <p>I have a class proposing translations utilities. The translations themselves should be reloaded every 30 minutes. I use Spring Timer support for that. Basically, my class looks like :</p>
<pre><code>public interface Translator {
public void loadTranslations();
public String getTranslation(String key);
}
</c... | [
{
"answer_id": 152147,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 0,
"selected": false,
"text": "<p>Keep a handle on the load thread to see if it's running?</p>\n\n<p>Or can't you just use a synchronized flag to indic... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23704/"
] | I have a class proposing translations utilities. The translations themselves should be reloaded every 30 minutes. I use Spring Timer support for that. Basically, my class looks like :
```
public interface Translator {
public void loadTranslations();
public String getTranslation(String key);
}
```
loadTransla... | Use some form of locking mechanism to only perform the task if it is not already in progress. Acquiring the locking token must be a one-step process. See:
```
/**
* @author McDowell
*/
public abstract class NonconcurrentTask implements Runnable {
private boolean token = true;
private synchronized boolean a... |
152,160 | <p>Has anyone used the <a href="http://www.cs.tufts.edu/~nr/noweb/" rel="noreferrer">noweb</a> literate programming tool on a large Java project, where several source code files must be generated in different subdirectories? How did you manage this with noweb? Are there any resources and/or best practices out there?</p... | [
{
"answer_id": 433328,
"author": "Thorbjørn Ravn Andersen",
"author_id": 53897,
"author_profile": "https://Stackoverflow.com/users/53897",
"pm_score": 2,
"selected": false,
"text": "<p>Literate Programming works its best if the generated intermediate code can point back to the original s... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] | Has anyone used the [noweb](http://www.cs.tufts.edu/~nr/noweb/) literate programming tool on a large Java project, where several source code files must be generated in different subdirectories? How did you manage this with noweb? Are there any resources and/or best practices out there? | Noweb will dump out files relative to the current working directory, or at the absolute path you specify. Just don't use \* at the end of your filename (to avoid inserting the # preprocessor directives). I would recommend using %def with @ to show where you define and use names.
```
<</path/to/file.java>>=
reallyImp... |
152,187 | <p>What type of authentication would you suggest for the service that is:</p>
<ul>
<li>implemented as WCF and exposed via
varios enpoints (including XML-RPC)</li>
<li>has to be consumed easily by various cross-platform clients</li>
</ul>
<p>Why?</p>
<p>Options that I'm aware of are:</p>
<ul>
<li>Forms-based authent... | [
{
"answer_id": 433328,
"author": "Thorbjørn Ravn Andersen",
"author_id": 53897,
"author_profile": "https://Stackoverflow.com/users/53897",
"pm_score": 2,
"selected": false,
"text": "<p>Literate Programming works its best if the generated intermediate code can point back to the original s... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47366/"
] | What type of authentication would you suggest for the service that is:
* implemented as WCF and exposed via
varios enpoints (including XML-RPC)
* has to be consumed easily by various cross-platform clients
Why?
Options that I'm aware of are:
* Forms-based authentication for IIS-hosted WCF (easy to implement, but ha... | Noweb will dump out files relative to the current working directory, or at the absolute path you specify. Just don't use \* at the end of your filename (to avoid inserting the # preprocessor directives). I would recommend using %def with @ to show where you define and use names.
```
<</path/to/file.java>>=
reallyImp... |
152,188 | <p>I have read in some of the ClickOnce posts that ClickOnce does not allow you to create a desktop icon for you application. Is there any way around this?</p>
| [
{
"answer_id": 152194,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 0,
"selected": false,
"text": "<p>The desktop icon can be a shortcut to the <code>.application</code> file. Install this as one of the first thing... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18826/"
] | I have read in some of the ClickOnce posts that ClickOnce does not allow you to create a desktop icon for you application. Is there any way around this? | In Visual Studio 2005, [ClickOnce](http://en.wikipedia.org/wiki/ClickOnce) does not have the ability to create a desktop icon, but it is now available in Visual Studio 2008 SP1. In Visual Studio 2005, you can use the following code to create a desktop icon for you when the application starts.
I have used this code ove... |
152,190 | <p>I'm using StringBuffer in Java to concat strings together, like so:</p>
<pre><code>StringBuffer str = new StringBuffer();
str.append("string value");
</code></pre>
<p>I would like to know if there's a method (although I didn't find anything from a quick glance at the documentation) or some other way to add "paddi... | [
{
"answer_id": 152195,
"author": "Johan",
"author_id": 11347,
"author_profile": "https://Stackoverflow.com/users/11347",
"pm_score": 2,
"selected": false,
"text": "<p>Just add the space yourself, it's easy enough, as per your own example.</p>\n"
},
{
"answer_id": 152210,
"aut... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6618/"
] | I'm using StringBuffer in Java to concat strings together, like so:
```
StringBuffer str = new StringBuffer();
str.append("string value");
```
I would like to know if there's a method (although I didn't find anything from a quick glance at the documentation) or some other way to add "padding".
Let me explain; ever... | I think this is handled easier either with a helper method (untested code):
```
public String myMethod() {
StringBuilder sb = new StringBuilder();
addToBuffer(sb, "Hello").addToBuffer("there,");
addToBuffer(sb, "it").addToBuffer(sb, "works");
}
private StringBuilder addToBuffer(StringBuilder sb, String wh... |
152,205 | <p>I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc.</p>
<p>I have marked these methods 'deprecated', ... | [
{
"answer_id": 152213,
"author": "Milan Babuškov",
"author_id": 14690,
"author_profile": "https://Stackoverflow.com/users/14690",
"pm_score": 0,
"selected": false,
"text": "<p>Use <a href=\"http://java.sun.com/j2se/1.4.2/docs/guide/misc/deprecation/deprecated.html\" rel=\"nofollow norefe... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/706/"
] | I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc.
I have marked these methods 'deprecated', and would ... | Set a date and publicize it in the @deprecated tag. The amount of time given to the removal depends on the amount of users your code has, how well connected you are with them and the the reason for the change.
If you have thousands of users and you barely talk to them, the time frame should probably be in the decades ... |
152,216 | <p>Boost range library (<a href="http://www.boost.org/doc/libs/1_35_0/libs/range/index.html" rel="noreferrer">http://www.boost.org/doc/libs/1_35_0/libs/range/index.html</a>) allows us to abstract a pair of iterators into a range. Now I want to combine two ranges into one, viz:</p>
<p>given two ranges r1 and r2, define... | [
{
"answer_id": 152227,
"author": "Roel",
"author_id": 11449,
"author_profile": "https://Stackoverflow.com/users/11449",
"pm_score": 0,
"selected": false,
"text": "<p>I think you'd have to make a custom iterator that will 'roll over' r1.end() to r2.begin() when r1.end() is reached. Begin(... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19501/"
] | Boost range library (<http://www.boost.org/doc/libs/1_35_0/libs/range/index.html>) allows us to abstract a pair of iterators into a range. Now I want to combine two ranges into one, viz:
given two ranges r1 and r2, define r which traverses [r1.begin(), r1.end()[ and then [r2.begin(), r2.end()[. Is there some way to de... | I needed this again so I had a second look. There is a way to concat two ranges using boost/range/join.hpp. Unluckily the output range type is not included in the interface:
```
#include "boost/range/join.hpp"
#include "boost/foreach.hpp"
#include <iostream>
int main() {
int a[] = {1, 2, 3, 4};
int b... |
152,218 | <p>Here's the problem:</p>
<pre><code>split=re.compile('\\W*')
</code></pre>
<p>This regular expression works fine when dealing with regular words, but there are occasions where I need the expression to include words like <code>k&amp;auml;ytt&amp;auml;j&aml;auml;</code>.</p>
<p>What should I add to the r... | [
{
"answer_id": 152225,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 4,
"selected": true,
"text": "<p>You probably want to take the problem reverse, i.e. finding all the character without the spaces:</p>\n\n<pre><code>[^ \... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21716/"
] | Here's the problem:
```
split=re.compile('\\W*')
```
This regular expression works fine when dealing with regular words, but there are occasions where I need the expression to include words like `k&auml;ytt&auml;j&aml;auml;`.
What should I add to the regex to include the `&` and `;` characters? | You probably want to take the problem reverse, i.e. finding all the character without the spaces:
```
[^ \t\n]*
```
Or you want to add the extra characters:
```
[a-zA-Z0-9&;]*
```
In case you want to match HTML entities, you should try something like:
```
(\w+|&\w+;)*
``` |
152,243 | <p>I have a database scenario (I'm using Oracle) in which several processes make inserts into a table and a single process selects from it. The table is basically used as intermediate storage, to which multiple processes (in the following called the Writers) write log events, and from which a single process (in the fo... | [
{
"answer_id": 152375,
"author": "AJ.",
"author_id": 7211,
"author_profile": "https://Stackoverflow.com/users/7211",
"pm_score": 1,
"selected": false,
"text": "<p>Interesting problem. It sounds like you're building a nice solution.<br />\nI hope I can help.</p>\n<p>A couple of suggestio... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7742/"
] | I have a database scenario (I'm using Oracle) in which several processes make inserts into a table and a single process selects from it. The table is basically used as intermediate storage, to which multiple processes (in the following called the Writers) write log events, and from which a single process (in the follow... | Interesting problem. It sounds like you're building a nice solution.
I hope I can help.
A couple of suggestions...
Writer Status
-------------
You could create a table, WRITER\_STATUS, which has a last\_id field: Each writer updates this table before writing with the ID it is going to write to the log, but only i... |
152,250 | <p>I have my winform application gathering data using databinding. Everything looks fine except that I have to link the <strong>property</strong> with the <strong>textedit</strong> using a string:</p>
<blockquote>
<p>Me.TextEdit4.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", Me.MyClassBindingSource,... | [
{
"answer_id": 152254,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "<p>Ironically reflection expects that you provide property name to get it's info :) </p>\n\n<p>You can create custom attribute, ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have my winform application gathering data using databinding. Everything looks fine except that I have to link the **property** with the **textedit** using a string:
>
> Me.TextEdit4.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", Me.MyClassBindingSource, "MyClassProperty", True))
>
>
>
This work... | Here is an example of what I'm talking about:
```
[AttributeUsage(AttributeTargets.Property)]
class TextProperyAttribute: Attribute
{}
class MyTextBox
{
[TextPropery]
public string Text { get; set;}
public int Foo { get; set;}
public double Bar { get; set;}
}
static string GetTextProperty(Type type)
... |
152,261 | <p>I have a Delphi DLL with a function defined as:</p>
<p>function SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer;</p>
<p>I am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as:</p>
<pre><code>[DllImport("opt7... | [
{
"answer_id": 152322,
"author": "OregonGhost",
"author_id": 20363,
"author_profile": "https://Stackoverflow.com/users/20363",
"pm_score": 5,
"selected": true,
"text": "<p>You'll most likely not have any luck with this. The TStringList is more than just an array, it's a full-blown class,... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3585/"
] | I have a Delphi DLL with a function defined as:
function SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer;
I am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as:
```
[DllImport("opt7bja.dll", CharSet = CharSet.... | You'll most likely not have any luck with this. The TStringList is more than just an array, it's a full-blown class, and the exact implementation details may differ from what is possible with .NET. Take a look at the Delphi VCL source code (that is, if you have it) and try to find out if you can rebuild the class in C#... |
152,262 | <p>I am in charge of a website at work and recently I have added ajaxy requests to make it faster and more responsive. But it has raised an issue.</p>
<p>On my pages, there is an index table on the left, like a menu. Once you have clicked on it, it makes a request that fills the rest of the page. At anytime you can cl... | [
{
"answer_id": 152271,
"author": "Franck Mesirard",
"author_id": 16070,
"author_profile": "https://Stackoverflow.com/users/16070",
"pm_score": 0,
"selected": false,
"text": "<p>Possibly, I could provide two links each time, one firing the javascript and another being a real link that wou... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16070/"
] | I am in charge of a website at work and recently I have added ajaxy requests to make it faster and more responsive. But it has raised an issue.
On my pages, there is an index table on the left, like a menu. Once you have clicked on it, it makes a request that fills the rest of the page. At anytime you can click on ano... | Yes. Instead of:
```
<a href="javascript:code">...</a>
```
Do this:
```
<a href="/non/ajax/display/page" id="thisLink">...</a>
```
And then in your JS, hook the link via it's ID to do the AJAX call. Remember that you need to stop the click event from bubbling up. Most frameworks have an event killer built in that... |
152,276 | <p>I have report on my asp page and every time I change a filter and click view report, I get this error:</p>
<p>Microsoft JScript runtime error: 'this._postBackSettings.async' is null or not an object</p>
<p>I tried change the EnablePartialRendering="true" to EnablePartialRendering="false" but then people can't logi... | [
{
"answer_id": 229605,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Put the button inside a panel (not update panel), then add this line to the panel\nDefaultButton=\"Button1\"</p>\n\n<p>This... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12311/"
] | I have report on my asp page and every time I change a filter and click view report, I get this error:
Microsoft JScript runtime error: 'this.\_postBackSettings.async' is null or not an object
I tried change the EnablePartialRendering="true" to EnablePartialRendering="false" but then people can't login on the site | This problem is solved by setting `EnablePartialRendering` to false of `ScriptManager`.
```
ScriptManager1.EnablePartialRendering = false;
```
In `OnInit` event of the page where `rsweb:ReportViewer` is used.
If you want to enable for other page then set it true on master page's `OnInit`. |
152,288 | <p>I've been pulling my hear out over this problem for a few hours yesterday:</p>
<p>I've a database on MySQL 4.1.22 server with encoding set to "UTF-8 Unicode (utf8)" (as reported by phpMyAdmin). Tables in this database have default charset set to <b>latin2</b>. But, the web application (CMS Made Simple written in PH... | [
{
"answer_id": 152730,
"author": "Matt",
"author_id": 23723,
"author_profile": "https://Stackoverflow.com/users/23723",
"pm_score": 1,
"selected": true,
"text": "<p>Ugh... ok, seems I found a solution.</p>\n\n<p>MySQL isn't the culprit here. I did a simple dump and load now, with no chan... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23723/"
] | I've been pulling my hear out over this problem for a few hours yesterday:
I've a database on MySQL 4.1.22 server with encoding set to "UTF-8 Unicode (utf8)" (as reported by phpMyAdmin). Tables in this database have default charset set to **latin2**. But, the web application (CMS Made Simple written in PHP) using it d... | Ugh... ok, seems I found a solution.
MySQL isn't the culprit here. I did a simple dump and load now, with no changes to the dump.sql script - meaning I left "set names latin2" and tables charsets as they were. Then I switched my original CMSMS installation over to the new database and... it worked correctly. So actual... |
152,299 | <p>I am about to set up a subversion server to be accessed via svn+ssh. I was wondering, where the <em>default</em> repository location is (on a unix box).</p>
<p>Do you put it in</p>
<pre><code>/opt/svn
</code></pre>
<p>or</p>
<pre><code>/home/svn
</code></pre>
<p>or</p>
<pre><code>/usr/subversion
</code></pre>
... | [
{
"answer_id": 152403,
"author": "Mihai Limbășan",
"author_id": 14444,
"author_profile": "https://Stackoverflow.com/users/14444",
"pm_score": 4,
"selected": true,
"text": "<p>I typically place the repositories somewhere under <code>/var</code>, usually in <code>/var/lib/svn</code> - I'm ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870/"
] | I am about to set up a subversion server to be accessed via svn+ssh. I was wondering, where the *default* repository location is (on a unix box).
Do you put it in
```
/opt/svn
```
or
```
/home/svn
```
or
```
/usr/subversion
```
or even
```
/svn
```
or somewhere else?
I am looking for the place, most peopl... | I typically place the repositories somewhere under `/var`, usually in `/var/lib/svn` - I'm trying to follow the [Filesystem Hierarchy Standard](http://www.pathname.com/fhs/) which has this to say about the [purpose of /var](http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE31):
`/var` is specified here in order to m... |
152,307 | <p>I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" rel="nofollow noreferrer">HTTP</a> ... | [
{
"answer_id": 152366,
"author": "Mauro",
"author_id": 2208,
"author_profile": "https://Stackoverflow.com/users/2208",
"pm_score": 2,
"selected": true,
"text": "<p>I've handled the 404 by doing this in the global.asax file</p>\n\n<pre><code>protected void Application_BeginRequest(object ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2208/"
] | I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an [HTTP](http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) status of 200. To try to resolve this I'... | I've handled the 404 by doing this in the global.asax file
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
string url = Request.RawUrl;
if ((url.Contains(".aspx")) && (!System.IO.File.Exists(Server.MapPath(url))))
{
Server.Transfer("/Error/FileNotFound.aspx");
}
}
```... |
152,313 | <p>When should you use XML attributes and when should you use XML elements?</p>
<p>e.g.</p>
<pre><code><customData>
<records>
<record name="foo" description="bar" />
</records>
</customData>
</code></pre>
<p>or</p>
<pre><code><customData>
<records>
<record&... | [
{
"answer_id": 152321,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": false,
"text": "<p>Personally I like using attributes for simple single-valued properties. Elements are (obviously) more suitable for co... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23726/"
] | When should you use XML attributes and when should you use XML elements?
e.g.
```
<customData>
<records>
<record name="foo" description="bar" />
</records>
</customData>
```
or
```
<customData>
<records>
<record>
<name>foo</name>
<description>bar</description>
</record>
</records>
<... | There is an article titled "[Principles of XML design: When to use elements versus attributes](http://www.ibm.com/developerworks/xml/library/x-eleatt.html)" on IBM's website.
Though there doesn't appear to be many hard and fast rules, there are some good guidelines mentioned in the posting. For instance, one of the re... |
152,319 | <p>I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other <a href="http://web.archive.org/web/20180224071555/http://www.cs.ubc.ca:80/~harrison/Java/sorting-demo.html" rel="noreferrer">sort algorithm</a> other than bubble or merge would suffice.</p>
<p>Please note t... | [
{
"answer_id": 152325,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 8,
"selected": true,
"text": "<p><del>Take a look <a href=\"http://en.allexperts.com/q/Visual-Basic-1048/string-manipulation.htm\" rel=\"noreferrer\... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4134/"
] | I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other [sort algorithm](http://web.archive.org/web/20180224071555/http://www.cs.ubc.ca:80/~harrison/Java/sorting-demo.html) other than bubble or merge would suffice.
Please note that this is to work with MS Project 20... | ~~Take a look [here](http://en.allexperts.com/q/Visual-Basic-1048/string-manipulation.htm):~~
**Edit:** The referenced source (allexperts.com) has since closed, but here are the relevant [author](https://web.archive.org/web/20090629091145/http://www.allexperts.com:80/ep/1048-18393/Visual-Basic/Robert-Nunemaker.htm) ... |
152,323 | <p>I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box.</p>
<p>The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl i... | [
{
"answer_id": 152356,
"author": "Moshe",
"author_id": 9941,
"author_profile": "https://Stackoverflow.com/users/9941",
"pm_score": 0,
"selected": false,
"text": "<p>I think that you'll have to install some ActiveX or other component what could be invoked from WScript, such as:\n<a href=\... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264/"
] | I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box.
The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl is not avai... | It is possible with Wscript, using CDO:
```
Dim objMail
Set objMail = CreateObject("CDO.Message")
objMail.From = "Me <Me@Server.com>"
objMail.To = "You <You@AnotherServer.com>"
objMail.Subject = "That's a mail"
objMail.Textbody = "Hello World"
objMail.AddAttachment "C:\someFile.ext"
---8<----- You don't need this p... |
152,328 | <p>What is better?</p>
<p><strong>A:</strong></p>
<pre><code>server:1080/repo/projectA/trunk/...
branches/branch1
branches/branch2
branches/branch3
tags/tag1/...
tags/tag2/...
server:1080/... | [
{
"answer_id": 152341,
"author": "OregonGhost",
"author_id": 20363,
"author_profile": "https://Stackoverflow.com/users/20363",
"pm_score": 4,
"selected": false,
"text": "<p>We use A, because the other one didn't make sense to us. Note that a \"project\" with regard to SVN is not necessar... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8986/"
] | What is better?
**A:**
```
server:1080/repo/projectA/trunk/...
branches/branch1
branches/branch2
branches/branch3
tags/tag1/...
tags/tag2/...
server:1080/repo/projectB/trunk/...
... | The [Repository Administration](http://svnbook.red-bean.com/en/1.5/svn.reposadmin.html) chapter of the [SVN book](http://svnbook.red-bean.com/en/1.5/index.html) includes a section on [Planning Your Repository Organization](http://svnbook.red-bean.com/en/1.5/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselay... |
152,337 | <p>Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:</p>
<pre><code>System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
</code></pre>
<p>When NOT running as scheduled task i.e. under a l... | [
{
"answer_id": 152390,
"author": "EggyBach",
"author_id": 15475,
"author_profile": "https://Stackoverflow.com/users/15475",
"pm_score": -1,
"selected": false,
"text": "<p>Taken from <a href=\"http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx\" rel=\"nofollow noreferrer\">MSDN</a>:</p... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:
```
System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
```
When NOT running as scheduled task i.e. under a logged in user, as long as ... | My humblest apologies. The user I was using was NOT a member of "Performance Monitor Users" group.
This is necessary for .NET Framework 1.1 implementation of System.Diagnostics.
I have added the user to this group, and all is well. |
152,342 | <p>I fill a collection one single time when my J2EE webapp starts.
Then, several thread may access it at same time but only to read it.</p>
<p>I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read ?</p>
| [
{
"answer_id": 152348,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 5,
"selected": true,
"text": "<p>Normally no because you are not changing the internal state of the collection in this case. When you iterate over t... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3122/"
] | I fill a collection one single time when my J2EE webapp starts.
Then, several thread may access it at same time but only to read it.
I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read ? | Normally no because you are not changing the internal state of the collection in this case. When you iterate over the collection a new instance of the iterator is created and the state of the iteration is per iterator instance.
---
**Aside note:** Remember that by keeping a read-only collection you are only preventin... |
152,344 | <p>I have a statusItem application written in PyObjC. The statusItem has a menuItem which is supposed to launch a new window when it is clicked:</p>
<pre><code># Create statusItem
statusItem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength)
statusItem.setHighlightMode_(TRUE)
statusItem.... | [
{
"answer_id": 152399,
"author": "Nathan Kinsinger",
"author_id": 20045,
"author_profile": "https://Stackoverflow.com/users/20045",
"pm_score": 3,
"selected": false,
"text": "<p>You need to send the application an activateIgnoringOtherApps: message and then send the window makeKeyAndOrde... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] | I have a statusItem application written in PyObjC. The statusItem has a menuItem which is supposed to launch a new window when it is clicked:
```
# Create statusItem
statusItem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength)
statusItem.setHighlightMode_(TRUE)
statusItem.setEnabled_(TR... | You need to send the application an activateIgnoringOtherApps: message and then send the window makeKeyAndOrderFront:.
In Objective-C this would be:
```
[NSApp activateIgnoringOtherApps:YES];
[[self window] makeKeyAndOrderFront:self];
``` |
152,376 | <p>How do I set the background colour of items in a list box dynamically? i.e. there is some property on my business object that I'm binding too, so based on some business rules I want the background colour to be different?</p>
<pre><code> <ListBox Background="Red">
<ListBox.ItemContainerStyle>... | [
{
"answer_id": 152437,
"author": "Dan",
"author_id": 230,
"author_profile": "https://Stackoverflow.com/users/230",
"pm_score": 0,
"selected": false,
"text": "<p>@Matt Thanks for the reply. I'll look into triggers.</p>\n\n<p>My only problem is that, the logic for determining whether a row... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230/"
] | How do I set the background colour of items in a list box dynamically? i.e. there is some property on my business object that I'm binding too, so based on some business rules I want the background colour to be different?
```
<ListBox Background="Red">
<ListBox.ItemContainerStyle>
<Style TargetT... | Ok - if you need custom logic to determine the background then I would look into building a simple IValueConverter class. You just need to implement the IValueConverter interface and, in its Convert method, change the supplied value into a Brush.
Here's a quick post from Sahil Malik that describes IValueConverters - ... |
152,382 | <p>We recently installed SVN 1.5.2 (with VisualSVN/Apache) on some of our servers / virtual machines, and now when I send a commandline command with username/password they don't get cached anymore.
Before, we were running SVN 1.5.0 installed with CollabNet, on svn://, and the credentials were cached after the first com... | [
{
"answer_id": 159009,
"author": "wds",
"author_id": 10098,
"author_profile": "https://Stackoverflow.com/users/10098",
"pm_score": 1,
"selected": false,
"text": "<p>AFAIK the credential caching is a client responsibility. All the server does is ask for those credentials when necessary. I... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21162/"
] | We recently installed SVN 1.5.2 (with VisualSVN/Apache) on some of our servers / virtual machines, and now when I send a commandline command with username/password they don't get cached anymore.
Before, we were running SVN 1.5.0 installed with CollabNet, on svn://, and the credentials were cached after the first comman... | AFAIK the credential caching is a client responsibility. All the server does is ask for those credentials when necessary. I'd check the local client configuration files and maybe see what happens with different version clients. |
152,416 | <p>Given the following idioms:</p>
<p>1)</p>
<p><pre><code>variable = value1
if condition
variable = value2</code></pre></p>
<p>2)</p>
<p><pre><code>variable = value2
if not condition
variable = value1</pre></code></p>
<p>3)</p>
<p><pre><code>if condition
variable = value2
else
variable = value1</pre></co... | [
{
"answer_id": 152423,
"author": "cruizer",
"author_id": 6441,
"author_profile": "https://Stackoverflow.com/users/6441",
"pm_score": 4,
"selected": true,
"text": "<p>In theory, I prefer #3 as it avoids having to assign a value to the variable twice. In the real world though I use any of ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1709/"
] | Given the following idioms:
1)
```
variable = value1
if condition
variable = value2
```
2)
```
variable = value2
if not condition
variable = value1
```
3)
```
if condition
variable = value2
else
variable = value1
```
4)
```
if not condition
variable = value1
else
variable = value2
```
Which do you ... | In theory, I prefer #3 as it avoids having to assign a value to the variable twice. In the real world though I use any of the four above that would be more readable or would express more clearly my intention. |
152,419 | <p>I've added a custom soap header <code><MyApp:FOO></code> element to the <code><soap:Header></code> element and the requirments states that i must sign this element , how would one do that?
<code><MyApp:FOO></code> contains a number of things (username, preferences, etc) that identifies a user on hi... | [
{
"answer_id": 152522,
"author": "Carl-Johan",
"author_id": 15406,
"author_profile": "https://Stackoverflow.com/users/15406",
"pm_score": 2,
"selected": false,
"text": "<p>My current version of SecureMessage seems to do the trick..</p>\n\n<pre><code> public override void SecureMessage... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15406/"
] | I've added a custom soap header `<MyApp:FOO>` element to the `<soap:Header>` element and the requirments states that i must sign this element , how would one do that?
`<MyApp:FOO>` contains a number of things (username, preferences, etc) that identifies a user on higher level.
I've succesfully used a policy file and no... | My current version of SecureMessage seems to do the trick..
```
public override void SecureMessage(SoapEnvelope envelope, Security security)
{
//EncryptedData data = new EncryptedData(userToken);
SignatureReference ssekSignature = new SignatureReference();
MessageSignature signature = n... |
152,439 | <p>I am actually new to this forum and I kept trying for a few days to find an easy way to copy an entire LDAP subtree to another tree. Since I couldn't find anything useful, i thought of dropping a question here as well. Does anybody know how to do this programatically ?</p>
<p>For normal operations like add, remove,... | [
{
"answer_id": 152529,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 1,
"selected": false,
"text": "<p>I actually don't know Spring LDAP but if your LDAP interface does not provide any high level abstraction for movi... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am actually new to this forum and I kept trying for a few days to find an easy way to copy an entire LDAP subtree to another tree. Since I couldn't find anything useful, i thought of dropping a question here as well. Does anybody know how to do this programatically ?
For normal operations like add, remove, search, I... | I actually don't know Spring LDAP but if your LDAP interface does not provide any high level abstraction for moving/renaming or copying an entire subtree you have to move/rename or copy all subtree nodes recursively. The LDAP API does not provide such an option directly.
The following is pseudo-code:
```
function cop... |
152,447 | <p>When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish. If I kick off the backup or restore with a script, is there a way to monitor the progress, or do I just sit back ... | [
{
"answer_id": 152465,
"author": "Pavel Chuchuva",
"author_id": 14131,
"author_profile": "https://Stackoverflow.com/users/14131",
"pm_score": 2,
"selected": false,
"text": "<p>Use STATS option: <a href=\"http://msdn.microsoft.com/en-us/library/ms186865.aspx\" rel=\"nofollow noreferrer\">... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18826/"
] | When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish. If I kick off the backup or restore with a script, is there a way to monitor the progress, or do I just sit back and... | Yes. If you have installed [sp\_who2k5](http://blogs.msdn.com/chadboyd/archive/2007/08/15/sp-who-for-sql-2005-sp-who2k5.aspx) into your master database, you can simply run:
```
sp_who2k5 1,1
```
The resultset will include all the active transactions. The currently running backup(s) will contain the string "BACKUP" i... |
152,457 | <p>This was a question raised by one of the software engineers in my organisation. I'm interested in the broadest definition.</p>
| [
{
"answer_id": 152463,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": 5,
"selected": false,
"text": "<p>A socket = IP Address + a port (numeric address)<br>\nTogether they identify an end-point for a network connection on a mac... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199234/"
] | This was a question raised by one of the software engineers in my organisation. I'm interested in the broadest definition. | Summary
-------
**A TCP socket is an endpoint *instance*** defined by an IP address and a port in the context of either a particular TCP connection or the listening state.
**A port is a virtualisation identifier** defining a service endpoint (as distinct from a service *instance* endpoint aka session identifier).
**... |
152,462 | <p>I need to run a Java application, which we are trying to port to Java 6, on an NT box.</p>
<p>I manage to run java 5 on it (although not officially supported), but when I try to run java 6 I get the following error:</p>
<pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre... | [
{
"answer_id": 152495,
"author": "Jacek Szymański",
"author_id": 23242,
"author_profile": "https://Stackoverflow.com/users/23242",
"pm_score": 1,
"selected": false,
"text": "<p>Java SE 6 <a href=\"http://java.sun.com/javase/6/webnotes/install/system-configurations.html\" rel=\"nofollow n... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11699/"
] | I need to run a Java application, which we are trying to port to Java 6, on an NT box.
I manage to run java 5 on it (although not officially supported), but when I try to run java 6 I get the following error:
```
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre1.6.0_05\bin\awt.dll:... | OK, Thanks for all the viewers and to @Roel Spiker and @Partyzant for their answers.
**It can't be done.** Not unless you install windows2000 on the NT box. This is because awt.dll fr J6SE uses new methods in User32.dll, which is part of the windows OS (linked to kernel.dll et al). Use the dll dependency walker and se... |
152,469 | <p>I want to make a login system using ASP.NET (MVC).</p>
<p>On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider.</p>
<p>However, I want to roll my own. I don't want to use the built-in membership provider, as it only seem... | [
{
"answer_id": 152513,
"author": "Peter Marshall",
"author_id": 4692,
"author_profile": "https://Stackoverflow.com/users/4692",
"pm_score": -1,
"selected": false,
"text": "<p>I would avoid the whole issue and use openid. There is a library available that you can use directly. \n<a href=\... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to make a login system using ASP.NET (MVC).
On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider.
However, I want to roll my own. I don't want to use the built-in membership provider, as it only seems to work on MS S... | I dont know about best practices but I can tell you what I do. Its not hitech security but it does the job.
I use forms authentication. I receive the password secured with ssl via a textbox on the login page. I take that password and hash it. (Hashing is like one way encryption, you can get hash code that cant be reve... |
152,483 | <p>Is there a way to print all methods of an object in JavaScript?</p>
| [
{
"answer_id": 152499,
"author": "WalkingRandomly",
"author_id": 1856916,
"author_profile": "https://Stackoverflow.com/users/1856916",
"pm_score": 1,
"selected": false,
"text": "<p>From <a href=\"http://www.javascriptkit.com/jsref/looping.shtml\" rel=\"nofollow noreferrer\">here</a>:</p>... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21132/"
] | Is there a way to print all methods of an object in JavaScript? | Sure:
```
function getMethods(obj) {
var result = [];
for (var id in obj) {
try {
if (typeof(obj[id]) == "function") {
result.push(id + ": " + obj[id].toString());
}
} catch (err) {
result.push(id + ": inaccessible");
}
}
return result;
}
```
Using it:
```
alert(getMeth... |
152,487 | <p>There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. </p>
<p>The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be not a good option, because the build sh... | [
{
"answer_id": 152524,
"author": "Jason Stangroome",
"author_id": 20819,
"author_profile": "https://Stackoverflow.com/users/20819",
"pm_score": 1,
"selected": false,
"text": "<p>The C# compiler (csc.exe) has a /warnaserror switch will will treat warnings as errors and fail the build. Thi... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11391/"
] | There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc.
The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be not a good option, because the build should test ... | AFAIK MSBuild has no built-in support to retrieve the warning count at a given point of the build script. You can however follow these steps to achieve this goal:
1. Create a custom logger that listens for the warning event and counts the number of warnings
2. Create a custom task that exposes an [Output] WarningCount... |
152,514 | <p>I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter).</p>
<p>Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any L... | [
{
"answer_id": 152519,
"author": "vividos",
"author_id": 23740,
"author_profile": "https://Stackoverflow.com/users/23740",
"pm_score": 3,
"selected": false,
"text": "<p>Here's my suboptimal solution, using a Bash shell script:</p>\n\n<pre><code>#!/bin/bash\n# First, rename all folders\nf... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23740/"
] | I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter).
Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any Linux box.
... | A concise version using the `"rename"` command:
```
find my_root_dir -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
```
This avoids problems with directories being renamed before files and trying to move files into non-existing directories (e.g. `"A/A"` into `"a/a"`).
Or, a more verbose version without usin... |
152,537 | <p>I need to add the ability for users of my software to select records by character ranges.<br>
How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example?</p>
<p>Currently I'm using greater than and less than operators, so the above example would become:</p>
<pre><... | [
{
"answer_id": 152608,
"author": "Zsolt Botykai",
"author_id": 11621,
"author_profile": "https://Stackoverflow.com/users/11621",
"pm_score": 0,
"selected": false,
"text": "<p>For MSSQL see this thread: <a href=\"http://bytes.com/forum/thread483570.html\" rel=\"nofollow noreferrer\">http:... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8799/"
] | I need to add the ability for users of my software to select records by character ranges.
How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example?
Currently I'm using greater than and less than operators, so the above example would become:
```
select * from wid... | Let's skip directly to localization. Would you say "aa" >= "ba" ? Probably not, but that is where it sorts in Sweden. Also, you simply can't assume that you can ignore casing in any language. Casing is explicitly language-dependent, with the most common example being Turkish: uppercase i is İ. Lowercase I is ı.
Now, y... |
152,541 | <p>I have a stored procedure that looks like:</p>
<pre><code>CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND CASE WHEN @AdditionalFilter = 1 THEN
T.Column2 IS NOT NULL
</code></pre>
<p>Needless to say, this doesn't wo... | [
{
"answer_id": 152551,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 1,
"selected": false,
"text": "<pre><code>CREATE PROCEDURE dbo.usp_TestFilter\n @AdditionalFilter BIT = 1\nAS\n SELECT *\n FROM dbo.SomeTable... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6651/"
] | I have a stored procedure that looks like:
```
CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND CASE WHEN @AdditionalFilter = 1 THEN
T.Column2 IS NOT NULL
```
Needless to say, this doesn't work. How can I activate the... | ```
CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND (@AdditionalFilter = 0 OR
T.Column2 IS NOT NULL)
```
If @AdditionalFilter is 0, the column won't be evaluated since it can't affect the outcome of the part between b... |
152,580 | <p>How do I check if an object is of a given type, or if it inherits from a given type?</p>
<p>How do I check if the object <code>o</code> is of type <code>str</code>?</p>
<hr />
<p><sub>Beginners often wrongly expect the string to <em>already be</em> "a number" - either expecting Python 3.x <code>input</code... | [
{
"answer_id": 152583,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 4,
"selected": false,
"text": "<pre><code>isinstance(o, str)\n</code></pre>\n\n<p><a href=\"https://docs.python.org/2/library/functions.html#isi... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14102/"
] | How do I check if an object is of a given type, or if it inherits from a given type?
How do I check if the object `o` is of type `str`?
---
Beginners often wrongly expect the string to *already be* "a number" - either expecting Python 3.x `input` to convert type, or expecting that a string like `'1'` is *also simult... | Use [`isinstance`](https://docs.python.org/library/functions.html#isinstance) to check if `o` is an instance of `str` or any subclass of `str`:
```
if isinstance(o, str):
```
To check if the type of `o` is exactly `str`, *excluding subclasses of `str`*:
```
if type(o) is str:
```
Another alternative to the above:... |
152,585 | <p>What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?</p>
| [
{
"answer_id": 152599,
"author": "John Topley",
"author_id": 1450,
"author_profile": "https://Stackoverflow.com/users/1450",
"pm_score": 6,
"selected": false,
"text": "<p>You can use the <code>request.get?</code> and <code>request.post?</code> methods to distinguish between HTTP Gets and... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18768/"
] | What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $\_GET and $\_POST variables in PHP? | I don't know of any convenience methods in Rails for this, but you can access the querystring directly to parse out parameters that are set there. Something like the following:
```
request.query_string.split(/&/).inject({}) do |hash, setting|
key, val = setting.split(/=/)
hash[key.to_sym] = val
hash
end
``` |
152,602 | <p>Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"?</p>
<ol>
<li>f arg (obj.DoStuff())</li>
<li>f arg <| obj.DoStuff()</li>
</ol>
| [
{
"answer_id": 152637,
"author": "Rayne",
"author_id": 21734,
"author_profile": "https://Stackoverflow.com/users/21734",
"pm_score": 0,
"selected": false,
"text": "<p>I use () much much more often, but thats just preference, I'm pretty sure that <| is more idomatic, but I use () by ha... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21182/"
] | Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"?
1. f arg (obj.DoStuff())
2. f arg <| obj.DoStuff() | Overall, I don't know that one or the other is more idiomatic.
Personally, the only time I use <| is with "raise":
```
raise <| new FooException("blah")
```
Apart from that, I always use parens. Note that since most F# code uses curried functions, this does not typically imply any "extra" parens:
```
f arg (g x y)... |
152,613 | <p>I have a specialized list that holds items of type <code>IThing</code>:</p>
<pre><code>public class ThingList : IList<IThing>
{...}
public interface IThing
{
Decimal Weight { get; set; }
Decimal Velocity { get; set; }
Decimal Distance { get; set; }
Decimal Age { get; set; }
Decimal Anothe... | [
{
"answer_id": 152619,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 4,
"selected": false,
"text": "<p>If you were you using .NET 3.5 and LINQ:</p>\n\n<pre><code>Decimal result = myThingList.Max(i => i.Weight);\n</cod... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8976/"
] | I have a specialized list that holds items of type `IThing`:
```
public class ThingList : IList<IThing>
{...}
public interface IThing
{
Decimal Weight { get; set; }
Decimal Velocity { get; set; }
Decimal Distance { get; set; }
Decimal Age { get; set; }
Decimal AnotherValue { get; set; }
[...e... | Yes, you should use a delegate and anonymous methods.
For an example see [here](http://encodo.com/en/blogs.php?entry_id=76).
Basically you need to implement something similar to the [Find method of Lists](http://msdn.microsoft.com/en-us/library/x0b5b5bc(VS.80).aspx).
Here is a sample implementation
```
public class... |
152,618 | <p>Probably a long question for a simple solution, but here goes...</p>
<p>I have a custom made silverlight control for selecting multiple files and sending them to the server. It sends files to a general handler (FileReciever.ashx) using the OpenWriteAsync method of a WebCLient control.</p>
<p>Basically, the silverl... | [
{
"answer_id": 152632,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 1,
"selected": true,
"text": "<p>Hrm, maybe a simple solutioin could be to tag the url with a GUID(the guid being unique per file, or transfer, whatever... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22621/"
] | Probably a long question for a simple solution, but here goes...
I have a custom made silverlight control for selecting multiple files and sending them to the server. It sends files to a general handler (FileReciever.ashx) using the OpenWriteAsync method of a WebCLient control.
Basically, the silverlight code does so... | Hrm, maybe a simple solutioin could be to tag the url with a GUID(the guid being unique per file, or transfer, whatever makes sense to your situatuation). Then you can have another simple web service that is capable of checking on the status of the other service, based on the guid, and have your silverlight client quer... |
152,643 | <p>For an <code>std::map<std::string, std::string> variables</code>, I'd like to do this:</p>
<pre><code>BOOST_CHECK_EQUAL(variables["a"], "b");
</code></pre>
<p>The only problem is, in this context <code>variables</code> is <code>const</code>, so <code>operator[]</code> won't work :(</p>
<p>Now, there are sev... | [
{
"answer_id": 152658,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 3,
"selected": false,
"text": "<p><code>find</code> is the idiomatic form. Casting away <code>const</code> is almost always a bad idea. You'd have t... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971/"
] | For an `std::map<std::string, std::string> variables`, I'd like to do this:
```
BOOST_CHECK_EQUAL(variables["a"], "b");
```
The only problem is, in this context `variables` is `const`, so `operator[]` won't work :(
Now, there are several workarounds to this; casting away the `const`, using `variables.count("a") ? v... | ```
template <typename K, typename V>
V get(std::map<K, V> const& map, K const& key)
{
std::map<K, V>::const_iterator iter(map.find(key));
return iter != map.end() ? iter->second : V();
}
```
Improved implementation based on comments:
```
template <typename T>
typename T::mapped_type get(T const& map, typena... |
152,664 | <p>I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the... | [
{
"answer_id": 152672,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 3,
"selected": false,
"text": "<p>Have a look at the <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplat... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6276/"
] | I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the mo... | the `ItemTemplateSelector` will work but I think it is easier to create multiple `DataTemplate`s in your resource section and then just giving each one a `DataType`. This will automatically then use this `DataTemplate` if the items generator detects the matching data type?
```
<DataTemplate DataType={x:Type local:Obje... |
152,670 | <p>Is it possible to prevent the Windows Installer from running every time Access 2003 and Access 2007 are started, when they are both installed on the same machine at the same time..?</p>
<p>Like many developers I need to run more than 1 version of MS Access. I have just installed Access 2007. If I open Access 2003... | [
{
"answer_id": 152875,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 2,
"selected": false,
"text": "<p>This is caused by Windows Installer, which is used by both installers. Advertised shortcuts as used by both Office 2... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10422/"
] | Is it possible to prevent the Windows Installer from running every time Access 2003 and Access 2007 are started, when they are both installed on the same machine at the same time..?
Like many developers I need to run more than 1 version of MS Access. I have just installed Access 2007. If I open Access 2003 and then op... | This is caused by Windows Installer, which is used by both installers. Advertised shortcuts as used by both Office 2003 and Office 2007 invoke Windows Installer to check that the entire feature is installed properly; the installer detects that something else (in this case the other product) has registered the file exte... |
152,675 | <p>There is probably is simple fix for this but I currently have code similar to </p>
<pre><code>dim dr as dbDataReader
try
dr = connection.getDataReader(sql_str)
Catch ex as sqlClientException
log.error(ex)
finally
if not IsNothing(dr) then
dr.close
end if
end try
</code></pre>
<p>However Visua... | [
{
"answer_id": 152715,
"author": "Joseph Daigle",
"author_id": 507,
"author_profile": "https://Stackoverflow.com/users/507",
"pm_score": 0,
"selected": false,
"text": "<p>Your code is correct. In the <code>finally</code> statement, as long as you check to make sure your objects are not n... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] | There is probably is simple fix for this but I currently have code similar to
```
dim dr as dbDataReader
try
dr = connection.getDataReader(sql_str)
Catch ex as sqlClientException
log.error(ex)
finally
if not IsNothing(dr) then
dr.close
end if
end try
```
However Visual Studio still warns me th... | Explicitly initialize the dr declaration to Nothing as such:
```
Dim dr As DbDataReader = Nothing
```
And the warning will disappear. |
152,693 | <p>I have an <strong>if</strong> condition which checks for value and the it throws new <strong>NumberFormatException</strong></p>
<p>Is there any other way to code this</p>
<pre><code>if (foo)
{
throw new NumberFormatException
}
// ..
catch (NumberFormatException exc)
{
// some msg...
}
</code></pre>
| [
{
"answer_id": 152709,
"author": "Burkhard",
"author_id": 12860,
"author_profile": "https://Stackoverflow.com/users/12860",
"pm_score": 2,
"selected": false,
"text": "<p>If your aim is to avoid to throw a new exception:</p>\n\n<pre><code>if(foo)\n{\n //some msg...\n} else\n{\n //do som... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11114/"
] | I have an **if** condition which checks for value and the it throws new **NumberFormatException**
Is there any other way to code this
```
if (foo)
{
throw new NumberFormatException
}
// ..
catch (NumberFormatException exc)
{
// some msg...
}
``` | If your aim is to avoid to throw a new exception:
```
if(foo)
{
//some msg...
} else
{
//do something else
}
``` |
152,699 | <p>In Python, you can do this:</p>
<pre><code>import webbrowser
webbrowser.open_new("http://example.com/")
</code></pre>
<p>It will open the passed in url in the default browser</p>
<p>Is there a ruby equivalent?</p>
| [
{
"answer_id": 152765,
"author": "Ken",
"author_id": 20621,
"author_profile": "https://Stackoverflow.com/users/20621",
"pm_score": 2,
"selected": false,
"text": "<p>Windows Only Solution:</p>\n\n<pre><code>require 'win32ole'\nshell = WIN32OLE.new('Shell.Application')\nshell.ShellExecute(... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147/"
] | In Python, you can do this:
```
import webbrowser
webbrowser.open_new("http://example.com/")
```
It will open the passed in url in the default browser
Is there a ruby equivalent? | Cross-platform solution:
------------------------
First, install the [Launchy](http://www.copiousfreetime.org/projects/launchy/) gem:
```
$ gem install launchy
```
Then, you can run this:
```
require 'launchy'
Launchy.open("http://stackoverflow.com")
``` |
152,708 | <p>I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using <em>find</em> piped with <em>xargs grep</em>:</p>
<pre><code>find . -iname '*.py' | xargs grep -e 'YOUR_PATTERN'
</code></pre>
<p>But if I need to find patterns that spans on more than one line, ... | [
{
"answer_id": 152711,
"author": "Oli",
"author_id": 22035,
"author_profile": "https://Stackoverflow.com/users/22035",
"pm_score": 8,
"selected": true,
"text": "<p>So I discovered <a href=\"http://www.pcre.org/\" rel=\"nofollow noreferrer\"><em><strong>pcregrep</strong></em></a> which st... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22035/"
] | I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using *find* piped with *xargs grep*:
```
find . -iname '*.py' | xargs grep -e 'YOUR_PATTERN'
```
But if I need to find patterns that spans on more than one line, I'm stuck because vanilla grep can't fin... | So I discovered [***pcregrep***](http://www.pcre.org/) which stands for **Perl Compatible Regular Expressions GREP**.
>
> the -M option makes it possible to search for patterns that span line boundaries.
>
>
>
For example, you need to find files where the '*\_name*' variable is followed on the next line by the '*... |
152,714 | <p>I am relatively new to matchers. I am toying around with <a href="http://code.google.com/p/hamcrest/" rel="noreferrer">hamcrest</a> in combination with JUnit and I kinda like it.</p>
<p>Is there a way, to state that one of multiple choices is correct?</p>
<p>Something like</p>
<pre><code>assertThat( result, is( e... | [
{
"answer_id": 153198,
"author": "marcospereira",
"author_id": 4600,
"author_profile": "https://Stackoverflow.com/users/4600",
"pm_score": 8,
"selected": true,
"text": "<pre><code>assertThat(result, anyOf(equalTo(1), equalTo(2), equalTo(3)))\n</code></pre>\n<p>From <a href=\"http://hamcr... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870/"
] | I am relatively new to matchers. I am toying around with [hamcrest](http://code.google.com/p/hamcrest/) in combination with JUnit and I kinda like it.
Is there a way, to state that one of multiple choices is correct?
Something like
```
assertThat( result, is( either( 1, or( 2, or( 3 ) ) ) ) ) //does not work in hamc... | ```
assertThat(result, anyOf(equalTo(1), equalTo(2), equalTo(3)))
```
From [Hamcrest tutorial](http://hamcrest.org/JavaHamcrest/tutorial#logical):
>
> `anyOf` - matches if any matchers match, short circuits (like Java ||)
>
>
>
See also [Javadoc](http://hamcrest.org/JavaHamcrest/javadoc/2.2/org/hamcrest/core/An... |
152,729 | <p>If you use Image.Save Method to save an image to a EMF/WMF, you get an exception (<a href="http://msdn.microsoft.com/en-us/library/ktx83wah.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ktx83wah.aspx</a>)</p>
<p>Is there another way to save the image to an EMF/WMF?
Are there any encoders a... | [
{
"answer_id": 152830,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 2,
"selected": false,
"text": "<p>A metafile is a file which records a sequence of GDI operations. It is scalable because the original sequence of ope... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12192/"
] | If you use Image.Save Method to save an image to a EMF/WMF, you get an exception (<http://msdn.microsoft.com/en-us/library/ktx83wah.aspx>)
Is there another way to save the image to an EMF/WMF?
Are there any encoders available? | `Image` is an abstract class: what you want to do depends on whether you are dealing with a `Metafile` or a `Bitmap`.
Creating an image with GDI+ and saving it as an EMF is simple with `Metafile`. Per Mike's [post](https://stackoverflow.com/questions/152729/gdi-c-how-to-save-an-image-as-emf/152830#152830):
```
var pa... |
152,745 | <p>I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. </p>
<p>I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as:</p>
<pre><code>vector<vector<double> > matrix(n,vector<double>(... | [
{
"answer_id": 152761,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 3,
"selected": false,
"text": "<p>My guess would be the fastest is, for a matrix, to use 1D STL array and override the () operator to use it as 2D matrix... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23732/"
] | I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead.
I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as:
```
vector<vector<double> > matrix(n,vector<double>(n));
```
and accessed through `matrix... | If you're using GCC the compiler can analyze your matrix accesses and change the order in memory in certain cases. The magic compiler flag is defined as:
```
-fipa-matrix-reorg
```
>
> Perform matrix flattening and
> transposing. Matrix flattening tries
> to replace a m-dimensional matrix with
> its equivalent n... |
152,757 | <p>I am wondering whether it is safe to mix jdk 1.5 and 1.6 (Java 6) object serialization (biderctional communication). I searched for an explicit statement from sun concerning this question but did not succeed. So, besides the technical feasability I am searching for an "official" statement concerning the problem.</p>... | [
{
"answer_id": 152789,
"author": "GavinCattell",
"author_id": 21644,
"author_profile": "https://Stackoverflow.com/users/21644",
"pm_score": 2,
"selected": false,
"text": "<p>After testing with a serialized object written to a file using the ObjectOutputStream in a Java 1.5 program, then ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am wondering whether it is safe to mix jdk 1.5 and 1.6 (Java 6) object serialization (biderctional communication). I searched for an explicit statement from sun concerning this question but did not succeed. So, besides the technical feasability I am searching for an "official" statement concerning the problem. | The serialization mechanism itself has not changed. For individual classes it will depend on the specific class. If a class has a serialVersionUID field, this is supposed to indicate serialization compatiblity.
Something like:
```
private static final long serialVersionUID = 8683452581122892189L;
```
If it is unch... |
152,770 | <p>Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)?
I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL Server?</p>
| [
{
"answer_id": 152963,
"author": "Corey Trager",
"author_id": 9328,
"author_profile": "https://Stackoverflow.com/users/9328",
"pm_score": 3,
"selected": true,
"text": "<p>The example at <a href=\"http://jdixon.dotnetdevelopersjournal.com/pivot_table_data_in_sql_server_2000_and_2005.htm\"... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4021/"
] | Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)?
I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL Server? | The example at <http://jdixon.dotnetdevelopersjournal.com/pivot_table_data_in_sql_server_2000_and_2005.htm> only works if you know in advance what the row values can be. For example, let's say you have an entity with custom attributes and the custom attributes are implemented as rows in a child table, where the child t... |
152,774 | <p>What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than this?</p>
<pre><code>private static DateTime TrimDateToMinute(DateTime date)
{
... | [
{
"answer_id": 152803,
"author": "Rikalous",
"author_id": 4271,
"author_profile": "https://Stackoverflow.com/users/4271",
"pm_score": 3,
"selected": false,
"text": "<p>You could use an enumeration</p>\n\n<pre><code>public enum DateTimePrecision\n{\n Hour, Minute, Second\n}\n\npublic sta... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21807/"
] | What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than this?
```
private static DateTime TrimDateToMinute(DateTime date)
{
return new D... | ```
static class Program
{
//using extension method:
static DateTime Trim(this DateTime date, long roundTicks)
{
return new DateTime(date.Ticks - date.Ticks % roundTicks, date.Kind);
}
//sample usage:
static void Main(string[] args)
{
Console.WriteLine(DateTime.Now);
... |
152,807 | <p><strong>UPDATE:</strong> i updated the code and problem description to reflect my changes. </p>
<p>I know now that i'm trying a Socket operation on nonsocket. or that my fd_set is not valid since:</p>
<p><code>select</code> returns -1 and
<code>WSAGetLastError()</code>returns 10038. </p>
<p>But i can't seem to ... | [
{
"answer_id": 152831,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 0,
"selected": false,
"text": "<p>The first argument to select needs to be the highest-numbered file descriptor in any of the three sets, plus 1:</p... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10010/"
] | **UPDATE:** i updated the code and problem description to reflect my changes.
I know now that i'm trying a Socket operation on nonsocket. or that my fd\_set is not valid since:
`select` returns -1 and
`WSAGetLastError()`returns 10038.
But i can't seem to figure out what it is. Platform is Windows. I have not post... | You have some data ready to be read, but you are not actually reading anything. When you poll the descriptor next time, the data will still be there. Drain the pipe before you continue to poll. |
152,822 | <p>I want something like this:</p>
<pre><code><msxsl:script language="C#">
??? getNodes() { ... return ... }
</msxsl:script>
<xsl:for-each select="user:getNodes()">
...
</xsl:for-each>
</code></pre>
<p>What return type should i use for <code>getNodes()</code> and what should i put in i... | [
{
"answer_id": 153141,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 2,
"selected": false,
"text": "<p>A quick google for C# xslt msxml revealed a link to the following page which gives many examples of extending XSLT in m... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20310/"
] | I want something like this:
```
<msxsl:script language="C#">
??? getNodes() { ... return ... }
</msxsl:script>
<xsl:for-each select="user:getNodes()">
...
</xsl:for-each>
```
What return type should i use for `getNodes()` and what should i put in it's body? | In principle you need to use the XPathNodeIterator to return node sets (as Samjudson says). I take it that the example you gave is a degenerated function, as you do not supply it with any parameters. However, I think it is instructive the see how you *could* fabricate nodes out of thin air.
```
<msxsl:script language... |
152,823 | <p>XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling <code>.htaccess</code> files is such a nightmare.</p>
<p>My problem:
I've got a PHP application that requires apache/php to search for an <code>/includes/</code> directory contained within the application. To d... | [
{
"answer_id": 152851,
"author": "Lucas Oman",
"author_id": 6726,
"author_profile": "https://Stackoverflow.com/users/6726",
"pm_score": 2,
"selected": false,
"text": "<p>You can alter the include_path on each request using ini_set(). This would avoid having to use htaccess at all.</p>\n"... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10583/"
] | XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling `.htaccess` files is such a nightmare.
My problem:
I've got a PHP application that requires apache/php to search for an `/includes/` directory contained within the application. To do this, `.htaccess` files must ... | 1. Why do you need to rename .htaccess to htaccess.txt
2. Try setting the include\_path using [set\_include\_path()](http://php.net/set_include_path()) and see if that helps (as an intermediate fix)
3. Verify which php.ini to use through a [phpinfo()](http://php.net/phpinfo) |
152,837 | <p>How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database.</p>
<p>I'm not sure if it makes a difference, but I'm using Oracle 9i.</p>
| [
{
"answer_id": 152849,
"author": "stjohnroe",
"author_id": 2985,
"author_profile": "https://Stackoverflow.com/users/2985",
"pm_score": 0,
"selected": false,
"text": "<p>If you are using sql plus then I think that you need to issue the command </p>\n\n<pre><code>SET SCAN OFF\n</code></pre... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466/"
] | How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database.
I'm not sure if it makes a difference, but I'm using Oracle 9i. | I keep on forgetting this and coming back to it again! I think the best answer is a combination of the responses provided so far.
Firstly, & is the variable prefix in sqlplus/sqldeveloper, hence the problem - when it appears, it is expected to be part of a variable name.
SET DEFINE OFF will stop sqlplus interpreting ... |
152,866 | <p>For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the main config file using the 'configSource' attribute. For example:</p>
<pre><code><appSettings configSource="appSettings.config"/>
</cod... | [
{
"answer_id": 152873,
"author": "Jesse Taber",
"author_id": 1680,
"author_profile": "https://Stackoverflow.com/users/1680",
"pm_score": 5,
"selected": true,
"text": "<p>Found it:</p>\n\n<p>If you edit the test run configuration (by double clicking the .testrunconfig file that gets put i... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1680/"
] | For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the main config file using the 'configSource' attribute. For example:
```
<appSettings configSource="appSettings.config"/>
```
and then placing al... | Found it:
If you edit the test run configuration (by double clicking the .testrunconfig file that gets put into the 'Solution Items' solution folder when you add a new unit test), you get a test run configuration dialog. There's a section there called 'Deployment' where you can specifiy files or whole folders from any... |
152,869 | <p>It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could become expensive for larger datagrids. I'd be interested in the simp... | [
{
"answer_id": 152877,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "<p>If you just want to find items that have <strong>toggledClass</strong> and turn that off using jQuery:</p>\n\n<pr... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/785/"
] | It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could become expensive for larger datagrids. I'd be interested in the simplest so... | This method stores the active row into a variable. The $ at the start of the variable is just my own hungarian notation for jQuery objects.
```
var $activeRow;
$('#myGrid tr').click(function() {
if ($activeRow) $activeRow.removeClass('active');
$activeRow = $(this).addClass('active');
});
``` |
152,893 | <p>We have a form that allows a user to dynamically add inputs for fields. For example if you have a form for tracking projects, you want to dynamically add tasks to that project. Just to clarify my language: you dynamically add inputs for the task field. The problem is, we have 50 of those fields. Our current solution... | [
{
"answer_id": 152904,
"author": "zackola",
"author_id": 321427,
"author_profile": "https://Stackoverflow.com/users/321427",
"pm_score": 0,
"selected": false,
"text": "<p>Little + icon somewhere near the last task field with a link that says \"Add new task\". When clicked, new task field... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1681/"
] | We have a form that allows a user to dynamically add inputs for fields. For example if you have a form for tracking projects, you want to dynamically add tasks to that project. Just to clarify my language: you dynamically add inputs for the task field. The problem is, we have 50 of those fields. Our current solution pr... | Thinking on from what @zachary suggested:
Display the form as it was designed to the user with the default/ last saved number of fields. At the bottom of the form place a DropDownButton that has a + icon and the words Add Field (**+ Add Field**).
Dropping down this button will show the list of all fields that are av... |
152,900 | <p>When loading XML into an XmlDocument, i.e.</p>
<pre>
XmlDocument document = new XmlDocument();
document.LoadXml(xmlData);
</pre>
<p>is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converted into the TM... | [
{
"answer_id": 152923,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>I confess things get a little confusing with XML documents and encodings, but I'd hope that it would get set appropri... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21299/"
] | When loading XML into an XmlDocument, i.e.
```
XmlDocument document = new XmlDocument();
document.LoadXml(xmlData);
```
is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converted into the TM character. A... | This is a standard misunderstanding of the XML toolset. The whole business with "&#x", is a syntactic feature designed to cope with character encodings. Your XmlDocument isn't a stream of characters - it has been freed of character encoding issues - instead it contains an abstract model of XML type data. Words for this... |
152,968 | <p>Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M?</p>
<p>Right now I can do this by making several comparisons, but I'm not happy with my method:</p>
<pre><code>if($bytes > 1000000000){
$bytes = ... | [
{
"answer_id": 152978,
"author": "WalkingRandomly",
"author_id": 1856916,
"author_profile": "https://Stackoverflow.com/users/1856916",
"pm_score": 5,
"selected": true,
"text": "<p>The <a href=\"http://search.cpan.org/dist/Number-Bytes-Human\" rel=\"noreferrer\">Number::Bytes::Human</a> m... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23780/"
] | Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M?
Right now I can do this by making several comparisons, but I'm not happy with my method:
```
if($bytes > 1000000000){
$bytes = ( sprintf( "%0.2f", $byt... | The [Number::Bytes::Human](http://search.cpan.org/dist/Number-Bytes-Human) module should be able to help you out.
An example of how to use it can be found in its synopsis:
```
use Number::Bytes::Human qw(format_bytes);
$size = format_bytes(0); # '0'
$size = format_bytes(2*1024); # '2.0K'
$size = format_byte... |
152,975 | <p>I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area.</p>
<p>Is something like this possible with jQuery?</p>
<pre><code>$("#menuscontainer").clickOutsideThisElement(function() {
// Hide t... | [
{
"answer_id": 152992,
"author": "Chris MacDonald",
"author_id": 18146,
"author_profile": "https://Stackoverflow.com/users/18146",
"pm_score": 5,
"selected": false,
"text": "<p>Check the window click event target (it should propagate to the window, as long as it's not captured anywhere e... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] | I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area.
Is something like this possible with jQuery?
```
$("#menuscontainer").clickOutsideThisElement(function() {
// Hide the menus
});
``` | >
> Note: Using `stopPropagation` is something that should be avoided as it breaks normal event flow in the DOM. See [this CSS Tricks article](https://css-tricks.com/dangers-stopping-event-propagation/) for more information. Consider using [this method](https://stackoverflow.com/a/3028037/561309) instead.
>
>
>
At... |
152,985 | <p>And how do you keep them in synch between test and production environments?</p>
<p>When it comes to indexes on database tables, my philosophy is that they are an integral part of writing any code that queries the database. You can't introduce new queries or change a query without analyzing the impact to the indexe... | [
{
"answer_id": 152999,
"author": "Matt Rogish",
"author_id": 2590,
"author_profile": "https://Stackoverflow.com/users/2590",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, <em>any</em> DML or DDL changes are scripted and checked in to source control, mostly thru activerecord migrati... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] | And how do you keep them in synch between test and production environments?
When it comes to indexes on database tables, my philosophy is that they are an integral part of writing any code that queries the database. You can't introduce new queries or change a query without analyzing the impact to the indexes.
So I do... | Indexes are a part of the database schema and hence should be source controlled along with everything else. Nobody should go around creating indexes on production without going through the normal QA and release process- particularly performance testing.
There have been numerous other threads on schema versioning. |
153,021 | <p>I need to generate an XML file in C#.</p>
<p>I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page. </p>
<p>So I want a code file that looks like:</p>
<pre><code><lots of angle brackets...>
<% foreach(data in myData)
{ %&... | [
{
"answer_id": 153172,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": -1,
"selected": false,
"text": "<p>Create a PageView in a standard ASPX file, but don't include a master or anything else. Just start putting in the angl... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] | I need to generate an XML file in C#.
I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page.
So I want a code file that looks like:
```
<lots of angle brackets...>
<% foreach(data in myData)
{ %>
< <%= data.somefield %>
<% }... | First off, its MUCH easier to generate XML using XElements. There are many examples floating around. Just search for "Linq to XML."
Alternatively, if you absolutely need to do templating, I'd suggest using a template engine such as [NVelocity](http://sourceforge.net/projects/nvelocity/) rather than trying to kludge AS... |
153,023 | <p>I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb.</p>
<p>Yes, I know Access sucks. It's a huge legacy app, and everything else works OK.</p>
<p>The table has an autonumber column. I insert the rows, but the autonumber column is set to zero.</p>
<p>I Googled the question and re... | [
{
"answer_id": 153041,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>When doing the insert, you need to be sure that you are NOT specifying a value for the AutoNumber column. Just... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6783/"
] | I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb.
Yes, I know Access sucks. It's a huge legacy app, and everything else works OK.
The table has an autonumber column. I insert the rows, but the autonumber column is set to zero.
I Googled the question and read all the articles I coul... | In Access it is possible to INSERT an explicit value into an IDENTITY (a.k.a. Automnumber) column. If you (or your middleware) is writing the value zero to the IDENTITY column and there is no unique constraint on the IDENTITY column then that might explain it.
Just to be clear you should be using the syntax
```
INS... |
153,035 | <p>I've got two tables:</p>
<pre><code>Employees:
uid (number) | first_name (string) | last_name (string) | ...
Projects:
uid | project_title (string) | point_of_contact_id (FK: Employees.uid) | ...
</code></pre>
<p>I'd like to create a form for Projects with a "Point of Contact" combo box (dropdown) field. The dis... | [
{
"answer_id": 153080,
"author": "xsl",
"author_id": 11387,
"author_profile": "https://Stackoverflow.com/users/11387",
"pm_score": 4,
"selected": true,
"text": "<p>According to <a href=\"http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124842\" rel=\"noreferre... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] | I've got two tables:
```
Employees:
uid (number) | first_name (string) | last_name (string) | ...
Projects:
uid | project_title (string) | point_of_contact_id (FK: Employees.uid) | ...
```
I'd like to create a form for Projects with a "Point of Contact" combo box (dropdown) field. The display values should be "firs... | According to [the bug report](http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124842) this is a known issue, still not fixed and there is no workaround. |
153,046 | <p>Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows, but if there's a broader, more p... | [
{
"answer_id": 153050,
"author": "Brian Ensink",
"author_id": 1254,
"author_profile": "https://Stackoverflow.com/users/1254",
"pm_score": 2,
"selected": false,
"text": "<p>I believe you want to use the ShellExecute() function which should respect the users choice of default browser.</p>\... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17693/"
] | Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows, but if there's a broader, more port... | ```
#include <windows.h>
void main()
{
ShellExecute(NULL, "open", "http://yourwebpage.com",
NULL, NULL, SW_SHOWNORMAL);
}
``` |
153,048 | <p>I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them.</p>
<p>The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface. </p>
<p>What's the best way around this? Should I jus... | [
{
"answer_id": 153056,
"author": "Grundlefleck",
"author_id": 4120,
"author_profile": "https://Stackoverflow.com/users/4120",
"pm_score": 6,
"selected": true,
"text": "<p>I would use a method object pattern. Have a static instance of this, and call it in the static method. It should be p... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4219/"
] | I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them.
The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface.
What's the best way around this? Should I just use instance meth... | I would use a method object pattern. Have a static instance of this, and call it in the static method. It should be possible to subclass for testing, depending on your mocking framework.
i.e. in your class with the static method have:
```cs
private static final MethodObject methodObject = new MethodObject();
public ... |
153,053 | <h2>The problem:</h2>
<p>We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program.</p>
<p... | [
{
"answer_id": 167409,
"author": "Eduardo Molteni",
"author_id": 2385,
"author_profile": "https://Stackoverflow.com/users/2385",
"pm_score": -1,
"selected": false,
"text": "<p>It is not possible without the help of the developers. Sorry.</p>\n"
},
{
"answer_id": 168993,
"auth... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21038/"
] | The problem:
------------
We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program.
Now t... | To get your grubby hands on exactly what Access is doing query-wise behind the scenes there's an undocumented feature called JETSHOWPLAN - when switched on in the registry it creates a `showplan.out` text file. The details are in
[this TechRepublic article](https://www.techrepublic.com/article/use-microsoft-jets-showp... |
153,054 | <p>I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there another way to do it?</p>
| [
{
"answer_id": 317442,
"author": "JamesEggers",
"author_id": 28540,
"author_profile": "https://Stackoverflow.com/users/28540",
"pm_score": 4,
"selected": true,
"text": "<p>By default, Elmah uses the AppPool's application GUID as the default application name. It uses this as the key to i... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App\_Debug' in the Application field in the Elmah\_Error table. Does anyone have any experience with this? Or is there another way to do it? | By default, Elmah uses the AppPool's application GUID as the default application name. It uses this as the key to identify the errors in the Elmah\_Error table when you look at the web interface that's created through it's HTTP Module.
I was tasked to explore this option for my company earlier this year. I couldn't f... |
153,062 | <p>How do I escape '<' and '>' character in sed.</p>
<p>I have some xml files which needs some text between the tags to be replaced. How do I escape the '>' and '<' characters.</p>
<p>The problem with > and < is it has special meaning in the shell to redirect the output to a file. So backslash doesn't work.<... | [
{
"answer_id": 153068,
"author": "Milan Babuškov",
"author_id": 14690,
"author_profile": "https://Stackoverflow.com/users/14690",
"pm_score": 0,
"selected": false,
"text": "<p>Escape them with backslash</p>\n"
},
{
"answer_id": 153070,
"author": "Douglas Mayle",
"author_i... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448/"
] | How do I escape '<' and '>' character in sed.
I have some xml files which needs some text between the tags to be replaced. How do I escape the '>' and '<' characters.
The problem with > and < is it has special meaning in the shell to redirect the output to a file. So backslash doesn't work. | Ok. Found out by myself. Use quotes.
```
$ sed -i "s/>foo</>bar</g" file
``` |
153,065 | <p>I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itself. A short example:</p>
<pre><code>void function(MESSAGE_ID id, void* param)
{
if(id == FOO) {
int real_... | [
{
"answer_id": 153077,
"author": "Milan Babuškov",
"author_id": 14690,
"author_profile": "https://Stackoverflow.com/users/14690",
"pm_score": 7,
"selected": true,
"text": "<p>Use <code>intptr_t</code> and <code>uintptr_t</code>.</p>\n\n<p>To ensure it is defined in a portable way, you ca... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7136/"
] | I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void\* argument that is converted into suitable type in the function itself. A short example:
```
void function(MESSAGE_ID id, void* param)
{
if(id == FOO) {
int real_param = (int)... | Use `intptr_t` and `uintptr_t`.
To ensure it is defined in a portable way, you can use code like this:
```
#if defined(__BORLANDC__)
typedef unsigned char uint8_t;
typedef __int64 int64_t;
typedef unsigned long uintptr_t;
#elif defined(_MSC_VER)
typedef unsigned char uint8_t;
typedef __int64 int64... |
153,087 | <p>I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers?</p>
<p>After a quick google, I found only <a href="http://web.archive.org/web/20061116233324/http://www.softinsight.com/bnoyes/Perma... | [
{
"answer_id": 153146,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 7,
"selected": true,
"text": "<p>No need to P/Invoke. <a href=\"http://msdn.microsoft.com/en-us/library/system.io.file.getaccesscontrol.aspx\" rel=\"... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363/"
] | I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers?
After a quick google, I found only [the WMI solution](http://web.archive.org/web/20061116233324/http://www.softinsight.com/bnoyes/Perma... | No need to P/Invoke. [System.IO.File.GetAccessControl](http://msdn.microsoft.com/en-us/library/system.io.file.getaccesscontrol.aspx) will return a [FileSecurity](http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesecurity_members.aspx) object, which has a [GetOwner](http://msdn.microsoft.com/en-u... |
153,123 | <p>I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same width, but the width may vary in real life), i would like, instead o... | [
{
"answer_id": 153357,
"author": "Jasper",
"author_id": 18702,
"author_profile": "https://Stackoverflow.com/users/18702",
"pm_score": 1,
"selected": false,
"text": "<p>Something like this?</p>\n\n<ul>\n<li>Sort your collection of rectangles by x-position </li>\n<li><p>write a method that... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8776/"
] | I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same width, but the width may vary in real life), i would like, instead of. ... | Your problem is a simpler variant, but you might get some tips reading about heuristics developed for the "binpacking" problem. There has been a lot written about this, but [this page](http://en.wikipedia.org/wiki/Bin_packing_problem) is a good start. |
153,151 | <p>I recently upgraded my oracle client to 10g (10.2.0.1.0).</p>
<p>Now when I try to connect to a legacy 8.0 database, I get</p>
<pre><code>ORA-03134: Connections to this server version are no longer supported.
</code></pre>
<p>Is there any workaround for this problem, or do I have to install two clients on my loca... | [
{
"answer_id": 153170,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 1,
"selected": false,
"text": "<p>I had to connect a C# code to an Oracle 7 (I know you it's 8...)... the only way I get it was to get the CD ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] | I recently upgraded my oracle client to 10g (10.2.0.1.0).
Now when I try to connect to a legacy 8.0 database, I get
```
ORA-03134: Connections to this server version are no longer supported.
```
Is there any workaround for this problem, or do I have to install two clients on my local machine? | **Yes**, you can connect to an Oracle 8i database with the 10g client, but the 8i Database requires the 8.1.7.3 patchset, which you can get from [Oracle's Metalink support site](http://metalink.oracle.com/) (requires login).
Here's an [Oracle forum post](http://forums.oracle.com/forums/thread.jspa?threadID=241380) wit... |
153,152 | <p>I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. </p>
<p>How do I resize the iframes to fit the height of the iframes' content?</p>
<p>I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitle... | [
{
"answer_id": 153187,
"author": "roryf",
"author_id": 270,
"author_profile": "https://Stackoverflow.com/users/270",
"pm_score": -1,
"selected": false,
"text": "<p>This is slightly tricky as you have to know when the iframe page has loaded, which is difficuly when you're not in control o... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3842/"
] | I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes.
How do I resize the iframes to fit the height of the iframes' content?
I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitless so far.
**Upd... | We had this type of problem, but slightly in reverse to your situation - we were providing the iframed content to sites on other domains, so the [same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy) was also an issue. After many hours spent trawling google, we eventually found a (somewhat..) workable so... |
153,156 | <p>How to count distinct values in a node in XSLT?</p>
<p>Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3.</p>
<pre><code><Artists_by_Countries>
<Artist_by_Country>
<Location_ID>62</Location_ID>
<Artist_ID>212<... | [
{
"answer_id": 153204,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 3,
"selected": false,
"text": "<p>Try something like this:</p>\n\n<pre><code>count(//Country[not(following::Country/text() = text())])\n</code></pr... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100/"
] | How to count distinct values in a node in XSLT?
Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3.
```
<Artists_by_Countries>
<Artist_by_Country>
<Location_ID>62</Location_ID>
<Artist_ID>212</Artist_ID>
<Country>Argentina</Country>
... | If you have a large document, you probably want to use the "Muenchian Method", which is usually used for grouping, to identify the distinct nodes. Declare a key that indexes the things you want to count by the values that are distinct:
```
<xsl:key name="artists-by-country" match="Artist_by_Country" use="Country" />
... |
153,166 | <p>I'm trying to find out whether there is a way to reliably determine when a managed thread is about to terminate. I'm using a third-party library that includes support for PDF documents and the problem is that in order to use the PDF functionality, I have to explicitly initialize the PDF component, do the work, then... | [
{
"answer_id": 153176,
"author": "Eric",
"author_id": 6367,
"author_profile": "https://Stackoverflow.com/users/6367",
"pm_score": 1,
"selected": false,
"text": "<p>I think you can use an [Auto|Manual]ResetEvent which you will set when the thread terminates</p>\n"
},
{
"answer_id"... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22239/"
] | I'm trying to find out whether there is a way to reliably determine when a managed thread is about to terminate. I'm using a third-party library that includes support for PDF documents and the problem is that in order to use the PDF functionality, I have to explicitly initialize the PDF component, do the work, then exp... | You don't want to wrap `System.Thread` per se - just compose it with your `PDFWidget` class that is doing the work:
```
class PDFWidget
{
private Thread pdfWorker;
public void DoPDFStuff()
{
pdfWorker = new Thread(new ThreadStart(ProcessPDF));
pdfWorker.Start();
}
private void Proc... |
153,183 | <p>I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller:</p>
<pre><code>class Admin::BlogsController < ApplicationController
def index
@blogs = Blog.find(:all)
end
def show
@blog = Blog.find(params[:id])
en... | [
{
"answer_id": 153228,
"author": "TonyLa",
"author_id": 1295,
"author_profile": "https://Stackoverflow.com/users/1295",
"pm_score": 2,
"selected": false,
"text": "<p>I'm assuming you are using rails 2.0.x so the way you generate a route is\n__path</p>\n\n<pre><code>admin_blog_path(blog) ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] | I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller:
```
class Admin::BlogsController < ApplicationController
def index
@blogs = Blog.find(:all)
end
def show
@blog = Blog.find(params[:id])
end
...
end
```... | Your Delete link should end in \_path:
```
<%= link_to 'Delete', admin_blog_path(blog), :method => :delete %>
``` |
153,227 | <p>When I call</p>
<pre><code>help(Mod.Cls.f)
</code></pre>
<p>(Mod is a C extension module), I get the output</p>
<pre>Help on method_descriptor:
f(...)
doc_string</pre>
<p>What do I need to do so that the help output is of the form</p>
<pre>Help on method f in module Mod:
f(x, y, z)
doc_string</pre>
<... | [
{
"answer_id": 153284,
"author": "Thomas Wouters",
"author_id": 17624,
"author_profile": "https://Stackoverflow.com/users/17624",
"pm_score": 3,
"selected": true,
"text": "<p>You cannot. The inspect module, which is what 'pydoc' and 'help()' use, has no way of figuring out what the exact... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11828/"
] | When I call
```
help(Mod.Cls.f)
```
(Mod is a C extension module), I get the output
```
Help on method_descriptor:
f(...)
doc_string
```
What do I need to do so that the help output is of the form
```
Help on method f in module Mod:
f(x, y, z)
doc_string
```
like it is for random.Random.shuffle, for ex... | You cannot. The inspect module, which is what 'pydoc' and 'help()' use, has no way of figuring out what the exact signature of a C function is. The best you can do is what the builtin functions do: include the signature in the first line of the docstring:
```
>>> help(range)
Help on built-in function range in module _... |
153,257 | <p>I noticed that writing to a file, closing it and moving it to destination place randomly fails on Vista. Specifically, MoveFileEx() would return <code>ERROR_ACCESS_DENIED</code> for no apparent reason. This happens on Vista SP1 at least (32 bit). Does not happen on XP SP3.</p>
<p>Found <a href="http://groups.google... | [
{
"answer_id": 153493,
"author": "Martin Plante",
"author_id": 4898,
"author_profile": "https://Stackoverflow.com/users/4898",
"pm_score": 1,
"selected": false,
"text": "<p>I'd say it's either your anti-virus or Windows Indexing messing with the file at the same moment. Can you run the s... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6799/"
] | I noticed that writing to a file, closing it and moving it to destination place randomly fails on Vista. Specifically, MoveFileEx() would return `ERROR_ACCESS_DENIED` for no apparent reason. This happens on Vista SP1 at least (32 bit). Does not happen on XP SP3.
Found [this thread](http://groups.google.com/group/micro... | I suggest you use [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) *(edit: the artist formerly known as FileMon)* to watch and see which application exactly is getting in the way. It can show you the entire trace of file system calls made on your machine.
*(edit: thanks to @moocha for t... |
153,266 | <p>In C and C++ you can tell the compiler that a number is a 'long' by putting an 'l' at the end of the number.
e.g long x = 0l;</p>
<p>How can I tell the C# compiler that a number is a byte?</p>
| [
{
"answer_id": 153271,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 3,
"selected": false,
"text": "<pre><code>byte b = (byte) 123; \n</code></pre>\n\n<p>even though</p>\n\n<pre><code>byte b = 123;\n</code></pre>\n\n<p>does ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9516/"
] | In C and C++ you can tell the compiler that a number is a 'long' by putting an 'l' at the end of the number.
e.g long x = 0l;
How can I tell the C# compiler that a number is a byte? | According to the [C# language specification](http://msdn.microsoft.com/en-us/library/aa664674(VS.71).aspx) there is no way to specify a byte literal. You'll have to cast down to byte in order to get a byte. Your best bet is probably to specify in hex and cast down, like this:
```
byte b = (byte) 0x10;
``` |
153,287 | <p>I have implemented a simple file upload-download mechanism. When a user clicks a file name, the file is downloaded with these HTTP headers:</p>
<pre><code>HTTP/1.1 200 OK
Date: Tue, 30 Sep 2008 14:00:39 GMT
Server: Microsoft-IIS/6.0
Content-Disposition: attachment; filename=filename.doc;
Content-Type: application/o... | [
{
"answer_id": 153400,
"author": "Ovesh",
"author_id": 3751,
"author_profile": "https://Stackoverflow.com/users/3751",
"pm_score": 4,
"selected": true,
"text": "<p>gmail handles file name escaping somewhat differently: the file name is quoted (double-quotes), and single-byte periods are ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3751/"
] | I have implemented a simple file upload-download mechanism. When a user clicks a file name, the file is downloaded with these HTTP headers:
```
HTTP/1.1 200 OK
Date: Tue, 30 Sep 2008 14:00:39 GMT
Server: Microsoft-IIS/6.0
Content-Disposition: attachment; filename=filename.doc;
Content-Type: application/octet-stream
Co... | gmail handles file name escaping somewhat differently: the file name is quoted (double-quotes), and single-byte periods are not URL-escaped.
This way, the long file name in the question is OK.
```
Content-Disposition: attachment; filename="%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%8... |
153,298 | <p>Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical users in the office to do many of the tasks currently handed to me.</p>
<p>There are a range of HTML editors out there but ... | [
{
"answer_id": 153349,
"author": "nikhil",
"author_id": 7926,
"author_profile": "https://Stackoverflow.com/users/7926",
"pm_score": 1,
"selected": false,
"text": "<p>Have you tried <a href=\"http://www.fckeditor.net/\" rel=\"nofollow noreferrer\">FCKEditor</a>. It is very popular and use... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical users in the office to do many of the tasks currently handed to me.
There are a range of HTML editors out there but none of th... | You can't give your non-technial users such a complex HTML template and hope they will not break it. There is no HTML editor that can enforce such rules for structures that are more complex than a class attribute on an element.
This scenario calls for the use of XML: you need to separate your content and presentation.... |
153,329 | <p>We have a service that handles authorization based on a User Name and Password. Instead of making the username and password part of the call, we place it in the SOAP header. </p>
<p>In a typical scenario, a Web Service calls the Authorization service at the start of execution to check that the caller is allowed to... | [
{
"answer_id": 153378,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>Personally I don't see you having any issues there as long as you have a centralized underlying framework to su... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9825/"
] | We have a service that handles authorization based on a User Name and Password. Instead of making the username and password part of the call, we place it in the SOAP header.
In a typical scenario, a Web Service calls the Authorization service at the start of execution to check that the caller is allowed to call it. T... | Ok, replacing my older answers with hopefully a better one.
What you describe should work if you have a way to securely share data between your services. For example, if your services share a secret key with the Authorization Service, you can use this key to get the salt.
BTW, I don't know enough cryptography to say ... |
153,344 | <p>I have a class Animal and an interface it inherits from IAnimal.</p>
<pre><code>@MappedSuperclass
public class Animal implements Serializable, IAnimal{...}.
@Entity
public class Jaguar extends Animal{...}
</code></pre>
<p>My first question is, do I need to annotate the interface?</p>
<p>I asked this because I am... | [
{
"answer_id": 153336,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": false,
"text": "<p>Here are a bunch of good textbooks:</p>\n\n<p>Modern Compiler Implementation in Java (Tiger book) \nA.W. Appel \n... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22763/"
] | I have a class Animal and an interface it inherits from IAnimal.
```
@MappedSuperclass
public class Animal implements Serializable, IAnimal{...}.
@Entity
public class Jaguar extends Animal{...}
```
My first question is, do I need to annotate the interface?
I asked this because I am getting this error when I run my... | Here are a bunch of good textbooks:
Modern Compiler Implementation in Java (Tiger book)
A.W. Appel
Cambridge University Press, 1998
ISBN 0-52158-388-8
A textbook tutorial on compiler implementation, including techniques for many language features
Compilers: Principles, Techniques and Tools (Dragon book)
Aho, Lam... |
153,354 | <p>I have the following code that I wrote but it the SQLBindCol does not seem to work correctly (of course I could have screwed up the whole program too!.) The connection works, it creates the table in the DB, addes the record fine and they all look good in SQL Enterprise Manager. So what I need help with is after th... | [
{
"answer_id": 153386,
"author": "antik",
"author_id": 1625,
"author_profile": "https://Stackoverflow.com/users/1625",
"pm_score": 2,
"selected": false,
"text": "<p>You can get enough diagnostic out of SQL that you may be able to isolate and resolve the issue.</p>\n\n<p>You can get the s... | 2008/09/30 | [
"https://Stackoverflow.com/questions/153354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following code that I wrote but it the SQLBindCol does not seem to work correctly (of course I could have screwed up the whole program too!.) The connection works, it creates the table in the DB, addes the record fine and they all look good in SQL Enterprise Manager. So what I need help with is after the com... | You can get enough diagnostic out of SQL that you may be able to isolate and resolve the issue.
You can get the statement handle to tell you what has gone wrong with it by calling when SQLExecDirect returns something other than `SQL_SUCCESS` or `SQL_SUCCESS_WITH_INFO`
`SQLGetDiagRec( SQL_HANDLE_STMT, StatementHandle,... |