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 |
|---|---|---|---|---|---|---|
314,213 | <p>How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the 'My' structure.
Thank you.</p>
| [
{
"answer_id": 314228,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 1,
"selected": false,
"text": "<p>Well, you would try to connect to the specific ip, and handle denies and timeouts.</p>\n\n<p>Look at the TcpClient... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37350/"
] | How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the 'My' structure.
Thank you. | If you just want to check if the network is up then use:
```
bool networkUp
= System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
```
To check a specific interface's status (or other info) use:
```
NetworkInterface[] networkCards
= System.Net.NetworkInformation.NetworkInterface.GetAllNet... |
314,232 | <p>I have a DateTime object that I need to print in a custom gridlike control.
The type of the data I want to print is a date in the format dd-mm-yyyy.
This value can be either filled or blank.
If it's filled it will be parsed into a <code>DateTime</code> and then printed as the default <code>ToString</code>.</p>
<p>F... | [
{
"answer_id": 314263,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 3,
"selected": true,
"text": "<pre><code>Container.Value.Length > 0 ? Convert.ToDateTime(Container.Value).ToShortTimeString() : \"\"\n</code></pre>\... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40274/"
] | I have a DateTime object that I need to print in a custom gridlike control.
The type of the data I want to print is a date in the format dd-mm-yyyy.
This value can be either filled or blank.
If it's filled it will be parsed into a `DateTime` and then printed as the default `ToString`.
For each row, I can use
```
<Cel... | ```
Container.Value.Length > 0 ? Convert.ToDateTime(Container.Value).ToShortTimeString() : ""
```
You should also be able to pass `Container.Value` to any method in scope that you've defined. |
314,245 | <p>I have this code:</p>
<pre><code>db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5"
TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt"
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.... | [
{
"answer_id": 314285,
"author": "Daniel Kreiseder",
"author_id": 31406,
"author_profile": "https://Stackoverflow.com/users/31406",
"pm_score": 0,
"selected": false,
"text": "<p>I think there is something wrong with the spaces in your connection string</p>\n\n<p>Try this:</p>\n\n<pre><co... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have this code:
```
db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5"
TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt"
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.Open _
"Pro... | I have tried to reproduce this on several databases and machines, I can't get your code to fail.
Leaves :
* a corrupt database, could you please run repair and try again ?
* Fields in your database that are throwing of the query, I have tried several possibilities but can't find anything that brakes your code. To exc... |
314,254 | <p>I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that doesn't work...</p>
| [
{
"answer_id": 314337,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "https://Stackoverflow.com/users/15955",
"pm_score": 2,
"selected": false,
"text": "<p>All OpenGL|ES complient GL-implementations have to support GL_RGBA as a parameter to glReadPixels. </p>\n\n<p>... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL\_BGRA but on the iPhone that doesn't work... | All OpenGL|ES complient GL-implementations have to support GL\_RGBA as a parameter to glReadPixels.
If your OpenGL|Es supports the
```
GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES
```
extension you can also query the native format. glReadPixels will understand this format as a parameter to glReadPixels and allows you... |
314,256 | <p>My Cocoa app needs some small dynamically generated windows. How can I programmatically create Cocoa windows at runtime?</p>
<p>This is my non-working attempt so far. I see no result whatsoever.</p>
<pre><code>NSRect frame = NSMakeRect(0, 0, 200, 200);
NSUInteger styleMask = NSBorderlessWindowMask;
NSRect rect ... | [
{
"answer_id": 314308,
"author": "Steve McLeod",
"author_id": 2959,
"author_profile": "https://Stackoverflow.com/users/2959",
"pm_score": 2,
"selected": false,
"text": "<p>This is what I've come up with myself:</p>\n\n<pre><code>NSRect frame = NSMakeRect(100, 100, 200, 200);\nNSUInteger ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959/"
] | My Cocoa app needs some small dynamically generated windows. How can I programmatically create Cocoa windows at runtime?
This is my non-working attempt so far. I see no result whatsoever.
```
NSRect frame = NSMakeRect(0, 0, 200, 200);
NSUInteger styleMask = NSBorderlessWindowMask;
NSRect rect = [NSWindow contentRe... | The problem is that you don't want to call `display`, you want to call either `makeKeyAndOrderFront` or `orderFront` depending on whether or not you want the window to become the key window. You should also probably use `NSBackingStoreBuffered`.
This code will create your borderless, blue window at the bottom left of ... |
314,277 | <p>I am getting an vba error 3271; Invalid property value. This happens when trying to append a memo field in a querydef. Any ideas on how to get around this?</p>
<p>Example:</p>
<pre><code>public sub TestMemoField
Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("AppendRecord")
qdf.Parameters("@SomeBi... | [
{
"answer_id": 314486,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 2,
"selected": false,
"text": "<p>Apparently you cannot have a parameter longer than 255 characters ( <a href=\"http://support.microsoft.com/kb/275116\" ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37797/"
] | I am getting an vba error 3271; Invalid property value. This happens when trying to append a memo field in a querydef. Any ideas on how to get around this?
Example:
```
public sub TestMemoField
Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("AppendRecord")
qdf.Parameters("@SomeBigText").value = string(... | Apparently you cannot have a parameter longer than 255 characters ( <http://support.microsoft.com/kb/275116> ).
It is possible to use a recordset, or to use:
```
qdf.SQL="INSERT INTO Sometable (SomeField) Values('" & String(1000, "A") & "')"
``` |
314,300 | <p>I would like to upload files from java application/applet using POST http event. I would like to avoid to use any library not included in SE, unless there is no other (feasible) option. <br>
So far I come up only with very simple solution. <br>
- Create String (Buffer) and fill it with compatible header (<a href="h... | [
{
"answer_id": 314615,
"author": "Josh",
"author_id": 2204759,
"author_profile": "https://Stackoverflow.com/users/2204759",
"pm_score": 2,
"selected": false,
"text": "<p>You need to learn about the chunked encoding used in newer versions of HTTP. The Apache HttpClient library is a good r... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40271/"
] | I would like to upload files from java application/applet using POST http event. I would like to avoid to use any library not included in SE, unless there is no other (feasible) option.
So far I come up only with very simple solution.
- Create String (Buffer) and fill it with compatible header (<http://www.ietf... | You need to use the `java.net.URL` and `java.net.URLConnection` classes.
There are some good examples at <http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html>
Here's some quick and nasty code:
```
public void post(String url) throws Exception {
URL u = new URL(url);
URLConnection c = ... |
314,301 | <p>I am creating a large table dynamically using Javascript.
I have realised the time taken to add a new row grows exponentially as the number of rows increase.</p>
<p>I suspect the Page is getting refreshed in each loop per row (I am also adding input elements of type text on each cell)</p>
<p>Is there a way to stop... | [
{
"answer_id": 314323,
"author": "Zebra North",
"author_id": 17440,
"author_profile": "https://Stackoverflow.com/users/17440",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe build your table as a big string of HTML, and then set the .innerHTML of a container div to that string when ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] | I am creating a large table dynamically using Javascript.
I have realised the time taken to add a new row grows exponentially as the number of rows increase.
I suspect the Page is getting refreshed in each loop per row (I am also adding input elements of type text on each cell)
Is there a way to stop the page "refres... | Use the table DOM to loop trough the rows and cells to populate them, instead of using document.getElementByID() to get each individual cell.
```
E.g.
thisTable = document.getElementByID('mytable');//get the table
oneRow = thisTable.rows[0].cells; //for instance the first row
for (var colCount = 0; colCount <totalCols... |
314,307 | <p>I have two tables: a source table and a target table. The target table will have a subset of the columns of the source table. I need to update a single column in the target table by joining with the source table based on another column. The update statement is as follows:</p>
<pre><code>UPDATE target_table tt
SE... | [
{
"answer_id": 314327,
"author": "SquareCog",
"author_id": 15962,
"author_profile": "https://Stackoverflow.com/users/15962",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Update:</strong> Ok, now that the query has been fixed -- I've done this exact thing many times, on unindexed... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20133/"
] | I have two tables: a source table and a target table. The target table will have a subset of the columns of the source table. I need to update a single column in the target table by joining with the source table based on another column. The update statement is as follows:
```
UPDATE target_table tt
SET special_id = ( ... | Your initial query executes the inner subquery once for every row in the outer table. See if Oracle likes this better:
```
UPDATE target_table
SET special_id = st.source_special_id
FROM
target_table tt
INNER JOIN
source_table st
WHERE tt.another_id = st.another_id
```
(edited after posted quer... |
314,314 | <p>I have a rather large (many gigabytes) table of data in SQL Server that I wish to move to a table in another database on the same server.</p>
<p>The tables are the same layout.</p>
<p>What would be the most effecient way of going about doing this?</p>
<p>This is a one off operation so no automation is required.</... | [
{
"answer_id": 314338,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 4,
"selected": true,
"text": "<p>If it is a one-off operation, why care about <em>top</em> efficiency so much?</p>\n\n<pre><code>SELECT * INTO OtherDatab... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/770/"
] | I have a rather large (many gigabytes) table of data in SQL Server that I wish to move to a table in another database on the same server.
The tables are the same layout.
What would be the most effecient way of going about doing this?
This is a one off operation so no automation is required.
Many thanks. | If it is a one-off operation, why care about *top* efficiency so much?
```
SELECT * INTO OtherDatabase..NewTable FROM ThisDatabase..OldTable
```
or
```
INSERT OtherDatabase..NewTable
SELECT * FROM ThisDatabase..OldTable
```
...and let it run over night. I would dare to say that using SELECT/INSERT INTO on the sam... |
314,321 | <p>I've looked this up a thousand times, and I always forget it, so, here for eternity:</p>
<p>Solaris has a bit of an awkward syntax for <code>tail</code>.</p>
<p>How do I do the equivalent of BSD's <code>tail -n<i>N</i></code>?</p>
<p>What I want are the last N lines from tail's input.</p>
| [
{
"answer_id": 314341,
"author": "Ulf Lindback",
"author_id": 30354,
"author_profile": "https://Stackoverflow.com/users/30354",
"pm_score": 5,
"selected": true,
"text": "<p>Just remove the \"n\"</p>\n\n<pre><code>tail -100\n</code></pre>\n"
},
{
"answer_id": 314367,
"author":... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13989/"
] | I've looked this up a thousand times, and I always forget it, so, here for eternity:
Solaris has a bit of an awkward syntax for `tail`.
How do I do the equivalent of BSD's `tail -n*N*`?
What I want are the last N lines from tail's input. | Just remove the "n"
```
tail -100
``` |
314,329 | <p>OK, this is my own fault, but I can't seem to rescue myself.</p>
<p>Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":</p>
<p><img src="https://i.stack.imgur.com/3pfTr.... | [
{
"answer_id": 314353,
"author": "Ali Ersöz",
"author_id": 4215,
"author_profile": "https://Stackoverflow.com/users/4215",
"pm_score": 2,
"selected": false,
"text": "<p>Check if your projects have a project reference, not a DLL reference! If there exists a DLL reference, your changes wil... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] | OK, this is my own fault, but I can't seem to rescue myself.
Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":
 Handles YourGridcontrol.MouseDown
YourGridcontrol.PerformAction(Inf... |
314,384 | <p>How do you parse a CSV file using gawk? Simply setting <code>FS=","</code> is not enough, as a quoted field with a comma inside will be treated as multiple fields.</p>
<p>Example using <code>FS=","</code> which does not work:</p>
<p>file contents:</p>
<pre><code>one,two,"three, four",five
"six, seven",eight,"nin... | [
{
"answer_id": 314421,
"author": "MCS",
"author_id": 1094969,
"author_profile": "https://Stackoverflow.com/users/1094969",
"pm_score": 0,
"selected": false,
"text": "<p>Here's what I came up with. Any comments and/or better solutions would be appreciated.</p>\n\n<pre><code>BEGIN { FS=\"... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1094969/"
] | How do you parse a CSV file using gawk? Simply setting `FS=","` is not enough, as a quoted field with a comma inside will be treated as multiple fields.
Example using `FS=","` which does not work:
file contents:
```
one,two,"three, four",five
"six, seven",eight,"nine"
```
gawk script:
```
BEGIN { FS="," }
{
for... | The short answer is "I wouldn't use gawk to parse CSV if the CSV contains awkward data", where 'awkward' means things like commas in the CSV field data.
The next question is "What other processing are you going to be doing", since that will influence what alternatives you use.
I'd probably use Perl and the Text::CSV ... |
314,397 | <p>More detail to my question:</p>
<p>HTML and JavaScript are called "client-side code".</p>
<p>C# and VB in the code behind files are termed "server-side code".</p>
<p>So what is inline-asp, and 'runat=server' code blocks called?</p>
<pre><code><!-- This is called "client-side" -->
<p>Hello World</p... | [
{
"answer_id": 314402,
"author": "Gabe Sumner",
"author_id": 12689,
"author_profile": "https://Stackoverflow.com/users/12689",
"pm_score": 1,
"selected": false,
"text": "<p>I call them \"server tags\" or \"server-side tags\".</p>\n\n<p>No idea if this is correct or not.</p>\n"
},
{
... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11917/"
] | More detail to my question:
HTML and JavaScript are called "client-side code".
C# and VB in the code behind files are termed "server-side code".
So what is inline-asp, and 'runat=server' code blocks called?
```
<!-- This is called "client-side" -->
<p>Hello World</p>
<script>alert("Hello World");</script>
```
...... | To be explicit, Microsoft calls them Embedded Code Blocks.
<http://msdn.microsoft.com/en-us/library/ms178135.aspx>
They are code blocks embeded into the page lifecycle by being called during the Render phase. |
314,401 | <p>What is the simplest way to read a full line in a C console program
The text entered might have a variable length and we can't make any assumption about its content.</p>
| [
{
"answer_id": 314422,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 8,
"selected": true,
"text": "<p>You need dynamic memory management, and use the <code>fgets</code> function to read your line. However, t... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2011/"
] | What is the simplest way to read a full line in a C console program
The text entered might have a variable length and we can't make any assumption about its content. | You need dynamic memory management, and use the `fgets` function to read your line. However, there seems to be no way to see how many characters it read. So you use fgetc:
```
char * getline(void) {
char * line = malloc(100), * linep = line;
size_t lenmax = 100, len = lenmax;
int c;
if(line == NULL)
... |
314,415 | <p>Why use a GlobalClass? What are they for? I have inherited some code (shown below) and as far as I can see there is no reason why strUserName needs this. What is all for?</p>
<pre><code>public static string strUserName
{
get { return m_globalVar; }
set { m_globalVar = value; }
}
</code></pre... | [
{
"answer_id": 314429,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 0,
"selected": false,
"text": "<p>When you want to use a <b>static</b> member of a type, you use it like <code>ClassName.MemberName</code>. If your code snip... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why use a GlobalClass? What are they for? I have inherited some code (shown below) and as far as I can see there is no reason why strUserName needs this. What is all for?
```
public static string strUserName
{
get { return m_globalVar; }
set { m_globalVar = value; }
}
```
Used later as:
```
... | You get all the bugs of global state and none of the yucky direct variable access.
If you're going to do it, then your coder implemented it pretty well. He/She probably thought (correctly) that they would be free to swap out an implementation later.
Generally it's viewed as a bad idea since it makes it difficult to ... |
314,423 | <p>I've been tasked with integration testing of a large system. Presently, I have a COM dll that I'm testing useing a UI that I created that kicks off a series of unit tests that call into the dll. This works, but I'm wanting to migrate this over to MbUnit. When I start the first test in MbUnit, it seems to hang at "F... | [
{
"answer_id": 339836,
"author": "Excel Kobayashi",
"author_id": 42911,
"author_profile": "https://Stackoverflow.com/users/42911",
"pm_score": 0,
"selected": false,
"text": "<p>Try stepping through the code manually with a debugger.</p>\n"
},
{
"answer_id": 448702,
"author": ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been tasked with integration testing of a large system. Presently, I have a COM dll that I'm testing useing a UI that I created that kicks off a series of unit tests that call into the dll. This works, but I'm wanting to migrate this over to MbUnit. When I start the first test in MbUnit, it seems to hang at "Found... | This is how we kick off our MBUnit test application (command line):
```
namespace UnitTest
{
class Program
{
static void Main(string[] args_)
{
// run unit test
AutoRunner auto = new AutoRunner();
auto.Load();
auto.Run();
HtmlReport report = new HtmlReport();
string fi... |
314,424 | <p>I have a report reading records out of a DMS system and I thought it would be nice to have a link to the documents that it is listing so that the users could view the actual documents. </p>
<p>However when it displays a Word doc it allows you to make changes and then save them, which rather undermines the DMS syste... | [
{
"answer_id": 339836,
"author": "Excel Kobayashi",
"author_id": 42911,
"author_profile": "https://Stackoverflow.com/users/42911",
"pm_score": 0,
"selected": false,
"text": "<p>Try stepping through the code manually with a debugger.</p>\n"
},
{
"answer_id": 448702,
"author": ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a report reading records out of a DMS system and I thought it would be nice to have a link to the documents that it is listing so that the users could view the actual documents.
However when it displays a Word doc it allows you to make changes and then save them, which rather undermines the DMS system.
I don... | This is how we kick off our MBUnit test application (command line):
```
namespace UnitTest
{
class Program
{
static void Main(string[] args_)
{
// run unit test
AutoRunner auto = new AutoRunner();
auto.Load();
auto.Run();
HtmlReport report = new HtmlReport();
string fi... |
314,426 | <p>How can I go through each of the properties in my custom object? It is not a collection object, but is there something like this for non-collection objects?</p>
<pre><code>For Each entry as String in myObject
' Do stuff here...
Next
</code></pre>
<p>There are string, integer and boolean properties in my object... | [
{
"answer_id": 314436,
"author": "Ali Ersöz",
"author_id": 4215,
"author_profile": "https://Stackoverflow.com/users/4215",
"pm_score": 7,
"selected": true,
"text": "<p>By using reflection you can do that. In C# it looks like that;</p>\n\n<pre><code>PropertyInfo[] propertyInfo = myobject.... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | How can I go through each of the properties in my custom object? It is not a collection object, but is there something like this for non-collection objects?
```
For Each entry as String in myObject
' Do stuff here...
Next
```
There are string, integer and boolean properties in my object. | By using reflection you can do that. In C# it looks like that;
```
PropertyInfo[] propertyInfo = myobject.GetType().GetProperties();
```
---
Added a VB.Net translation:
```
Dim info() As PropertyInfo = myobject.GetType().GetProperties()
``` |
314,432 | <p>I am using Visual Studio 2005 and StarTeam 2008 (cross-platform client and VS integration). At some point, I added an 'App.config' to a project. I notice now that this file will not check-in.</p>
<ol>
<li><p>The 'StarTeam Pending Checkins' window in VS reports the file 'Not in View'. Selecting it for check in and c... | [
{
"answer_id": 314436,
"author": "Ali Ersöz",
"author_id": 4215,
"author_profile": "https://Stackoverflow.com/users/4215",
"pm_score": 7,
"selected": true,
"text": "<p>By using reflection you can do that. In C# it looks like that;</p>\n\n<pre><code>PropertyInfo[] propertyInfo = myobject.... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3619/"
] | I am using Visual Studio 2005 and StarTeam 2008 (cross-platform client and VS integration). At some point, I added an 'App.config' to a project. I notice now that this file will not check-in.
1. The 'StarTeam Pending Checkins' window in VS reports the file 'Not in View'. Selecting it for check in and clicking 'Check I... | By using reflection you can do that. In C# it looks like that;
```
PropertyInfo[] propertyInfo = myobject.GetType().GetProperties();
```
---
Added a VB.Net translation:
```
Dim info() As PropertyInfo = myobject.GetType().GetProperties()
``` |
314,433 | <p>If you call a web service from Silverlight like this:</p>
<pre><code>MyServiceClient serviceClient = new MyServiceClient();
void MyMethod()
{
serviceClient.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(serviceClient_GetDataCompleted);
serviceClient.GetDataAsync();
// HOW DO I WAIT/JOI... | [
{
"answer_id": 314854,
"author": "Bryant",
"author_id": 10893,
"author_profile": "https://Stackoverflow.com/users/10893",
"pm_score": 1,
"selected": true,
"text": "<p>To do this you would use a <a href=\"http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent(VS.95).asp... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12172/"
] | If you call a web service from Silverlight like this:
```
MyServiceClient serviceClient = new MyServiceClient();
void MyMethod()
{
serviceClient.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(serviceClient_GetDataCompleted);
serviceClient.GetDataAsync();
// HOW DO I WAIT/JOIN HERE ON THE ASYNC ... | To do this you would use a [ManualResetEvent](http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent(VS.95).aspx) in your class (class level variable) and then wait on it.
```
void MyMethod()
{
wait = new ManualResetEvent(false);
// call your service
wait.WaitOne();
// finish working
}
```... |
314,437 | <p>I have a list of images that i’ve loaded with the Loader class, but I’m having a tough time assigning them unique names.
I need unique names because I want to remove certain images after a while.
Is there a way to assign loaders a name or some unique tag so i can remove them later? thanks.</p>
<p>Here's part of my ... | [
{
"answer_id": 314476,
"author": "Simon",
"author_id": 24039,
"author_profile": "https://Stackoverflow.com/users/24039",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure I 100% understand your problem, but why not put them in an object map rather than a list and generate unique nam... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34797/"
] | I have a list of images that i’ve loaded with the Loader class, but I’m having a tough time assigning them unique names.
I need unique names because I want to remove certain images after a while.
Is there a way to assign loaders a name or some unique tag so i can remove them later? thanks.
Here's part of my code
```
... | All display objects in ActionScript 3 have a name property. Whenever you create a Loader object you can assign a name to it like so:
```
var myLoader:Loader = new Loader();
myLoader.name = "myUniqueName";
myLoader.load( .... );
addChild( myLoader );
```
If you'd like to refer to the loader by the name you gave it, u... |
314,457 | <p>Usually, I've seen it with forms, but I've found it helpful to group related sets of data (eg when you have multiple tables on a page, using a fieldset around each table or group of related tables to define a visible meaning and a group name (legend)). Is this abusing the fieldset tag to the point where, in my uses,... | [
{
"answer_id": 314480,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 1,
"selected": false,
"text": "<p>The fieldset tag is also of use to screen readers and some other assistive technologies.</p>\n"
},
{
"answer_id... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | Usually, I've seen it with forms, but I've found it helpful to group related sets of data (eg when you have multiple tables on a page, using a fieldset around each table or group of related tables to define a visible meaning and a group name (legend)). Is this abusing the fieldset tag to the point where, in my uses, it... | I can see semantic advantages to blocking content into fieldsets with legends.
Although the W3C associated the use of fieldsets and legends with forms, allowing the use outside the form tag opens up new boundaries to experimentation. Potentially similar to definition list in use.
I personally do not think that the "... |
314,459 | <p>I´m using <code>Transaction Binding=Explicit Unbind</code> in the connection string as recommended <a href="http://weblogs.asp.net/ryangaraygay/archive/2008/04/14/issue-with-system-transactions-sqlconnection-and-timeout.aspx" rel="noreferrer">here</a> since I´m also using TransactionScope with timeout. The problem i... | [
{
"answer_id": 315109,
"author": "Magnus Lindhe",
"author_id": 966,
"author_profile": "https://Stackoverflow.com/users/966",
"pm_score": 3,
"selected": true,
"text": "<p>The connections only seem to stay in the pool and not being reused in case you get an exception, just like the example... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30790/"
] | I´m using `Transaction Binding=Explicit Unbind` in the connection string as recommended [here](http://weblogs.asp.net/ryangaraygay/archive/2008/04/14/issue-with-system-transactions-sqlconnection-and-timeout.aspx) since I´m also using TransactionScope with timeout. The problem is that the connections does not seem to cl... | The connections only seem to stay in the pool and not being reused in case you get an exception, just like the example. If you increase the timeout the connection will be reused.
A workaround to this problem is to clear the connection pool in case you get an exception like this:
```
using (SqlConnection con = new Sql... |
314,463 | <p>In Team Build 2008, the Drop Location for a build is no longer specified in the .proj file, and instead is stored in the database and maintained in the GUI tool.</p>
<p>The GUI tool only accepts a network path as a drop location (i.e. \\server\share) and will not accept a local path.</p>
<p>Our build server also h... | [
{
"answer_id": 315109,
"author": "Magnus Lindhe",
"author_id": 966,
"author_profile": "https://Stackoverflow.com/users/966",
"pm_score": 3,
"selected": true,
"text": "<p>The connections only seem to stay in the pool and not being reused in case you get an exception, just like the example... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34409/"
] | In Team Build 2008, the Drop Location for a build is no longer specified in the .proj file, and instead is stored in the database and maintained in the GUI tool.
The GUI tool only accepts a network path as a drop location (i.e. \\server\share) and will not accept a local path.
Our build server also hosts the dropped ... | The connections only seem to stay in the pool and not being reused in case you get an exception, just like the example. If you increase the timeout the connection will be reused.
A workaround to this problem is to clear the connection pool in case you get an exception like this:
```
using (SqlConnection con = new Sql... |
314,465 | <p>I have a MasterPage and a Content Page</p>
<p>My Content Page has a number of controls, - dropdownlist, text boxes, radio buttons.</p>
<p>I want to loop through all the control and if its one of the controls above then i want to obtain the selectedvalue, text etc</p>
<p>I know I can access the control directly by... | [
{
"answer_id": 314548,
"author": "AlexCuse",
"author_id": 794,
"author_profile": "https://Stackoverflow.com/users/794",
"pm_score": 0,
"selected": false,
"text": "<p>If you are trying to access the content page controls from the master page, you need to access the controls through the ap... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38230/"
] | I have a MasterPage and a Content Page
My Content Page has a number of controls, - dropdownlist, text boxes, radio buttons.
I want to loop through all the control and if its one of the controls above then i want to obtain the selectedvalue, text etc
I know I can access the control directly by name, but as this is my... | The Controls are in a heirarchy. The only control in the page is usually a Form (but not always). The form contains controls that appear in the `<form>` tag. If the form has for example a `<p runat="server">` in it, the `<p>` will contains all controls that appear inside it.
For instance,
```
<form runat="server">
... |
314,466 | <p>Is there an easy way to generate an array containing the letters of the alphabet in C#? It's not too hard to do it by hand, but I was wondering if there was a built in way to do this. </p>
| [
{
"answer_id": 314475,
"author": "Bob",
"author_id": 45,
"author_profile": "https://Stackoverflow.com/users/45",
"pm_score": 9,
"selected": true,
"text": "<p>I don't think there is a built in way, but I think the easiest would be </p>\n\n<pre><code> char[] alpha = \"ABCDEFGHIJKLMNOPQRST... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13028/"
] | Is there an easy way to generate an array containing the letters of the alphabet in C#? It's not too hard to do it by hand, but I was wondering if there was a built in way to do this. | I don't think there is a built in way, but I think the easiest would be
```
char[] alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
``` |
314,467 | <p>I'm looking for articles, forum or blog posts dealing with SharePoint and thread safety? I'm quite sure there are some special aspects regarding thread safety that have to be considered when working with the SharePoint object model.</p>
<p>Actually I didn't find many information about this, yet.</p>
<p>So I'm look... | [
{
"answer_id": 314534,
"author": "x0n",
"author_id": 6920,
"author_profile": "https://Stackoverflow.com/users/6920",
"pm_score": 3,
"selected": false,
"text": "<p>There are much worse pitfalls in the SharePoint OM than just plain old thread safety. Pay particular attention to working wit... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19601/"
] | I'm looking for articles, forum or blog posts dealing with SharePoint and thread safety? I'm quite sure there are some special aspects regarding thread safety that have to be considered when working with the SharePoint object model.
Actually I didn't find many information about this, yet.
So I'm looking forward to yo... | So after doing some more googling and searching on the web and testing, it seems as if you don't have to care about thread-safety that much when using the MOSS object model because you're always working with non-static and unique instances.
Furthermore an exception is thrown when a object e.g. a SPWeb was altered and... |
314,492 | <p>I've got an array of <code>char*</code> in a file.
The company I work for stores data in flat files.. Sometimes the data is sorted, but sometimes it's not.
I'd like to sort the data in the files.</p>
<p>Now I could write the code to do this, from scratch.
Is there an easier way? </p>
<p>Of course an in-place so... | [
{
"answer_id": 314527,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 5,
"selected": true,
"text": "<pre><code>template<size_t length> int less(const char* left, const char* right) {\n return memcmp(left, rig... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31325/"
] | I've got an array of `char*` in a file.
The company I work for stores data in flat files.. Sometimes the data is sorted, but sometimes it's not.
I'd like to sort the data in the files.
Now I could write the code to do this, from scratch.
Is there an easier way?
Of course an in-place sort would be the best option.... | ```
template<size_t length> int less(const char* left, const char* right) {
return memcmp(left, right, length) < 0;
}
std::sort(array, array + array_length, less<buffer_length>);
``` |
314,493 | <p>I have an xml web service which I use at work to make a request to. This request, an xml document, includes information such as recipients, subject, body, etc (as a newsletter would contain).</p>
<p>I have an ASP.NET form to enter the above information to, to form the Xml document, and I can type foreign characters... | [
{
"answer_id": 314527,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 5,
"selected": true,
"text": "<pre><code>template<size_t length> int less(const char* left, const char* right) {\n return memcmp(left, rig... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I have an xml web service which I use at work to make a request to. This request, an xml document, includes information such as recipients, subject, body, etc (as a newsletter would contain).
I have an ASP.NET form to enter the above information to, to form the Xml document, and I can type foreign characters (non lati... | ```
template<size_t length> int less(const char* left, const char* right) {
return memcmp(left, right, length) < 0;
}
std::sort(array, array + array_length, less<buffer_length>);
``` |
314,503 | <p>I have a combobox at the top of a form that loads editable data into fields below. If the user has made changes, but not saved, and tries to select a different option from the combobox, I want to warn them and give them a chance to cancel or save.</p>
<p>I am in need of a "BeforeValueChange" event with a cancelabl... | [
{
"answer_id": 314528,
"author": "Simon",
"author_id": 15371,
"author_profile": "https://Stackoverflow.com/users/15371",
"pm_score": 0,
"selected": false,
"text": "<p>You could use a <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.imessagefilter.aspx\" rel=\"nofoll... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a combobox at the top of a form that loads editable data into fields below. If the user has made changes, but not saved, and tries to select a different option from the combobox, I want to warn them and give them a chance to cancel or save.
I am in need of a "BeforeValueChange" event with a cancelable event arg... | Save the ComboBox's SelectedIndex when to box if first entered, and then restore it's value when you need to cancel the change.
```
cbx_Example.Enter += cbx_Example_Enter;
cbx_Example.SelectionChangeCommitted += cbx_Example_SelectionChangeCommitted;
...
private int prevExampleIndex = 0;
private void cbx_Example_Ent... |
314,505 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1759352/how-do-i-mark-a-method-as-obsolete-deprecated-c-sharp">How do I mark a method as Obsolete/Deprecated? - C#</a> </p>
</blockquote>
<p>How do you mark a class as deprecated? I do not want to use a class a... | [
{
"answer_id": 314507,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 10,
"selected": true,
"text": "<p>You need to use the <code>[Obsolete]</code> attribute.</p>\n<p>Example:</p>\n<pre><code>[Obsolete("Not ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] | >
> **Possible Duplicate:**
>
> [How do I mark a method as Obsolete/Deprecated? - C#](https://stackoverflow.com/questions/1759352/how-do-i-mark-a-method-as-obsolete-deprecated-c-sharp)
>
>
>
How do you mark a class as deprecated? I do not want to use a class any more in my project, but do not want to delete it... | You need to use the `[Obsolete]` attribute.
Example:
```
[Obsolete("Not used any more", true)]
public class MyDeprecatedClass
{
//...
}
```
The parameters are optional. The first parameter is for providing the reason it's obsolete, and the last one is to throw an error at compile time instead of a warning. |
314,515 | <p>What options are there for installing Django such that multiple users (each with an "Account") can each have their own database?</p>
<p>The semantics are fairly intuitive. There may be more than one User for an Account. An Account has a unique database (and a database corresponds to an account). Picture WordpressMU... | [
{
"answer_id": 314742,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>The Django ORM doesn't provide multiple database support classes, but it is definitely possible - you'll have to write a cu... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19212/"
] | What options are there for installing Django such that multiple users (each with an "Account") can each have their own database?
The semantics are fairly intuitive. There may be more than one User for an Account. An Account has a unique database (and a database corresponds to an account). Picture WordpressMU. :)
I've... | The Django way would definitely be to have separate installations with their own database name (#1). #2 would involve quite a bit of hacking with the ORM, and even then I'm not quite sure it's possible at all.
But mind you, you don't need a WHOLE new installation of all the site's models/views/templates for each user,... |
314,531 | <p>When obtaining the DPI for the screen under Windows (by using ::GetDeviceCaps) will the horizontal value always be the same as the vertical? For example:</p>
<pre><code>HDC dc = ::GetDC(NULL);
const int xDPI = ::GetDeviceCaps(dc, LOGPIXELSX);
const int yDPI - ::GetDeviceCaps(dc, LOGPIXELSY);
assert(xDPI == yDPI);
... | [
{
"answer_id": 314732,
"author": "John Dibling",
"author_id": 241536,
"author_profile": "https://Stackoverflow.com/users/241536",
"pm_score": 1,
"selected": false,
"text": "<p>I have never seen them be different, but on <a href=\"http://msdn.microsoft.com/en-us/library/aa273854(VS.60).as... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | When obtaining the DPI for the screen under Windows (by using ::GetDeviceCaps) will the horizontal value always be the same as the vertical? For example:
```
HDC dc = ::GetDC(NULL);
const int xDPI = ::GetDeviceCaps(dc, LOGPIXELSX);
const int yDPI - ::GetDeviceCaps(dc, LOGPIXELSY);
assert(xDPI == yDPI);
::ReleaseDC(NUL... | It's possible for it to be different, but that generally only applies to printers. It can be safely assumed that the screen will always have identical horizontal and vertical DPIs. |
314,554 | <p>I am using the following generic code to save entities.</p>
<pre><code>using (ITransaction tx = session.BeginTransaction())
{
try
{
entity.DateModified = DateTime.Now;
session.SaveOrUpdate(entity);
session.Flush();
tx.Commit();
return entity;
}
catch (Exception)
... | [
{
"answer_id": 314803,
"author": "madman1969",
"author_id": 36563,
"author_profile": "https://Stackoverflow.com/users/36563",
"pm_score": 0,
"selected": false,
"text": "<p>Try committing the transaction, then flushing the session.</p>\n"
},
{
"answer_id": 314946,
"author": "M... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34133/"
] | I am using the following generic code to save entities.
```
using (ITransaction tx = session.BeginTransaction())
{
try
{
entity.DateModified = DateTime.Now;
session.SaveOrUpdate(entity);
session.Flush();
tx.Commit();
return entity;
}
catch (Exception)
{
tx.... | I'll suggest the obvious: make sure Profiler is set to display transaction information.
In the Trace Properties dialog -> Events selection tab, there's an expando for Transactions. Open it up and check the appropriate boxes (or just check 'em all on).
Also, FYI: I checked our application that uses NHibernate, and yes... |
314,555 | <p>In Linqtosql how do I show items from multiple rows in a single field.</p>
<p>eg I have a 3 table setup for tagging(entity, tag, entitytag) all linked via foreign keys.</p>
<p>For each entity I would like to return the name in one field and then all relevant tags in 2nd field.</p>
<p>eg Item1, tag1; tag2; tag3
... | [
{
"answer_id": 314795,
"author": "Geoff Appleford",
"author_id": 7793,
"author_profile": "https://Stackoverflow.com/users/7793",
"pm_score": 2,
"selected": true,
"text": "<p>Okay, not sure if this is the most efficient way but it works.</p>\n\n<pre><code>Dim dc As New DataContext\n\nDim ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7793/"
] | In Linqtosql how do I show items from multiple rows in a single field.
eg I have a 3 table setup for tagging(entity, tag, entitytag) all linked via foreign keys.
For each entity I would like to return the name in one field and then all relevant tags in 2nd field.
eg Item1, tag1; tag2; tag3
Item2, tag4, tag5....
VB... | Okay, not sure if this is the most efficient way but it works.
```
Dim dc As New DataContext
Dim query = From i In dc.Items _
Let tags = (From t In dc.ItemTags _
Where t.ItemID = i.ID _
Select t.Tag.Name).ToArray _
Select i.ItemName, Tags = Strin... |
314,558 | <p>I'm trying to use route constraints in an Asp.Net MVC Application. </p>
<pre><code>routes.MapRoute(
"theRoute",
"MyAction/{page}",
new { controller = "TheController", action = "MyAction", page = 1 },
new { page = @"[0-9]" });
</code></pre>
<p>When I enter an url like ~/MyAction/aString, an YSOD is ... | [
{
"answer_id": 330049,
"author": "Matthew",
"author_id": 20162,
"author_profile": "https://Stackoverflow.com/users/20162",
"pm_score": 3,
"selected": true,
"text": "<p>The problem is that you do not have a route that matches the route that ends in a string.</p>\n\n<p>Modify your routes s... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13376/"
] | I'm trying to use route constraints in an Asp.Net MVC Application.
```
routes.MapRoute(
"theRoute",
"MyAction/{page}",
new { controller = "TheController", action = "MyAction", page = 1 },
new { page = @"[0-9]" });
```
When I enter an url like ~/MyAction/aString, an YSOD is shown with an invalid oper... | The problem is that you do not have a route that matches the route that ends in a string.
Modify your routes similar to:
```
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controlle... |
314,572 | <p>The following code</p>
<pre><code>public class GenericsTest2 {
public static void main(String[] args) throws Exception {
Integer i = readObject(args[0]);
System.out.println(i);
}
public static <T> T readObject(String file) throws Exception {
return readObject(new ObjectIn... | [
{
"answer_id": 314743,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 4,
"selected": false,
"text": "<p>In this case, I'd say your code is wrong (and the Sun compiler is right). There is nothing in your input arguments to <co... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/969/"
] | The following code
```
public class GenericsTest2 {
public static void main(String[] args) throws Exception {
Integer i = readObject(args[0]);
System.out.println(i);
}
public static <T> T readObject(String file) throws Exception {
return readObject(new ObjectInputStream(new FileIn... | I'd say it's the bug in the Sun compiler reported [here](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954) and [here](https://bugs.eclipse.org/bugs/show_bug.cgi?id=98379), because if you change your line to the one below it works with both, which seems to be exactly what is described in the bug reports.
```
... |
314,578 | <p>Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :</p>
<pre><code>@Entity
@Table(name = "paper_cheque_stop_metadata")
@org.hibernate.annotations.Entity(mutable = false)
public class... | [
{
"answer_id": 314660,
"author": "activout.se",
"author_id": 20444,
"author_profile": "https://Stackoverflow.com/users/20444",
"pm_score": 3,
"selected": false,
"text": "<p>I saved <a href=\"http://forum.hibernate.org/viewtopic.php?p=2381079\" rel=\"nofollow noreferrer\">this discussion<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32232/"
] | Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :
```
@Entity
@Table(name = "paper_cheque_stop_metadata")
@org.hibernate.annotations.Entity(mutable = false)
public class PaperChequeSt... | Your intention is to have a 1-1 relationship between PaperChequeStopMetaData and PaperCheque? If that's so, you can't define the PaperCheque instance as the @Id of PaperChequeStopMetaData, you have to define a separate @Id column in PaperChequeStopMetaData. |
314,580 | <p><b>Executive Summary:</b> When assertion errors are thrown in the threads, the unit test doesn't die. This makes sense, since one thread shouldn't be allowed to crash another thread. The question is how do I either 1) make the whole test fail when the first of the helper threads crashes or 2) loop through and determ... | [
{
"answer_id": 314729,
"author": "ljorquera",
"author_id": 9132,
"author_profile": "https://Stackoverflow.com/users/9132",
"pm_score": 4,
"selected": true,
"text": "<p>Concurrency is one of those things that are very difficult to unit test. If you are just trying to test that the code in... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39489/"
] | **Executive Summary:** When assertion errors are thrown in the threads, the unit test doesn't die. This makes sense, since one thread shouldn't be allowed to crash another thread. The question is how do I either 1) make the whole test fail when the first of the helper threads crashes or 2) loop through and determine th... | Concurrency is one of those things that are very difficult to unit test. If you are just trying to test that the code inside each thread is doing what it is supposed to test, may be you should just test this code isolated of the context.
If in this example the threads collaborate to reach a result, may be you can tes... |
314,583 | <p>I'm new to Python and am running to a problem I can't google my way out of. I've built a GUI using wxPython and ObjectiveListView. In its very center, the GUI has a list control displaying data in X rows (the data is loaded by the user) and in five columns.</p>
<p>When the user selects multiple entries from the lis... | [
{
"answer_id": 314621,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Sorry, yes, 'type':'Purchase' is also one of the common values.Should have logged in to edit the question.</p>\n"
},
{
... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm new to Python and am running to a problem I can't google my way out of. I've built a GUI using wxPython and ObjectiveListView. In its very center, the GUI has a list control displaying data in X rows (the data is loaded by the user) and in five columns.
When the user selects multiple entries from the list control ... | ```
>>> mysets = (set(x.items()) for x in MyList)
>>> reduce(lambda a,b: a.intersection(b), mysets)
set([('sum', '-21,90'), ('type', 'Purchase'), ('target', 'Apple Store')])
```
First, I've created a generator that will convert the list of dicts into an iterable sequence of sets of key,value pairs. You could use a li... |
314,594 | <p>I have a web service that acts as an interface between a farm of websites and some analytics software. Part of the analytics tracking requires harvesting the page title. Rather than passing it from the webpage to the web service, I would like to use <code>HTTPWebRequest</code> to call the page. </p>
<p>I have code ... | [
{
"answer_id": 314648,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 2,
"selected": false,
"text": "<p>Great idea, but a <a href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html\" rel=\"nofollow noreferrer\">HEAD<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12442/"
] | I have a web service that acts as an interface between a farm of websites and some analytics software. Part of the analytics tracking requires harvesting the page title. Rather than passing it from the webpage to the web service, I would like to use `HTTPWebRequest` to call the page.
I have code that will get the ent... | Great idea, but a [HEAD](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) request only returns the document's HTTP headers. This does not include the title element, which is part of the HTTP message body. |
314,600 | <p>I have a bunch of generic interfaces and classes</p>
<pre><code>public interface IElement {
// omited
}
class Element implements IElement {
// omited
}
public interface IElementList<E extends IElement> extends Iterable {
public Iterator<E> iterator();
}
class ElementList implements IElementList&l... | [
{
"answer_id": 314635,
"author": "Michael Myers",
"author_id": 13531,
"author_profile": "https://Stackoverflow.com/users/13531",
"pm_score": 4,
"selected": true,
"text": "<p><code>IElementList</code> needs to implement <code>Iterable<E></code>. Otherwise, the interface specifies <c... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24028/"
] | I have a bunch of generic interfaces and classes
```
public interface IElement {
// omited
}
class Element implements IElement {
// omited
}
public interface IElementList<E extends IElement> extends Iterable {
public Iterator<E> iterator();
}
class ElementList implements IElementList<Element> {
public Iter... | `IElementList` needs to implement `Iterable<E>`. Otherwise, the interface specifies `Iterator iterator()`, not `Iterator<E> iterator()`. This makes the compiler think that you're iterating over `Object`s.
I made this change, and it compiled fine (after adding some null returns). |
314,607 | <p>I have a class which looks something like this:</p>
<pre><code>public class Test {
private static final Object someObject = new Object();
public void doSomething()
{
synchronized (someObject) {
System.out.println(someObject.toString());
}
}
}
</code></pre>
<p>Can I consider the object to be sync... | [
{
"answer_id": 314632,
"author": "David M. Karr",
"author_id": 10508,
"author_profile": "https://Stackoverflow.com/users/10508",
"pm_score": 4,
"selected": true,
"text": "<p>By using a static object as your monitor object, only one thread using ANY instance of the Test class can get into... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24545/"
] | I have a class which looks something like this:
```
public class Test {
private static final Object someObject = new Object();
public void doSomething()
{
synchronized (someObject) {
System.out.println(someObject.toString());
}
}
}
```
Can I consider the object to be synchronized, or is there a pr... | By using a static object as your monitor object, only one thread using ANY instance of the Test class can get into the sync block. If the monitor object was not a static object, other threads holding different instances of the Test class could get into the sync block. |
314,636 | <p>If you know the Index, Value or Text. also if you don't have an ID for a direct reference.</p>
<p><a href="https://stackoverflow.com/questions/149573/check-if-option-is-selected-with-jquery-if-not-select-a-default#149820">This</a>, <a href="https://stackoverflow.com/questions/196684/jquery-get-select-option-text#19... | [
{
"answer_id": 314644,
"author": "Jay Corbett",
"author_id": 2755,
"author_profile": "https://Stackoverflow.com/users/2755",
"pm_score": 3,
"selected": false,
"text": "<p>Answering my own question for documentation. I'm sure there are other ways to accomplish this, but this works and thi... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755/"
] | If you know the Index, Value or Text. also if you don't have an ID for a direct reference.
[This](https://stackoverflow.com/questions/149573/check-if-option-is-selected-with-jquery-if-not-select-a-default#149820), [this](https://stackoverflow.com/questions/196684/jquery-get-select-option-text#196687) and [this](https:... | A selector to get the middle option-element by value is
```
$('.selDiv option[value="SEL1"]')
```
For an index:
```
$('.selDiv option:eq(1)')
```
For a known text:
```
$('.selDiv option:contains("Selection 1")')
```
**EDIT**: As commented above the OP might have been after changing the selected item of the dro... |
314,639 | <p>I'm trying to get a regex that will match:</p>
<pre><code>somefile_1.txt
somefile_2.txt
somefile_{anything}.txt
</code></pre>
<p>but not match:</p>
<pre><code>somefile_16.txt
</code></pre>
<p>I tried</p>
<pre><code>somefile_[^(16)].txt
</code></pre>
<p>with no luck (it includes even the "16" record)</p>
| [
{
"answer_id": 314650,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 5,
"selected": true,
"text": "<p>Some regex libraries allow lookahead:</p>\n\n<pre><code>somefile(?!16\\.txt$).*?\\.txt\n</code></pre>\n\n<p>Otherwise, yo... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] | I'm trying to get a regex that will match:
```
somefile_1.txt
somefile_2.txt
somefile_{anything}.txt
```
but not match:
```
somefile_16.txt
```
I tried
```
somefile_[^(16)].txt
```
with no luck (it includes even the "16" record) | Some regex libraries allow lookahead:
```
somefile(?!16\.txt$).*?\.txt
```
Otherwise, you can still use multiple character classes:
```
somefile([^1].|1[^6]|.|.{3,})\.txt
```
or, to achieve maximum portability:
```
somefile([^1].|1[^6]|.|....*)\.txt
```
`[^(16)]` means: Match any character but braces, 1, and 6... |
314,647 | <p>I have this rewrite rule</p>
<pre><code>RewriteEngine On
RewriteBase /location/
RewriteRule ^(.+)/?$ index.php?franchise=$1
</code></pre>
<p>Which is suppose to change this URL</p>
<pre><code>http://example.com/location/kings-lynn
</code></pre>
<p>Into this one</p>
<pre><code>http://example.com/location/index.p... | [
{
"answer_id": 314653,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 4,
"selected": true,
"text": "<p>Your problem is you are redirecting twice.</p>\n\n<p><code>'location/index.php'</code> matches the regex <code>^(.+... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319/"
] | I have this rewrite rule
```
RewriteEngine On
RewriteBase /location/
RewriteRule ^(.+)/?$ index.php?franchise=$1
```
Which is suppose to change this URL
```
http://example.com/location/kings-lynn
```
Into this one
```
http://example.com/location/index.php?franchise=kings-lynn
```
But instead I am getting this
... | Your problem is you are redirecting twice.
`'location/index.php'` matches the regex `^(.+)/?$`
You want to possibly use the "if file does not exist" conditional to make it not try mapping a second time.
```
RewriteEngine on
RewriteBase /location/
RewriteCond %{REQUEST_FILENAME} !-f # ignore existing files
RewriteC... |
314,664 | <p>I have a class which constructor takes a <a href="http://commons.apache.org/lang/api-2.3/org/apache/commons/lang/enums/Enum.html" rel="nofollow noreferrer">Jakarta enums</a>. I'm trying to find how I can easily inject it via an <a href="http://www.springframework.org/" rel="nofollow noreferrer">Spring</a> XML aplica... | [
{
"answer_id": 314720,
"author": "Guillaume",
"author_id": 23704,
"author_profile": "https://Stackoverflow.com/users/23704",
"pm_score": 1,
"selected": false,
"text": "<p>I found a solution, but it is very verbose (far too much to my taste) :</p>\n\n<pre><code><bean id=\"myService\" c... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23704/"
] | I have a class which constructor takes a [Jakarta enums](http://commons.apache.org/lang/api-2.3/org/apache/commons/lang/enums/Enum.html). I'm trying to find how I can easily inject it via an [Spring](http://www.springframework.org/) XML aplicationContext.
For example :
The enum :
```
public class MyEnum extends org.... | Check out the `<util:constant>` tag in Spring. It will require you to add the schema to your xml definition. So you would wind up with the following:
```
<bean id="myService" class="MyService">
<constructor-arg index="0">
<util:constant static-field="MyEnum.MY_FIRST_VALUE"/>
</constructor-arg>
</bean>
```
Th... |
314,675 | <p>Is it possible to redirect all of the output of a Bourne shell script to somewhere, but with shell commands inside the script itself?</p>
<p>Redirecting the output of a single command is easy, but I want something more like this:</p>
<pre><code>#!/bin/sh
if [ ! -t 0 ]; then
# redirect all of my output to a file ... | [
{
"answer_id": 314678,
"author": "Joshua",
"author_id": 14768,
"author_profile": "https://Stackoverflow.com/users/14768",
"pm_score": 8,
"selected": false,
"text": "<p>Typically we would place one of these at or near the top of the script. Scripts that parse their command lines would do ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40307/"
] | Is it possible to redirect all of the output of a Bourne shell script to somewhere, but with shell commands inside the script itself?
Redirecting the output of a single command is easy, but I want something more like this:
```
#!/bin/sh
if [ ! -t 0 ]; then
# redirect all of my output to a file here
fi
# rest of ... | Addressing the question as updated.
```
#...part of script without redirection...
{
#...part of script with redirection...
} > file1 2>file2 # ...and others as appropriate...
#...residue of script without redirection...
```
The braces '{ ... }' provide a unit of I/O redirection. The braces must appear where a ... |
314,682 | <p>Given a collection of user specified tags how do I determine which ones <strong>are not</strong> in the tags table with 1 SQL Statement?</p>
<p>Assuming a table schema <code>tags (id, tag)</code> and I'm using mysql, if there's an optimization I'm unaware of.</p>
<p>thanks</p>
| [
{
"answer_id": 314693,
"author": "Unsliced",
"author_id": 2902,
"author_profile": "https://Stackoverflow.com/users/2902",
"pm_score": 1,
"selected": false,
"text": "<pre><code>select * from canonical_list_of_tags where tag not in (select tag from used_tags) \n</code></pre>\n\n<p>At least... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | Given a collection of user specified tags how do I determine which ones **are not** in the tags table with 1 SQL Statement?
Assuming a table schema `tags (id, tag)` and I'm using mysql, if there's an optimization I'm unaware of.
thanks | ```
SELECT Tag
FROM UserSpecifiedTags
LEFT OUTER JOIN AllTags ON UserSpecifiedTags.Tag = AllTags.Tag
WHERE AllTags.Tag IS NULL
```
This should return what you want. In my experience, executing a join and looking for rows which don't have a match is **much** quicker than using the `IN` operator. |
314,683 | <p>How do I make an instance of gwtext.client.widgets.Window appear at specific DIV in my html ? I tried window.anchorTo(DOM.getElementById("Some_Div"),"left", new int[]{0,0}), thinking the window will anchor itself to div id="Some_Div" in my html. it didnt. </p>
| [
{
"answer_id": 320763,
"author": "bikesandcode",
"author_id": 40112,
"author_profile": "https://Stackoverflow.com/users/40112",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't used the gwt-ext library in a couple of months, but you might want to try this if you haven't already. I... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I make an instance of gwtext.client.widgets.Window appear at specific DIV in my html ? I tried window.anchorTo(DOM.getElementById("Some\_Div"),"left", new int[]{0,0}), thinking the window will anchor itself to div id="Some\_Div" in my html. it didnt. | I haven't used the gwt-ext library in a couple of months, but you might want to try this if you haven't already. It *should* attach the widget where you want it. That said, there are some cases where the gwt-ext widgets react in ways that are not intuitive to someone who really understands the normal GWT widgets.
```
... |
314,736 | <p>I have an ASP.NET GridView which has columns that look like this:</p>
<pre><code>| Foo | Bar | Total1 | Total2 | Total3 |
</code></pre>
<p>Is it possible to create a header on two rows that looks like this?</p>
<pre><code>| | Totals |
| Foo | Bar | 1 | 2 | 3 |
</code></pre>
<p>The data in each r... | [
{
"answer_id": 314748,
"author": "Mark Struzinski",
"author_id": 1284,
"author_profile": "https://Stackoverflow.com/users/1284",
"pm_score": 5,
"selected": true,
"text": "<p><a href=\"https://web.archive.org/web/20100201202857/http://blogs.msdn.com/mattdotson/articles/541795.aspx\" rel=\... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3161/"
] | I have an ASP.NET GridView which has columns that look like this:
```
| Foo | Bar | Total1 | Total2 | Total3 |
```
Is it possible to create a header on two rows that looks like this?
```
| | Totals |
| Foo | Bar | 1 | 2 | 3 |
```
The data in each row will remain unchanged as this is just to prett... | [This article](https://web.archive.org/web/20100201202857/http://blogs.msdn.com/mattdotson/articles/541795.aspx) should point you in the right direction. You can programmatically create the row and add it to the collection at position 0. |
314,737 | <p>I have some strings that I am pulling out of a database and I would like to use Template Toolkit on them, but I can't seem to figure out how to use strings as TT input. Any tips?</p>
<p>Thanks!</p>
<p>-fREW</p>
| [
{
"answer_id": 314902,
"author": "oeuftete",
"author_id": 7674,
"author_profile": "https://Stackoverflow.com/users/7674",
"pm_score": 5,
"selected": true,
"text": "<p>The documentation explains:</p>\n\n<blockquote>\n <p>process($template, \\%vars, $output, %options)</p>\n \n <p>The pr... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12448/"
] | I have some strings that I am pulling out of a database and I would like to use Template Toolkit on them, but I can't seem to figure out how to use strings as TT input. Any tips?
Thanks!
-fREW | The documentation explains:
>
> process($template, \%vars, $output, %options)
>
>
> The process() method is called to process a template. The first parameter indicates the input template as one of: a filename relative to INCLUDE\_PATH, if defined; **a reference to a text string containing the template text**; ...
>... |
314,739 | <p>I'm running Xorg and my (Qt) program daemonises itself. Now I log out and restart the X server. When I log in again my process is still running fine, but I can't see it.</p>
<p>Is there a way of attatching the new incarnation of the X server to the old process?
If I don't restart the whole server, but log out and i... | [
{
"answer_id": 314890,
"author": "ypnos",
"author_id": 21974,
"author_profile": "https://Stackoverflow.com/users/21974",
"pm_score": 0,
"selected": false,
"text": "<p>After the connection to the X server is lost, it is not possible to regain it.</p>\n\n<p>There was an xserver proxy calle... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40317/"
] | I'm running Xorg and my (Qt) program daemonises itself. Now I log out and restart the X server. When I log in again my process is still running fine, but I can't see it.
Is there a way of attatching the new incarnation of the X server to the old process?
If I don't restart the whole server, but log out and in again, i... | xpra should achieve your requirement. And it can also start tcp connection (without need of ssh). Start it on the you server:
```
xpra start :100 --start-child=xterm --bind-tcp=0.0.0.0:10000
```
Connect it on your client:
```
xpra attach tcp:SERVERHOST:10000
```
You can also use mac or windows xpra app to connect... |
314,765 | <p>I am trying to implement performance testing on ActiveMQ, so have setup a basic producer and consumer to send and receive messages across a queue. I have created a producer with no problems, getting it to write a specific number of messages to the queue:</p>
<pre><code> for(int i = 0; i < numberOfMessages; i++){... | [
{
"answer_id": 314857,
"author": "Richard",
"author_id": 16759,
"author_profile": "https://Stackoverflow.com/users/16759",
"pm_score": 3,
"selected": true,
"text": "<p>Not many views on this yet, but for future reference if anyone has the same problem, I have found the solution. The conf... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16759/"
] | I am trying to implement performance testing on ActiveMQ, so have setup a basic producer and consumer to send and receive messages across a queue. I have created a producer with no problems, getting it to write a specific number of messages to the queue:
```
for(int i = 0; i < numberOfMessages; i++){
... | Not many views on this yet, but for future reference if anyone has the same problem, I have found the solution. The configuration for activeMQ limits the amount of memory used by the senders and receivers before slowing them down, the default values given to me were:
```
<systemUsage>
<systemUsage>
... |
314,779 | <p>while writing a custom attribute in C# i was wondering if there are any guidelines or best practices regarding exceptions in attributes.
Should the attribute check the given parameters for validity? Or is this the task of the user of the property?</p>
<p>In a simple test I did the exception was not thrown until i u... | [
{
"answer_id": 314831,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>Attributes are only actually constructed when you use reflection, so that's the only time you <em>can</em> throw an ex... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21566/"
] | while writing a custom attribute in C# i was wondering if there are any guidelines or best practices regarding exceptions in attributes.
Should the attribute check the given parameters for validity? Or is this the task of the user of the property?
In a simple test I did the exception was not thrown until i used GetCus... | Attributes are only actually constructed when you use reflection, so that's the only time you *can* throw an exception. I can't remember *ever* using an attribute and having it throw an exception though. Attributes usually provide data rather than real behaviour - I'd expect the code which *uses* the attribute to provi... |
314,781 | <p>I am working on a windows form application. How do i use the find method of a datatable to find a row if the datatable has a compound key?</p>
<p>Table Structure
Col A, Col B, Col C</p>
<p>Col A and Col B make up the compound key.
I want to find the row where the value in Col A is 6 and Col B is 5</p>
| [
{
"answer_id": 314805,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 4,
"selected": false,
"text": "<p>When you \"set\" the Primary key of the datatable, the parameter value is an array of DataColumns... </p>\n\n<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14780/"
] | I am working on a windows form application. How do i use the find method of a datatable to find a row if the datatable has a compound key?
Table Structure
Col A, Col B, Col C
Col A and Col B make up the compound key.
I want to find the row where the value in Col A is 6 and Col B is 5 | There is an overload that you can use to pass in two different values to the find method. [Here is the MSDN doc](http://msdn.microsoft.com/en-us/library/f6dh4x2h(VS.80).aspx).
So you would most likely be doing something like.
```
DataTable.Rows.Find(6,5)
``` |
314,783 | <p>I have two SQL scripts which get called within a loop that accept a number parameter. Here is what I'm currently using:</p>
<pre><code>for /l %%i in (1, 1, 51) do (
sqlplus u/p@name @script.sql a%%i.html %%i
sqlplus u/p@name @script.sql b%%i.html %%i
)
</code></pre>
<p>Everything works fine, but it seems l... | [
{
"answer_id": 314813,
"author": "Brian Schmitt",
"author_id": 30492,
"author_profile": "https://Stackoverflow.com/users/30492",
"pm_score": 3,
"selected": true,
"text": "<p>You can create a masterscript.sql that contains your two script.sql statements.\nThe only thing I'm not sure about... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25371/"
] | I have two SQL scripts which get called within a loop that accept a number parameter. Here is what I'm currently using:
```
for /l %%i in (1, 1, 51) do (
sqlplus u/p@name @script.sql a%%i.html %%i
sqlplus u/p@name @script.sql b%%i.html %%i
)
```
Everything works fine, but it seems like a waste of time and re... | You can create a masterscript.sql that contains your two script.sql statements.
The only thing I'm not sure about is if it will pass in your variables.
MasterScript.sql would contain:
```
@@script1.sql
@@script2.sql
```
and neither of your sub-scripts should contain an exit.
[Differences between "@" and "@@"](http... |
314,786 | <p>I have library code that overrides Ar's find method. I also include the module for all Association classes so both MyModel.find and @parent.my_models.find work and apply the correct scope.</p>
<p>I based my code off of will_paginate's:</p>
<pre><code>a = ActiveRecord::Associations
returning([ a::AssociationCollect... | [
{
"answer_id": 315092,
"author": "gtd",
"author_id": 8376,
"author_profile": "https://Stackoverflow.com/users/8376",
"pm_score": 3,
"selected": false,
"text": "<p>First of all, make sure you know Ruby's <a href=\"http://mpathirage.com/ruby-method-lookupmethod-name-resolution-algorithm/\"... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21702/"
] | I have library code that overrides Ar's find method. I also include the module for all Association classes so both MyModel.find and @parent.my\_models.find work and apply the correct scope.
I based my code off of will\_paginate's:
```
a = ActiveRecord::Associations
returning([ a::AssociationCollection ]) { |classes|
... | First of all, make sure you know Ruby's [method call inheritance structure](http://mpathirage.com/ruby-method-lookupmethod-name-resolution-algorithm/) well, as without this you can end up stabbing around in the dark.
The most straightforward way to do this inside an ActiveRecord class is:
```
def self.find(*args)
s... |
314,792 | <p>Can I export multiple calendar events into a single iCalendar file? </p>
| [
{
"answer_id": 314812,
"author": "Paul Fisher",
"author_id": 39808,
"author_profile": "https://Stackoverflow.com/users/39808",
"pm_score": 2,
"selected": true,
"text": "<p>You simply make an iCalendar file with multiple VEVENT sections. For example:</p>\n\n<pre><code>BEGIN:VCALENDAR\nBEG... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37759/"
] | Can I export multiple calendar events into a single iCalendar file? | You simply make an iCalendar file with multiple VEVENT sections. For example:
```
BEGIN:VCALENDAR
BEGIN:VEVENT
DESCRIPTION:
DTEND:20071202T220000Z
DTSTAMP:20081124T220920Z
DTSTART:20071202T200000Z
LOCATION:Wherever
STATUS:CONFIRMED
SUMMARY:An event
UID:event-the-first
END:VEVENT
BEGIN:VEVENT
DESCRIPTION:Doing whatever... |
314,800 | <p>If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.</p>
<p>What's the best practice to achieve this? Define a new simple class... | [
{
"answer_id": 314809,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 7,
"selected": true,
"text": "<pre><code>Boolean a = true;\nBoolean b = false;\nBoolean c = null;\n</code></pre>\n\n<p>I would use that. I... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5303/"
] | If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.
What's the best practice to achieve this? Define a new simple class that is ca... | ```
Boolean a = true;
Boolean b = false;
Boolean c = null;
```
I would use that. It's the most straight-forward.
Another way is to use an enumeration. Maybe that's even better and faster, since no boxing is required:
```
public enum ThreeState {
TRUE,
FALSE,
TRALSE
};
```
There is the advantage of the... |
314,824 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2647/split-string-in-sql">Split string in SQL</a> </p>
</blockquote>
<p>I have seen <a href="https://stackoverflow.com/questions/tagged/concatenation+sql">a couple of questions related to string concatenation</... | [
{
"answer_id": 314833,
"author": "user39603",
"author_id": 39603,
"author_profile": "https://Stackoverflow.com/users/39603",
"pm_score": 4,
"selected": false,
"text": "<p>I use this function (SQL Server 2005 and above).</p>\n\n<pre><code>create function [dbo].[Split]\n(\n @string nvar... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3241/"
] | >
> **Possible Duplicate:**
>
> [Split string in SQL](https://stackoverflow.com/questions/2647/split-string-in-sql)
>
>
>
I have seen [a couple of questions related to string concatenation](https://stackoverflow.com/questions/tagged/concatenation+sql) in SQL.
I wonder how would you approach the opposite proble... | There are a wide varieties of solutions to this problem [documented here](http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648), including this little gem:
```
CREATE FUNCTION dbo.Split (@sep char(1), @s varchar(512))
RETURNS table
AS
RETURN (
WITH Pieces(pn, start, stop) AS (
SELECT 1, 1, CHARINDEX(@sep, ... |
314,843 | <p>Is it possible to have a post-mortem ( or post-exception ) debugging session in Java ? What would the workarounds be ( if there isn't a solution for this already ) ?</p>
| [
{
"answer_id": 314898,
"author": "Mario Ortegón",
"author_id": 2309,
"author_profile": "https://Stackoverflow.com/users/2309",
"pm_score": 3,
"selected": true,
"text": "<p>You can attach the debugger to a java process and set a breakpoint when a specific \nexception is received. Is this... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Is it possible to have a post-mortem ( or post-exception ) debugging session in Java ? What would the workarounds be ( if there isn't a solution for this already ) ? | You can attach the debugger to a java process and set a breakpoint when a specific
exception is received. Is this what you need?
From
<http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html>
>
> When an exception occurs for which
> there isn't a catch statement anywhere
> up a Java program's stack, the Jav... |
314,853 | <p>Wanting to deploy my project on different servers I would prefer to be able to specify a connect string using a relative path. I can't seem to get that to work and want to know if there is some trick to it...?</p>
| [
{
"answer_id": 314951,
"author": "AJ.",
"author_id": 7211,
"author_profile": "https://Stackoverflow.com/users/7211",
"pm_score": 3,
"selected": false,
"text": "<h2>A suggestion</h2>\n<p>You could build the absolute path in the app and pass that in the connection string.</p>\n<p>So, if yo... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] | Wanting to deploy my project on different servers I would prefer to be able to specify a connect string using a relative path. I can't seem to get that to work and want to know if there is some trick to it...? | A suggestion
------------
You could build the absolute path in the app and pass that in the connection string.
So, if you know that the database file is in the `database` subfolder of the application folder, you could do something like this (C#):
```
string relativePath = @"database\myfile.s3db";
string curr... |
314,858 | <p>I have a string</p>
<pre><code>var s:String = "This is a line \n This is another line.";
this.txtHolder.text = s; //.text has \n, not a new line
</code></pre>
<p>and i want to put it into a text area, but the new line character is ignored. How can i ensure that the text breaks where i want it to when its assigned?... | [
{
"answer_id": 314964,
"author": "Hates_",
"author_id": 3410,
"author_profile": "https://Stackoverflow.com/users/3410",
"pm_score": 2,
"selected": false,
"text": "<p>Try </p>\n\n<pre><code>\"This is a line {\\n} This is another line.\"\n</code></pre>\n\n<p>Alternatively, use the htmlText... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748529/"
] | I have a string
```
var s:String = "This is a line \n This is another line.";
this.txtHolder.text = s; //.text has \n, not a new line
```
and i want to put it into a text area, but the new line character is ignored. How can i ensure that the text breaks where i want it to when its assigned? | On flex, while coding `\n` is working well on `mxml` or any `xml` to define a line just use `&#13;` line entity.
I mean:
```
lazy&#13;fox
```
gives us
```
lazy<br />
fox
``` |
314,864 | <p>Learning a little about T-SQL, and thought an interesting exercise would be to generate a Mandelbrot set with it.</p>
<p>Turns out someone already has (and recently, it appears). I'll let someone else post it as an answer, but I'm curious what optimizations can be made.</p>
<p>Alternately, what would you do to ma... | [
{
"answer_id": 314875,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 4,
"selected": false,
"text": "<p>From <a href=\"http://thedailywtf.com/Articles/Stupid-Coding-Tricks-The-TSQL-Madlebrot.aspx\" rel=\"nofollow noreferrer\">... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] | Learning a little about T-SQL, and thought an interesting exercise would be to generate a Mandelbrot set with it.
Turns out someone already has (and recently, it appears). I'll let someone else post it as an answer, but I'm curious what optimizations can be made.
Alternately, what would you do to make the code more r... | ```
Create PROCEDURE dbo.mandlebrot
@left float,
@right float,
@Top float,
@Bottom float,
@Res float,
@MaxIterations Integer = 500
As
Set NoCount On
Declare @Grid Table (
X float Not Null,
Y float Not Null,
InSet Bit
Primary Key (X, Y))
Declare @Xo float, @Yo float, @Abs float
Declare @PtX Float, @PtY... |
314,872 | <p>There doesn't seem to be much info on this topic so I'm going to outline my specific problem then maybe we can shape the question and the answer into something a bit more universal.</p>
<p>I have this rewrite rule</p>
<pre><code>RewriteEngine On
RewriteBase /bookkeepers/
RewriteCond %{REQUEST_FILENAME} !-f
Rewrite... | [
{
"answer_id": 314877,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": false,
"text": "<p>It looks like the (.+) is being greedy matched. In that case, you could try</p>\n\n<pre><code>RewriteRule ^(.+[^/])... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319/"
] | There doesn't seem to be much info on this topic so I'm going to outline my specific problem then maybe we can shape the question and the answer into something a bit more universal.
I have this rewrite rule
```
RewriteEngine On
RewriteBase /bookkeepers/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENA... | As @Paul Tomblin said, the .+ is being greedy; that is, it's matching as much as it can.
`^(.+[^/])/?$` tells it to match anything, followed by a character that isn't a /, then followed by an optional /. This has the effect of not capturing the trailing /.
The most probable reason your CSS and Javascript doesn't work... |
314,926 | <p>I have populated a Datatable, from 2 different servers. I am able to make adjustments where my length>0, what I want to do is remove the rows that does not hit. Here is a summary of what I have</p>
<pre><code>DataRow[] dr = payments.dtPayments.Select(myselect);
if (dr.Length > 0)
{
for (int a = 0; a < d... | [
{
"answer_id": 314940,
"author": "Sergio",
"author_id": 32037,
"author_profile": "https://Stackoverflow.com/users/32037",
"pm_score": 1,
"selected": false,
"text": "<p>Have you tryed this?</p>\n\n<p>payments.dtPayments.Rows.Remove(dr)</p>\n"
},
{
"answer_id": 314991,
"author"... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have populated a Datatable, from 2 different servers. I am able to make adjustments where my length>0, what I want to do is remove the rows that does not hit. Here is a summary of what I have
```
DataRow[] dr = payments.dtPayments.Select(myselect);
if (dr.Length > 0)
{
for (int a = 0; a < dr.Length; a++)
{
... | If dr.Length is zero, then your select did not return any rows. If you want to delete rows that don't match your criteria, then I would implement that as a different type of query. It could also be that I am completely misunderstanding your question. Could you update your question to show your SQL and indicate where in... |
314,933 | <p>How do I do the above? I've started using MVC and I'm having issues passing data around.</p>
<p>My specific problem is to do with a list of objects I have in my Model which I need to access in a View and iterate through.</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 314969,
"author": "TimothyP",
"author_id": 28149,
"author_profile": "https://Stackoverflow.com/users/28149",
"pm_score": 1,
"selected": false,
"text": "<p>If I'm not mistaken, the repeater control requires the page model.\n(Page model being what classic ASP.NET uses)</p>\n... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29445/"
] | How do I do the above? I've started using MVC and I'm having issues passing data around.
My specific problem is to do with a list of objects I have in my Model which I need to access in a View and iterate through.
Thanks in advance. | Let's say your controller action looks something like
```
public ActionResult List()
{
List<string> myList = database.GetListOfStrings();
(...)
}
```
Now you want to pass your list to the view, say "List.aspx". You do this by having the action return a ViewResult (ViewResult is a subclass of ActionResult). Y... |
314,945 | <p>I'm new using makefiles and I have some makefiles. One of them has these statements I tried to understand but I can't.</p>
<h3>What is this makefile doing?</h3>
<pre><code># debugging support
ifeq ($(DEBUG), true)
CFLAGS+=-DDEBUG -g
endif
ifeq ($(DEBUG), gdb)
CFLAGS+=-g
endif
ifeq ($(PROFILING), true)
CFLAGS+=-p... | [
{
"answer_id": 314957,
"author": "Geo",
"author_id": 31610,
"author_profile": "https://Stackoverflow.com/users/31610",
"pm_score": 3,
"selected": false,
"text": "<p>This checks for the values of environmental variables and configures the build process with specific options for the compil... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40341/"
] | I'm new using makefiles and I have some makefiles. One of them has these statements I tried to understand but I can't.
### What is this makefile doing?
```
# debugging support
ifeq ($(DEBUG), true)
CFLAGS+=-DDEBUG -g
endif
ifeq ($(DEBUG), gdb)
CFLAGS+=-g
endif
ifeq ($(PROFILING), true)
CFLAGS+=-p
endif
# symbolic... | This checks for the values of environmental variables and configures the build process with specific options for the compiler ( I think ) . |
314,966 | <p>This question is a follow-up to a question I asked the other day <a href="https://stackoverflow.com/questions/302022/sql-need-to-find-duplicate-records-but-exclude-reversed-transactions">("Need to find duplicate records but exclude reversed transactions")</a>.</p>
<p>I have a Crystal Report which displays customers... | [
{
"answer_id": 315871,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 2,
"selected": false,
"text": "<p>Does the reversals always sort to the bottom? If so you can use a formula to check the Next record and conditionally hide ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38949/"
] | This question is a follow-up to a question I asked the other day [("Need to find duplicate records but exclude reversed transactions")](https://stackoverflow.com/questions/302022/sql-need-to-find-duplicate-records-but-exclude-reversed-transactions).
I have a Crystal Report which displays customers' fuel transactions. ... | Does the reversals always sort to the bottom? If so you can use a formula to check the Next record and conditionally hide the detail section.
So in the detail section add a formula to conditionally suppress the section if it is a reversal record or if the current record matches a subsequent reversal record:
```
( {Re... |
314,983 | <p>I know it makes little difference to a project but, assuming you use #defined header guards for your C++ code, what format do you use? e.g. assuming a header called <code>foo.hpp</code>:</p>
<pre><code>#ifndef __FOO_HPP__
...
#ifndef INCLUDED_FOO_HPP
...
#ifndef SOME_OTHER_FORMAT
</code></pre>
<p>I'm sold on th... | [
{
"answer_id": 314989,
"author": "Zebra North",
"author_id": 17440,
"author_profile": "https://Stackoverflow.com/users/17440",
"pm_score": 4,
"selected": false,
"text": "<p>I always use <code>INCLUDED_FOO_HPP</code></p>\n\n<p>I wouldn't use the double underscore one, because starting thi... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | I know it makes little difference to a project but, assuming you use #defined header guards for your C++ code, what format do you use? e.g. assuming a header called `foo.hpp`:
```
#ifndef __FOO_HPP__
...
#ifndef INCLUDED_FOO_HPP
...
#ifndef SOME_OTHER_FORMAT
```
I'm sold on the idea of upper-case #defines but cann... | I always included the namespace or relative path in the include guard, because only the header name alone has proven to be dangerous.
For example, you have some large project with the two files somewhere in your code
```
/myproject/module1/misc.h
/myproject/module2/misc.h
```
So if you use a consistent naming schem... |
314,998 | <p>I have a column with a "DEFAULT" constraint. I'd like to create a script that drops that column.</p>
<p>The problem is that it returns this error:</p>
<pre><code>Msg 5074, Level 16, State 1, Line 1
The object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'.
Msg 4922, Level 16, State 9, Line 1... | [
{
"answer_id": 315023,
"author": "DCNYAM",
"author_id": 30419,
"author_profile": "https://Stackoverflow.com/users/30419",
"pm_score": 0,
"selected": false,
"text": "<p>What do you mean randomly generated? You can look up the constraints on the specific column in management studio or via... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28544/"
] | I have a column with a "DEFAULT" constraint. I'd like to create a script that drops that column.
The problem is that it returns this error:
```
Msg 5074, Level 16, State 1, Line 1
The object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE DROP CO... | This query finds default constraints for a given table. It aint pretty, I agree:
```
select
col.name,
col.column_id,
col.default_object_id,
OBJECTPROPERTY(col.default_object_id, N'IsDefaultCnst') as is_defcnst,
dobj.name as def_name
from sys.columns col
left outer join sys.objects dobj
... |
315,011 | <p>Is there a command, or a set of tables I can look at to determine which tables, stored procedures and views in SQL Server server 2005 have a certain user defined data type?</p>
| [
{
"answer_id": 315055,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 2,
"selected": true,
"text": "<p>Tables are relatively easy, sys.columns and sys.types allow you to link columns to types. The query b... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1942/"
] | Is there a command, or a set of tables I can look at to determine which tables, stored procedures and views in SQL Server server 2005 have a certain user defined data type? | Tables are relatively easy, sys.columns and sys.types allow you to link columns to types. The query below will get this out.
```
select s.name
,o.name
,c.name
,t.name
from sys.schemas s
join sys.objects o
on o.schema_id = s.schema_id
join sys.columns c
on c.object_id = o.object_id
joi... |
315,051 | <p>I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able to create an instance of this class to... | [
{
"answer_id": 315064,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 8,
"selected": true,
"text": "<p>There is no way to directly use a C++ class in C# code. You can use PInvoke in an indirect fashion to access your type... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55638/"
] | I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able to create an instance of this class to pr... | There is no way to directly use a C++ class in C# code. You can use PInvoke in an indirect fashion to access your type.
The basic pattern is that for every member function in class Foo, create an associated non-member function which calls into the member function.
```
class Foo {
public:
int Bar();
};
extern "C" ... |
315,073 | <p>I'm building a JSF+Facelets web app, one piece of which is a method that scans a directory every so often and indexes any changes. This method is part of a bean which is in application scope. I have built a subclass of TimerTask to call the method every X milliseconds. My problem is getting the bean initialized. ... | [
{
"answer_id": 315184,
"author": "Loki",
"author_id": 39057,
"author_profile": "https://Stackoverflow.com/users/39057",
"pm_score": 0,
"selected": false,
"text": "<p>Using listeners or load-on-startup, try this: <a href=\"http://www.thoughtsabout.net/blog/archives/000033.html\" rel=\"nof... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1322/"
] | I'm building a JSF+Facelets web app, one piece of which is a method that scans a directory every so often and indexes any changes. This method is part of a bean which is in application scope. I have built a subclass of TimerTask to call the method every X milliseconds. My problem is getting the bean initialized. I can ... | If your code calls [FacesContext](http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/context/FacesContext.html), it will not work outside a thread associated with a JSF request lifecycle. A FacesContext object is created for every request and disposed at the end of the request. The reason you can fe... |
315,078 | <p>What is the most recommended/best way to stop multiple instances of a setTimeout function from being created (in javascript)?</p>
<p>An example (psuedo code):</p>
<pre><code>function mouseClick()
{
moveDiv("div_0001", mouseX, mouseY);
}
function moveDiv(objID, destX, destY)
{
//some code that moves the div ... | [
{
"answer_id": 315107,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 2,
"selected": false,
"text": "<pre><code>var timeout1 = window.setTimeout('doSomething();', 1000);\nvar timeout2 = window.setTimeout('doSomething(... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490/"
] | What is the most recommended/best way to stop multiple instances of a setTimeout function from being created (in javascript)?
An example (psuedo code):
```
function mouseClick()
{
moveDiv("div_0001", mouseX, mouseY);
}
function moveDiv(objID, destX, destY)
{
//some code that moves the div closer to destination... | when you call settimeout, it returns you a variable "handle" (a number, I think)
if you call settimeout a second time, you should first
```
clearTimeout( handle )
```
then:
```
handle = setTimeout( ... )
```
to help automate this, you might use a wrapper that associates timeout calls with a string (i.e. the div... |
315,084 | <p>I am the .Net specialist in a consultancy with many difference flavors of developers using many different languages and frameworks. Because everyone is pretty much trying to push their own agendas with our different clients in terms of what technology to propose, I'm constantly finding myself in the classic argument... | [
{
"answer_id": 315107,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 2,
"selected": false,
"text": "<pre><code>var timeout1 = window.setTimeout('doSomething();', 1000);\nvar timeout2 = window.setTimeout('doSomething(... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39086/"
] | I am the .Net specialist in a consultancy with many difference flavors of developers using many different languages and frameworks. Because everyone is pretty much trying to push their own agendas with our different clients in terms of what technology to propose, I'm constantly finding myself in the classic arguments w... | when you call settimeout, it returns you a variable "handle" (a number, I think)
if you call settimeout a second time, you should first
```
clearTimeout( handle )
```
then:
```
handle = setTimeout( ... )
```
to help automate this, you might use a wrapper that associates timeout calls with a string (i.e. the div... |
315,091 | <p>Suppose you have a GridView with a few columns like:</p>
<p>| Foo | Bar | Total |</p>
<p>and you use a style sheet to make the alternating rows different colors, say light blue and white.</p>
<p>Is there a good way to make a particular column alternate in a different color? For example, I might want the Total co... | [
{
"answer_id": 315123,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 2,
"selected": false,
"text": "<p>If you're using jQuery, you can do it pretty easily.</p>\n\n<pre><code>$(\"table#myTable col:odd\").css(\"backgroun... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3161/"
] | Suppose you have a GridView with a few columns like:
| Foo | Bar | Total |
and you use a style sheet to make the alternating rows different colors, say light blue and white.
Is there a good way to make a particular column alternate in a different color? For example, I might want the Total column to alternate in medi... | If you're using jQuery, you can do it pretty easily.
```
$("table#myTable col:odd").css("background-color:#ffe");
```
the `:odd` selector is not available in most current browsers, but jQuery gives it to us today.
For rows, you can do it with the built-in AlternatingRowStyle element.
Edit: found a good resource fo... |
315,115 | <p>I'm pretty sure that I'm not understanding something about JPA (I'm using OpenJPA) and it's causing this problem. I want to make a copy of a Job entity.</p>
<pre><code>@Entity
@Table(name="Job")
public class Job implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int... | [
{
"answer_id": 315888,
"author": "yclian",
"author_id": 36397,
"author_profile": "https://Stackoverflow.com/users/36397",
"pm_score": -1,
"selected": false,
"text": "<p>I'm not familiar with JPA and therefore I don't know if your JobManager is doing the wrong thing. </p>\n\n<p>What will ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1294/"
] | I'm pretty sure that I'm not understanding something about JPA (I'm using OpenJPA) and it's causing this problem. I want to make a copy of a Job entity.
```
@Entity
@Table(name="Job")
public class Job implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Many... | You don't show what your implementation of the copy constructor for Job is, but if you are copying the id from one Job as the id of the copy of that Job, then attempting to save the copy job will fail because JPA will know that the instance of Job with that Id lives in another object, and it is that original object tha... |
315,139 | <p>I want to start using Nunit (finally), I am using Visual Studio 2008.</p>
<p>Is it as simple as importing Nunit into my test project?</p>
<p>I remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually?</p>
| [
{
"answer_id": 315150,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, that's basically it. Personally I find the unit test runner which comes with <a href=\"http://jetbrains.com/resh... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I want to start using Nunit (finally), I am using Visual Studio 2008.
Is it as simple as importing Nunit into my test project?
I remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually? | I like to add a link to NUnit in my external tools.
Under Tools->External Tools add NUnit
```
Title: &NUnit
Command: <path to nunit>
Arguments $(ProjectFileName) /run
Initial directory: $(ProjectDir)
```
After that you can quickly run it by compiling then hitting alt-t + n |
315,146 | <p>Is there anything to use, to determine if a type is actually a anonymous type? For example an interface, etc?</p>
<p>The goal is to create something like the following...</p>
<pre><code>//defined like...
public static T Get<T>(this IAnonymous obj, string prop) {
return (T)obj.GetType().GetProperty(prop).... | [
{
"answer_id": 315152,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>As I recall, there is a <a href=\"http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.compiler... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17091/"
] | Is there anything to use, to determine if a type is actually a anonymous type? For example an interface, etc?
The goal is to create something like the following...
```
//defined like...
public static T Get<T>(this IAnonymous obj, string prop) {
return (T)obj.GetType().GetProperty(prop).GetValue(obj, null);
}
//..... | EDIT: The list below applies to C# anonymous types. VB.NET has different rules - in particular, it can generate mutable anonymous types (and does by default). Jared has pointed out in the comment that the naming style is different, too. Basically this is all pretty fragile...
You can't identify it in a generic constra... |
315,164 | <p>I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don't much care that it has the Windows Forms look to it.</p>
<p>However, when I call ShowDialog, I want to pass the owner window which is an IWin32Window. How do I get this from my WPF control?</p>
<p>Actually, does it matter? If... | [
{
"answer_id": 315172,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 4,
"selected": false,
"text": "<p>If you specify Owner, you will get a Modal dialog over the specified WPF window. </p>\n\n<p>To get WinForms compatible W... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14537/"
] | I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don't much care that it has the Windows Forms look to it.
However, when I call ShowDialog, I want to pass the owner window which is an IWin32Window. How do I get this from my WPF control?
Actually, does it matter? If I run this code ... | And here's my final version.
```
public static class MyWpfExtensions
{
public static System.Windows.Forms.IWin32Window GetIWin32Window(this System.Windows.Media.Visual visual)
{
var source = System.Windows.PresentationSource.FromVisual(visual) as System.Windows.Interop.HwndSource;
System.Windo... |
315,176 | <p>I am working on a multi-purpose page and rather than adding multiple grids to the same page we wanted to use a single GridView to the page, and on Page_Init add the needed columns, and set the respective DataSourceID.</p>
<p>So to do this, we have something like the following in the aspx, the codebehind in the Page... | [
{
"answer_id": 315270,
"author": "Brian",
"author_id": 18192,
"author_profile": "https://Stackoverflow.com/users/18192",
"pm_score": 1,
"selected": false,
"text": "<ol>\n<li>Make sure Windows 2000 has SP3, or encryption is far less likely to work, particularly if using Capicom (or the ap... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13279/"
] | I am working on a multi-purpose page and rather than adding multiple grids to the same page we wanted to use a single GridView to the page, and on Page\_Init add the needed columns, and set the respective DataSourceID.
So to do this, we have something like the following in the aspx, the codebehind in the Page\_Init is... | 1. Make sure Windows 2000 has SP3, or encryption is far less likely to work, particularly if using Capicom (or the api it wraps).
2. Not all of the encryption algorithms and keylengths are supported on Windows 2000 if using Capicom (or the api it wraps). |
315,177 | <p>I'm relatively new to Javascript and was wondering if there's a quick way to shuffle content that is contained in multiple <code><div></code> tags. For example</p>
<pre><code><div id='d1'>
<span>alpha</span>
<img src='alpha.jpg'>
</div>
<div id='d2'>
<span>beta... | [
{
"answer_id": 315192,
"author": "Kev",
"author_id": 16777,
"author_profile": "https://Stackoverflow.com/users/16777",
"pm_score": 0,
"selected": false,
"text": "<p>I'd wrap the divs in an outer div, then pass its id to shuffle_content().</p>\n\n<p>In there, you could create a new div, <... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5073/"
] | I'm relatively new to Javascript and was wondering if there's a quick way to shuffle content that is contained in multiple `<div>` tags. For example
```
<div id='d1'>
<span>alpha</span>
<img src='alpha.jpg'>
</div>
<div id='d2'>
<span>beta</span>
<img src='beta.jpg'>
</div>
<div id='d3'>
<span>gamma</span>
... | are you ok with using a javascript library like [jQuery](http://jquery.com)? here's a quick jQuery example to accomplish what you're after. the only modification to your HTML is the addition of a container element as suggested:
```
<div id="shuffle">
<div id='d1'>...</div>
<div id='d2'>...</div>
<div id='d... |
315,178 | <p>Greetings!</p>
<p>I'm still learning about the GridView control and I have one bound to an ObjectDataSource. My Web form looks like this:</p>
<pre><code><asp:GridView ID="ourGrid" runat="server" DataSourceID="ourDataSource" onrowdatabound="ourGrid_RowDataBound"
HeaderStyle-CssClass="header_style"... | [
{
"answer_id": 315264,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": -1,
"selected": false,
"text": "<p>Footer content will need to be generated on databind. Set a handler for RowDataBound. The logic should look som... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] | Greetings!
I'm still learning about the GridView control and I have one bound to an ObjectDataSource. My Web form looks like this:
```
<asp:GridView ID="ourGrid" runat="server" DataSourceID="ourDataSource" onrowdatabound="ourGrid_RowDataBound"
HeaderStyle-CssClass="header_style" AlternatingRowStyle-CssC... | **TFOOT Customisation:**
The footer will always default to creating the same number of cells as the rest of the gridview. You can override this in code by adding:
```
protected void OurGrid_RowCreated(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.Footer)
{
int colSpan... |
315,185 | <p>I have a large db with many tables and sprocs, and I want to find and see, for example, if there is a table with a name that has "setting" as part of it. I'm not very familiar with SqlServer's System Databases like master, msdb etc., I know there is a way to query one of those dbs to get what I need back, does some... | [
{
"answer_id": 315190,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 1,
"selected": false,
"text": "<p>the table you want is sys.objects</p>\n\n<pre><code>SELECT * \nFROM sys.objects\n</code></pre>\n"
},
{
"an... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32240/"
] | I have a large db with many tables and sprocs, and I want to find and see, for example, if there is a table with a name that has "setting" as part of it. I'm not very familiar with SqlServer's System Databases like master, msdb etc., I know there is a way to query one of those dbs to get what I need back, does someone ... | SQL Server also supports the standard information schema views. Probably better to use them, since this query should also work across different database engines if you ever need to do a migration:
```
SELECT * FROM INFORMATION_SCHEMA.tables where table_name LIKE '%Settings%'
``` |
315,196 | <p>I have a SQL challenge that is wracking my brain. I am trying to reconcile two reports for licenses of an application. </p>
<p>The first report is an access database table. It has been created and maintained by hand by my predecessors. Whenever they installed or uninstalled the application they would manually up... | [
{
"answer_id": 315203,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 0,
"selected": false,
"text": "<p>Try the following:</p>\n\n<pre><code>SELECT displayName, 'report_1' as type\nFROM report_1 r1 \nLEFT OUTER JOIN r... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8007/"
] | I have a SQL challenge that is wracking my brain. I am trying to reconcile two reports for licenses of an application.
The first report is an access database table. It has been created and maintained by hand by my predecessors. Whenever they installed or uninstalled the application they would manually update the tabl... | Taking Kaboing's answer and the edited question, the solution seems to be:
```
SELECT *
FROM report_1 r1
FULL OUTER JOIN report_2 r2
ON r1.SAMAccountName = r2.SAMAccountName
OR r1.NetbiosName = r2.NetbiosName
OR r1.DisplayName = r2.DisplayName
WHERE r2.NetbiosName IS NULL OR r1.NetbiosName IS NULL
```
... |
315,210 | <p>I've got a Visual Studio 2008 solution with a WCF service, and a client.</p>
<p>When I run my client, and call a method from my service I get a message saying "Unable to automatically debug 'Home.Service'. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the ... | [
{
"answer_id": 315216,
"author": "Ta01",
"author_id": 7280,
"author_profile": "https://Stackoverflow.com/users/7280",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried</p>\n\n<pre><code> <serviceBehaviors>\n\n <serviceDebug includeExceptionDetailInFaults=\"true\"/... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33431/"
] | I've got a Visual Studio 2008 solution with a WCF service, and a client.
When I run my client, and call a method from my service I get a message saying "Unable to automatically debug 'Home.Service'. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server."
... | In my case the problem turned out to be a mismatch between security settings on client and server. I was using a custom binding like this:
```
<customBinding>
<binding name="AuthorisedBinaryHttpsBinding" receiveTimeout="00:03:00" sendTimeout="00:03:00">
<!-- this next element caused the problem: -->
<s... |
315,218 | <p>My C++ framework has Buttons. A Button derives from Control. So a function accepting a Control can take a Button as its argument. So far so good.</p>
<p>I also have List<code><</code>T>. However, List<code><</code>Button> doesn't derive from List<code><</code>Control>, which means a function accepting a li... | [
{
"answer_id": 315232,
"author": "Zebra North",
"author_id": 17440,
"author_profile": "https://Stackoverflow.com/users/17440",
"pm_score": 3,
"selected": false,
"text": "<p>How about using pointers? Just have a list of <code>list<Control*></code> and put whatever Control-derived o... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39301/"
] | My C++ framework has Buttons. A Button derives from Control. So a function accepting a Control can take a Button as its argument. So far so good.
I also have List`<`T>. However, List`<`Button> doesn't derive from List`<`Control>, which means a function accepting a list of Controls can't take a list of Buttons as its a... | I hate to tell you but if you're using a list of instances to Control instead of pointers to Control, your buttons will be garbage anyway (Google "object slicing"). If they're lists of pointers, then either make the `list<button*>` into `list<control*>` as others have suggested, or do a copy to a new `list<control*>` f... |
315,227 | <p>So my goal is to be able to add a user from one Active Directory Domain to another group in a separate Active Directory Domain.</p>
<p>I'd like to do this in C#. I know there is a System.DirectoryServices namespace with classes to communicate with AD, but I can't find any information on adding users across domains... | [
{
"answer_id": 392491,
"author": "barneytron",
"author_id": 48988,
"author_profile": "https://Stackoverflow.com/users/48988",
"pm_score": 1,
"selected": false,
"text": "<p>What worked for me when I wrote code to do this a couple years back:</p>\n\n<ol>\n<li>Get a DirectoryEntry for the g... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26861/"
] | So my goal is to be able to add a user from one Active Directory Domain to another group in a separate Active Directory Domain.
I'd like to do this in C#. I know there is a System.DirectoryServices namespace with classes to communicate with AD, but I can't find any information on adding users across domains.
In the e... | What worked for me when I wrote code to do this a couple years back:
1. Get a DirectoryEntry for the group to which you want to add a member.
2. Call Invoke on the group DirectoryEntry passing arguments "Add" as the method name and the [ADsPath](http://msdn.microsoft.com/en-us/library/aa746384(VS.85).aspx) of the memb... |
315,231 | <p>How can I use reflection to create a generic List with a custom class (List<CustomClass>)? I need to be able to add values and use
<code>propertyInfo.SetValue(..., ..., ...)</code> to store it. Would I be better off storing these List<>'s as some other data structure?</p>
<p>Edit:</p>
<p>I should have s... | [
{
"answer_id": 315256,
"author": "Neil",
"author_id": 24315,
"author_profile": "https://Stackoverflow.com/users/24315",
"pm_score": 1,
"selected": false,
"text": "<p>Here's an example of taking the List<> type and turning it into List<string>.</p>\n\n<p>var list = typeof(List... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37344/"
] | How can I use reflection to create a generic List with a custom class (List<CustomClass>)? I need to be able to add values and use
`propertyInfo.SetValue(..., ..., ...)` to store it. Would I be better off storing these List<>'s as some other data structure?
Edit:
I should have specified that the object is more like t... | ```
class Foo
{
public string Bar { get; set; }
}
class Program
{
static void Main()
{
Type type = typeof(Foo); // possibly from a string
IList list = (IList) Activator.CreateInstance(
typeof(List<>).MakeGenericType(type));
object obj = Activator.CreateInstance(type);
... |
315,237 | <p>I filled up a combobox with the values from an Enum.</p>
<p>Now a combobox is text right? So I'm using a getter and a setter. I'm having problems reading the text.</p>
<p>Here's the code:</p>
<pre><code>public BookType type
{
get
{
return (BookType)Enum.Parse(typeof(BookType), this.typeComboBox.T... | [
{
"answer_id": 315282,
"author": "Vordreller",
"author_id": 11795,
"author_profile": "https://Stackoverflow.com/users/11795",
"pm_score": 1,
"selected": false,
"text": "<p>The combobox starts at index -1, which has no text, thus an empty string: \"\"</p>\n\n<p>I then change the index to ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11795/"
] | I filled up a combobox with the values from an Enum.
Now a combobox is text right? So I'm using a getter and a setter. I'm having problems reading the text.
Here's the code:
```
public BookType type
{
get
{
return (BookType)Enum.Parse(typeof(BookType), this.typeComboBox.Text);
}
set
{
... | I just created a simple windows form, and everything worked okay for me. Here is the code.
```
public enum Test
{
One, Two, Three
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.comboBox1.DataSource = Enum.GetNames(typeof(Test));
}
public Test T... |
315,242 | <p>I thought I'd get myself a Subversion setup at home for my hobby projects, and I'm trying to do it right, first time (my work's source control control policies or lack of them are, well, not perfect).</p>
<p>The thing I'm struggling with is this: I'd like to version entire Eclipse projects. This will be good from... | [
{
"answer_id": 315286,
"author": "Varun Mehta",
"author_id": 31537,
"author_profile": "https://Stackoverflow.com/users/31537",
"pm_score": 0,
"selected": false,
"text": "<p>If you on a linux box, you can try these steps, if on windows, pretty the installer shall do things for you.\n<a hr... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I thought I'd get myself a Subversion setup at home for my hobby projects, and I'm trying to do it right, first time (my work's source control control policies or lack of them are, well, not perfect).
The thing I'm struggling with is this: I'd like to version entire Eclipse projects. This will be good from Eclipse's p... | There are basically two ways to instruct subversion to ignore files either by name or by pattern.
The first way is to find the configuration file (location depends on platform) and add the file name or pattern to the global-ignores list. This applies to all svn operations on the machine or for that user.
The second w... |
315,261 | <p>I'm using the <code>QMdiArea</code> in Qt 4.4.</p>
<p>If a new project is created, I add a number of sub windows to a <code>QMdiArea</code>. I'd like to disallow the user to close a sub window during runtime. The sub windows should only be closed if the whole application is closed or if a new project is created.</p... | [
{
"answer_id": 584552,
"author": "puetzk",
"author_id": 14312,
"author_profile": "https://Stackoverflow.com/users/14312",
"pm_score": 1,
"selected": false,
"text": "<p>You'd do this the same as for a top-level window: process and ignore the QCloseEvent it sent. QMdiArea::closeActiveSubWi... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5334/"
] | I'm using the `QMdiArea` in Qt 4.4.
If a new project is created, I add a number of sub windows to a `QMdiArea`. I'd like to disallow the user to close a sub window during runtime. The sub windows should only be closed if the whole application is closed or if a new project is created.
How can I do this? | You need to define your own `subWindow`. create a subclass of `QMdiSubWindow` and override the `closeEvent(QCloseEvent *closeEvent)`. you can control it by argument. for example:
```
void ChildWindow::closeEvent(QCloseEvent *closeEvent)
{
if(/*condition C*/)
closeEvent->accept();
else
closeEvent->ignore(); ... |
315,301 | <p>At the moment I'm creating a <code>DateTime</code> for each month and formatting it to only include the month.<br>
Is there another or any better way to do this?</p>
| [
{
"answer_id": 315319,
"author": "Rohan West",
"author_id": 38686,
"author_profile": "https://Stackoverflow.com/users/38686",
"pm_score": 4,
"selected": false,
"text": "<p>You can use the following to return an array of string containing the month names</p>\n\n<pre><code>System.Globaliza... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | At the moment I'm creating a `DateTime` for each month and formatting it to only include the month.
Is there another or any better way to do this? | You can use the [`DateTimeFormatInfo`](http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx) to get that information:
```
// Will return January
string name = DateTimeFormatInfo.CurrentInfo.GetMonthName(1);
```
or to get all names:
```
string[] names = DateTimeFormatInfo.CurrentInfo.... |
315,358 | <p>What is the correct syntax for this:</p>
<pre><code>IList<string> names = "Tom,Scott,Bob".Split(',').ToList<string>().Reverse();
</code></pre>
<p>What am I messing up?
What does TSource mean?</p>
| [
{
"answer_id": 315365,
"author": "Yona",
"author_id": 40007,
"author_profile": "https://Stackoverflow.com/users/40007",
"pm_score": 2,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>List<string> names = new List<string>(\"Tom,Scott,Bob\".Split(','));\nnames.Revers... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | What is the correct syntax for this:
```
IList<string> names = "Tom,Scott,Bob".Split(',').ToList<string>().Reverse();
```
What am I messing up?
What does TSource mean? | The problem is that you're calling `List<T>.Reverse()` which returns `void`.
You could either do:
```
List<string> names = "Tom,Scott,Bob".Split(',').ToList<string>();
names.Reverse();
```
or:
```
IList<string> names = "Tom,Scott,Bob".Split(',').Reverse().ToList<string>();
```
The latter is more expensive, as re... |