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 |
|---|---|---|---|---|---|---|
545,320 | <p>Say you had a long array of chars that are either 1 or 0, kind of like a bitvector, but on a database column. How would you query to know what values are set/no set? Say you need to know if the char 500 and char 1500 are "true" or not.</p>
| [
{
"answer_id": 545344,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>In MySQL, something using <a href=\"http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_substring\" ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] | Say you had a long array of chars that are either 1 or 0, kind of like a bitvector, but on a database column. How would you query to know what values are set/no set? Say you need to know if the char 500 and char 1500 are "true" or not. | ```
SELECT
Id
FROM
BitVectorTable
WHERE
SUBSTRING(BitVector, 500, 1) = '1'
AND SUBSTRING(BitVector, 1000, 1) = '1'
```
No index can be used for this kind of query, though. When you have many rows, this will get slow very quickly.
Edit: On SQL Server at least, all built-in string functions are [deterministic]... |
545,322 | <p>I need to do a Full Text Search with NO word stemming...I tried to wrap the term I'm searching in double quotes, but no joy... I still get results like "bologna" when I search for '"bolognalo"'</p>
<p>Any help is appreciated..</p>
| [
{
"answer_id": 545332,
"author": "Arjan Einbu",
"author_id": 19594,
"author_profile": "https://Stackoverflow.com/users/19594",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe setting the language of the fulltextindex to neutral will do the trick...</p>\n\n<p>(Though, then you'd never... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to do a Full Text Search with NO word stemming...I tried to wrap the term I'm searching in double quotes, but no joy... I still get results like "bologna" when I search for '"bolognalo"'
Any help is appreciated.. | Switch from using [`FREETEXT`](http://msdn.microsoft.com/en-us/library/ms176078.aspx) to [`CONTAINS`](http://msdn.microsoft.com/en-us/library/ms187787.aspx).
I assume that you're currently using `FREETEXT` because stemming is automatically applied to `FREETEXT` queries, whereas `CONTAINS` doesn't use stemming by defau... |
545,333 | <p>(This relates to Microsoft's SitkaSoapService, in the service reference at <a href="https://database.windows.net/soap/v1/" rel="nofollow noreferrer">https://database.windows.net/soap/v1/</a>)</p>
<p>I'm using SitkaSoapServiceClient to access my SQL Data Services database by SOAP.</p>
<p>Should I use a "using" stat... | [
{
"answer_id": 547311,
"author": "Brian Carlton",
"author_id": 20147,
"author_profile": "https://Stackoverflow.com/users/20147",
"pm_score": 3,
"selected": true,
"text": "<p>Since you are moving along a track, I have to assume the sampling frequency isn't more than 10 kHz. You can offlo... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15825/"
] | (This relates to Microsoft's SitkaSoapService, in the service reference at <https://database.windows.net/soap/v1/>)
I'm using SitkaSoapServiceClient to access my SQL Data Services database by SOAP.
Should I use a "using" statement every time I use this proxy class? Or does it do its own connection handling in a safe ... | Since you are moving along a track, I have to assume the sampling frequency isn't more than 10 kHz. You can offload the data to PC at that rate easily, even 12 Mb USB (full-speed).
For serious processing of math data, Matlab is the way to go. But since I haven't heard of F#, I can't comment.
4 x 400 doubles is no pro... |
545,364 | <p>Is there a TSQL command to connect to another server?</p>
<p>Or when you are in a Query Window, what are the Keyboard shortcuts to connect to another server and have a Query Window show up?</p>
<p>I have seen Ctrl+N pop up the <strong>Connect to Server</strong> dialog in some screens but when I am in a Query Windo... | [
{
"answer_id": 545375,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>You have the choice of creating a <a href=\"http://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx\" rel=\"n... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4964/"
] | Is there a TSQL command to connect to another server?
Or when you are in a Query Window, what are the Keyboard shortcuts to connect to another server and have a Query Window show up?
I have seen Ctrl+N pop up the **Connect to Server** dialog in some screens but when I am in a Query Window already and hit Ctrl+N it ju... | You can use [OpenDataSource](http://msdn.microsoft.com/en-us/library/ms179856.aspx) with a linked server
```
OpenDataSource(provider_name, init_string)
```
For example
```
SELECT
FirstName,
Gender
FROM
OpenDataSource (
'SQLOLEDB',
'DataSource = NOLI\SQL2;UserID=myUserID;Password=myPassword'
).Organisation.dbo.Emplo... |
545,387 | <p>Surely there must be a way to do this easily! </p>
<p>I've tried the Linux command-line apps such as <code>sha1sum</code> and <code>md5sum</code> but they seem only to be able to compute hashes of individual files and output a list of hash values, one for each file. </p>
<p>I need to generate a single hash for the... | [
{
"answer_id": 545398,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>If you just want to hash the contents of the files, ignoring the filenames then you can use</p>\n\n<pre><code>cat $FILES | ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22185/"
] | Surely there must be a way to do this easily!
I've tried the Linux command-line apps such as `sha1sum` and `md5sum` but they seem only to be able to compute hashes of individual files and output a list of hash values, one for each file.
I need to generate a single hash for the entire contents of a folder (not just ... | One possible way would be:
```
sha1sum path/to/folder/* | sha1sum
```
If there is a whole directory tree, you're probably better off using find and xargs. One possible command would be
```
find path/to/folder -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum
```
And, finally, if you also need to take accoun... |
545,391 | <p>I recently started a new project and I'm trying to keep my instance variables always initialized to some value, so none of them is at any time null. Small example below:</p>
<pre><code>public class ItemManager {
ItemMaster itemMaster;
List<ItemComponentManager> components;
ItemManager() {
itemMast... | [
{
"answer_id": 545402,
"author": "Paul Whelan",
"author_id": 3050,
"author_profile": "https://Stackoverflow.com/users/3050",
"pm_score": 0,
"selected": false,
"text": "<p>What happens if in one of your methods you set</p>\n\n<pre><code>itemMaster = null; \n</code></pre>\n\n<p>or you retu... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44522/"
] | I recently started a new project and I'm trying to keep my instance variables always initialized to some value, so none of them is at any time null. Small example below:
```
public class ItemManager {
ItemMaster itemMaster;
List<ItemComponentManager> components;
ItemManager() {
itemMaster = new ItemMaster(... | I usually treat an empty collection and a null collection as two separate things:
An empty collection implies that I know there are zero items available. A null collection will tell me that I don't know the state of the collection, which is a different thing.
So I really do not think it's an either/or. And I would de... |
545,394 | <p>Is there any way that you can combine predicates? </p>
<p>Lets say I have something like this:</p>
<pre><code>class MatchBeginning : public binary_function<CStdString, CStdString, bool>
{ public:
bool operator()(const CStdString &inputOne, const CStdString &inputTwo) const
{ return ... | [
{
"answer_id": 545464,
"author": "gimpf",
"author_id": 15529,
"author_profile": "https://Stackoverflow.com/users/15529",
"pm_score": 4,
"selected": true,
"text": "<p>I can recommend boost.lambda for combining function-objects for such tasks. Although it is a bit heavyweight for such a s... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52844/"
] | Is there any way that you can combine predicates?
Lets say I have something like this:
```
class MatchBeginning : public binary_function<CStdString, CStdString, bool>
{ public:
bool operator()(const CStdString &inputOne, const CStdString &inputTwo) const
{ return inputOne.substr(0, inputTwo.length(... | I can recommend boost.lambda for combining function-objects for such tasks. Although it is a bit heavyweight for such a simple problem. (**edit**) See the community wiki answer started by xhantt for a good example using STL.
(old, deprecated, answer) You can write your own utility for this, similar:
```
// here we de... |
545,408 | <p>I'm writing a small webpage that will enable students to answer questions and get feedback on their answers.</p>
<p>Part of this detection checks for common errors to give them guidance. Specifically I want to check if their answer is a power of ten out from the actual answer.</p>
<p>If the answer was 3.93E-6, thi... | [
{
"answer_id": 545423,
"author": "Tyler",
"author_id": 65977,
"author_profile": "https://Stackoverflow.com/users/65977",
"pm_score": 1,
"selected": false,
"text": "<p>If they're required to enter the answer with the \"E\" notation, why not just check if all the stuff before the \"E\" is ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16511/"
] | I'm writing a small webpage that will enable students to answer questions and get feedback on their answers.
Part of this detection checks for common errors to give them guidance. Specifically I want to check if their answer is a power of ten out from the actual answer.
If the answer was 3.93E-6, this condition shoul... | ```
var num = 12.4123;
var numString = num.toExponential()
// numString = "1.24123e+1"
```
This normalizes the number, but you have to parse it manually. (Like on how accurate the result has to be…) |
545,416 | <p>For some reason I can't catch the error. I'm following an example in O'Reillys PHP cookbook, so I'm not doing any cowboy coding (yet).</p>
<p>The error is:</p>
<pre><code>SoapFault exception: [SOAP-ENV:Server] SoapFault::SoapFault() [soapfault.soapfault]: Invalid parameters. Invalid fault code. in C:\xampp\htdocs\... | [
{
"answer_id": 546373,
"author": "Bob Fanger",
"author_id": 19165,
"author_profile": "https://Stackoverflow.com/users/19165",
"pm_score": 0,
"selected": false,
"text": "<p>I got other (weird) SOAP errors in php 5.2.0 which where resolved in php 5.2.8</p>\n\n<p>If you're not on the latest... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | For some reason I can't catch the error. I'm following an example in O'Reillys PHP cookbook, so I'm not doing any cowboy coding (yet).
The error is:
```
SoapFault exception: [SOAP-ENV:Server] SoapFault::SoapFault() [soapfault.soapfault]: Invalid parameters. Invalid fault code. in C:\xampp\htdocs\soap\client_database.... | I found the solution, you can only use certain error codes when throwing an error.
<http://www.w3.org/TR/soap12-part1/#faultcodes> |
545,419 | <p>I'm using base class constructor as factory and changing class in this constructor/factory to select appropriate class -- is this approach is good python practice or there are more elegant ways? </p>
<p>I've tried to read help about metaclasses but without big success.</p>
<p>Here example of what I'm doing.</p>
<... | [
{
"answer_id": 545444,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I think the second approach using a factory function is a lot cleaner than making the implementation of your base class dep... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65736/"
] | I'm using base class constructor as factory and changing class in this constructor/factory to select appropriate class -- is this approach is good python practice or there are more elegant ways?
I've tried to read help about metaclasses but without big success.
Here example of what I'm doing.
```
class Project(obje... | I would stick with the factory function approach. It's very standard python and easy to read and understand. You could make it more generic to handle more options in several ways such as by passing in the discriminator function and a map of results to classes.
If the first example works it's more by luck than by desi... |
545,421 | <p>I have two or more arrays -- one with IDs, one or more with string values. I want to merge these into a hash table so I can look up values by ID.</p>
<p>The following function does the job, but a shorter and sweeter version (LINQ?) would be nice:</p>
<pre><code>Dictionary<int, string[]> MergeArrays( IEnumera... | [
{
"answer_id": 545437,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>That's very inefficent at the moment - all those calls to ElementAt could be going through the whole sequence (as far ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35462/"
] | I have two or more arrays -- one with IDs, one or more with string values. I want to merge these into a hash table so I can look up values by ID.
The following function does the job, but a shorter and sweeter version (LINQ?) would be nice:
```
Dictionary<int, string[]> MergeArrays( IEnumerable<int> idCollection,
... | That's very inefficent at the moment - all those calls to ElementAt could be going through the whole sequence (as far as they need to) each time. (It depends on the implementation of the sequence.)
However, I'm not at all sure I even understand what this code is doing (using foreach loops would almost certainly make i... |
545,436 | <p>I got a NullReference problem using WWF and externaly raised events. The WWF state machine works together with a service instance raising events in the state machine to provide data and - of course - to change the state. While the "normal" operation works fine using events I got a strange problem. </p>
<p>To handle... | [
{
"answer_id": 548802,
"author": "Lex Li",
"author_id": 11182,
"author_profile": "https://Stackoverflow.com/users/11182",
"pm_score": 0,
"selected": false,
"text": "<p>May you check if this link helpful?</p>\n\n<p><a href=\"http://www.mono-project.com/Gendarme.Rules.Concurrency#ProtectCa... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43913/"
] | I got a NullReference problem using WWF and externaly raised events. The WWF state machine works together with a service instance raising events in the state machine to provide data and - of course - to change the state. While the "normal" operation works fine using events I got a strange problem.
To handle timeout s... | You should check the inner exception for more details. Check if you event service classes are marked [Serializable] and also set the WaitForIdle property to true in the event args.
```
CustomEventDataArgs eventArgs = new CustomEventDataArgs();
//
eventArgs.WaitForIdle = true;
```
Check if this fixes the problem.
Th... |
545,449 | <p>I'm looking for an easy way to find the process tree (as shown by tools like Process Explorer), in C# or other .NET language. It would also be useful to find the command-line arguments of another process (the StartInfo on System.Diagnostics.Process seems invalid for process other than the current process).</p>
<p>I... | [
{
"answer_id": 545498,
"author": "Noldorin",
"author_id": 44389,
"author_profile": "https://Stackoverflow.com/users/44389",
"pm_score": -1,
"selected": false,
"text": "<p>I'm pretty sure you'll need to go with the WinAPI for this. See <a href=\"http://msmvps.com/blogs/siva/archive/2006/1... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17864/"
] | I'm looking for an easy way to find the process tree (as shown by tools like Process Explorer), in C# or other .NET language. It would also be useful to find the command-line arguments of another process (the StartInfo on System.Diagnostics.Process seems invalid for process other than the current process).
I think the... | If you don't want to P/Invoke, you can grab the parent Id's with a performance counter:
```
foreach (var p in Process.GetProcesses())
{
var performanceCounter = new PerformanceCounter("Process", "Creating Process ID", p.ProcessName);
var parent = GetProcessIdIfStillRunning((int)performanceCounter.RawValue);
C... |
545,457 | <p>I'm not against using "Using" statement, but I'm wondering how this affect performance when we use it inside one of another.</p>
<p>For example:</p>
<pre><code> using (test1 (type1))
{
using (test2(type2))
{
using (test2(type3))
{
... | [
{
"answer_id": 545465,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>A try/catch/finally is not expensive unless an exception is thrown. And even then several people (Jon Skeet include... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40077/"
] | I'm not against using "Using" statement, but I'm wondering how this affect performance when we use it inside one of another.
For example:
```
using (test1 (type1))
{
using (test2(type2))
{
using (test2(type3))
{
}
}
... | No, *don't* use your second form. If `test1.Dispose()` throws an exception for some reason, `test2.Dispose()` and `test3.Dispose()` won't get called.
The performance difference, if any, will be microscopic. Don't throw away correctness for insignificant performance :) |
545,500 | <p>Just wondering what is best practice for getting the values of a datareader. For example:</p>
<p>I have been doing this:</p>
<pre><code>MyValue = Dr("ColumnName")
</code></pre>
<p>But have noticed other people doing:</p>
<pre><code>MyValue = Dr.GetString("ColumnName")
</code></pre>
<p>I am intested to know the ... | [
{
"answer_id": 545505,
"author": "Nick Allen",
"author_id": 12918,
"author_profile": "https://Stackoverflow.com/users/12918",
"pm_score": 1,
"selected": false,
"text": "<p>DataReader returns type object so you need to cast the value from the DataReader to whatever type MyValue is so in t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47212/"
] | Just wondering what is best practice for getting the values of a datareader. For example:
I have been doing this:
```
MyValue = Dr("ColumnName")
```
But have noticed other people doing:
```
MyValue = Dr.GetString("ColumnName")
```
I am intested to know the benifits of the 2nd method | I've been using a wrapper that does a similar thing for a while that does the trick nicely.
```
RowHelper helper = new RowHelper(Dr);
MyValue = helper.IntColumn("ColumnName");
```
The nice thing about this is the helper will return pre-defined defaults for NULL columns (this is configurable). I've got met... |
545,510 | <p>I have a simple JS function that needs to get called when AJAX call succeeds, however i don't have any control over the AJAX calls since the framework (DNN5) handles all that.</p>
<p>How do i call my function on AJAX success?</p>
<p>I use DNN5 and jQuery, if you're not familiar with DNN, just assume that all the c... | [
{
"answer_id": 545540,
"author": "Russ Cam",
"author_id": 1831,
"author_profile": "https://Stackoverflow.com/users/1831",
"pm_score": 2,
"selected": true,
"text": "<p>I'm not familiar with DNN5, but am with UpdatePanels. Can you hook into the Client events of an async postback in ASP.NET... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661/"
] | I have a simple JS function that needs to get called when AJAX call succeeds, however i don't have any control over the AJAX calls since the framework (DNN5) handles all that.
How do i call my function on AJAX success?
I use DNN5 and jQuery, if you're not familiar with DNN, just assume that all the controls on the pa... | I'm not familiar with DNN5, but am with UpdatePanels. Can you hook into the Client events of an async postback in ASP.NET AJAX i.e. add an eventhandler to the PageRequestManager endRequest event.
As an example,
```
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(EndRequest);
// run... |
545,524 | <p>Is it possible to have a WebView zoomed in by default. Im trying to place and advert in my application and would like it to be zoomed to 100% by default so it fills the space.</p>
<p>Being able to disable zooming would also be a benefit but I cant disable all interaction as I would like them to be able to click the... | [
{
"answer_id": 545673,
"author": "Anthony Main",
"author_id": 258,
"author_profile": "https://Stackoverflow.com/users/258",
"pm_score": 1,
"selected": true,
"text": "<p>I didn't find out how to fix the zoom but I did manage to tweak my html banner code to force it to display the correct ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258/"
] | Is it possible to have a WebView zoomed in by default. Im trying to place and advert in my application and would like it to be zoomed to 100% by default so it fills the space.
Being able to disable zooming would also be a benefit but I cant disable all interaction as I would like them to be able to click the link | I didn't find out how to fix the zoom but I did manage to tweak my html banner code to force it to display the correct size using the following code in the head tag:
```
<meta name="viewport" content="width=320px,height=65px" />
``` |
545,532 | <p>I'd like to initialize a map - object "id" with identities from 0 to n-1, i.e. </p>
<pre><code> id[0] = 0
id[1] = 1
.
.
id[n-1] = n-1
</code></pre>
<p>Is there a simple way - a one-liner, a method inside the map-object, simply something really simple - that does that?</p>
| [
{
"answer_id": 545555,
"author": "Crashworks",
"author_id": 53543,
"author_profile": "https://Stackoverflow.com/users/53543",
"pm_score": 3,
"selected": true,
"text": "<p>You could use the </p>\n\n<pre><code>template <class InputIterator>\nmap(InputIterator f, InputIterator l,\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4085/"
] | I'd like to initialize a map - object "id" with identities from 0 to n-1, i.e.
```
id[0] = 0
id[1] = 1
.
.
id[n-1] = n-1
```
Is there a simple way - a one-liner, a method inside the map-object, simply something really simple - that does that? | You could use the
```
template <class InputIterator>
map(InputIterator f, InputIterator l,
const key_compare& comp)
```
form of the constructor, but you'd need to build an InputIterator that worked as a generator function over the range you want. That'd be a whole lot more typing than just using a for loop. |
545,533 | <p>Is there a nice simple method of delaying a function call whilst letting the thread continue executing?</p>
<p>e.g.</p>
<pre><code>public void foo()
{
// Do stuff!
// Delayed call to bar() after x number of ms
// Do more Stuff
}
public void bar()
{
// Only execute once foo has finished
}
</code>... | [
{
"answer_id": 545545,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 3,
"selected": false,
"text": "<p>It sounds like the control of the creation of both these objects and their interdependence needs to controlled exter... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | Is there a nice simple method of delaying a function call whilst letting the thread continue executing?
e.g.
```
public void foo()
{
// Do stuff!
// Delayed call to bar() after x number of ms
// Do more Stuff
}
public void bar()
{
// Only execute once foo has finished
}
```
I'm aware that this ca... | Thanks to modern C# 5/6 :)
```
public void foo()
{
Task.Delay(1000).ContinueWith(t=> bar());
}
public void bar()
{
// do stuff
}
``` |
545,535 | <p>I'm parsing some <strong>big</strong> log files and have some very simple string matches for example</p>
<pre><code>if(m/Some String Pattern/o){
#Do something
}
</code></pre>
<p>It seems simple enough but in fact most of the matches I have could be against the start of the line, but the match would be "longer"... | [
{
"answer_id": 545538,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": true,
"text": "<p>I think you'll find that starting your regex with ^ will definitely be faster, because the regex engine doesn't have to... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3720/"
] | I'm parsing some **big** log files and have some very simple string matches for example
```
if(m/Some String Pattern/o){
#Do something
}
```
It seems simple enough but in fact most of the matches I have could be against the start of the line, but the match would be "longer" for example
```
if(m/^Initial static ... | I think you'll find that starting your regex with ^ will definitely be faster, because the regex engine doesn't have to look any further than the left edge of the string for a match.
This is something that you could easily test and measure, of course. Do a regex match 10 million times or so, measure how long it takes,... |
545,562 | <p>Is it possible to do something like this?</p>
<pre><code>class A
{
public virtual string prop
{
get
{
return "A";
}
}
}
class B: A
{
private string X;
public override string prop
{
get
{
return X;
}
set
{... | [
{
"answer_id": 545576,
"author": "ng5000",
"author_id": 36860,
"author_profile": "https://Stackoverflow.com/users/36860",
"pm_score": 1,
"selected": false,
"text": "<p>No, there is no way to do this. Think about how the syntactic sugar of your virtual property is being dealt with, i.e. ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41360/"
] | Is it possible to do something like this?
```
class A
{
public virtual string prop
{
get
{
return "A";
}
}
}
class B: A
{
private string X;
public override string prop
{
get
{
return X;
}
set
{
X... | No, this is not possible. Unfortunately you can not even override and change the accessor level (from *protected* to *public* for example), as documented on [MSDN](http://msdn.microsoft.com/en-us/library/75e8y5dd(VS.80).aspx). I would recommend that you consider restructuring the code/class slightly and look for an alt... |
545,566 | <p>I am wondering if there is a way to synchronize the build numbers (20080213.1) without using the BuildNumberOverrideTarget where I would have to generate my own build number? I basically want to use the default/built-in tfs buildnumber generator but want to access it to align my assembly versions with it. Can this b... | [
{
"answer_id": 545621,
"author": "Ray Booysen",
"author_id": 42124,
"author_profile": "https://Stackoverflow.com/users/42124",
"pm_score": 3,
"selected": false,
"text": "<p>Yes you can. At some point, possibly at AfterGet, you can use the BuildNumber and create a custom task to update t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | I am wondering if there is a way to synchronize the build numbers (20080213.1) without using the BuildNumberOverrideTarget where I would have to generate my own build number? I basically want to use the default/built-in tfs buildnumber generator but want to access it to align my assembly versions with it. Can this be d... | Yes you can. At some point, possibly at AfterGet, you can use the BuildNumber and create a custom task to update the AssemblyInfo.cs files in your source code.
We've hooked into AfterGet and caused our target to be dependant:
```
<Target Name="AfterGet" DependsOnTargets="VersionAssemblies" />
```
Our VersionAssembl... |
545,583 | <p>I have been developing a location based application and would ideally like to link directly to the directions using the Google application.</p>
<p>I have seen a few applications such as AroundMe which already seem to do this but I can't work out how they have managed to implement it</p>
| [
{
"answer_id": 545769,
"author": "froh42",
"author_id": 60229,
"author_profile": "https://Stackoverflow.com/users/60229",
"pm_score": 0,
"selected": false,
"text": "<p>Use OpenURL to start google maps with the correct location, just like described in <a href=\"https://stackoverflow.com/q... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258/"
] | I have been developing a location based application and would ideally like to link directly to the directions using the Google application.
I have seen a few applications such as AroundMe which already seem to do this but I can't work out how they have managed to implement it | The question was about opening maps with the navigation directions displayed, not just the map. The iPhone's URL scheme supports a source & destination address - try, for example:
```
NSString* urlString = @"http://maps.google.com/maps?saddr=London+UK&daddr=Birmingham+UK";
[[UIApplication sharedApplication] openURL:[N... |
545,584 | <p>I'm trying to extract specific hard coded variables from C source code. My remaining problem is that I'd like to parse array initialisation, for example:</p>
<pre><code>#define SOMEVAR { {T_X, {1, 2}}, {T_Y, {3, 4}} }
</code></pre>
<p>It's enough to parse this example into "{T_X, {1, 2}}" and "{T_Y, {3, 4}}", sinc... | [
{
"answer_id": 545769,
"author": "froh42",
"author_id": 60229,
"author_profile": "https://Stackoverflow.com/users/60229",
"pm_score": 0,
"selected": false,
"text": "<p>Use OpenURL to start google maps with the correct location, just like described in <a href=\"https://stackoverflow.com/q... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21322/"
] | I'm trying to extract specific hard coded variables from C source code. My remaining problem is that I'd like to parse array initialisation, for example:
```
#define SOMEVAR { {T_X, {1, 2}}, {T_Y, {3, 4}} }
```
It's enough to parse this example into "{T\_X, {1, 2}}" and "{T\_Y, {3, 4}}", since it's then possible to ... | The question was about opening maps with the navigation directions displayed, not just the map. The iPhone's URL scheme supports a source & destination address - try, for example:
```
NSString* urlString = @"http://maps.google.com/maps?saddr=London+UK&daddr=Birmingham+UK";
[[UIApplication sharedApplication] openURL:[N... |
545,593 | <p>I am using the following query to insert values into one field in table A.</p>
<pre><code>insert
into A (name)
values ('abc')
where
A.id=B.code
and B.dept='hr' ;
</code></pre>
<p>Is this query right?
If not, please provide me a correct way.</p>
| [
{
"answer_id": 545600,
"author": "htaler",
"author_id": 64502,
"author_profile": "https://Stackoverflow.com/users/64502",
"pm_score": 3,
"selected": false,
"text": "<p>You should rather use <code>UPDATE</code>, if you want to change the value of the field in records you select using the ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using the following query to insert values into one field in table A.
```
insert
into A (name)
values ('abc')
where
A.id=B.code
and B.dept='hr' ;
```
Is this query right?
If not, please provide me a correct way. | You should rather use `UPDATE`, if you want to change the value of the field in records you select using the `WHERE` clause. |
545,596 | <p>I have been spying the MSDN and can't see a property/method for TextBox that allows you to get the default text value that was set on a field; I want to be able to compare the current txtMyTextBox.Text to the default value (like this psuedo code shows):</p>
<pre><code>var myValue = (String.Compare(txtMyTextBox.Text... | [
{
"answer_id": 545602,
"author": "LeJeune",
"author_id": 37955,
"author_profile": "https://Stackoverflow.com/users/37955",
"pm_score": 2,
"selected": false,
"text": "<p>There is no \"DefaultText\" property on a textbox (or any other control).\nYou probably have defined the default throug... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57591/"
] | I have been spying the MSDN and can't see a property/method for TextBox that allows you to get the default text value that was set on a field; I want to be able to compare the current txtMyTextBox.Text to the default value (like this psuedo code shows):
```
var myValue = (String.Compare(txtMyTextBox.Text, txtMyTextBox... | There is no built in way of retrieving the default value of a textbox during postback.
One option would be to use ViewState to store the value during the initial PageLoad and retrieving it from there during the postback to make the comparison. |
545,603 | <p>How can I store logical expressions using a RDBMS?</p>
<p>I tag objects and would like to be able to build truth statements based on those tags. (These might be considered as virtual tags.)</p>
<p><strong>Tags</strong><br>
<code>new</code><br>
<code>for_sale</code><br>
<code>used</code><br>
<code>offer</code></p>... | [
{
"answer_id": 545627,
"author": "Phil Bennett",
"author_id": 2995,
"author_profile": "https://Stackoverflow.com/users/2995",
"pm_score": 1,
"selected": false,
"text": "<p>As a default, until I've understood a problem well enough to figure out the solution, I would not store business rul... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56679/"
] | How can I store logical expressions using a RDBMS?
I tag objects and would like to be able to build truth statements based on those tags. (These might be considered as virtual tags.)
**Tags**
`new`
`for_sale`
`used`
`offer`
**Rule**
`second_hand_goods = (!new or used) and for_sale`
`new_offer = new... | Managing the nesting/brackets can become quite complex and prone to errors. The way I have done this in the past is to use XML to define the logic as it handles nesting very well. Using SQL Server 2005 or higher you can also store this nicely in a single table.
Your second hand goods logic could be stored as...
```
<... |
545,616 | <p>I've been chatting with my colleagues the other day and heard that their coding standard explicitly forbids them to use the <code>var</code> keyword in C#. They had no idea why it was so and I've always found implicit declaration to be incredibly useful when coding. I've never had any problems finding out what type ... | [
{
"answer_id": 545623,
"author": "NeedHack",
"author_id": 44950,
"author_profile": "https://Stackoverflow.com/users/44950",
"pm_score": 4,
"selected": false,
"text": "<p>Surely this is a mistake. It's because some folk don't realise that it is actually strongly typed, and not at all lik... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713/"
] | I've been chatting with my colleagues the other day and heard that their coding standard explicitly forbids them to use the `var` keyword in C#. They had no idea why it was so and I've always found implicit declaration to be incredibly useful when coding. I've never had any problems finding out what type the variable w... | The writers of the [.Net Framework Design Guidelines](https://rads.stackoverflow.com/amzn/click/com/0321545613) (awesome book) that came out in November 2008 recommend considering using `var` when the Type is obvious and unambiguous.
On the other hand, if using `var` would result in an ambiguity when reading the code,... |
545,634 | <p>Im trapping link clicked information in a UIWebView in the shouldStartLoadWithRequest delegate. I am using mainDocumentURL to get the url of the linked clicked. This shows the complete url but I need JUST the name of the page i.e .html, .htm etc requested. I cant see any property that would return this. Do i need to... | [
{
"answer_id": 546023,
"author": "Jane Sales",
"author_id": 63994,
"author_profile": "https://Stackoverflow.com/users/63994",
"pm_score": 1,
"selected": false,
"text": "<p>I think you mean the path of the URL. The code below extracts a string, s, whose value is @\"/cheese.html\". </p>\n\... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51630/"
] | Im trapping link clicked information in a UIWebView in the shouldStartLoadWithRequest delegate. I am using mainDocumentURL to get the url of the linked clicked. This shows the complete url but I need JUST the name of the page i.e .html, .htm etc requested. I cant see any property that would return this. Do i need to pa... | If I'm understanding you correctly, you want to convert to an NSString and then use its methods. Starting with your NSURLRequest, you'd do something like this (note, I typed this into a web page and have not compiled it):
```
NSURL *url = [request URL];
NSString *filename = [[url path] lastPathComponent];
```
If you... |
545,655 | <p>As you may know, tonight, at exactly 23:31:30 UTC, Epoch Time will reach 1234567890! Hurray!</p>
<p>One way of watching epoch time is by using Perl:</p>
<pre><code>perl -le 'while(true){print time();sleep 1;}'
</code></pre>
<p>Can you do the same in another programming language?</p>
| [
{
"answer_id": 545664,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 0,
"selected": false,
"text": "<p>java:</p>\n\n<pre><code>System.out.println((new java.util.Date(0)).toString());\n</code></pre>\n\n<p>That's the epoch :)... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7412/"
] | As you may know, tonight, at exactly 23:31:30 UTC, Epoch Time will reach 1234567890! Hurray!
One way of watching epoch time is by using Perl:
```
perl -le 'while(true){print time();sleep 1;}'
```
Can you do the same in another programming language? | this [site](http://www.epochconverter.com/) is in my favorites and has many answers for it |
545,666 | <p>How to translate MS Windows OS version numbers into product names?</p>
<p>For example, in .NET the following two properties could be used to work out that the product is MS Windows Vista Ultimate Edition :</p>
<p><code>Environment.OSVersion.Platform returns Win32NT</code></p>
<p><code>Environment.OSVersion.Versio... | [
{
"answer_id": 545698,
"author": "Avram",
"author_id": 61883,
"author_profile": "https://Stackoverflow.com/users/61883",
"pm_score": 7,
"selected": true,
"text": "<p><a href=\"http://www.vb-helper.com/howto_net_os_version.html\" rel=\"noreferrer\">howto net os version</a></p>\n\n<p>VB:</... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15985/"
] | How to translate MS Windows OS version numbers into product names?
For example, in .NET the following two properties could be used to work out that the product is MS Windows Vista Ultimate Edition :
`Environment.OSVersion.Platform returns Win32NT`
`Environment.OSVersion.Version returns 6.0.6001.65536` | [howto net os version](http://www.vb-helper.com/howto_net_os_version.html)
VB:
```
Public Function GetOSVersion() As String
Select Case Environment.OSVersion.Platform
Case PlatformID.Win32S
Return "Win 3.1"
Case PlatformID.Win32Windows
Select Case Environment.OSVersion.Vers... |
545,667 | <p>I'd like to have my desktop Java application to have single sign on related to
Active Directory users. In two steps, I'd like to:</p>
<ol>
<li>Be sure that the particular user has logged in to Windows with some user entry.</li>
<li>Check out some setup information for that user from the Active Directory</li>
</ol>... | [
{
"answer_id": 545693,
"author": "aldrinleal",
"author_id": 39261,
"author_profile": "https://Stackoverflow.com/users/39261",
"pm_score": 0,
"selected": false,
"text": "<p>Check jCifs at <a href=\"http://jcifs.samba.org/\" rel=\"nofollow noreferrer\">http://jcifs.samba.org/</a> </p>\n\n<... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28482/"
] | I'd like to have my desktop Java application to have single sign on related to
Active Directory users. In two steps, I'd like to:
1. Be sure that the particular user has logged in to Windows with some user entry.
2. Check out some setup information for that user from the Active Directory
With [Java: Programatic Way ... | It is not supported. Java 6 has improvements, but not enough yet.
Java has its own GSS stack. The problem is for single sign-on, you need to get the Kerberos ticket from the OS (not the Java stack). Otherwise the user has to authenticate a second time (defeating the purpose of single sign-on).
Look at <http://java.s... |
545,671 | <p>As unit testing is not used in our firm, I'm teaching myself to unit test my own code.
I'm using the standard .net test framework for some really basic unit testing.</p>
<p>A method of mine returns a <code>IEnumerable<string></code> and I want to test it's output.
So I created an <code>IEnumerable<string&g... | [
{
"answer_id": 545678,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>You want the <a href=\"https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.sequenceequal?view=net-... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | As unit testing is not used in our firm, I'm teaching myself to unit test my own code.
I'm using the standard .net test framework for some really basic unit testing.
A method of mine returns a `IEnumerable<string>` and I want to test it's output.
So I created an `IEnumerable<string>` expected to test it against.
I tho... | I don't know which "standard .net test framework" you're referring to, but if it's Visual Studio Team System Unit testing stuff you could use [CollectionAssert](http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.collectionassert.aspx).
Your test would be like this:
```
CollectionAsse... |
545,676 | <p>I have a WPF Image control with attached blur effect.
Is there a way to save the image (with blur) without using RenderTargetBitmap?</p>
<p>Thank you.</p>
<p>UPDATE: I'm using now new custom effect which derives from System.Windows.Media.Effects.ShaderEffect.
I would like to save my image with shader effect appli... | [
{
"answer_id": 546027,
"author": "U62",
"author_id": 47612,
"author_profile": "https://Stackoverflow.com/users/47612",
"pm_score": 1,
"selected": false,
"text": "<p>Since the shader effect is by definition applied on the video card, the only way you can get a copy of it in main memory is... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430254/"
] | I have a WPF Image control with attached blur effect.
Is there a way to save the image (with blur) without using RenderTargetBitmap?
Thank you.
UPDATE: I'm using now new custom effect which derives from System.Windows.Media.Effects.ShaderEffect.
I would like to save my image with shader effect applied. | the only way you can render the bitmap is using RenderTargetBitmap.
Have a look at this example:
```
BitmapSource bitmap=GetYourBitmap();
Rectangle r=new Rectangle();
r.Background=new ImageBrush(bitmap);
r.Effect=yourEffect;
Size sz=new Size(bitmap.PixelWidth, bitmap.PixelHeight);
r.Measure(sz);
r.Arrange(new Rect(s... |
545,683 | <p>I can turn on warnings as errors and exclude certain warnings for all the projects in my solution except for a website (not web application).</p>
<p>Is there anyway to turn on 'warnings as errors' as errors for websites and is there anyway to turn off certain errors for the whole website or sub folders?</p>
<p><st... | [
{
"answer_id": 546083,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 3,
"selected": true,
"text": "<p>The only way I know of is to add this to your web.config directly under your <code>configuration</code> element:</p>... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18107/"
] | I can turn on warnings as errors and exclude certain warnings for all the projects in my solution except for a website (not web application).
Is there anyway to turn on 'warnings as errors' as errors for websites and is there anyway to turn off certain errors for the whole website or sub folders?
**Update** I'm using... | The only way I know of is to add this to your web.config directly under your `configuration` element:
```
<system.codedom>
<compilers>
<compiler
language="c#;cs;csharp" extension=".cs"
compilerOptions="/warnaserror"
type="Microsoft.CSharp.CSharpCodeProvider,
System... |
545,702 | <p>I am currently working on a site that requires ACL and as I am using Zend, it makes sense for me to make use of their ACL class but I have little to zero idea of how to do this. I have read the docs but it confused me further...basically all I want to do is to set up two user groups e.g. "normal" and "admin", normal... | [
{
"answer_id": 545824,
"author": "Marek Janouch",
"author_id": 58672,
"author_profile": "https://Stackoverflow.com/users/58672",
"pm_score": 6,
"selected": true,
"text": "<p>I implemented similar thing not so long ago. Basic concept follows in an example code.</p>\n\n<p>I created my own ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57872/"
] | I am currently working on a site that requires ACL and as I am using Zend, it makes sense for me to make use of their ACL class but I have little to zero idea of how to do this. I have read the docs but it confused me further...basically all I want to do is to set up two user groups e.g. "normal" and "admin", normal us... | I implemented similar thing not so long ago. Basic concept follows in an example code.
I created my own configAcl.php file which is loaded in bootstrap file, in my case it is index.php. Here is how it'd be according to your case:
```
$acl = new Zend_Acl();
$roles = array('admin', 'normal');
// Controller script na... |
545,703 | <p>I've a List of this type List> that contains this</p>
<pre><code>List<int> A = new List<int> {1, 2, 3, 4, 5};
List<int> B = new List<int> {0, 1};
List<int> C = new List<int> {6};
List<int> X = new List<int> {....,....};
</code></pre>
<p>I want to have all combination... | [
{
"answer_id": 545722,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>If the number of dimensions is fixed, this is simply <code>SelectMany</code>:</p>\n\n<pre><code>var qry = from a i... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61589/"
] | I've a List of this type List> that contains this
```
List<int> A = new List<int> {1, 2, 3, 4, 5};
List<int> B = new List<int> {0, 1};
List<int> C = new List<int> {6};
List<int> X = new List<int> {....,....};
```
I want to have all combinations like this
```
1-0-6
1-1-6
2-0-6
2-1-6
3-0-6
```
and so on.
According... | It's quite similar to [this answer](https://stackoverflow.com/questions/312732/whats-a-good-way-for-figuring-out-all-possible-words-of-a-given-length/312761#312761) I gave to another question:
```
var combinations = from a in A
from b in B
from c in C
orderby a,... |
545,708 | <p>I have a program in C# that connects to a server using a DuplexChannelFactory, and that server can call methods from client side by callback, the problem is that I have no idea how to access the Main Thread were the connection was created from the callback methods. Is there any way to do this, by means of passing an... | [
{
"answer_id": 545722,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>If the number of dimensions is fixed, this is simply <code>SelectMany</code>:</p>\n\n<pre><code>var qry = from a i... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45320/"
] | I have a program in C# that connects to a server using a DuplexChannelFactory, and that server can call methods from client side by callback, the problem is that I have no idea how to access the Main Thread were the connection was created from the callback methods. Is there any way to do this, by means of passing an ob... | It's quite similar to [this answer](https://stackoverflow.com/questions/312732/whats-a-good-way-for-figuring-out-all-possible-words-of-a-given-length/312761#312761) I gave to another question:
```
var combinations = from a in A
from b in B
from c in C
orderby a,... |
545,714 | <p>I am a bit lost. I've tried to implement a solution based on JqGrid and tried to use function as datatype. I've setted all by the book I guess, I get WS invoked and get JSON back, I got succes on clientside in ajax call and I "bind" jqGrid using <code>addJSONData</code> but grid remains empty. I do not have any clue... | [
{
"answer_id": 548750,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "<p>I've been trying to solve the same problem for the last couple of hours. I've now given up on getting AddJSONData working - ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65445/"
] | I am a bit lost. I've tried to implement a solution based on JqGrid and tried to use function as datatype. I've setted all by the book I guess, I get WS invoked and get JSON back, I got succes on clientside in ajax call and I "bind" jqGrid using `addJSONData` but grid remains empty. I do not have any clue now... other ... | I've been trying to solve the same problem for the last couple of hours. I've now given up on getting AddJSONData working - my web service method is returning an array so it looks like using addRowData will work.
```
function ReceivedClientData(data) {
var thegrid = $("#list4");
for (var i = 0; i < dat... |
545,720 | <p>I'm currently trying to move from hand-crafted hql to queries constructed via DetachedCriteria. I have and HQL:</p>
<pre><code>from GenericObject genericObject
left join fetch genericObject.Positions positions
where (positions.Key.TrackedSourceID, positions.Key.PositionTimestamp) in
(select gp.K... | [
{
"answer_id": 545732,
"author": "Nuno G",
"author_id": 20959,
"author_profile": "https://Stackoverflow.com/users/20959",
"pm_score": 2,
"selected": false,
"text": "<p>I cannot see the advantage in moving from hql to DetachedCriteria, if the latter is more difficult to write. And read.</... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30681/"
] | I'm currently trying to move from hand-crafted hql to queries constructed via DetachedCriteria. I have and HQL:
```
from GenericObject genericObject
left join fetch genericObject.Positions positions
where (positions.Key.TrackedSourceID, positions.Key.PositionTimestamp) in
(select gp.Key.TrackedSour... | I cannot see the advantage in moving from hql to DetachedCriteria, if the latter is more difficult to write. And read.
In my projects I use preferrably DetachedCriteria, unless the syntax gets too complicated. Then I use hql. Until it gets complicated again. Then I give it a try in sql, and go back to hql if it doesn'... |
545,735 | <p>I have loaded XmlDocument into memory and created new XmlElement. Now I am trying to add XmlElement to the path /report/section/hosts but I don't know how. I can add it easily below root node of XML but I cannot figure out how can I navigate deeper level in XML and just append there. In pseudo I am trying to do this... | [
{
"answer_id": 545748,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": true,
"text": "<p>Try SelectSingleNode instead of SelectNodes</p>\n\n<pre><code>XmlElement parent = (XmlElement)doc.SelectSingleNode... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31425/"
] | I have loaded XmlDocument into memory and created new XmlElement. Now I am trying to add XmlElement to the path /report/section/hosts but I don't know how. I can add it easily below root node of XML but I cannot figure out how can I navigate deeper level in XML and just append there. In pseudo I am trying to do this:
... | Try SelectSingleNode instead of SelectNodes
```
XmlElement parent = (XmlElement)doc.SelectSingleNode("/report/section/hosts")
parent.AppendChild(subRoot);
``` |
545,737 | <p>I try to call my custom web service which is deployed as part of CRM4 and received the following error:</p>
<pre><code>Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
... | [
{
"answer_id": 545748,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": true,
"text": "<p>Try SelectSingleNode instead of SelectNodes</p>\n\n<pre><code>XmlElement parent = (XmlElement)doc.SelectSingleNode... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I try to call my custom web service which is deployed as part of CRM4 and received the following error:
```
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>No Micros... | Try SelectSingleNode instead of SelectNodes
```
XmlElement parent = (XmlElement)doc.SelectSingleNode("/report/section/hosts")
parent.AppendChild(subRoot);
``` |
545,752 | <p>I have an object (Incident) which has a child object (Action). An Incident may have zero or or one Action objects. I'm attempting to test whether the Incident object has a child Action object with the following code:</p>
<p><code>If Not MyIncident.Action Is Nothing</code></p>
<p>In theory this should work but for ... | [
{
"answer_id": 545764,
"author": "Rytmis",
"author_id": 266,
"author_profile": "https://Stackoverflow.com/users/266",
"pm_score": 1,
"selected": false,
"text": "<p>Is your Action a Structure or a class? Structures can't be null.</p>\n"
},
{
"answer_id": 545777,
"author": "Mar... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20048/"
] | I have an object (Incident) which has a child object (Action). An Incident may have zero or or one Action objects. I'm attempting to test whether the Incident object has a child Action object with the following code:
`If Not MyIncident.Action Is Nothing`
In theory this should work but for some reason the child Action... | Is your Action a Structure or a class? Structures can't be null. |
545,760 | <p>I have a Windows Forms application that has this code in the program's start up:</p>
<pre><code>Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
</code></pre>
<p>In the MSDN Documentation for <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.unhandledexceptionmode(VS.85)... | [
{
"answer_id": 1202301,
"author": "Rob Parker",
"author_id": 181460,
"author_profile": "https://Stackoverflow.com/users/181460",
"pm_score": 2,
"selected": false,
"text": "<p>I wondered about this as well, and I was never able to find anything about any specific built-in config option yo... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20553/"
] | I have a Windows Forms application that has this code in the program's start up:
```
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
```
In the MSDN Documentation for [UnhandledExceptionMode.Automatic](http://msdn.microsoft.com/en-us/library/system.windows.forms.unhandledexceptionmode(VS.85)... | You can add a JitDebugging section to your config file like this:
```
<configuration>
<system.windows.forms jitDebugging="true"/>
</configuration>
```
This is equivalent to setting the UnhandledExceptionMode to `UnhandledExceptionMode.ThrowException` (incidentally, if you run your application with a Debugger attac... |
545,779 | <p>I'm now working with code that looks like this</p>
<pre><code>public String getName(User user) {
user.setSth(...);
return user.getName();
}
</code></pre>
<p>I think it's bad practice to change objects passed as parameters. Is there a tool that detects that kind of code? I looked at findbugs, pmd and che... | [
{
"answer_id": 545819,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 2,
"selected": false,
"text": "<p>You won't find anything because, from a tool's point of view, \"getName\" and \"setSth\" are just method calls. H... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30453/"
] | I'm now working with code that looks like this
```
public String getName(User user) {
user.setSth(...);
return user.getName();
}
```
I think it's bad practice to change objects passed as parameters. Is there a tool that detects that kind of code? I looked at findbugs, pmd and checkstyle, but could not find... | I think you are already on the right track: your best tool to detect this sort of code is almost certainly [Findbugs](http://findbugs.sourceforge.net/). However, you will probably need to write your own detector for this pattern. [Here is an example](http://www.ibm.com/developerworks/library/j-findbug2/) of how you wou... |
545,790 | <p>Actually there many examples and I have used one of them. But it works asynchronous, I mean it is not waiting the function that I called to finish.</p>
<pre><code>function ProcessSend()
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")
Set oXMLDoc = CreateObject("MSXML2.DOMDocument")
oXMLHTTP.onreadys... | [
{
"answer_id": 545815,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 4,
"selected": true,
"text": "<p>Have you tried opening Source Control Explorer, File -> Source Control -> Labels -> Find Label? [EDIT: that may hav... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66018/"
] | Actually there many examples and I have used one of them. But it works asynchronous, I mean it is not waiting the function that I called to finish.
```
function ProcessSend()
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")
Set oXMLDoc = CreateObject("MSXML2.DOMDocument")
oXMLHTTP.onreadystatechange = g... | Have you tried opening Source Control Explorer, File -> Source Control -> Labels -> Find Label? [EDIT: that may have been in a beta version, and I don't have TFS here atm...]
Also, are you using [SideKicks](http://www.attrice.info/cm/tfs/)? The Labels SideKick allows you to find a label and see the related changesets. |
545,794 | <p>How can I mock one method with RhinoMocks in VB.Net? The reference I found is in C#:</p>
<pre><code> Expect.Call(delegate{list.Add(0);}).IgnoreArguments()
.Do((Action<int>)delegate(int item) {
if (item < 0) throw new ArgumentOutOfRangeException();
});
</code></pre>
<p>SharpDevelop converts ... | [
{
"answer_id": 545967,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 3,
"selected": true,
"text": "<p>Unfortunately you're attempting to do both a Sub lambda and a Statement Lambda. Neither are supported in VS2008 (but w... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15349/"
] | How can I mock one method with RhinoMocks in VB.Net? The reference I found is in C#:
```
Expect.Call(delegate{list.Add(0);}).IgnoreArguments()
.Do((Action<int>)delegate(int item) {
if (item < 0) throw new ArgumentOutOfRangeException();
});
```
SharpDevelop converts this to:
```
Expect.Call(Function(... | Unfortunately you're attempting to do both a Sub lambda and a Statement Lambda. Neither are supported in VS2008 (but will be in the upcoming version of VS). Here is the expanded version that will work for VB
I'm guessing at the type of m\_list
```
Class MockHelper
Dim m_list as new List(Of Object)
Public Sub New... |
545,800 | <p>Currently i can create PDF files from images in Imagick with this function</p>
<pre><code>$im->setImageFormat("pdf");
$im->writeImage("file.pdf");
</code></pre>
<p>And it's possible to fetch multiple pages with imagick like this</p>
<pre><code>$im = new imagick("file.pdf[0]");
$im2 = new imagick("file.pdf[1... | [
{
"answer_id": 545852,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 1,
"selected": false,
"text": "<p>Is this working?</p>\n\n<pre><code>$im->setImageFormat(\"pdf\");\n$im->writeImage(\"file1.pdf\");\n\n$im2->s... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22459/"
] | Currently i can create PDF files from images in Imagick with this function
```
$im->setImageFormat("pdf");
$im->writeImage("file.pdf");
```
And it's possible to fetch multiple pages with imagick like this
```
$im = new imagick("file.pdf[0]");
$im2 = new imagick("file.pdf[1]");
```
But is it possible to save two i... | I know this is long past due, but this result came up when I was trying to do the same thing. Here is how you create a multi-page PDF file in PHP and Imagick.
```
$images = array(
'page_1.png',
'page_2.png'
);
$pdf = new Imagick($images);
$pdf->setImageFormat('pdf');
if (!$pdf->writeImages('combined.pdf', ... |
545,841 | <p>I have read in the article (<a href="http://dev.opera.com/articles/view/timing-and-synchronization-in-javascript/" rel="nofollow noreferrer">the article</a>) following concepts about event handlers:</p>
<blockquote>
<p>For a non-bubbling event, the sequence
of the dispatch is like this:</p>
<ol>
<li>Capt... | [
{
"answer_id": 546025,
"author": "Christoph",
"author_id": 48015,
"author_profile": "https://Stackoverflow.com/users/48015",
"pm_score": 2,
"selected": false,
"text": "<p>This is a hack, but it should work if you add the following line to your regular event handler:</p>\n\n<pre><code>set... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59692/"
] | I have read in the article ([the article](http://dev.opera.com/articles/view/timing-and-synchronization-in-javascript/)) following concepts about event handlers:
>
> For a non-bubbling event, the sequence
> of the dispatch is like this:
>
>
> 1. Capturing phase: All "capturing"
> event handlers are fired on all
>... | You need onkeyup/onkeypress combination:
```
<script type="text/javascript">
$(document).ready(function(){
// single button (abcd)
$("#source").keyup(function() {
$("#target").html( $(this).val() );
});
// pressed button (aaaaaaaa)
$("#source").keypress(function() {
$("#target").htm... |
545,842 | <p>I want to following things for testing a application involving complex calculations:</p>
<ol>
<li>How to use test automation tools for testing calculations?(using automation tools like QTP or open source tools)</li>
<li>How to decide coverage while testing calculations, how to design test cases?</li>
</ol>
<p>Than... | [
{
"answer_id": 546025,
"author": "Christoph",
"author_id": 48015,
"author_profile": "https://Stackoverflow.com/users/48015",
"pm_score": 2,
"selected": false,
"text": "<p>This is a hack, but it should work if you add the following line to your regular event handler:</p>\n\n<pre><code>set... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183373/"
] | I want to following things for testing a application involving complex calculations:
1. How to use test automation tools for testing calculations?(using automation tools like QTP or open source tools)
2. How to decide coverage while testing calculations, how to design test cases?
Thanks in advance,
Testmann | You need onkeyup/onkeypress combination:
```
<script type="text/javascript">
$(document).ready(function(){
// single button (abcd)
$("#source").keyup(function() {
$("#target").html( $(this).val() );
});
// pressed button (aaaaaaaa)
$("#source").keypress(function() {
$("#target").htm... |
545,885 | <p>I recently came across <a href="http://blogs.msdn.com/lukeh/archive/2007/10/01/taking-linq-to-objects-to-extremes-a-fully-linqified-raytracer.aspx" rel="nofollow noreferrer">this raytracer in LINQ</a>. Just wondering if anyone can top that?</p>
<pre><code>var pixelsQuery =
from y in Enumerable.Range(0, screenHeight... | [
{
"answer_id": 545914,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>I doubt that there's anything to top the raytracer. I'm quite fond of <a href=\"http://msmvps.com/blogs/jon_skeet/arc... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64565/"
] | I recently came across [this raytracer in LINQ](http://blogs.msdn.com/lukeh/archive/2007/10/01/taking-linq-to-objects-to-extremes-a-fully-linqified-raytracer.aspx). Just wondering if anyone can top that?
```
var pixelsQuery =
from y in Enumerable.Range(0, screenHeight)
let recenterY = -(y - (screenHeight / 2.0)) / (2.... | I doubt that there's anything to top the raytracer. I'm quite fond of [my Mandelbrot expression](http://msmvps.com/blogs/jon_skeet/archive/2008/02/26/visualising-the-mandelbrot-set-with-linq-yet-again.aspx) though:
```
from row in Enumerable.Range(0, ImageHeight)
from col in Enumerable.Range(0, ImageWidth)
// Work out... |
545,904 | <p>Is there any way to update a table within the select_expr part of a mysql select query. Here is an example of what I am trying to achieve:</p>
<pre><code>SELECT id, name, (UPDATE tbl2 SET currname = tbl.name WHERE tbl2.id = tbl.id) FROM tbl;
</code></pre>
<p>This gives me an error in mysql, but I dont see why thi... | [
{
"answer_id": 545913,
"author": "Amandasaurus",
"author_id": 161922,
"author_profile": "https://Stackoverflow.com/users/161922",
"pm_score": 2,
"selected": false,
"text": "<p>What results do you want? The results of the select, or of the update.</p>\n\n<p>If you want to update based on ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65584/"
] | Is there any way to update a table within the select\_expr part of a mysql select query. Here is an example of what I am trying to achieve:
```
SELECT id, name, (UPDATE tbl2 SET currname = tbl.name WHERE tbl2.id = tbl.id) FROM tbl;
```
This gives me an error in mysql, but I dont see why this shouldn't be possible as... | If your goal is to update tbl2 every time you query tbl1, then the best way to do that is to create a stored procedure to do it and wrap it in a transaction, possibly changing isolation levels if atomicity is needed.
You can't nest updates in selects. |
545,907 | <p>My brother recently started learning C++. He told me a problem he encountered while trying to validate input in a simple program. He had a text menu where the user entered an integer <code>choice</code>, if they entered an invalid choice, they would be asked to enter it again (do while loop). However, if the user en... | [
{
"answer_id": 545919,
"author": "Diego Sevilla",
"author_id": 62365,
"author_profile": "https://Stackoverflow.com/users/62365",
"pm_score": 2,
"selected": false,
"text": "<p>What I would do is twofold: First, try to validate the input, and extract the data, using a regular expression, i... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59024/"
] | My brother recently started learning C++. He told me a problem he encountered while trying to validate input in a simple program. He had a text menu where the user entered an integer `choice`, if they entered an invalid choice, they would be asked to enter it again (do while loop). However, if the user entered a string... | Here is code you could use to make sure you also reject things like
```
42crap
```
Where non-number characters follow the number. If you read the whole line and then parse it and execute actions appropriately it will possibly require you to change the way your program works. If your program read your number from di... |
545,941 | <p>I have a strange problem whereby the ValidationSummary is not being displayed. However, the ValidationMessage's are being displayed. I've checked the output page source and it's not as though they are in a colour that is obscuring them. I'm using the RC. Any ideas?</p>
<p>Edit:
Break point set at ValidationSummary ... | [
{
"answer_id": 545999,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 4,
"selected": true,
"text": "<p>You don't say what the errors are that are not displaying, but there are some errors which will be displayed in Valid... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63492/"
] | I have a strange problem whereby the ValidationSummary is not being displayed. However, the ValidationMessage's are being displayed. I've checked the output page source and it's not as though they are in a colour that is obscuring them. I'm using the RC. Any ideas?
Edit:
Break point set at ValidationSummary shows:
``... | You don't say what the errors are that are not displaying, but there are some errors which will be displayed in ValidationMessage but not in ValidationSummary. I think that this is a bug in the Release Candidate, but I am open to other interpretations. In particular, consider this line from the ValidationSummary source... |
545,951 | <p>After following a <a href="http://guides.rails.info/getting_started.html" rel="noreferrer">tutorial</a> Ive found. Im now redoing it again, without the scaffolding part, to learn it better.</p>
<p>However, editing my \app\views\home\index.html.erb to contain:</p>
<pre><code><h1>Rails test project</h1>
... | [
{
"answer_id": 545959,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 5,
"selected": true,
"text": "<p>You will need to define a path to your posts in <code>config/routes.rb</code></p>\n\n<p>Rails 2.x syntax:</p>\n\n<p... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56763/"
] | After following a [tutorial](http://guides.rails.info/getting_started.html) Ive found. Im now redoing it again, without the scaffolding part, to learn it better.
However, editing my \app\views\home\index.html.erb to contain:
```
<h1>Rails test project</h1>
<%= link_to "my blog", posts_path>
```
I get an error:
```... | You will need to define a path to your posts in `config/routes.rb`
Rails 2.x syntax:
```
map.resources :posts
```
Rails 3.x syntax:
```
resources :posts
``` |
545,957 | <p>Check out the below program. </p>
<pre><code>try {
for (String data : Files.readAllLines(Paths.get("D:/sample.txt"))){
String[] de = data.split(";");
System.out.println("Length = " + de.length);
}
} catch (IOException e) {
e.printStackTrace();
}
</code></pre>
<p>Sample.txt:</p>
<pre>
1... | [
{
"answer_id": 545975,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 5,
"selected": false,
"text": "<p>have a look at the <a href=\"http://java.sun.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String,... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51659/"
] | Check out the below program.
```
try {
for (String data : Files.readAllLines(Paths.get("D:/sample.txt"))){
String[] de = data.split(";");
System.out.println("Length = " + de.length);
}
} catch (IOException e) {
e.printStackTrace();
}
```
Sample.txt:
```
1;2;3;4
A;B;;
a;b;c;
```
Outpu... | You can specify to apply the pattern as often as possible with:
```
String[] de = data.split(";", -1);
```
[See the Javadoc](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String,%20int)) for the split method taking two arguments for details. |
545,978 | <p>I have some html like this:</p>
<pre><code><div id="1">
<p>
Volume = <input type="text" />
<button rel="3.93e-6" class="1" type="button">Check answer</button>
</p>
<div></div>
</div>
</code></pre>
<p>and some JS like this:</p>
<pre>... | [
{
"answer_id": 545992,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": 3,
"selected": false,
"text": "<p>To get the id of the parent div:</p>\n<pre><code>$(buttonSelector).parents('div:eq(0)').attr('id');\n</code></pre>\n<... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16511/"
] | I have some html like this:
```
<div id="1">
<p>
Volume = <input type="text" />
<button rel="3.93e-6" class="1" type="button">Check answer</button>
</p>
<div></div>
</div>
```
and some JS like this:
```
$("button").click(function () {
var buttonNo = $(this).attr('class');
var cor... | You could use [event delegation](http://learn.jquery.com/events/event-delegation/) on the parent div. Or use the [closest](http://docs.jquery.com/Traversing/closest) method to find the parent of the button.
The easiest of the two is probably the closest.
```
var id = $("button").closest("div").prop("id");
``` |
545,979 | <p>Does anybody know/have an example of how to change WPF DataGrid layout to be something like card-view or anything else, not just stack of rows?</p>
| [
{
"answer_id": 546239,
"author": "Jarrett Meyer",
"author_id": 5834,
"author_profile": "https://Stackoverflow.com/users/5834",
"pm_score": 1,
"selected": false,
"text": "<p>Instead of a datagrid, try using a combination of a listview or listbox (depending on which functionality you want ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19268/"
] | Does anybody know/have an example of how to change WPF DataGrid layout to be something like card-view or anything else, not just stack of rows? | The result looks like this. [alt text http://iwebthereforeiam.com/files/ScreenShot.gif](http://iwebthereforeiam.com/files/ScreenShot.gif)
Here's code that should demonstrate the idea.
XAML:
```
<Window x:Class="StackOverflow_545979.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
x... |
545,985 | <p>I am working on a VB.NET batch PDF exporting program for CAD drawings. The programs runs fine, but the architecture is a mess. Basically, one big function takes the entire process from start to finish. I would like to make a separate class, or several, to do the exporting work. </p>
<p><strong>Here's the problem:</... | [
{
"answer_id": 546041,
"author": "Charlie",
"author_id": 466531,
"author_profile": "https://Stackoverflow.com/users/466531",
"pm_score": 0,
"selected": false,
"text": "<p>So the appropriate method on your class needs an optional parameter of</p>\n\n<pre><code>[OverwriteExisting as Boolea... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65393/"
] | I am working on a VB.NET batch PDF exporting program for CAD drawings. The programs runs fine, but the architecture is a mess. Basically, one big function takes the entire process from start to finish. I would like to make a separate class, or several, to do the exporting work.
**Here's the problem:**
Sometimes th... | You could use an Event, create a custom event argument class with a property on it that the application can call. Then when your app is handling the event prompt the user and then tell the exporter what to do. I'm a c# guy so let me give you a sample in there first:
```
void form_Load(object sender,EventArgs e)
{
/... |
545,988 | <p>Can I do the following?</p>
<pre><code>[OperationContract]
[WebGet(UriTemplate = "/foo/{id}")]
string GetFoo(int id);
</code></pre>
<p>I'd like my service to function as both RESTful service and RPC-style SOAP service.
If possible I'd like to retain int as int, and not do parsing by hand.</p>
| [
{
"answer_id": 546035,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>Unfortunately you must do the parsing yourself if you want to use the <code>UriTemplate</code>.</p>\n"
},
{
... | 2009/02/13 | [
"https://Stackoverflow.com/questions/545988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3827/"
] | Can I do the following?
```
[OperationContract]
[WebGet(UriTemplate = "/foo/{id}")]
string GetFoo(int id);
```
I'd like my service to function as both RESTful service and RPC-style SOAP service.
If possible I'd like to retain int as int, and not do parsing by hand. | If I remember correctly, UriTemplate variables in the path always resolve to strings when using WebGet or WebInvoke. You can only bind UriTemplate variables to int, long, etc. when they are in the query portion of the UriTemplate. |
546,010 | <p>I'm trying to make a little gallery of some school works I've done in my animation class. I want to put 3 images on each line and they are all in divs because I did onion skin wrapping for a dropshadow on them. Unfortunately this makes them all just stick together in two lines across the page. But I want them specif... | [
{
"answer_id": 546047,
"author": "Rich Adams",
"author_id": 10018,
"author_profile": "https://Stackoverflow.com/users/10018",
"pm_score": 1,
"selected": false,
"text": "<p>I cannot see your picture, but based on your description it sounds like you're not clearing the floats. You have a b... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] | I'm trying to make a little gallery of some school works I've done in my animation class. I want to put 3 images on each line and they are all in divs because I did onion skin wrapping for a dropshadow on them. Unfortunately this makes them all just stick together in two lines across the page. But I want them specifica... | It looks like your second image may be slightly taller than your third. So your floated second line is only floating back until it hits the second image. Either set your image or wrap1 heights, or add style="clear:both" to the break tags between lines. |
546,014 | <p>I'm wondering if there is a ".net integrated" solution for exact time measurement (like the execution time of a function)? At the moment I'm using the PerformanceCounters from Kernel32. </p>
<pre><code> [DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceCounter(
out long lpPerform... | [
{
"answer_id": 546021,
"author": "BC.",
"author_id": 54838,
"author_profile": "https://Stackoverflow.com/users/54838",
"pm_score": 5,
"selected": true,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx\" rel=\"nofollow noreferrer\">The Stopwa... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43913/"
] | I'm wondering if there is a ".net integrated" solution for exact time measurement (like the execution time of a function)? At the moment I'm using the PerformanceCounters from Kernel32.
```
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceCounter(
out long lpPerformanceCount);
... | [The Stopwatch](http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx) is a high resolution framework timer class (that probably wraps that api). |
546,017 | <p>I am creating a little dashboard for a user that will allow him to run specific jobs. I am using Django so I want him to be able to click a link to start the job and then return the page back to him with a message that the job is running. The results of the job will be emailed to him later.</p>
<p>I believe I am ... | [
{
"answer_id": 546024,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 7,
"selected": true,
"text": "<pre><code>p = subprocess.Popen([sys.executable, '/path/to/script.py'], \n stdout=subproc... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4915/"
] | I am creating a little dashboard for a user that will allow him to run specific jobs. I am using Django so I want him to be able to click a link to start the job and then return the page back to him with a message that the job is running. The results of the job will be emailed to him later.
I believe I am supposed to ... | ```
p = subprocess.Popen([sys.executable, '/path/to/script.py'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
```
That will start the subprocess in background. Your script will keep running normally.
Read the documentation [here](http://d... |
546,045 | <p>I have a listview with two columns and I'm using a context menu to allow users to remove selected rows. To remove the selected rows, I've tried with the following code but it doesn't work:</p>
<pre><code>private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
listView1.SelectedItems.Clear();
}
</cod... | [
{
"answer_id": 546056,
"author": "BeefTurkey",
"author_id": 55072,
"author_profile": "https://Stackoverflow.com/users/55072",
"pm_score": 0,
"selected": false,
"text": "<p>This seems to work:</p>\n\n<pre><code> for (int i = 0; i < listView1.Items.Count; i++ )\n {\n\n if (... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55072/"
] | I have a listview with two columns and I'm using a context menu to allow users to remove selected rows. To remove the selected rows, I've tried with the following code but it doesn't work:
```
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
listView1.SelectedItems.Clear();
}
```
I suspect thi... | The latest example of BeefTurkey looks correct, but he should decrement the variable `i` after removing a selected item:
```
for (int i = 0; i < listView1.Items.Count; i++ )
{
if (listView1.Items[i].Selected)
{
listView1.Items[i].Remove();
i--;
}
}
```
The index of items larger as `i` is ... |
546,080 | <p>Has anyone done this / have some example code? </p>
| [
{
"answer_id": 546091,
"author": "BC.",
"author_id": 54838,
"author_profile": "https://Stackoverflow.com/users/54838",
"pm_score": 0,
"selected": false,
"text": "<p>Apparently Ruby has a built in <a href=\"http://harborsparrow.blogspot.com/2007/07/using-rubys-wsdl-driver-to-call.html\" r... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66084/"
] | Has anyone done this / have some example code? | ```
#use .wsdl file to initialize an RPC driver
driver = SOAP::WSDLDriverFactory.new('dotnetwebservice.wsdl').create_rpc_driver
#useful debugging call
driver.wiredump_dev = STDERR
#Set the enconding style to ASP.NET
driver.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
#call method defined ... |
546,097 | <p>This is a follow up to my <a href="https://stackoverflow.com/questions/490792/error-1053-while-trying-to-restart-stop-tomcat-5-0-30-installed-as-a-windows-ser">earlier question</a>.</p>
<p>Tomcat 5.0.28 had a bug where the Servlet's destroy() method was not being invoked by the container on a shutdown. This is fixe... | [
{
"answer_id": 546182,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 4,
"selected": false,
"text": "<blockquote>\n <p>Calling System.exit() inside a Servlet's destroy() method to forcefully kill any non-daemon threads is a g... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11299/"
] | This is a follow up to my [earlier question](https://stackoverflow.com/questions/490792/error-1053-while-trying-to-restart-stop-tomcat-5-0-30-installed-as-a-windows-ser).
Tomcat 5.0.28 had a bug where the Servlet's destroy() method was not being invoked by the container on a shutdown. This is fixed in Tomcat 5.0.30, b... | You're asking two questions:
**Question 1: Is calling System.exit() inside a Servlet's destroy() method to forcefully kill any non-daemon threads a good idea?**
Calling System.exit() inside ANY servlet-related method is always 100% incorrect. Your code is not the only code running in the JVM - **even if you are the o... |
546,101 | <p>We have a user table, every user has an unique email and username. We try to do this within our code but we want to be sure users are never inserted (or updated) in the database with the same username of email.
I've added a <code>BEFORE INSERT</code> Trigger which prevents the insertion of duplicate users.</p>
<pre... | [
{
"answer_id": 546110,
"author": "Garry Shutler",
"author_id": 6369,
"author_profile": "https://Stackoverflow.com/users/6369",
"pm_score": 3,
"selected": false,
"text": "<p>Sounds like a lot of work instead of just using one or more unique indexes. Is there a reason you haven't gone the ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29964/"
] | We have a user table, every user has an unique email and username. We try to do this within our code but we want to be sure users are never inserted (or updated) in the database with the same username of email.
I've added a `BEFORE INSERT` Trigger which prevents the insertion of duplicate users.
```
CREATE TRIGGER [db... | You can add a unique contraint on the table, this will raise an error if you try and insert or update and create duplicates
```
ALTER TABLE [Users] ADD CONSTRAINT [IX_UniqueUserEmail] UNIQUE NONCLUSTERED
(
[Email] ASC
)
ALTER TABLE [Users] ADD CONSTRAINT [IX_UniqueUserName] UNIQUE NONCLUSTERED
(
[UserName... |
546,119 | <p>What i am really trying to achieve is to full control the active TabItem by using the combobox as the navigation control. </p>
<p>Here is what ive got so far: </p>
<pre><code> <TabControl Canvas.Left="26" Canvas.Top="27" Height="100" Name="TabControl1" Width="220">
<TabItem Header="TabItem1" x:... | [
{
"answer_id": 546166,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 3,
"selected": true,
"text": "<p>If you're trying to control the TabControl from the Combo then it looks a bit backwards to me.. if you change the... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15228/"
] | What i am really trying to achieve is to full control the active TabItem by using the combobox as the navigation control.
Here is what ive got so far:
```
<TabControl Canvas.Left="26" Canvas.Top="27" Height="100" Name="TabControl1" Width="220">
<TabItem Header="TabItem1" x:Name="TabItem1">
<... | If you're trying to control the TabControl from the Combo then it looks a bit backwards to me.. if you change the SelectedIndex on the tab control to bind it to the combo it should work:
```
<TabControl Canvas.Left="26" Canvas.Top="27" Height="100" Name="TabControl1" Width="220" SelectedIndex="{Binding ElementName=Cmb... |
546,121 | <p>I'm trying to execute a web service which returns a DataTable with the following piece of code:</p>
<pre><code>$.ajax({
type: "POST",
url: url,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
//do things
... | [
{
"answer_id": 546157,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>I must admit I'm not hugely surprised - <code>DataTable</code> basically breaks most of the rules of structured da... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15928/"
] | I'm trying to execute a web service which returns a DataTable with the following piece of code:
```
$.ajax({
type: "POST",
url: url,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
//do things
}
});
... | In the end, I've decided to use the JavaScriptSerializer class to convert the DataTable into a JSON string.
Unfortunately, this class doesn't work with a DataTable so I converted the DataTable into a list of dictionnaries and pass that list to the JavaScriptSerializer class. It takes only a few lines of code and it wo... |
546,144 | <p>I'm building a little app using Java and Swing in NetBeans. Using NetBeans design window, I created a JFrame with a JPanel inside.</p>
<p>Now I want to dynamically add some jTextFields to the JPanel.
I wrote something like that:</p>
<pre><code>Vector textFieldsVector = new Vector();
JTextField tf;
int i = 0;
while... | [
{
"answer_id": 546198,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 0,
"selected": false,
"text": "<p>Your while loop is wrong. <code>i</code> never gets incremented so your window creation is in an endless loop and your CP... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28582/"
] | I'm building a little app using Java and Swing in NetBeans. Using NetBeans design window, I created a JFrame with a JPanel inside.
Now I want to dynamically add some jTextFields to the JPanel.
I wrote something like that:
```
Vector textFieldsVector = new Vector();
JTextField tf;
int i = 0;
while (i < 3) {
tf = n... | In the Netbeans GUI, set the layout manager to something like GridLayout or FlowLayout (just for testing). You can do this by going to the GUI editor, clicking on your panel, and then right-clicking and selecting a layout.
Once you've changed to a different layout, go to the properties and alter the layout properties.... |
546,149 | <p>How come unserialize isn't restoring my array? See code below..</p>
<pre><code>// prints a:1:{s:8:"txn_type";s:32:"recurring_payment_profile_cancel";}
echo $item['response'];
// prints nothing
print_r(unserialize($item['response']));
</code></pre>
<p>I understand why the print_r($response) gives me nothing</p>
... | [
{
"answer_id": 546172,
"author": "SilentGhost",
"author_id": 12855,
"author_profile": "https://Stackoverflow.com/users/12855",
"pm_score": 1,
"selected": false,
"text": "<p>works for me just fine. are you sure that <code>$item['response']</code> is a string? yeah, seems like leading whit... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27305/"
] | How come unserialize isn't restoring my array? See code below..
```
// prints a:1:{s:8:"txn_type";s:32:"recurring_payment_profile_cancel";}
echo $item['response'];
// prints nothing
print_r(unserialize($item['response']));
```
I understand why the print\_r($response) gives me nothing
\*\* edit - I noticed this
N... | Is it possible `$item['response']` contains some whitespace before or after it?
Check `strlen($item['response'])` gives you 61.
Edit: It seems to work with whitespace at the end, but whitespace at the start will make it fail to unserialize.
Edit: that error message means either you have a LOT of whitespace (almost 2... |
546,173 | <p>Hey, I am so close to fininshing my guess a number game, very simple in PHP, but for some reason I am stuck. I am storing the variable in a hidden form, but obviously each time the page is sent it resets the number so you can never get the right one.</p>
<p>Any ideas? My code is below.</p>
<pre><code><?php
// g... | [
{
"answer_id": 546174,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 2,
"selected": false,
"text": "<p>Is it because of this typo?</p>\n\n<pre><code>$numbe = $_POST['number'];\n//numbe -> number\n</code></pre>\n"
... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hey, I am so close to fininshing my guess a number game, very simple in PHP, but for some reason I am stuck. I am storing the variable in a hidden form, but obviously each time the page is sent it resets the number so you can never get the right one.
Any ideas? My code is below.
```
<?php
// generate a random number ... | Change:
```
// generate a random number for user to guess
$number = rand(1,100);
```
To:
```
if(isset($_POST['number'])) {
$number = $_POST['number'];
} else {
$number = rand(1,100);
}
``` |
546,175 | <p>I often have a subroutine in Perl that fills an array with some information. Since I'm also used to hacking in C++, I find myself often do it like this in Perl, using references:</p>
<pre><code>my @array;
getInfo(\@array);
sub getInfo {
my ($arrayRef) = @_;
push @$arrayRef, "obama";
# ...
}
</code></pre>
... | [
{
"answer_id": 546236,
"author": "user55400",
"author_id": 55400,
"author_profile": "https://Stackoverflow.com/users/55400",
"pm_score": 5,
"selected": true,
"text": "<p>What about returning an array reference in the first place?</p>\n\n<pre><code>sub getInfo {\n my $array_ref = [];\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60628/"
] | I often have a subroutine in Perl that fills an array with some information. Since I'm also used to hacking in C++, I find myself often do it like this in Perl, using references:
```
my @array;
getInfo(\@array);
sub getInfo {
my ($arrayRef) = @_;
push @$arrayRef, "obama";
# ...
}
```
instead of the more st... | What about returning an array reference in the first place?
```
sub getInfo {
my $array_ref = [];
push @$array_ref, 'foo';
# ...
return $array_ref;
}
my $a_ref = getInfo();
# or if you want the array expanded
my @array = @{getInfo()};
```
Edit according to dehmann's comment:
It's also possible to use a nor... |
546,187 | <p>I have a XML File and I want to read the data and assign it to a string array, so Operative would be assign to 1 array and JobLocation to another</p>
<pre><code><Demo>
<JOBOperatives>
<Operative>
<Clock>aaaa</Clock>
<Name>aaaaa</Name>
<Mob... | [
{
"answer_id": 546206,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>I take it you mean where each property from the xml is it's own element in the array?</p>\n\n<p>That doesn't seem l... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49971/"
] | I have a XML File and I want to read the data and assign it to a string array, so Operative would be assign to 1 array and JobLocation to another
```
<Demo>
<JOBOperatives>
<Operative>
<Clock>aaaa</Clock>
<Name>aaaaa</Name>
<MobileNumber>00000000010</MobileNumber>
<OperativeTrad... | I take it you mean where each property from the xml is it's own element in the array?
That doesn't seem like a very good data structure, especially as xml schema definitions allow for the items to arrive in any order; your expected indexes could get all screwed up. A strongly-typed object seems more appropriate and is... |
546,199 | <p>I have an HTML textbox that contains some SQL code that I need executed. I am able to retrieve the actual code from the textbox but I am not sure how to go about executing the code. Any simple and elegant ways using c# 3.5?</p>
| [
{
"answer_id": 546211,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 5,
"selected": true,
"text": "<p><strong>DON'T EXECUTE CODE FROM A TEXTBOX</strong></p>\n\n<p>unless you really trust what is being entered.</p>\n\n<p>If you... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66098/"
] | I have an HTML textbox that contains some SQL code that I need executed. I am able to retrieve the actual code from the textbox but I am not sure how to go about executing the code. Any simple and elegant ways using c# 3.5? | **DON'T EXECUTE CODE FROM A TEXTBOX**
unless you really trust what is being entered.
If you do, use this:
```
SqlConnection con = new SqlConnection("Your connection string");
con.Open();
SqlCommand cmd = new SqlCommand(TexdtBox1.Text, con);
cmd.ExecuteNonQuery();
con.Close()
```
Note that this will not return anyt... |
546,220 | <p>For example, in this text:</p>
<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu tellus vel nunc pretium lacinia. Proin sed lorem. Cras sed ipsum. Nunc a libero quis risus sollicitudin imperdiet.</p>
</blockquote>
<p>I want to match the word after 'ipsum'.</p>
| [
{
"answer_id": 546224,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": -1,
"selected": false,
"text": "<p>ipsum\\b(.*)\\b</p>\n\n<p>EDIT: \nalthough depending on your regex implementation, this could be hungry and find all words... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/154560/"
] | For example, in this text:
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu tellus vel nunc pretium lacinia. Proin sed lorem. Cras sed ipsum. Nunc a libero quis risus sollicitudin imperdiet.
>
>
>
I want to match the word after 'ipsum'. | This sounds like a job for lookbehinds, though you should be aware that not all regex flavors support them. In your example:
```
(?<=\bipsum\s)(\w+)
```
This will match any sequence of letter characters which follows "ipsum" as a whole word followed by a space. It does **not** match "ipsum" itself, you don't need to... |
546,229 | <p>I'm trying to change in runtime one key of my applications settings file, but it does not work.</p>
<p>I do on that way:</p>
<pre><code>ConfigurationSettings.AppSettings["XPTO"] = "HELLO";
</code></pre>
<p>It seems that it only changes in memory, not on the file.</p>
<p>Does anyone knows how to do this?</p>
<p>... | [
{
"answer_id": 546285,
"author": "brendan",
"author_id": 225,
"author_profile": "https://Stackoverflow.com/users/225",
"pm_score": 3,
"selected": false,
"text": "<p>The AppSettings file is not designed to be writable. It is designed to store configurations that will not change at run ti... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58251/"
] | I'm trying to change in runtime one key of my applications settings file, but it does not work.
I do on that way:
```
ConfigurationSettings.AppSettings["XPTO"] = "HELLO";
```
It seems that it only changes in memory, not on the file.
Does anyone knows how to do this?
Thanks. | Take a look at my [overview of .NET settings files](https://stackoverflow.com/questions/481025/where-property-setting-value-stored-in-c-windows-application/481064#481064)...In short, I think you want a user-scoped setting. It will behave more like you expect.
>
> **Edit:** If you are using the [settings designer in V... |
546,242 | <p>I am using mysql_num_rows to check if one row is returned for my user login and if count == 1 then log user in, I get an error though below my code is after that. Any suggestions?</p>
<blockquote>
<p>Warning: mysql_num_rows(): supplied
argument is not a valid MySQL result
resource in
/home/web42001spring09/... | [
{
"answer_id": 546252,
"author": "Dominic Rodger",
"author_id": 20972,
"author_profile": "https://Stackoverflow.com/users/20972",
"pm_score": 1,
"selected": false,
"text": "<p>Looks like you might want to do 2 things:</p>\n\n<ol>\n<li>Sanitise your input - passing user-submitted data str... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using mysql\_num\_rows to check if one row is returned for my user login and if count == 1 then log user in, I get an error though below my code is after that. Any suggestions?
>
> Warning: mysql\_num\_rows(): supplied
> argument is not a valid MySQL result
> resource in
> /home/web42001spring09/rcoughlin/pub... | You're not quoting your strings in the query, so your SQL statement is invalid.
```
$query = "SELECT username,password,id FROM login WHERE username='" . mysql_escape_string($username) . "' AND password = '" . mysql_escape_string($password) . "' LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
```
You ... |
546,276 | <p>Given the following SUT, would you consider this unit test to be unnecessary?</p>
<p>**edit : we cannot assume the names will match, so reflection wouldn't work.</p>
<p>**edit 2 : in actuality, this class would implement an IMapper interface and there would be full blown behavioral (mock) testing at the business l... | [
{
"answer_id": 546289,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 2,
"selected": false,
"text": "<p>i would question the construct itself, not the need to test it</p>\n\n<p>[reflection would be far less code]</p>\n... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66101/"
] | Given the following SUT, would you consider this unit test to be unnecessary?
\*\*edit : we cannot assume the names will match, so reflection wouldn't work.
\*\*edit 2 : in actuality, this class would implement an IMapper interface and there would be full blown behavioral (mock) testing at the business logic layer of... | It is not excessive. I'm sure not sure it fully focuses on what you want to test.
["Under the strict definition, for QA purposes, the failure of a UnitTest implicates only one unit. You know exactly where to search to find the bug."](http://c2.com/cgi/wiki?UnitTest)
The power of a unit test is in having a known corr... |
546,287 | <p>I am just starting to learn F#. In several F# coding examples I see the keyword "in" used in the following way:</p>
<pre><code>let doStuff x =
let first, second = x in
first + " " + second
</code></pre>
<p>The function works with and without the "in" at then end of the second line. What does "in" do?</p>... | [
{
"answer_id": 546326,
"author": "Mark Pim",
"author_id": 38883,
"author_profile": "https://Stackoverflow.com/users/38883",
"pm_score": 6,
"selected": true,
"text": "<p><code>in</code> is a hangover from F#'s OCaml roots and it specifies <em>bound</em> variables, which are subtly differe... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64161/"
] | I am just starting to learn F#. In several F# coding examples I see the keyword "in" used in the following way:
```
let doStuff x =
let first, second = x in
first + " " + second
```
The function works with and without the "in" at then end of the second line. What does "in" do? | `in` is a hangover from F#'s OCaml roots and it specifies *bound* variables, which are subtly different to variable *scopes*.
Think of variable binding as follows; You have an expression:
```
first + " " + second
```
As it stands `first` and `second` are unbound - they don't have any fixed values - so that expressi... |
546,299 | <p>Can someone please help me with my problem?</p>
<p>I have a gridview in a webpage, whose datasource is an oracle database. I would like to know if it is possible to change the column widths while you are on the web page?</p>
<pre><code>string select = "SELECT * FROM TABLE"
OracleCommand cmd = new OracleCommand(se... | [
{
"answer_id": 546326,
"author": "Mark Pim",
"author_id": 38883,
"author_profile": "https://Stackoverflow.com/users/38883",
"pm_score": 6,
"selected": true,
"text": "<p><code>in</code> is a hangover from F#'s OCaml roots and it specifies <em>bound</em> variables, which are subtly differe... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can someone please help me with my problem?
I have a gridview in a webpage, whose datasource is an oracle database. I would like to know if it is possible to change the column widths while you are on the web page?
```
string select = "SELECT * FROM TABLE"
OracleCommand cmd = new OracleCommand(select, connectionstrin... | `in` is a hangover from F#'s OCaml roots and it specifies *bound* variables, which are subtly different to variable *scopes*.
Think of variable binding as follows; You have an expression:
```
first + " " + second
```
As it stands `first` and `second` are unbound - they don't have any fixed values - so that expressi... |
546,319 | <p>I wanted to use boost::thread in my program, but get the following compiler error (Visual Studio 2005):</p>
<pre><code>Error 1 **error C2064**: term does not evaluate to a function taking 0
arguments d:\...\boost_1_37_0\boost\thread\detail\thread.hpp 56
</code></pre>
<p>Therefore I tried to recreate the pro... | [
{
"answer_id": 546329,
"author": "mch",
"author_id": 32515,
"author_profile": "https://Stackoverflow.com/users/32515",
"pm_score": 0,
"selected": false,
"text": "<p>You are passing a member function to the thread object as the function to call when the thread starts. Since the thread do... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63520/"
] | I wanted to use boost::thread in my program, but get the following compiler error (Visual Studio 2005):
```
Error 1 **error C2064**: term does not evaluate to a function taking 0
arguments d:\...\boost_1_37_0\boost\thread\detail\thread.hpp 56
```
Therefore I tried to recreate the problem in a small program an... | Try it like this - the boost::thread constructor is expecting a boost::function0 (which a function pointer is, but a member function pointer isn't, due to the this pointer).
```
void HelloWorld::entry()
{
boost::thread thrd(boost::bind(&HelloWorld::hello,this));
thrd.join();
}
``` |
546,321 | <p>I am using the datetime Python module. I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?</p>
<p>The reason I want to generate a date 6 months from the current date is to produce a <em>review date</em>. If the user enters data into the system it will... | [
{
"answer_id": 546331,
"author": "Devin Jeanpierre",
"author_id": 18515,
"author_profile": "https://Stackoverflow.com/users/18515",
"pm_score": -1,
"selected": false,
"text": "<p>Use the python datetime module to add a timedelta of six months to datetime.today() .</p>\n\n<p><a href=\"htt... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30786/"
] | I am using the datetime Python module. I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?
The reason I want to generate a date 6 months from the current date is to produce a *review date*. If the user enters data into the system it will have a review date... | I found this solution to be good. (This uses the [python-dateutil extension](https://dateutil.readthedocs.org/en/latest/))
```
from datetime import date
from dateutil.relativedelta import relativedelta
six_months = date.today() + relativedelta(months=+6)
```
The advantage of this approach is that it takes care of i... |
546,337 | <p>I'm using Python 2.x and I have an object I'm summoning from the aether; the documentation on it is not particularly clear. I would like to be able to get a list of properties for that object and the type of each property. </p>
<p>Similarly, I'd like to get a list of methods for that object, as well, plus any oth... | [
{
"answer_id": 546349,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 5,
"selected": false,
"text": "<p>Well ... Your first stop will be a simple dir(object). This will show you all the object's members, both fields and meth... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using Python 2.x and I have an object I'm summoning from the aether; the documentation on it is not particularly clear. I would like to be able to get a list of properties for that object and the type of each property.
Similarly, I'd like to get a list of methods for that object, as well, plus any other informati... | Well ... Your first stop will be a simple dir(object). This will show you all the object's members, both fields and methods. Try it in an interactive Python shell, and play around a little.
For instance:
```
> class Foo:
def __init__(self):
self.a = "bar"
self.b = 4711
> a=Foo()
> dir(a)
['__doc__', '__in... |
546,344 | <p>Thanks for reading this.</p>
<p>I imagine this is really a javascript question, and my title probably does not get at the heart of what I am trying to do, but I want to store the result of my ajax request in a global variable. This would allow me to test the var before making the ajax call...and avoid repeated ajax... | [
{
"answer_id": 546382,
"author": "jacobangel",
"author_id": 31318,
"author_profile": "https://Stackoverflow.com/users/31318",
"pm_score": 0,
"selected": false,
"text": "<p>JavaScript's scoping is such that if you just declared a global variable, you should be able to access it from withi... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755/"
] | Thanks for reading this.
I imagine this is really a javascript question, and my title probably does not get at the heart of what I am trying to do, but I want to store the result of my ajax request in a global variable. This would allow me to test the var before making the ajax call...and avoid repeated ajax calls for... | jQuery has a $.data method which you can use to store/retrieve items related to any element on the page.
```
//e.g. create some object
var inst = {};
inst.name = 'My Name'
var target = $('#textbox1');
//save the data
$.data(target, 'PROP_NAME', inst);
//retrieve the instance
var inst = $.data(target, 'PROP_NAME');... |
546,345 | <p>I have the following code:</p>
<pre><code>Public Enum Country
Canada = 1
USA = 2
End Enum
</code></pre>
<p>When I want to see if the user has selected a value, I do:</p>
<pre><code>ddl.SelectedValue = Country.Canada
</code></pre>
<p>Which works fine. However, if I turn on a warning for implicit conversion... | [
{
"answer_id": 546351,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 1,
"selected": false,
"text": "<p>You can explicitly cast the SelectedValue to an int, or the Country as a string.</p>\n\n<pre><code>If CInt(ddl.SelectedValu... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4782/"
] | I have the following code:
```
Public Enum Country
Canada = 1
USA = 2
End Enum
```
When I want to see if the user has selected a value, I do:
```
ddl.SelectedValue = Country.Canada
```
Which works fine. However, if I turn on a warning for implicit conversion, this gives a warning. Changing it to
```
ddl.Se... | You can explicitly cast the SelectedValue to an int, or the Country as a string.
```
If CInt(ddl.SelectedValue) = Country.Canada
```
or
```
If ddl.SelectedValue = CStr(Country.Canada)
```
If you take the first option, you might need to explicitly declare your enum as Integer
```
Public Enum Country As Integer
`... |
546,348 | <p>Suppose that for every Form in a WinForms application, you want to change the cursor to the WaitCursor. The obvious way to do this would be to add the code to every place where a form is instantiated/shown:</p>
<pre><code>Try
Me.Cursor = Cursors.WaitCursor
Dim f As New frmMyForm
f.Show()
Catch ex As E... | [
{
"answer_id": 546450,
"author": "ng5000",
"author_id": 36860,
"author_profile": "https://Stackoverflow.com/users/36860",
"pm_score": 3,
"selected": true,
"text": "<p>To answer your question - there are no global .Net events to achieve what you want. There isn'y any pure .net solution t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62477/"
] | Suppose that for every Form in a WinForms application, you want to change the cursor to the WaitCursor. The obvious way to do this would be to add the code to every place where a form is instantiated/shown:
```
Try
Me.Cursor = Cursors.WaitCursor
Dim f As New frmMyForm
f.Show()
Catch ex As Exception
T... | To answer your question - there are no global .Net events to achieve what you want. There isn'y any pure .net solution to this. You could take a look at Aspect Orientated Programming and Cross Cutting Concerns - there may be an AOP solution to this (some googling will get you started then post back here for details).
... |
546,365 | <p>I'm uploading a file to the server. The file upload HTML form has 2 fields:</p>
<ol><li>File name - A HTML text box where the user can give a name in any language.</li>
<li> File upload - A HTMl 'file' where user can specify a file from disk to upload.</li></ol>
<p>When the form is submitted, the file contents ar... | [
{
"answer_id": 546531,
"author": "Michael Glenn",
"author_id": 9424,
"author_profile": "https://Stackoverflow.com/users/9424",
"pm_score": 2,
"selected": false,
"text": "<p>The filter is key for IE. A few other things to check;</p>\n\n<p>What is the page encoding and character set? Both ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm uploading a file to the server. The file upload HTML form has 2 fields:
1. File name - A HTML text box where the user can give a name in any language.
2. File upload - A HTMl 'file' where user can specify a file from disk to upload.
When the form is submitted, the file contents are received properly. However, whe... | I had the same problem using Apache commons-fileupload.
I did not find out what causes the problems especially because I have the UTF-8 encoding in the following places:
1. HTML meta tag
2. Form accept-charset attribute
3. Tomcat filter on every request that sets the "UTF-8" encoding
-> My solution was to especially c... |
546,369 | <p>After I get response from httpwebrequest, I'd like the cookies obtained to save for the purpose of using them in another httbwebrequest. However, I'd need to insert CookieCollection to CookieContainer. How do I do that? Tried to do:</p>
<pre><code>request.Cookiecontainer.add(response.Cookies);
</code></pre>
<p>but... | [
{
"answer_id": 546421,
"author": "John Rasch",
"author_id": 44765,
"author_profile": "https://Stackoverflow.com/users/44765",
"pm_score": 2,
"selected": false,
"text": "<pre><code>request.CookieContainer.Add(response.Cookies);\n</code></pre>\n"
},
{
"answer_id": 546512,
"auth... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21209/"
] | After I get response from httpwebrequest, I'd like the cookies obtained to save for the purpose of using them in another httbwebrequest. However, I'd need to insert CookieCollection to CookieContainer. How do I do that? Tried to do:
```
request.Cookiecontainer.add(response.Cookies);
```
but this keeps getting out of... | ```
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(response.Cookies);
```
According to Microsoft:
>
> CookieContainer is a null reference (Nothing in Visual Basic) by default. You must assign a CookieContainer object to the property to have cookies returned in the Cookies property of t... |
546,385 | <p>I am trying to write a view that will generate a report which displays all Items within my Inventory system, and provide summaries at a certain point. This report is purely just an HTML template by the way.</p>
<p>In my case, each Item is part of an Order. An Order can have several items, and I want to be able to d... | [
{
"answer_id": 546429,
"author": "Akbar ibrahim",
"author_id": 39540,
"author_profile": "https://Stackoverflow.com/users/39540",
"pm_score": 1,
"selected": false,
"text": "<p>You could compute the subtotals in Python in the Django view.</p>\n\n<p>The sub-totals could be stored in instanc... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25465/"
] | I am trying to write a view that will generate a report which displays all Items within my Inventory system, and provide summaries at a certain point. This report is purely just an HTML template by the way.
In my case, each Item is part of an Order. An Order can have several items, and I want to be able to display SUM... | Subtotals are `SELECT SUM(qty) GROUP BY order_number` things.
They are entirely separate from a query to get details.
The results of the two queries need to be interleaved. A good way to do this is to create each order as a tuple `( list_of_details, appropriate summary )`.
Then the display is easy
```
{% for order ... |
546,388 | <p>I've been trying to get my WPF application to prompt users to either discard their unsaved changes or to cancel when they navigate using a TreeView.</p>
<ul>
<li><a href="https://stackoverflow.com/questions/542392/how-can-i-cancel-a-users-wpf-treeview-click">How can I cancel a user’s WPF
TreeView click?</a></li>
<l... | [
{
"answer_id": 698725,
"author": "Alexandra",
"author_id": 77255,
"author_profile": "https://Stackoverflow.com/users/77255",
"pm_score": 2,
"selected": false,
"text": "<p>I'm having precisely the same problem and you're right in thinking that MessageBox is screwing things up. To be hones... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I've been trying to get my WPF application to prompt users to either discard their unsaved changes or to cancel when they navigate using a TreeView.
* [How can I cancel a user’s WPF
TreeView click?](https://stackoverflow.com/questions/542392/how-can-i-cancel-a-users-wpf-treeview-click)
* [How do I
properly handle a Pr... | I'm having precisely the same problem and you're right in thinking that MessageBox is screwing things up. To be honest, I've had other issues with MessageBox while working with Windows Forms before switching to WPF. Maybe it's just some century-old bug that became a feature (as often it is with Microsoft)?
In any case... |
546,392 | <p>I know that in the next version of ASP.NET we'll finally be able to set the clientids on System.Web controls without the framework doing it for us in a quasi-intelligent way e.g:</p>
<pre><code>id="ctl00__loginStatus__profileButton"
</code></pre>
<p>Does anyone know a good method in the meantime to force the above... | [
{
"answer_id": 546422,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 4,
"selected": true,
"text": "<p>What I tend to do is dynamically generate javascript methods which handle this. You can do this in markup or code behi... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21574/"
] | I know that in the next version of ASP.NET we'll finally be able to set the clientids on System.Web controls without the framework doing it for us in a quasi-intelligent way e.g:
```
id="ctl00__loginStatus__profileButton"
```
Does anyone know a good method in the meantime to force the above id to something like
```... | What I tend to do is dynamically generate javascript methods which handle this. You can do this in markup or code behind so for example:
```
<script language="javascript" type="text/javascript">
function doXYZ()
{
$("#" + getListBoxId()).css(...)
}
function getListBoxId()
{
return "<%=this.myListBox.ClientId>";
}... |
546,403 | <p>I currently have my PHP class variables set up like this:</p>
<pre><code>class someThing {
private $cat;
private $dog;
private $mouse;
private $hamster;
private $zebra;
private $lion;
//getters, setters and other methods
}
</code></pre>
<p>But I've also seen people using a single arra... | [
{
"answer_id": 546423,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": false,
"text": "<p>If you're using <code>private $data;</code> you've just got an impenetrable blob of data there... Explicitly stating them ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21709/"
] | I currently have my PHP class variables set up like this:
```
class someThing {
private $cat;
private $dog;
private $mouse;
private $hamster;
private $zebra;
private $lion;
//getters, setters and other methods
}
```
But I've also seen people using a single array to store all the variabl... | Generally, the first is better for reasons other people have stated here already.
However, if you need to store data on a class privately, but the footprint of data members is unknown, you'll often see your 2nd example combined with \_\_get() \_\_set() hooks to hide that they're being stored privately.
```
class some... |
546,404 | <p>Im using the AutoPersistenceModel in Fluent NHIbernate to map all my entities and that all works fine :D</p>
<p>However, several of my objects have</p>
<pre><code>public virtual IList<Comment> Comments { get; set; }
</code></pre>
<p>In the database there is a single comments table, and each entity with the ... | [
{
"answer_id": 547607,
"author": "James Gregory",
"author_id": 27206,
"author_profile": "https://Stackoverflow.com/users/27206",
"pm_score": 4,
"selected": true,
"text": "<p>I know it's not what you want to hear, but the answer is no.</p>\n\n<p>In the current design of Fluent NHibernate,... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28543/"
] | Im using the AutoPersistenceModel in Fluent NHIbernate to map all my entities and that all works fine :D
However, several of my objects have
```
public virtual IList<Comment> Comments { get; set; }
```
In the database there is a single comments table, and each entity with the above code, has its own link table to c... | I know it's not what you want to hear, but the answer is no.
In the current design of Fluent NHibernate, there isn't a way to apply conventions to collections while having knowledge of the types they're being used in, you can apply something to all collections just not depending on their contained type. This is a flaw... |
546,410 | <p>I've got a sql query (using MS-SQL 2005) that generates data with these columns:</p>
<pre><code>TimeStamp | SpeedMax | SpeedMin | HeightMax | HeightMin
-------------------------------------------------------
10 | 50 | 10 | 300 | 70
</code></pre>
<p>The form I need it in though is this:</p>... | [
{
"answer_id": 546466,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 3,
"selected": true,
"text": "<pre><code>SELECT TimeStamp,\n minmax,\n CASE WHEN minmax = 0 THEN SpeedMax ELSE SpeedMin END AS Speed\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11898/"
] | I've got a sql query (using MS-SQL 2005) that generates data with these columns:
```
TimeStamp | SpeedMax | SpeedMin | HeightMax | HeightMin
-------------------------------------------------------
10 | 50 | 10 | 300 | 70
```
The form I need it in though is this:
```
TimeStamp | Speed | Heig... | ```
SELECT TimeStamp,
minmax,
CASE WHEN minmax = 0 THEN SpeedMax ELSE SpeedMin END AS Speed
CASE WHEN minmax = 0 THEN HeightMax ELSE HeightMin END AS Height
FROM Table,
(
SELECT 0 AS minmax
UNION ALL
SELECT 1
) mm
```
You may add
```
OPTION (FORCE ORDER)
```
to avoid double scan on... |
546,411 | <p>I have a situation where I need to add an arbitrary unique id to each of a group of records. It's easier to visualize this below. </p>
<p>Edited 11:26 est:
Currently the lineNum field has garbage. This is running on sql server 2000. The sample that follows is what the results should look like but the actual values ... | [
{
"answer_id": 546432,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 0,
"selected": false,
"text": "<p>You could create a cursor that reads all values sorted, then at each change in value resets the 1 then steps through increm... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288/"
] | I have a situation where I need to add an arbitrary unique id to each of a group of records. It's easier to visualize this below.
Edited 11:26 est:
Currently the lineNum field has garbage. This is running on sql server 2000. The sample that follows is what the results should look like but the actual values aren't imp... | Assuming your using SQL Server 2005 or better you can use Row\_Number()
```
select orderId,
row_number() over(PARTITION BY orderId ORDER BY orderId) as lineNum
from Order
``` |
546,438 | <p>My project is to make a module enrollment system for our university. So I contacted the IT people in my university for details to authenticate the students into the system. We are developing the system using the existing university login. They gave me some LDAP information, I don't know the usage of that.
I'm using... | [
{
"answer_id": 546452,
"author": "Emil Sit",
"author_id": 55284,
"author_profile": "https://Stackoverflow.com/users/55284",
"pm_score": 2,
"selected": false,
"text": "<p>You might try <a href=\"http://code.activestate.com/recipes/101525/\" rel=\"nofollow noreferrer\">http://code.activest... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My project is to make a module enrollment system for our university. So I contacted the IT people in my university for details to authenticate the students into the system. We are developing the system using the existing university login. They gave me some LDAP information, I don't know the usage of that.
I'm using PH... | The general procedure would be (relevant ext/ldap php commands in brackets):
1. connect to LDAP server using the "LDAP Host" and "LDAP port no" ([ldap\_connect()](http://de2.php.net/manual/en/function.ldap-connect.php)) and set the correct connection options ([ldap\_set\_option()](http://de2.php.net/manual/en/function... |
546,461 | <p>Is it possible to redirect to a different view from a controller? </p>
<p>For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense.</p>
| [
{
"answer_id": 546474,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 8,
"selected": true,
"text": "<p>You can use the <code>RedirectToAction()</code> method, then the action you redirect to can return a View. The easies... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | You can use the `RedirectToAction()` method, then the action you redirect to can return a View. The easiest way to do this is:
```
return RedirectToAction("Index", model);
```
Then in your Index method, return the view you want. |
546,483 | <p>I am currently using CreateProcess/WaitForSingleObject from within a win32 GUI app to launch a small GUI app that deals with software licensing issues. This all works fine, but it essentially hangs the "parent" app while it waits for the licensing app to finish its work. During this time, updates to the parent app d... | [
{
"answer_id": 546536,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 1,
"selected": false,
"text": "<p>I suggest you can handle this as follows:</p>\n\n<ul>\n<li>Parent application does CreateProcess, and then returns immed... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am currently using CreateProcess/WaitForSingleObject from within a win32 GUI app to launch a small GUI app that deals with software licensing issues. This all works fine, but it essentially hangs the "parent" app while it waits for the licensing app to finish its work. During this time, updates to the parent app do n... | Your parent process appears to hang because the WaitForSingleObject() call blocks your thread until the handle you pass into the call is signaled.
Your child process likely hangs during the copy-to-clipboard operation because it is, as a part of that operation, sending a message either specifically to the parent proce... |
546,486 | <p>My question is a slight variation on the question <a href="https://stackoverflow.com/questions/322003/what-is-the-best-way-to-test-whether-a-file-exists-on-windows">What is the best way to test whether a file exists on Windows?</a>, with some specific caveats. Specifically, the data is located on a mapped drive, an... | [
{
"answer_id": 606645,
"author": "Randy Proctor",
"author_id": 22131,
"author_profile": "https://Stackoverflow.com/users/22131",
"pm_score": -1,
"selected": false,
"text": "<p>Just open it.</p>\n"
},
{
"answer_id": 904137,
"author": "dwc",
"author_id": 57301,
"author_... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30103/"
] | My question is a slight variation on the question [What is the best way to test whether a file exists on Windows?](https://stackoverflow.com/questions/322003/what-is-the-best-way-to-test-whether-a-file-exists-on-windows), with some specific caveats. Specifically, the data is located on a mapped drive, and the SMB 2.0 p... | While not a programmatic solution, I found an effective workaround (with the help of Microsoft support). I wanted to post the workaround here in case anyone else is as frustrated by this as I have been. Because this behavior is a "feature" of SMB2, Microsoft has provided the following registry entries to override the d... |