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 |
|---|---|---|---|---|---|---|
72,240 | <p>How can I call a BizTalk Orchestration dynamically knowing the Orchestration name? </p>
<p>The call Orchestration shapes need to know the name and parameters of Orchestrations at design time. I've tried using 'call' XLang keyword but it also required Orchestration name as Design Time like in expression shape, we ca... | [
{
"answer_id": 72353,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>Look at ESB Guidance (www.codeplex.com/esb) This package provides the functionality you are looking for</p>\n"
},
{
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7722/"
] | How can I call a BizTalk Orchestration dynamically knowing the Orchestration name?
The call Orchestration shapes need to know the name and parameters of Orchestrations at design time. I've tried using 'call' XLang keyword but it also required Orchestration name as Design Time like in expression shape, we can write as... | The way I've accomplished something similar in the past is by using direct binding ports in the orchestrations and letting the MsgBox do the dirty work for me. Basically, it goes something like this:
1. Make the callable orchestrations use a direct-bound port attached to your activating receive shape.
2. Set up a filt... |
72,242 | <p>The page <em><a href="http://www.codinghorror.com/blog/archives/001167.html" rel="noreferrer">Protecting Your Cookies: HttpOnly</a></em> explains why making HttpOnly cookies is a good idea.</p>
<p>How do I set this property in Ruby on Rails?</p>
| [
{
"answer_id": 72287,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 3,
"selected": false,
"text": "<p>Just set :http_only to true as described in the <a href=\"http://dev.rubyonrails.org/changeset/7525\" rel=\"noreferrer\"... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] | The page *[Protecting Your Cookies: HttpOnly](http://www.codinghorror.com/blog/archives/001167.html)* explains why making HttpOnly cookies is a good idea.
How do I set this property in Ruby on Rails? | Set the 'http\_only' option in the hash used to set a cookie
e.g.
```
cookies["user_name"] = { :value => "david", :httponly => true }
```
or, in Rails 2:
e.g.
```
cookies["user_name"] = { :value => "david", :http_only => true }
``` |
72,264 | <p>I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE. </p>
<p>What are the steps to create such an executable?</p>
| [
{
"answer_id": 72296,
"author": "Nick",
"author_id": 1490,
"author_profile": "https://Stackoverflow.com/users/1490",
"pm_score": 5,
"selected": true,
"text": "<p>Single Assembly Deployment of Managed and Unmanaged Code\nSunday, February 4, 2007</p>\n\n<p>.NET developers love XCOPY deploy... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE.
What are the steps to create such an executable? | Single Assembly Deployment of Managed and Unmanaged Code
Sunday, February 4, 2007
.NET developers love XCOPY deployment. And they love single assembly components. At least I always feel kinda uneasy, if I have to use some component and need remember a list of files to also include with the main assembly of that compon... |
72,281 | <p>Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.</p>
<pre><code>Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be ... | [
{
"answer_id": 72445,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 0,
"selected": false,
"text": "<p>Does your assembly do file I/O? If so, you must grant the assembly permission to do this. In SSMS:</p>\n\n<ol>\n<li... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3400/"
] | Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.
```
Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with P... | Ran the SQL commands below and the issue appears to be resolved.
```
USE database_name
GO
EXEC sp_changedbowner 'sa'
ALTER DATABASE database_name SET TRUSTWORTHY ON
``` |
72,358 | <p>I am using Tomcat as a server and Internet Explorer 6 as a browser. A web page in our app has about 75 images. We are using SSL. It seems to be very slow at loading all the content. How can I configure Tomcat so that IE caches the images?</p>
| [
{
"answer_id": 72413,
"author": "Gabor",
"author_id": 10485,
"author_profile": "https://Stackoverflow.com/users/10485",
"pm_score": -1,
"selected": false,
"text": "<p>Content served over a HTTPS connection <strong>never gets cached</strong> in the browser. You cannot do much about it. </... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959/"
] | I am using Tomcat as a server and Internet Explorer 6 as a browser. A web page in our app has about 75 images. We are using SSL. It seems to be very slow at loading all the content. How can I configure Tomcat so that IE caches the images? | If you are serving a page over https then you'll need to serve all the included static or dynamic resources over https (either from the same domain, or another domain, also over https) to avoid a security warning in the browser.
Content delivered over a secure channel will not be written to disk by default by most bro... |
72,360 | <p>here is what a I'm doing: </p>
<pre><code>object ReturnMatch(System.Type type)
{
foreach(object obj in myObjects)
{
if (obj == type)
{
return obj;
}
}
}
</code></pre>
<p>However, if obj is a subclass of <code>type</code>, it will not match. But I w... | [
{
"answer_id": 72384,
"author": "Thunder3",
"author_id": 2832,
"author_profile": "https://Stackoverflow.com/users/2832",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps </p>\n\n<pre><code>type.IsAssignableFrom(obj.GetType())\n</code></pre>\n"
},
{
"answer_id": 72407,
"a... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10833/"
] | here is what a I'm doing:
```
object ReturnMatch(System.Type type)
{
foreach(object obj in myObjects)
{
if (obj == type)
{
return obj;
}
}
}
```
However, if obj is a subclass of `type`, it will not match. But I would like the function to return the s... | I've used the IsAssignableFrom method when faced with this problem.
```
Type theTypeWeWant; // From argument or whatever
foreach (object o in myCollection)
{
if (theTypeWeWant.IsAssignableFrom(o.GetType))
return o;
}
```
Another approach that may or may not work with your problem is to use a generic met... |
72,381 | <p>I'm trying to use the following code but it's returning the wrong day of month.</p>
<pre><code>Calendar cal = Calendar.getInstance();
cal.setTime(sampleDay.getTime());
cal.set(Calendar.MONTH, sampleDay.get(Calendar.MONTH)+1);
cal.set(Calendar.DAY_OF_MONTH, 0);
return cal.getTime();
</code></pre>
| [
{
"answer_id": 72411,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 2,
"selected": false,
"text": "<p>I would create a date object for the first day of the NEXT month, and then just subtract a single day from the da... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | I'm trying to use the following code but it's returning the wrong day of month.
```
Calendar cal = Calendar.getInstance();
cal.setTime(sampleDay.getTime());
cal.set(Calendar.MONTH, sampleDay.get(Calendar.MONTH)+1);
cal.set(Calendar.DAY_OF_MONTH, 0);
return cal.getTime();
``` | Get the number of days for this month:
```
Calendar cal = Calendar.getInstance();
cal.setTime(sampleDay.getTime());
int noOfLastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
```
Set the Calendar to the last day of this month:
```
Calendar cal = Calendar.getInstance();
cal.setTime(sampleDay.getTime());
cal.se... |
72,393 | <p>A tutorial I have on Regex in python explains how to use the re module in python, I wanted to grab the URL out of an A tag so knowing Regex I wrote the correct expression and tested it in my regex testing app of choice and ensured it worked. When placed into python it failed:</p>
<pre><code>result = re.match("a... | [
{
"answer_id": 72449,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Are you using the <code>re.match()</code> or <code>re.search()</code> method? My understanding is that <code>re.match()</cod... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | A tutorial I have on Regex in python explains how to use the re module in python, I wanted to grab the URL out of an A tag so knowing Regex I wrote the correct expression and tested it in my regex testing app of choice and ensured it worked. When placed into python it failed:
```
result = re.match("a_regex_of_pure_awe... | In Python, there's a distinction between "match" and "search"; match only looks for the pattern at the start of the string, and search looks for the pattern starting at any location within the string.
[Python regex docs](http://docs.python.org/lib/module-re.html)
[Matching vs searching](http://docs.python.org/lib/m... |
72,410 | <p>How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "print this article" or "back to menu").</p>
<p>I know there are sever... | [
{
"answer_id": 72451,
"author": "SaaS Developer",
"author_id": 7215,
"author_profile": "https://Stackoverflow.com/users/7215",
"pm_score": 1,
"selected": false,
"text": "<p>If you are using .Net, I would recommend going with one or more resource files (.resx). There is plenty of documen... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11461/"
] | How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "print this article" or "back to menu").
I know there are several CMS pac... | Firstly put all code for all languages under one domain - it will help your google-rank.
We have a fully multi-lingual system, with localisations stored in a database but cached with the web application.
Wherever we want a localisation to appear we use:
```
<%$ Resources: LanguageProvider, Path/To/Localisation %>
`... |
72,422 | <p>Can someone explain this result to me. The first test succeeds but the second fails, although the variable tested is changed in the first test.</p>
<pre><code>>>> class MyTest(unittest.TestCase):
def setUp(self):
self.i = 1
def testA(self):
self.i = 3
self.assertEqual(self.i... | [
{
"answer_id": 72498,
"author": "mmaibaum",
"author_id": 12213,
"author_profile": "https://Stackoverflow.com/users/12213",
"pm_score": 0,
"selected": false,
"text": "<p>If I recall correctly in that test framework the setUp method is run before each test</p>\n"
},
{
"answer_id": ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9510/"
] | Can someone explain this result to me. The first test succeeds but the second fails, although the variable tested is changed in the first test.
```
>>> class MyTest(unittest.TestCase):
def setUp(self):
self.i = 1
def testA(self):
self.i = 3
self.assertEqual(self.i, 3)
def testB(self... | Each test is run using a new instance of the MyTest class. That means if you change self in one test, changes will not carry over to other tests, since self will refer to a different instance.
Additionally, as others have pointed out, setUp is called before each test. |
72,442 | <p>I have a nullable property, and I want to return a null value. How do I do that in VB.NET ?</p>
<p>Currently I use this solution, but I think there might be a better way.</p>
<pre><code> Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer)
Get
If Current.Request.QueryString(... | [
{
"answer_id": 72465,
"author": "Jon",
"author_id": 12261,
"author_profile": "https://Stackoverflow.com/users/12261",
"pm_score": 4,
"selected": true,
"text": "<p>Are you looking for the keyword \"Nothing\"?</p>\n"
},
{
"answer_id": 72542,
"author": "Luca Molteni",
"autho... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6776/"
] | I have a nullable property, and I want to return a null value. How do I do that in VB.NET ?
Currently I use this solution, but I think there might be a better way.
```
Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer)
Get
If Current.Request.QueryString("rid") <> "" Then
... | Are you looking for the keyword "Nothing"? |
72,458 | <p><strong>Problem</strong></p>
<p>I need to redirect some short convenience URLs to longer actual URLs. The site in question uses a set of subdomains to identify a set of development or live versions.</p>
<p>I would like the URL to which certain requests are redirected to include the HTTP_HOST such that I don't have... | [
{
"answer_id": 72530,
"author": "Nicholas",
"author_id": 8054,
"author_profile": "https://Stackoverflow.com/users/8054",
"pm_score": -1,
"selected": false,
"text": "<p>According to this cheatsheet ( <a href=\"http://www.addedbytes.com/download/mod_rewrite-cheat-sheet-v2/png/\" rel=\"nofo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5343/"
] | **Problem**
I need to redirect some short convenience URLs to longer actual URLs. The site in question uses a set of subdomains to identify a set of development or live versions.
I would like the URL to which certain requests are redirected to include the HTTP\_HOST such that I don't have to create a custom .htaccess... | It's strange that nobody has done the actual **working** answer (lol):
```
RewriteCond %{HTTP_HOST} support\.(([^\.]+))\.example\.com
RewriteRule ^/terms http://support.%1/article/terms [NC,QSA,R]
```
---
To help you doing the job faster, my favorite tool to check for regexp:
<http://www.quanetic.com/Regex> (don't... |
72,479 | <p>Can anyone tell me what exactly does this Java code do?</p>
<pre><code>SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
byte[] bytes = new byte[20];
synchronized (random)
{
random.nextBytes(bytes);
}
return Base64.encode(bytes);
</code></pre>
<hr>
<p>Step by step explanation will be useful so that... | [
{
"answer_id": 72520,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>This creates a random number generator (SecureRandom). It then creates a byte array (byte[] bytes), length 20 bytes, and pop... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12178/"
] | Can anyone tell me what exactly does this Java code do?
```
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
byte[] bytes = new byte[20];
synchronized (random)
{
random.nextBytes(bytes);
}
return Base64.encode(bytes);
```
---
Step by step explanation will be useful so that I can recreate this code i... | Using code snippets you can get to something like this
```
Dim randomNumGen As RandomNumberGenerator = RNGCryptoServiceProvider.Create()
Dim randomBytes(20) As Byte
randomNumGen.GetBytes(randomBytes)
return Convert.ToBase64String(randomBytes)
``` |
72,515 | <p>I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property?</p>
<p>I would like to be able to use a RichTextBox to allow better formatting of the input value.
Can this be done without creating a custom editor class... | [
{
"answer_id": 72538,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": 0,
"selected": false,
"text": "<p>I think what you are looking for is Custom Type Descriptors.\nYou could read up a bit and get started here: <a href=\"http... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533/"
] | I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property?
I would like to be able to use a RichTextBox to allow better formatting of the input value.
Can this be done without creating a custom editor class? | To add your own custom editing when the user selects a property grid value you need to implement a class that derives from UITypeEditor. You then have the choice of showing just a small popup window below the property area or a full blown dialog box.
What is nice is that you can reuse the existing implementations. So ... |
72,552 | <p>What does the <code>volatile</code> keyword do? In C++ what problem does it solve?</p>
<p>In my case, I have never knowingly needed it.</p>
| [
{
"answer_id": 72576,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 7,
"selected": false,
"text": "<p><code>volatile</code> is needed when developing embedded systems or device drivers, where you need to read or write a memor... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2167252/"
] | What does the `volatile` keyword do? In C++ what problem does it solve?
In my case, I have never knowingly needed it. | `volatile` is needed if you are reading from a spot in memory that, say, a completely separate process/device/whatever may write to.
I used to work with dual-port ram in a multiprocessor system in straight C. We used a hardware managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did... |
72,556 | <p>I am playing with Microsoft's TreeView control and I am trying to force a data update of some sorts while editing a node's label, similar to UpdateData for a grid.</p>
<p>Basically, in my editor, I have a Save button and this TreeView control: what I want is when I am editing a node's label in the TreeView, if I cl... | [
{
"answer_id": 72576,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 7,
"selected": false,
"text": "<p><code>volatile</code> is needed when developing embedded systems or device drivers, where you need to read or write a memor... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12333/"
] | I am playing with Microsoft's TreeView control and I am trying to force a data update of some sorts while editing a node's label, similar to UpdateData for a grid.
Basically, in my editor, I have a Save button and this TreeView control: what I want is when I am editing a node's label in the TreeView, if I click on the... | `volatile` is needed if you are reading from a spot in memory that, say, a completely separate process/device/whatever may write to.
I used to work with dual-port ram in a multiprocessor system in straight C. We used a hardware managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did... |
72,564 | <p>I'm kind of interested in getting some feedback about this technique I picked up from somewhere.</p>
<p>I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit ... | [
{
"answer_id": 72589,
"author": "Chris Broadfoot",
"author_id": 3947,
"author_profile": "https://Stackoverflow.com/users/3947",
"pm_score": 2,
"selected": false,
"text": "<p>As long as it's documented and contracted, and not too WTFy, then there shouldn't be a problem.</p>\n\n<p>Then aga... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I'm kind of interested in getting some feedback about this technique I picked up from somewhere.
I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit over the t... | I agree with the others who have stated that this is a little on the WTFy side. If it's clearly documented functionality, then it's less of an issue, but I think it'd be safer to take an alternate route of returning 0 for success and integers for error codes. If you don't like that idea or the idea of a global last err... |
72,568 | <p>What's the best and/or fastest method of doing multijoin queries in Django using the ORM and QuerySet API? </p>
| [
{
"answer_id": 73349,
"author": "Aaron",
"author_id": 11176,
"author_profile": "https://Stackoverflow.com/users/11176",
"pm_score": 2,
"selected": false,
"text": "<p>If you are trying to join across tables linked by ForeignKeys or ManyToManyField relationships then you can use the double... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What's the best and/or fastest method of doing multijoin queries in Django using the ORM and QuerySet API? | If you are trying to join across tables linked by ForeignKeys or ManyToManyField relationships then you can use the double underscore syntax. For example if you have the following models:
```
class Foo(models.Model):
name = models.CharField(max_length=255)
class FizzBuzz(models.Model):
bleh = models.CharField... |
72,626 | <p>I save stuff in an <a href="http://msdn.microsoft.com/en-us/library/3ak841sy.aspx" rel="nofollow noreferrer">Isolated Storage</a> file (using class IsolatedStorageFile). It works well, and I can retrieve the saved values when calling the saving and retrieving methods in my <a href="http://en.wikipedia.org/wiki/Data_... | [
{
"answer_id": 72736,
"author": "icelava",
"author_id": 2663,
"author_profile": "https://Stackoverflow.com/users/2663",
"pm_score": 3,
"selected": true,
"text": "<p>When you instantiated the IsolatedStorageFile, did you scope it to IsolatedStorageScope.Machine?</p>\n\n<p>Ok now that you ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3397/"
] | I save stuff in an [Isolated Storage](http://msdn.microsoft.com/en-us/library/3ak841sy.aspx) file (using class IsolatedStorageFile). It works well, and I can retrieve the saved values when calling the saving and retrieving methods in my [DAL](http://en.wikipedia.org/wiki/Data_access_layer) layer from my GUI layer. Howe... | When you instantiated the IsolatedStorageFile, did you scope it to IsolatedStorageScope.Machine?
Ok now that you have illustrated your code style and I have gone back to retesting the behaviour of the methods, here is the explanation:
* GetMachineStoreForAssembly() - scoped to the machine and the assembly identity. D... |
72,639 | <p>I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007.
The trouble is finding a technique to read ALL versions.</p>
<p>More info: </p>
<pre><code> - I am currently using php... | [
{
"answer_id": 72669,
"author": "Erratic",
"author_id": 2246765,
"author_profile": "https://Stackoverflow.com/users/2246765",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on the nature of your data and the parties that upload the excel files, you might want to consider having ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12231/"
] | I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007.
The trouble is finding a technique to read ALL versions.
More info:
```
- I am currently using php-ExcelReader.
- A ... | Depending on the nature of your data and the parties that upload the excel files, you might want to consider having them save the data in .csv format. It will be much easier to parse on your end.
Assuming that isn't an option a quick google search turned up <http://sourceforge.net/projects/phpexcelreader/> which might... |
72,671 | <p>I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command.</p>
<p>However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this?</p>
<p>E.g. batch file</p>
<pre><code>start "c:\path... | [
{
"answer_id": 72726,
"author": "Curro",
"author_id": 10688,
"author_profile": "https://Stackoverflow.com/users/10688",
"pm_score": -1,
"selected": false,
"text": "<p>Surrounding the path and the argument with spaces inside quotes as in your example should do. The command may need to han... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command.
However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this?
E.g. batch file
```
start "c:\path with spaces\app.exe" param1 "p... | Actually, his example won't work (although at first I thought that it would, too). Based on the help for the Start command, the first parameter is the name of the newly created Command Prompt window, and the second and third should be the path to the application and its parameters, respectively. If you add another "" b... |
72,672 | <p>Has anyone written an 'UnFormat' routine for Delphi?</p>
<p>What I'm imagining is the <em>inverse</em> of <em>SysUtils.Format</em> and looks something like this </p>
<p>UnFormat('a number %n and another %n',[float1, float2]); </p>
<p>So you could unpack a string into a series of variables using format strings.<... | [
{
"answer_id": 72713,
"author": "PatrickvL",
"author_id": 12170,
"author_profile": "https://Stackoverflow.com/users/12170",
"pm_score": 5,
"selected": true,
"text": "<p>This is called scanf in C, I've made a Delphi look-a-like for this :</p>\n\n<pre><code>function ScanFormat(const Input,... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12376/"
] | Has anyone written an 'UnFormat' routine for Delphi?
What I'm imagining is the *inverse* of *SysUtils.Format* and looks something like this
UnFormat('a number %n and another %n',[float1, float2]);
So you could unpack a string into a series of variables using format strings.
I've looked at the 'Format' routine in ... | This is called scanf in C, I've made a Delphi look-a-like for this :
```
function ScanFormat(const Input, Format: string; Args: array of Pointer): Integer;
var
InputOffset: Integer;
FormatOffset: Integer;
InputChar: Char;
FormatChar: Char;
function _GetInputChar: Char;
begin
if InputOffset <= Length(I... |
72,682 | <p>Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.</p>
<p>Now you have a method, and you want to return a value. You <em>also</em> want to return an error code. Of course, except... | [
{
"answer_id": 72729,
"author": "noah",
"author_id": 12034,
"author_profile": "https://Stackoverflow.com/users/12034",
"pm_score": 1,
"selected": false,
"text": "<p>How about the \"Can't decide whether this is an error or not\" pattern. Seems like if you really had an exception but want... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.
Now you have a method, and you want to return a value. You *also* want to return an error code. Of course, exceptions are a much bett... | I'd agree that this isn't specifically an antipattern. It might be a smell depending upon the usage. There are reasons why one would actually not want to use exceptions (e.g. the errors being returned are not 'exceptional', for starters).
There are instances where you want to have a service return a common model for i... |
72,696 | <p>I have some code like this:</p>
<pre><code>If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
DoSomething()
End If
</code></pre>
<p>I don't care about the case. Should I use <code>OrdinalIgnoreCase</code>, <code>InvariantCultureIgnoreCase</code>, or <code>CurrentCultureIgnoreCase</code>?</p>
| [
{
"answer_id": 72718,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>It depends on what you want, though I'd shy away from invariantculture unless you're <em>very</em> sure you'll never... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7072/"
] | I have some code like this:
```
If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
DoSomething()
End If
```
I don't care about the case. Should I use `OrdinalIgnoreCase`, `InvariantCultureIgnoreCase`, or `CurrentCultureIgnoreCase`? | **[Newer .Net Docs now has a table to help you decide which is best to use in your situation.](https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#choosing-a-stringcomparison-member-for-your-method-call)**
From MSDN's "[New Recommendations for Using Strings in Microsoft .NET 2.0](https:... |
72,699 | <p>For example which is better:</p>
<pre><code>select * from t1, t2 where t1.country='US' and t2.country=t1.country and t1.id=t2.id
</code></pre>
<p>or</p>
<pre><code>select * from t1, t2 where t1.country'US' and t2.country='US' and t1.id=t2.id
</code></pre>
<p>better as in less work for the database, faster result... | [
{
"answer_id": 72738,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>I'd lean towards only including your constant in the code once. There might be a performance advantage one way or t... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12386/"
] | For example which is better:
```
select * from t1, t2 where t1.country='US' and t2.country=t1.country and t1.id=t2.id
```
or
```
select * from t1, t2 where t1.country'US' and t2.country='US' and t1.id=t2.id
```
better as in less work for the database, faster results.
**Note:** Sybase, and there's an index on bot... | I had a situation similar to this and this was the solution I resorted to:
Select \*
FROM t1
INNER JOIN t2 ON t1.id = t2.id AND t1.country = t2.country AND t1.country = 'US'
I noticed that my query ran faster in this scenario. I made the assumption that joining on the constant saved the engine time because the WHER... |
72,723 | <p>I have a svn repository, R, that depends on a library, l, in another repository.</p>
<p>The goal is that when someone checks out R, they also check out l. We want l to still be in its own repository so that l can be updated without dependence on R.</p>
<p>I don't know much about external svn links, but I believe t... | [
{
"answer_id": 72925,
"author": "jtimberman",
"author_id": 7672,
"author_profile": "https://Stackoverflow.com/users/7672",
"pm_score": 2,
"selected": false,
"text": "<p>I suggest using a script wrapper for svn co. </p>\n\n<pre><code>#!/bin/sh\nsvn co path://server/R svn-R\ngit clone path... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a svn repository, R, that depends on a library, l, in another repository.
The goal is that when someone checks out R, they also check out l. We want l to still be in its own repository so that l can be updated without dependence on R.
I don't know much about external svn links, but I believe that when dependin... | I suggest using a script wrapper for svn co.
```
#!/bin/sh
svn co path://server/R svn-R
git clone path://server/l git-l
```
Or similar. |
72,768 | <p>I'm trying to figure out how to detect the type of credit card based purely on its number. Does anyone know of a definitive, reliable way to find this?</p>
| [
{
"answer_id": 72801,
"author": "senfo",
"author_id": 10792,
"author_profile": "https://Stackoverflow.com/users/10792",
"pm_score": 11,
"selected": true,
"text": "<p>The credit/debit card number is referred to as a <strong>PAN</strong>, or <em>Primary Account Number</em>. The first six ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12382/"
] | I'm trying to figure out how to detect the type of credit card based purely on its number. Does anyone know of a definitive, reliable way to find this? | The credit/debit card number is referred to as a **PAN**, or *Primary Account Number*. The first six digits of the PAN are taken from the **IIN**, or *Issuer Identification Number*, belonging to the issuing bank (IINs were previously known as BIN — Bank Identification Numbers — so you may see references to that termino... |
72,769 | <p>Problem (simplified to make things clearer):</p>
<ul>
1. there is one statically-linked static.lib that has a function that increments:
<pre><code>
extern int CallCount = 0;
int TheFunction()
{
void *p = &CallCount;
printf("Function called");
return CallCount++;
}
</code></p... | [
{
"answer_id": 73075,
"author": "gnobal",
"author_id": 7748,
"author_profile": "https://Stackoverflow.com/users/7748",
"pm_score": 3,
"selected": true,
"text": "<p>My hunch was that, as you suspected, unmanaged DLLs are loaded in the context of the process and not in the context of the A... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2341/"
] | Problem (simplified to make things clearer):
1. there is one statically-linked static.lib that has a function that increments:
```
extern int CallCount = 0;
int TheFunction()
{
void *p = &CallCount
printf("Function called");
return CallCount++;
}
```
2. static.lib is linked ... | My hunch was that, as you suspected, unmanaged DLLs are loaded in the context of the process and not in the context of the AppDomain, so any static data in unmanaged code is shared among AppDomains.
[This link](http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/98cbabe0-33d6-4775-a3a7-04e71b7498dd/) sh... |
72,789 | <p>I'd like to use a different icon for the demo version of my game, and I'm building the demo with a different build config than I do for the full verison, using a preprocessor define to lockout some content, use different graphics, etc. Is there a way that I can make Visual Studio use a different icon for the app Ic... | [
{
"answer_id": 72848,
"author": "Nick",
"author_id": 1490,
"author_profile": "https://Stackoverflow.com/users/1490",
"pm_score": 0,
"selected": false,
"text": "<p>This will get you halfway there: <a href=\"http://www.codeproject.com/KB/dotnet/embedmultipleiconsdotnet.aspx\" rel=\"nofollo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12117/"
] | I'd like to use a different icon for the demo version of my game, and I'm building the demo with a different build config than I do for the full verison, using a preprocessor define to lockout some content, use different graphics, etc. Is there a way that I can make Visual Studio use a different icon for the app Icon i... | According to [this page](http://msdn.microsoft.com/en-us/library/aa381033(VS.85).aspx) you may use preprocessor directives in your \*.rc file. You should write something like this
```
#ifdef _DEMO_VERSION_
IDR_MAINFRAME ICON "demo.ico"
#else
IDR_MAINFRAME ICON "full.ico"
#endif
``` |
72,831 | <p>Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own?</p>
| [
{
"answer_id": 72862,
"author": "ageektrapped",
"author_id": 631,
"author_profile": "https://Stackoverflow.com/users/631",
"pm_score": 9,
"selected": true,
"text": "<p><code>TextInfo.ToTitleCase()</code> capitalizes the first character in each token of a string.<br />\nIf there is no nee... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9938/"
] | Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own? | `TextInfo.ToTitleCase()` capitalizes the first character in each token of a string.
If there is no need to maintain Acronym Uppercasing, then you should include `ToLower()`.
```
string s = "JOHN DOE";
s = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower());
// Produces "John Doe"
```
If CurrentCulture is... |
72,832 | <p>When you use Visual Studio's code analysic (FxCop), and want to suppress a message there are 3 options.</p>
<ol>
<li>Suppress a violation in code.</li>
<li>Suppress a violation in a GlobalSupression.cs file.</li>
<li>Disable the violation check in the project file (via Project -> Properties -> Code Analysic).</li>
... | [
{
"answer_id": 73369,
"author": "Ishmaeel",
"author_id": 227,
"author_profile": "https://Stackoverflow.com/users/227",
"pm_score": 4,
"selected": true,
"text": "<p>Suppressing multiple violations with a single <strong>SuppressMessage</strong> attribute is officially not supported. Appare... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8547/"
] | When you use Visual Studio's code analysic (FxCop), and want to suppress a message there are 3 options.
1. Suppress a violation in code.
2. Suppress a violation in a GlobalSupression.cs file.
3. Disable the violation check in the project file (via Project -> Properties -> Code Analysic).
The later is very hard to rev... | Suppressing multiple violations with a single **SuppressMessage** attribute is officially not supported. Apparently, this is by design.
I agree, it might be annoying at times, but I can't say I disagree with the decision, since the attribute is their way to force you to say, "Yes, I know what I am doing", which should... |
72,852 | <p>Imagine this directory structure:</p>
<pre><code>app/
__init__.py
sub1/
__init__.py
mod1.py
sub2/
__init__.py
mod2.py
</code></pre>
<p>I'm coding <code>mod1</code>, and I need to import something from <code>mod2</code>. How should I do it? </p>
<p>I tried <code>from ..sub2 import... | [
{
"answer_id": 73149,
"author": "John B",
"author_id": 9597,
"author_profile": "https://Stackoverflow.com/users/9597",
"pm_score": 10,
"selected": true,
"text": "<p>Everyone seems to want to tell you what you should be doing rather than just answering the question.</p>\n\n<p>The problem ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3497/"
] | Imagine this directory structure:
```
app/
__init__.py
sub1/
__init__.py
mod1.py
sub2/
__init__.py
mod2.py
```
I'm coding `mod1`, and I need to import something from `mod2`. How should I do it?
I tried `from ..sub2 import mod2` but I'm getting an "Attempted relative import in non-p... | Everyone seems to want to tell you what you should be doing rather than just answering the question.
The problem is that you're running the module as '\_\_main\_\_' by passing the mod1.py as an argument to the interpreter.
From [PEP 328](http://www.python.org/dev/peps/pep-0328/):
>
> Relative imports use a module's... |
72,899 | <p>How do I sort a list of dictionaries by a specific key's value? Given:</p>
<pre><code>[{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age': 10}]
</code></pre>
<p>When sorted by <code>name</code>, it should become:</p>
<pre><code>[{'name': 'Bart', 'age': 10}, {'name': 'Homer', 'age': 39}]
</code></pre>
| [
{
"answer_id": 72950,
"author": "Matej",
"author_id": 11457,
"author_profile": "https://Stackoverflow.com/users/11457",
"pm_score": 5,
"selected": false,
"text": "<p>You have to implement your own comparison function that will compare the dictionaries by values of name keys. See <a href=... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12398/"
] | How do I sort a list of dictionaries by a specific key's value? Given:
```
[{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age': 10}]
```
When sorted by `name`, it should become:
```
[{'name': 'Bart', 'age': 10}, {'name': 'Homer', 'age': 39}]
``` | The [`sorted()`](https://docs.python.org/library/functions.html#sorted) function takes a `key=` parameter
```
newlist = sorted(list_to_be_sorted, key=lambda d: d['name'])
```
Alternatively, you can use [`operator.itemgetter`](https://docs.python.org/library/operator.html#operator.itemgetter) instead of defining the... |
72,913 | <p>If I have an IEnumerator variable is it possible to have a lambda function that takes it, advances it with MoveNext() and returns the Current value every single time its called?</p>
| [
{
"answer_id": 72963,
"author": "Abe Heidebrecht",
"author_id": 9268,
"author_profile": "https://Stackoverflow.com/users/9268",
"pm_score": 1,
"selected": false,
"text": "<p>A Lambda expression can contain complex statements, so you can do the following:</p>\n\n<pre><code>Func<IEnumer... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | If I have an IEnumerator variable is it possible to have a lambda function that takes it, advances it with MoveNext() and returns the Current value every single time its called? | ```
e => e.MoveNext() ? e.Current : null
```
This will advance the enumerator and return the current value, and return null when the enumeration is complete. |
72,921 | <p>I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem.</p>
<p>I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing the comments easier. <a href="https://stackoverflow.com/u... | [
{
"answer_id": 72981,
"author": "Dr. Bob",
"author_id": 12182,
"author_profile": "https://Stackoverflow.com/users/12182",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://javascript.about.com/library/blip.htm\" rel=\"nofollow noreferrer\">Here</a> is a good article on obtai... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12419/"
] | I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem.
I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing the comments easier. [Internet Duct Tape's Greasemonkey tools, like ... | In Firefox, you could do something like this:
```
javascript:alert(
document.getSelection().match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g)
.join("\n"))
```
How this works:
* Gets the selection text from the browser ("document.getSelection()" in FF, in IE it would be "document.selection.createRange().text")
* ... |
72,936 | <pre>
kt@rails-ubuntu:~/rails/ledger/releases/20080820144914/.git/hooks$ ls -al
ls: cannot access post-commit: No such file or directory
ls: cannot access update: No such file or directory
ls: cannot access post-update: No such file or directory
ls: cannot access commit-msg: No such file or directory
ls: cannot access ... | [
{
"answer_id": 72988,
"author": "raldi",
"author_id": 7598,
"author_profile": "https://Stackoverflow.com/users/7598",
"pm_score": 4,
"selected": true,
"text": "<p>First off, here's your question, nicely formatted (surround it in < pre > tags to get this):</p>\n\n<pre>kt@rails-ubuntu:~... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12417/"
] | ```
kt@rails-ubuntu:~/rails/ledger/releases/20080820144914/.git/hooks$ ls -al
ls: cannot access post-commit: No such file or directory
ls: cannot access update: No such file or directory
ls: cannot access post-update: No such file or directory
ls: cannot access commit-msg: No such file or directory
ls: cannot access p... | First off, here's your question, nicely formatted (surround it in < pre > tags to get this):
```
kt@rails-ubuntu:~/rails/ledger/releases/20080820144914/.git/hooks$ ls -al
ls: cannot access post-commit: No such file or directory
ls: cannot access update: No such file or directory
ls: cannot access post-update: No such ... |
72,943 | <p>Is it possible to launch a new window in JavaScript using the window.Open function, then set the focus to that tab?</p>
<p>Here's what I'm doing today:
<code></p>
<pre>
var winRef = window.open(outUrl,wName,'left='+ wX +',top=' + wY + ',height=' + wH + ',width=' + wW + args);
try {
... | [
{
"answer_id": 72971,
"author": "jtimberman",
"author_id": 7672,
"author_profile": "https://Stackoverflow.com/users/7672",
"pm_score": 1,
"selected": false,
"text": "<p>As a user, I never want applications (or tabs) to take focus unless I specifically requested it. I have gone to great l... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/733/"
] | Is it possible to launch a new window in JavaScript using the window.Open function, then set the focus to that tab?
Here's what I'm doing today:
```
var winRef = window.open(outUrl,wName,'left='+ wX +',top=' + wY + ',height=' + wH + ',width=' + wW + args);
try {
// Not all win... | Jay,
You are seeing designed behavior. To limit opportunities for malicious behavior, scripts running in tabbed windows cannot affect other tabs.
For more information, please see Tabbed Browsing for Developers at <http://msdn.microsoft.com/en-us/library/ms537636.aspx> :
"The ability to open multiple documents within... |
72,945 | <p>Using Django's built in models, how would one create a triple-join between three models.</p>
<p>For example:</p>
<ul>
<li>Users, Roles, and Events are the models.</li>
<li>Users have many Roles, and Roles many Users. (ManyToMany)</li>
<li>Events have many Users, and Users many Events. (ManyToMany)</li>
<li>But fo... | [
{
"answer_id": 73153,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 2,
"selected": false,
"text": "<p>I'd recommend just creating an entirely separate model for this.</p>\n\n<pre><code>class Assignment(Model):\n u... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8507/"
] | Using Django's built in models, how would one create a triple-join between three models.
For example:
* Users, Roles, and Events are the models.
* Users have many Roles, and Roles many Users. (ManyToMany)
* Events have many Users, and Users many Events. (ManyToMany)
* But for any given Event, any User may have only o... | **zacherates** writes:
>
> I'd model Role as an association class between Users and Roles (...)
>
>
>
I'd also reccomed this solution, but you can also make use of some syntactical sugar provided by Django: [ManyToMany relation with extra fields](http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields... |
72,994 | <p>I want to simulate a 'Web 2.0' Lightbox style UI technique in a <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window. </p>
<p>The obvious solution is to... | [
{
"answer_id": 73062,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>The forms themselves have the property <code>Opacity</code> that would be perfect, but I don't think most of the ind... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6199/"
] | I want to simulate a 'Web 2.0' Lightbox style UI technique in a [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms) application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window.
The obvious solution is to create a control that is simply a par... | Can you do this in .NET/C#?
Yes you certainly can but it takes a little bit of effort. I would recommend the following approach. Create a top level Form that has no border or titlebar area and then give make sure it draws no client area background by setting the TransparencyKey and BackColor to the same value. So you... |
72,996 | <p>I am creating an installer in IzPack. It is quite large, and I have broken up my XML files appropriately using <xinclude> and <xfragment> tags. Unfortunately, IzPack does not combine them together when you build your installer. This requires you to package the files with the installer, which just won't w... | [
{
"answer_id": 73306,
"author": "Paul de Vrieze",
"author_id": 4100,
"author_profile": "https://Stackoverflow.com/users/4100",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure if java supports automatic xinclude. But you will have to use namespaces to make it work. So don't use... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am creating an installer in IzPack. It is quite large, and I have broken up my XML files appropriately using <xinclude> and <xfragment> tags. Unfortunately, IzPack does not combine them together when you build your installer. This requires you to package the files with the installer, which just won't work.
I was ab... | If you can't get xinclude to work and you're using Ant, I'd recommend [XMLTask](http://www.oopsconsultancy.com/software/xmltask), which is a plugin task for Ant. It'll do lots of clever stuff, including the one thing you're interested in - constructing a XML file out of fragments.
e.g.
```
<xmltask source="templatefi... |
73,000 | <p>I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds <strong>all</strong> IE threads IE pane does not refresh and dialog window is still... | [
{
"answer_id": 73214,
"author": "noah",
"author_id": 12034,
"author_profile": "https://Stackoverflow.com/users/12034",
"pm_score": 0,
"selected": false,
"text": "<p>You might try launching a modal from JavaScript using the JavaScript integration (see <a href=\"http://www.raditha.com/java... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7918/"
] | I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds **all** IE threads IE pane does not refresh and dialog window is still painted on top ... | What argument are you using for the parent?
You may have better luck if you use the parent of the Applet.
```
javax.swing.SwingUtilities.getWindowAncestor(theApplet)
```
Using the getWindowAncestor will skip the applet parents (getRoot(component) will return applets). In at least some versions of Java there was a F... |
73,024 | <p>This is from an example accompanying the agsXMPP .Net assembly. I've read up on delegates, but am not sure how that fits in with this line of code (which waits for the logon to occur, and then sends a message. I guess what I'm looking for is an understanding of why <code>delegate(0)</code> accomplishes this, in th... | [
{
"answer_id": 73040,
"author": "Abe Heidebrecht",
"author_id": 9268,
"author_profile": "https://Stackoverflow.com/users/9268",
"pm_score": 0,
"selected": false,
"text": "<p>That is creating an anonymous function. This feature was introduced in C# 2.0</p>\n"
},
{
"answer_id": 73... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7574/"
] | This is from an example accompanying the agsXMPP .Net assembly. I've read up on delegates, but am not sure how that fits in with this line of code (which waits for the logon to occur, and then sends a message. I guess what I'm looking for is an understanding of why `delegate(0)` accomplishes this, in the kind of simple... | The `delegate(object o){..}` tells the compiler to package up whatever is inside the brackets as an object to be executed later, in this case when `OnLogin` is fired. Without the `delegate()` statement, the compiler would think you are tying to execute an action in the middle of an assignemnt statement and give you err... |
73,029 | <p>I try to use the Forms-Based authentication within an embedded Jetty 6.1.7 project.</p>
<p>That's why I need to serve servlets and html (login.html) under the same context
to make authentication work. I don't want to secure the hole application since
different context should need different roles. The jetty javadoc ... | [
{
"answer_id": 91072,
"author": "Eduard Wirch",
"author_id": 17428,
"author_profile": "https://Stackoverflow.com/users/17428",
"pm_score": 1,
"selected": false,
"text": "<p>Use the web application descriptor:</p>\n\n<p>Paste this in to your web.xml:</p>\n\n<pre><code><login-config>... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11450/"
] | I try to use the Forms-Based authentication within an embedded Jetty 6.1.7 project.
That's why I need to serve servlets and html (login.html) under the same context
to make authentication work. I don't want to secure the hole application since
different context should need different roles. The jetty javadoc states tha... | Finally I got it right, solution is to use latest jetty 6.1.12 rc2.
I didn't check out what they changed - I'm just happy that it works now. |
73,032 | <p>I'd really like to handle this without monkey-patching but I haven't been able to find another option yet.</p>
<p>I have an array (in Ruby) that I need to sort by multiple conditions. I know how to use the sort method and I've used the trick on sorting using an array of options to sort by multiple conditions. How... | [
{
"answer_id": 73090,
"author": "Brian Phillips",
"author_id": 7230,
"author_profile": "https://Stackoverflow.com/users/7230",
"pm_score": 6,
"selected": true,
"text": "<p>How about:</p>\n\n<pre>\n<code>\nordered_list = [[1, \"b\"], [1, \"a\"], [2, \"a\"]]\nordered_list.sort! do |a,b|\n ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3230/"
] | I'd really like to handle this without monkey-patching but I haven't been able to find another option yet.
I have an array (in Ruby) that I need to sort by multiple conditions. I know how to use the sort method and I've used the trick on sorting using an array of options to sort by multiple conditions. However, in thi... | How about:
```
ordered_list = [[1, "b"], [1, "a"], [2, "a"]]
ordered_list.sort! do |a,b|
[a[0],b[1]] <=> [b[0], a[1]]
end
``` |
73,037 | <p>This is a 3 part question regarding embedded RegEx into SQL statements. </p>
<ol>
<li><p>How do you embed a RegEx expression into an Oracle PL/SQL
select statement that will parse out
the “DELINQUENT” string in the text
string shown below?</p></li>
<li><p>What is the performance impact if used within a
mission crit... | [
{
"answer_id": 73084,
"author": "Matt Rogish",
"author_id": 2590,
"author_profile": "https://Stackoverflow.com/users/2590",
"pm_score": 0,
"selected": false,
"text": "<p>Why not just use INSTR (for Oracle) or CHARINDEX (for SQL Server) combined with SUBSTRING? Seems a bit more straightfo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3048/"
] | This is a 3 part question regarding embedded RegEx into SQL statements.
1. How do you embed a RegEx expression into an Oracle PL/SQL
select statement that will parse out
the “DELINQUENT” string in the text
string shown below?
2. What is the performance impact if used within a
mission critical business
transaction?
3.... | Why would you need regular expressions here?
INSTR and SUBSTR will do the job perfectly.
But if you convinced you need Regex'es you can use:
[REGEXP\_INSTR](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions129.htm#i1239887)
[REGEXP\_REPLACE](http://download.oracle.com/docs/cd/B19306_01/serve... |
73,039 | <p>In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons ... | [
{
"answer_id": 73082,
"author": "kemiller2002",
"author_id": 1942,
"author_profile": "https://Stackoverflow.com/users/1942",
"pm_score": 1,
"selected": false,
"text": "<p>I ran into this exact problem at my last job. The best way I found was to fire off an asychronous process, and notif... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12442/"
] | In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons - 1... | To avoid excessive architecture astronomy, I often [use a hidden iframe to call the long running process and stream back progress information](http://encosia.com/2007/10/03/easy-incremental-status-updates-for-long-requests/). Coupled with something like [jsProgressBarHandler](http://www.bram.us/demo/projects/jsprogress... |
73,051 | <p>I need to run a stored procedure from a C# application.</p>
<p>I use the following code to do so:</p>
<pre><code>Process sqlcmdCall = new Process();
sqlcmdCall.StartInfo.FileName = "sqlcmd.exe";
sqlcmdCall.StartInfo.Arguments = "-S localhost\\SQLEXPRESS -d some_db -Q \":EXIT(sp_test)\""
sqlcmdCall.Start();
sqlcmdC... | [
{
"answer_id": 73108,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": true,
"text": "<p>If you are trying to call a stored procedure from c# you would want to use ADO.Net instead of the calling sqlcmd via the comm... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12525/"
] | I need to run a stored procedure from a C# application.
I use the following code to do so:
```
Process sqlcmdCall = new Process();
sqlcmdCall.StartInfo.FileName = "sqlcmd.exe";
sqlcmdCall.StartInfo.Arguments = "-S localhost\\SQLEXPRESS -d some_db -Q \":EXIT(sp_test)\""
sqlcmdCall.Start();
sqlcmdCall.WaitForExit();
`... | If you are trying to call a stored procedure from c# you would want to use ADO.Net instead of the calling sqlcmd via the command line. Look at `SqlConnection` and `SqlCommand` in the `System.Data.SqlClient` namespace.
Once you are calling the stored procedure via `SqlCommand` you will be able to catch an exception rai... |
73,063 | <p>In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a "Find Results" window.</p>
<p>Now that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them?</p>
| [
{
"answer_id": 73120,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 2,
"selected": false,
"text": "<p>If you can search for the word exactly, you can use a pair of keyboard shortcuts to do it quickly.</p>\n\n<p>Tools -> O... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a "Find Results" window.
Now that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them? | ***This answer does not work for Visual Studio 2015 or later. A more recent answer can be found [here](https://stackoverflow.com/questions/38061627/how-do-i-add-debug-breakpoints-to-lines-displayed-in-a-find-results-window-in?rq=1).***
You can do this fairly easily with a Visual Studio macro. Within Visual Studio, hit... |
73,110 | <p>For a System.Windows.Forms.TextBox with Multiline=True, I'd like to only show the scrollbars when the text doesn't fit.</p>
<p>This is a readonly textbox used only for display. It's a TextBox so that users can copy the text out. Is there anything built-in to support auto show of scrollbars? If not, should I be usi... | [
{
"answer_id": 73173,
"author": "André Chalella",
"author_id": 4850,
"author_profile": "https://Stackoverflow.com/users/4850",
"pm_score": 3,
"selected": false,
"text": "<p>I also made some experiments, and found that the vertical bar will always show if you enable it, and the horizontal... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1042/"
] | For a System.Windows.Forms.TextBox with Multiline=True, I'd like to only show the scrollbars when the text doesn't fit.
This is a readonly textbox used only for display. It's a TextBox so that users can copy the text out. Is there anything built-in to support auto show of scrollbars? If not, should I be using a differ... | Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. It's not quite perfect but ought to work for you.
```
using System;
using System.Drawing;
using System.Windows.Forms;
public class MyTextBox : TextBox {
private bool mScrollbars;... |
73,117 | <p>I wanted to "emulate" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)</p>
<pre>
Basics:
Player has a time machine. On each iteration of using the time machine, a parallel state
is created, co-existing with a previous state. One of the... | [
{
"answer_id": 73152,
"author": "Jason Z",
"author_id": 2470,
"author_profile": "https://Stackoverflow.com/users/2470",
"pm_score": 1,
"selected": false,
"text": "<p>I have played this game before. I don't necessarily think parallel processing is the way to go. You have shared objects ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6128/"
] | I wanted to "emulate" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)
```
Basics:
Player has a time machine. On each iteration of using the time machine, a parallel state
is created, co-existing with a previous state. One of the states ... | What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: <http://www.gaffer.org/game-physics/fix-your-timestep>).
Then what you do is to keep a list of list of pairs of frame counter and action. STL example:
```c++
std::list<std::list<std::pair<unsigned long, Acti... |
73,123 | <p>Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404?</p>
<p>For example:</p>
<pre><code>http://mywebsite.com/132483
</code></pre>
<p>would be sent to:</p>
<pre><code>http://mywebsite.com/scriptname.php?no=132483
</code></pr... | [
{
"answer_id": 73141,
"author": "Frank Wiles",
"author_id": 12568,
"author_profile": "https://Stackoverflow.com/users/12568",
"pm_score": 0,
"selected": false,
"text": "<p>Yes it's possible with mod_rewrite. There are tons of good mod_rewrite tutorials online a quick Google search shoul... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12513/"
] | Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404?
For example:
```
http://mywebsite.com/132483
```
would be sent to:
```
http://mywebsite.com/scriptname.php?no=132483
```
but
```
http://mywebsite.com/132483a or
http://m... | ```
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([0-9]{6})$ scriptname.php?no=$1 [L]
</IfModule>
```
To preserve the clean URL
```
http://mywebsite.com/132483
```
while serving scriptname.php use only [L].
Using [R=301] will redirect you to your scriptname.php?no=xxx
You may find this useful <htt... |
73,128 | <p>We just started running in to an odd problem with a FileSystemWatcher where the call to Dispose() appears to be hanging. This is code that has been working without any problems for a while but we just upgraded to .NET3.5 SP1 so I'm trying to find out if anyone else has seen this behavior. Here is the code that creat... | [
{
"answer_id": 73192,
"author": "Jonathan Rupp",
"author_id": 12502,
"author_profile": "https://Stackoverflow.com/users/12502",
"pm_score": 4,
"selected": true,
"text": "<p>Just a thought... Any chance there's a deadlock issue here?</p>\n\n<p>You're calling TreeView.Invoke, which is a bl... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1559/"
] | We just started running in to an odd problem with a FileSystemWatcher where the call to Dispose() appears to be hanging. This is code that has been working without any problems for a while but we just upgraded to .NET3.5 SP1 so I'm trying to find out if anyone else has seen this behavior. Here is the code that creates ... | Just a thought... Any chance there's a deadlock issue here?
You're calling TreeView.Invoke, which is a blocking call. If a filesystem change happens just as you're clicking whatever button causes the FileSystemWatcher.Dispose() call, your FileWatcherFileChanged method will get called on a background thread and call Tr... |
73,134 | <p>I have been working on some legacy C++ code that uses variable length structures (TAPI), where the structure size will depend on variable length strings. The structures are allocated by casting array <code>new</code> thus:</p>
<pre class="lang-cpp prettyprint-override"><code>STRUCT* pStruct = (STRUCT*)new BYTE[size... | [
{
"answer_id": 73157,
"author": "Fire Lancer",
"author_id": 6266,
"author_profile": "https://Stackoverflow.com/users/6266",
"pm_score": 0,
"selected": false,
"text": "<p>Yes that may, since your allocating with new[] but deallocating with delelte, yes malloc/free is safer here, but in c+... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | I have been working on some legacy C++ code that uses variable length structures (TAPI), where the structure size will depend on variable length strings. The structures are allocated by casting array `new` thus:
```cpp
STRUCT* pStruct = (STRUCT*)new BYTE[sizeof(STRUCT) + nPaddingSize];
```
Later on however the memor... | Technically I believe it could cause a problem with mismatched allocators, though in practice I don't know of any compiler that would not do the right thing with this example.
More importantly if `STRUCT` where to have (or ever be given) a destructor then it would invoke the destructor without having invoked the corre... |
73,162 | <p>Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?</p>
| [
{
"answer_id": 73203,
"author": "Abe Heidebrecht",
"author_id": 9268,
"author_profile": "https://Stackoverflow.com/users/9268",
"pm_score": 2,
"selected": false,
"text": "<p>The FlashWindowEx Win32 API is the call used to do this. The documentation for it is at:\n<a href=\"http://msdn.mi... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6896/"
] | Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with? | FlashWindowEx is the way to go. See [here for MSDN documentation](http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx)
```
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINF... |
73,198 | <p>When using Linq to SQL and stored procedures, the class generated to describe the proc's result set uses char properties to represent char(1) columns in the SQL proc. I'd rather these be strings - is there any easy way to make this happen?</p>
| [
{
"answer_id": 73237,
"author": "Glenn Slaven",
"author_id": 2975,
"author_profile": "https://Stackoverflow.com/users/2975",
"pm_score": -1,
"selected": false,
"text": "<p>Not sure why you'd want to do that. The underlying data type can't store more than one char, by representing it as ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12260/"
] | When using Linq to SQL and stored procedures, the class generated to describe the proc's result set uses char properties to represent char(1) columns in the SQL proc. I'd rather these be strings - is there any easy way to make this happen? | You could modify the {database}.designer.cs file. I don't have one handy to check, but I believe it's fairly straight forward --- you'll just have to plow through a lot of code, and remember to re-apply the change if you ever regenerate it.
Alternately, you could create your own class and handle it in the select. For ... |
73,227 | <p>I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference.</p>
| [
{
"answer_id": 73249,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": -1,
"selected": false,
"text": "<p>Well, the really oversimplified version is that a lambda is just shorthand for an anonymous function. A delegate c... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1538/"
] | I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference. | They are actually two very different things. "Delegate" is actually the name for a variable that holds a reference to a method or a lambda, and a lambda is a method without a permanent name.
Lambdas are very much like other methods, except for a couple subtle differences.
1. A normal method is defined in a ["statemen... |
73,286 | <p>I created a C++ console app and just want to capture the cout/cerr statements in the Output Window within the Visual Studio 2005 IDE. I'm sure this is just a setting that I'm missing. Can anyone point me in the right direction?</p>
| [
{
"answer_id": 73363,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 3,
"selected": false,
"text": "<p>You can't do this.</p>\n\n<p>If you want to output to the debugger's output window, call OutputDebugString.</p>\n\n<p... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1265473/"
] | I created a C++ console app and just want to capture the cout/cerr statements in the Output Window within the Visual Studio 2005 IDE. I'm sure this is just a setting that I'm missing. Can anyone point me in the right direction? | I've finally implemented this, so I want to share it with you:
```
#include <vector>
#include <iostream>
#include <windows.h>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/tee.hpp>
using namespace std;
namespace io = boost::iostreams;
struct DebugSink
{
typedef char char_type;
typedef io::s... |
73,308 | <p>I am trying to implement a request to an unreliable server. The request is a nice to have, but not 100% required for my perl script to successfully complete. The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never succeed. Since the server thinks it is... | [
{
"answer_id": 73351,
"author": "Alex Fort",
"author_id": 12624,
"author_profile": "https://Stackoverflow.com/users/12624",
"pm_score": 0,
"selected": false,
"text": "<p>From what I understand, the timeout property doesn't take into account DNS timeouts. It's possible that you could make... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12628/"
] | I am trying to implement a request to an unreliable server. The request is a nice to have, but not 100% required for my perl script to successfully complete. The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never succeed. Since the server thinks it is live,... | You might try [LWPx::ParanoidAgent](http://search.cpan.org/%7Ebradfitz/LWPx-ParanoidAgent-1.02/lib/LWPx/ParanoidAgent.pm), a subclass of LWP::UserAgent which is more cautious about how it interacts with remote webservers.
Among other things, it allows you to specify a global timeout. It was developed by Brad Fitzpatri... |
73,320 | <p>How do I set the column which has the header sort glyph, and its direction, in a .NET 2.0 WinForms ListView?</p>
<h2>Bump</h2>
<p>The listview is .net is not a managed control, it is a very thin wrapper around the Win32 ListView common control. It's not even a very good wrapper - it doesn't expose all the features... | [
{
"answer_id": 73331,
"author": "DevelopingChris",
"author_id": 1220,
"author_profile": "https://Stackoverflow.com/users/1220",
"pm_score": 1,
"selected": false,
"text": "<p>I use unicode arrow characters in the title of the column and make the header a linkbutton.</p>\n"
},
{
"a... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | How do I set the column which has the header sort glyph, and its direction, in a .NET 2.0 WinForms ListView?
Bump
----
The listview is .net is not a managed control, it is a very thin wrapper around the Win32 ListView common control. It's not even a very good wrapper - it doesn't expose all the features of the real l... | In case someone needs a quick solution (it draws up/down arrow at the beginning of column header text):
**ListViewExtensions.cs:**
```
public static class ListViewExtensions
{
public static void DrawSortArrow(this ListView listView, SortOrder sortOrder, int colIndex)
{
string upArrow = "▲ ";
... |
73,380 | <p>I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page.</p>
<p>I'm not really sure where to start dealing with the problem. I don't mind resetting the... | [
{
"answer_id": 73402,
"author": "MrHinsh - Martin Hinshelwood",
"author_id": 11799,
"author_profile": "https://Stackoverflow.com/users/11799",
"pm_score": 1,
"selected": false,
"text": "<p>You can remove this error completely by saving your view state to a database and only cleaning with... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12382/"
] | I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page.
I'm not really sure where to start dealing with the problem. I don't mind resetting the page if i... | That is odd as the ViewState is stored as a string in the webpage itself. So I do not see how an extended period of time would cause that error. Perhaps one or more objects on the page have been garbage collected or the application reset, so the viewstate is referencing old controls instead of the controls created when... |
73,385 | <p>Is there an easy way to convert a string from csv format into a string[] or list? </p>
<p>I can guarantee that there are no commas in the data.</p>
| [
{
"answer_id": 73390,
"author": "DevelopingChris",
"author_id": 1220,
"author_profile": "https://Stackoverflow.com/users/1220",
"pm_score": 0,
"selected": false,
"text": "<pre><code>CsvString.split(',');\n</code></pre>\n"
},
{
"answer_id": 73394,
"author": "Timothy Carter",
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12653/"
] | Is there an easy way to convert a string from csv format into a string[] or list?
I can guarantee that there are no commas in the data. | ```
string[] splitString = origString.Split(',');
```
*(Following comment not added by original answerer)*
**Please keep in mind that this answer addresses the SPECIFIC case where there are guaranteed to be NO commas in the data.** |
73,447 | <p>What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()?</p>
| [
{
"answer_id": 73503,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 4,
"selected": true,
"text": "<p>How about this:</p>\n\n<pre><code>master.sys.fn_varbintohexstr(@binvalue)\n</code></pre>\n"
},
{
"answer_id": ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366182/"
] | What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()? | How about this:
```
master.sys.fn_varbintohexstr(@binvalue)
``` |
73,456 | <p>I have a weird problem with a dropdownbox selectedIndex always being set to 0 upon postback. I'm not accidentally rebinding it in my code. In fact I've placed a breakpoint at the very first line of the page_load event and the value is already set to zero. The dropdown is in the master page of my project, I don't kno... | [
{
"answer_id": 73501,
"author": "Gilligan",
"author_id": 12356,
"author_profile": "https://Stackoverflow.com/users/12356",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure you are doing a postback and not a refresh? It is hard to help you without more context into the problem o... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288/"
] | I have a weird problem with a dropdownbox selectedIndex always being set to 0 upon postback. I'm not accidentally rebinding it in my code. In fact I've placed a breakpoint at the very first line of the page\_load event and the value is already set to zero. The dropdown is in the master page of my project, I don't know ... | Are you sure you are doing a postback and not a refresh? It is hard to help you without more context into the problem or a chunk of the code. |
73,467 | <p>I've got a custom handler applied to a class (using the Policy Injection Application Block in entlib 4) and I would like to know whether the input method is a property when Invoke is called. Following is what my handler looks like.</p>
<pre><code>[ConfigurationElementType(typeof(MyCustomHandlerData))]
public class... | [
{
"answer_id": 73747,
"author": "Fredrik Kalseth",
"author_id": 1710,
"author_profile": "https://Stackoverflow.com/users/1710",
"pm_score": 0,
"selected": false,
"text": "<p>You could check the IsSpecialName property; it will be true for property getters and setters. However, it will als... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6542/"
] | I've got a custom handler applied to a class (using the Policy Injection Application Block in entlib 4) and I would like to know whether the input method is a property when Invoke is called. Following is what my handler looks like.
```
[ConfigurationElementType(typeof(MyCustomHandlerData))]
public class MyCustomHandle... | You can also check IsSpecialName is true. this will be true in a property (amongst other things)
At the il level the methods are exposed as follows (using Environment.ExitCode as example):
```
.method public hidebysig specialname static int32 get_ExitCode() cil managed
.method public hidebysig specialname static void... |
73,468 | <p>I'm coding the shutdown of a multithreaded server.If everything goes as it should all the threads exit by their own, but there's a small chance that a thread gets stuck.In this case it would be convenient to have a non-blocking join so I could do.</p>
<p><strong>Is there a way of doing a non-blocking pthread_join?
... | [
{
"answer_id": 73481,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 0,
"selected": false,
"text": "<p>You could push a byte into a pipe opened as non-blocking to signal to the other thread when its done, then use a non-block... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12661/"
] | I'm coding the shutdown of a multithreaded server.If everything goes as it should all the threads exit by their own, but there's a small chance that a thread gets stuck.In this case it would be convenient to have a non-blocking join so I could do.
**Is there a way of doing a non-blocking pthread\_join?
Some sort of ti... | As others have pointed out there is not a non-blocking pthread\_join available in the standard pthread libraries.
However, given your stated problem (trying to guarantee that all of your threads have exited on program shutdown) such a function is not needed. You can simply do this:
```
int killed_threads = 0;
for(i =... |
73,471 | <p>I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do... | [
{
"answer_id": 73636,
"author": "Clinton Pierce",
"author_id": 8173,
"author_profile": "https://Stackoverflow.com/users/8173",
"pm_score": 0,
"selected": false,
"text": "<p>You want to use the DataGridView RowPostPaint method. Let the framework draw the row, and afterwards go back and c... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012/"
] | I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do th... | I figured out a better way of doing this, using the CellFormatting event:
```
Private Sub uxContacts_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles uxContacts.CellFormatting
If uxContacts.CurrentCell IsNot Nothing Then
If e.RowIndex = uxC... |
73,474 | <p>I am having a frequent problems with my web hosting (its shared)</p>
<p>I am not able to delete or change permission for a particular directory. The response is,</p>
<pre><code>Cannot delete. Directory may not be empty
</code></pre>
<p>I checked the permissions and it looks OK. There are 100's of files in this fo... | [
{
"answer_id": 73529,
"author": "Ram Prasad",
"author_id": 6361,
"author_profile": "https://Stackoverflow.com/users/6361",
"pm_score": 0,
"selected": false,
"text": "<p>This could also be because your FTP client might not be showing the hidden files (like cache, or any hiddn files that y... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12178/"
] | I am having a frequent problems with my web hosting (its shared)
I am not able to delete or change permission for a particular directory. The response is,
```
Cannot delete. Directory may not be empty
```
I checked the permissions and it looks OK. There are 100's of files in this folder which I don't want.
I cont... | You can't **rmdir** a directory with files in it. You must first **rm** all files and subdirectories. Many times, the easiest solution is:
```
$ rm -rf old_directory
```
It's entirely possible that some of the files or subdirectories have permission limitations that might prevent them from being removed. Occasionall... |
73,476 | <p>We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true?</p>
| [
{
"answer_id": 73483,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 3,
"selected": true,
"text": "<p>No, it isn't true, you can encode XML to any Writer in Java using something similar to:</p>\n\n<pre><code>char[] ch;\n... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9254/"
] | We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true? | No, it isn't true, you can encode XML to any Writer in Java using something similar to:
```
char[] ch;
AttributesImpl atts = new AttributesImpl();
Writer writer = new StringWriter();
StreamResult streamResult = new StreamResult(writer);
SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance(... |
73,484 | <p>Basically I would like to find a way to ddo something like:</p>
<pre><code><asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="<%# MyProperty %>"></asp:Label>
</code></pre>
<p>I know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the m... | [
{
"answer_id": 73507,
"author": "Akselsson",
"author_id": 8862,
"author_profile": "https://Stackoverflow.com/users/8862",
"pm_score": 0,
"selected": false,
"text": "<p>Call lID.Databind() from code-behind</p>\n"
},
{
"answer_id": 73513,
"author": "John Sheehan",
"author_i... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1613872/"
] | Basically I would like to find a way to ddo something like:
```
<asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="<%# MyProperty %>"></asp:Label>
```
I know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the markup and I just can't seem to find the solu... | Code expressions are an option as well. These can be used inside of quotes in ASP tags, unlike standard <%= %> tags.
The general syntax is:
```
<%$ resources: ResourceKey %>
```
There is a built-in expression for appSettings:
```
<%$ appSettings: AppSettingsKey %>
```
More info on this here: <http://weblogs.asp.... |
73,491 | <p>I'm trying to use maven2 to build an axis2 project. My project is configured as a parent project with AAR, WAR, and EAR modules. When I run the parent project's package goal, the console shows a successful build and all of the files are created. However the AAR file generated by AAR project is not included in the... | [
{
"answer_id": 89868,
"author": "user11087",
"author_id": 11087,
"author_profile": "https://Stackoverflow.com/users/11087",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried using the \"type\" element in your dependencies? For example:</p>\n\n<pre><code><dependency>\n ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5313/"
] | I'm trying to use maven2 to build an axis2 project. My project is configured as a parent project with AAR, WAR, and EAR modules. When I run the parent project's package goal, the console shows a successful build and all of the files are created. However the AAR file generated by AAR project is not included in the gener... | I was able to get my maven build working correctly by adding the following plugin to the ws-war pom file:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<p... |
73,518 | <p>In Windows XP:</p>
<p>How do you direct traffic to/from a particular site to a specific NIC?</p>
<p>For Instance: How do I say, all connections to stackoverflow.com should use my wireless connection, while all other sites will use my ethernet?</p>
| [
{
"answer_id": 73545,
"author": "Danimal",
"author_id": 2757,
"author_profile": "https://Stackoverflow.com/users/2757",
"pm_score": 1,
"selected": false,
"text": "<p>you should be able to do it using the route command. Route add (ip address) (netmask) (gateway) metric 1</p>\n"
},
{
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2744/"
] | In Windows XP:
How do you direct traffic to/from a particular site to a specific NIC?
For Instance: How do I say, all connections to stackoverflow.com should use my wireless connection, while all other sites will use my ethernet? | I'm not sure if there's an easier way, but one way would be to add a route to the IP(s) of stackoverflow.com that explicitly specifies your wireless connection, using a lower metric (cost) than your default route.
Running nslookup www.stackoverflow.com shows only one IP: 67.199.15.132, so the syntax would be:
```
rou... |
73,524 | <p>I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The <a href="http://developer.yahoo.com/maps/ajax/V3.8/index.html#YMap" rel="nofollow noreferrer"><code>addMarker()</code> method</a> on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps mu... | [
{
"answer_id": 73625,
"author": "Paul Reiners",
"author_id": 7648,
"author_profile": "https://Stackoverflow.com/users/7648",
"pm_score": -1,
"selected": false,
"text": "<p>If you're working with U.S. addresses, you can use <a href=\"http://geocoder.us/\" rel=\"nofollow noreferrer\">geoco... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346/"
] | I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The [`addMarker()` method](http://developer.yahoo.com/maps/ajax/V3.8/index.html#YMap) on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because `draw... | You can ask the map object to do the geoCoding, and catch the callback:
```
<script type="text/javascript">
var map = new YMap(document.getElementById('map'));
map.drawZoomAndCenter("Algeria", 17);
map.geoCodeAddress("Cambridge, UK");
YEvent.Capture(map, EventsList.onEndGeoCode, function(geoCode) {
if (geoCode.... |
73,542 | <p>I have an List and I'd like to wrap it into an IQueryable.</p>
<p>Is this possible?</p>
| [
{
"answer_id": 73563,
"author": "Paul van Brenk",
"author_id": 1837197,
"author_profile": "https://Stackoverflow.com/users/1837197",
"pm_score": 8,
"selected": true,
"text": "<pre><code>List<int> list = new List<int>() { 1, 2, 3, 4, };\nIQueryable<int> query = list.AsQu... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11835/"
] | I have an List and I'd like to wrap it into an IQueryable.
Is this possible? | ```
List<int> list = new List<int>() { 1, 2, 3, 4, };
IQueryable<int> query = list.AsQueryable();
```
If you don't see the `AsQueryable()` method, add a using statement for `System.Linq`. |
73,544 | <p>Anyone know of a good, hopefully free FTP class for use in .NET that can actually work behind an HTTP proxy or FTP gateway? The FtpWebRequest stuff in .NET is horrible at best, and I really don't want to roll my own here.</p>
| [
{
"answer_id": 73566,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": -1,
"selected": false,
"text": "<p>System.Net.WebClient can handle ftp urls, and it's a bit easier to work with. You can set credentials and proxy in... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91911/"
] | Anyone know of a good, hopefully free FTP class for use in .NET that can actually work behind an HTTP proxy or FTP gateway? The FtpWebRequest stuff in .NET is horrible at best, and I really don't want to roll my own here. | Our [Rebex FTP](http://www.rebex.net/ftp.net/) works with proxies just fine. Following code shows how to connect to the FTP using HTTP proxy (code is taken from [FTP tutorial page](http://www.rebex.net/ftp.net/tutorial-ftp.aspx#proxy)).
```
// initialize FTP client
Ftp client = new Ftp();
// setup proxy details
cl... |
73,580 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail">How do you send email from a Java app using Gmail?</a> </p>
</blockquote>
<p>How do I send an SMTP Message from Java?</p>
| [
{
"answer_id": 73596,
"author": "Mason",
"author_id": 8973,
"author_profile": "https://Stackoverflow.com/users/8973",
"pm_score": 2,
"selected": false,
"text": "<p>See the <a href=\"http://www.oracle.com/technetwork/java/javamail/index.html\" rel=\"nofollow noreferrer\">JavaMail API</a> ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | >
> **Possible Duplicate:**
>
> [How do you send email from a Java app using Gmail?](https://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail)
>
>
>
How do I send an SMTP Message from Java? | Here's an example for Gmail smtp:
```
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
import javax.mail.*;
import javax.mail.internet.*;
import com.sun.mail.smtp.*;
public class Distribution {
public static void main(String args[]) throws Exception {
... |
73,628 | <p>If you have a JSF <code><h:commandLink></code> (which uses the <code>onclick</code> event of an <code><a></code> to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed?</p>
| [
{
"answer_id": 73644,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 4,
"selected": true,
"text": "<pre><code><h:commandLink id=\"myCommandLink\" action=\"#{myPageCode.doDelete}\">\n <h:outputText value=\"#{m... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9254/"
] | If you have a JSF `<h:commandLink>` (which uses the `onclick` event of an `<a>` to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed? | ```
<h:commandLink id="myCommandLink" action="#{myPageCode.doDelete}">
<h:outputText value="#{msgs.deleteText}" />
</h:commandLink>
<script type="text/javascript">
if (document.getElementById) {
var commandLink = document.getElementById('<c:out value="${myPageCode.myCommandLinkClientId}" />');
if (commandLi... |
73,629 | <p>I have a string that is like below.</p>
<pre><code>,liger, unicorn, snipe
</code></pre>
<p>in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#?</p>
<p>Thanks.</p>
<hr>
<p><em>There's been a lot of back and forth about the StartTrim function. As several have pointed... | [
{
"answer_id": 73650,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 0,
"selected": false,
"text": "<pre><code>if (s.StartsWith(\",\")) {\n s = s.Substring(1, s.Length - 1);\n}\n</code></pre>\n"
},
{
"answer_id": ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] | I have a string that is like below.
```
,liger, unicorn, snipe
```
in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#?
Thanks.
---
*There's been a lot of back and forth about the StartTrim function. As several have pointed out, the StartTrim doesn't affect the primar... | ```
string sample = ",liger, unicorn, snipe";
sample = sample.TrimStart(','); // to remove just the first comma
```
Or perhaps:
```
sample = sample.Trim().TrimStart(','); // to remove any whitespace and then the first comma
``` |
73,651 | <p>I'm failing at finding the commands I need to send to authenticate to a SMTP server using NTLM. </p>
<p>I think it goes something like:</p>
<pre><code>AUTH NTLM <bae64encode something>
334
<bae64encode something>
235
</code></pre>
| [
{
"answer_id": 82401,
"author": "Duncan Smart",
"author_id": 1278,
"author_profile": "https://Stackoverflow.com/users/1278",
"pm_score": 1,
"selected": false,
"text": "<p>Look for information about <strong>Apache</strong> and Siteminder as Apache is responsible for the HTTP transport stu... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4580/"
] | I'm failing at finding the commands I need to send to authenticate to a SMTP server using NTLM.
I think it goes something like:
```
AUTH NTLM <bae64encode something>
334
<bae64encode something>
235
``` | SVN with Siteminder has been implemented and is working now. Since there is not much of information out there on this, I would like to post the overview of steps followed:
1. Cookie based authentcation was disabled on Siteminder end
2. HTTP AUTH was enabled (in Siteminder) and all webdav methods were added to policy s... |
73,663 | <p>How do I exit a script early, like the <code>die()</code> command in PHP?</p>
| [
{
"answer_id": 73673,
"author": "pjz",
"author_id": 8002,
"author_profile": "https://Stackoverflow.com/users/8002",
"pm_score": 12,
"selected": true,
"text": "<pre><code>import sys\nsys.exit()\n</code></pre>\n<p>details from the <a href=\"https://docs.python.org/2/library/sys.html#sys.ex... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | How do I exit a script early, like the `die()` command in PHP? | ```
import sys
sys.exit()
```
details from the [`sys` module documentation](https://docs.python.org/2/library/sys.html#sys.exit):
>
> `sys.**exit**([*arg*])`
>
>
> Exit from Python. This is implemented by raising the
> [`SystemExit`](https://docs.python.org/2/library/exceptions.html#SystemExit "SystemExit") excep... |
73,667 | <p>How can I start an interactive console for Perl, similar to the <code>irb</code> command for Ruby or <code>python</code> for Python?</p>
| [
{
"answer_id": 73685,
"author": "Brian Phillips",
"author_id": 7230,
"author_profile": "https://Stackoverflow.com/users/7230",
"pm_score": 3,
"selected": false,
"text": "<p><code>perl -d</code> is your friend:</p>\n\n<pre><code>% perl -de 0</code></pre>\n"
},
{
"answer_id": 73689... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475/"
] | How can I start an interactive console for Perl, similar to the `irb` command for Ruby or `python` for Python? | You can use the perl debugger on a trivial program, like so:
```
perl -de1
```
Alternatively there's [*Alexis Sukrieh*'s Perl Console](http://search.cpan.org/~sukria/perlconsole-0.4/perlconsole) application, but I haven't used it. |
73,686 | <pre><code>#include <iostream>
using namespace std;
int main()
{
double u = 0;
double w = -u;
cout << w << endl;
return 0;
}
</code></pre>
<p>Why does this great piece of code output <code>-0</code> and not <code>0</code>, as one would expect?</p>
| [
{
"answer_id": 73711,
"author": "foxxtrot",
"author_id": 10369,
"author_profile": "https://Stackoverflow.com/users/10369",
"pm_score": 5,
"selected": true,
"text": "<p>The IEEE 754 standard for floating-point numbers has the sign bit separate from the mantissa, which allows for zero to b... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6922/"
] | ```
#include <iostream>
using namespace std;
int main()
{
double u = 0;
double w = -u;
cout << w << endl;
return 0;
}
```
Why does this great piece of code output `-0` and not `0`, as one would expect? | The IEEE 754 standard for floating-point numbers has the sign bit separate from the mantissa, which allows for zero to be negative. [Wikipedia](http://en.wikipedia.org/wiki/IEEE_754) should be able to help explain this. |
73,713 | <p>The following will cause infinite recursion on the == operator overload method</p>
<pre><code> Foo foo1 = null;
Foo foo2 = new Foo();
Assert.IsFalse(foo1 == foo2);
public static bool operator ==(Foo foo1, Foo foo2) {
if (foo1 == null) return foo2 == null;
return foo1.Equals(foo2);
... | [
{
"answer_id": 73729,
"author": "Andrew Jones",
"author_id": 12767,
"author_profile": "https://Stackoverflow.com/users/12767",
"pm_score": 4,
"selected": false,
"text": "<p>Cast to object in the overload method:</p>\n\n<pre><code>public static bool operator ==(Foo foo1, Foo foo2) {\n ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12767/"
] | The following will cause infinite recursion on the == operator overload method
```
Foo foo1 = null;
Foo foo2 = new Foo();
Assert.IsFalse(foo1 == foo2);
public static bool operator ==(Foo foo1, Foo foo2) {
if (foo1 == null) return foo2 == null;
return foo1.Equals(foo2);
}
```
How ... | Use `ReferenceEquals`:
```
Foo foo1 = null;
Foo foo2 = new Foo();
Assert.IsFalse(foo1 == foo2);
public static bool operator ==(Foo foo1, Foo foo2) {
if (object.ReferenceEquals(null, foo1))
return object.ReferenceEquals(null, foo2);
return foo1.Equals(foo2);
}
``` |
73,748 | <p>I have a dropdownlist with the autopostback set to true. I want the
user to confirm if they really want to change the value,
which on post back fires a server side event (selectedindexchanged).</p>
<p>I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") b... | [
{
"answer_id": 73860,
"author": "Brian Liang",
"author_id": 5853,
"author_profile": "https://Stackoverflow.com/users/5853",
"pm_score": 0,
"selected": false,
"text": "<p>Make sure your event is wired:</p>\n\n<pre><code>dropDown.SelectedIndexChanged += new EventHandler(dropDown_SelectedIn... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/262613/"
] | I have a dropdownlist with the autopostback set to true. I want the
user to confirm if they really want to change the value,
which on post back fires a server side event (selectedindexchanged).
I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it will... | Have you tried to set the onChange event to a javascript function and then inside the function display the javascript alert and utilize the \_\_doPostback function if it passes?
i.e.
```
drpControl.Attributes("onChange") = "DisplayConfirmation();"
function DisplayConfirmation() {
if (confirm('Are you sure you wan... |
73,781 | <p>If I want to send mail not via SMTP, but rather via sendmail, is there a library for python that encapsulates this process?</p>
<p>Better yet, is there a good library that abstracts the whole 'sendmail -versus- smtp' choice?</p>
<p>I'll be running this script on a bunch of unix hosts, only some of which are listen... | [
{
"answer_id": 73807,
"author": "tovare",
"author_id": 12677,
"author_profile": "https://Stackoverflow.com/users/12677",
"pm_score": 2,
"selected": false,
"text": "<p>It's quite common to just use the sendmail command from Python using os.popen</p>\n\n<p>Personally, for scripts i didn't ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12779/"
] | If I want to send mail not via SMTP, but rather via sendmail, is there a library for python that encapsulates this process?
Better yet, is there a good library that abstracts the whole 'sendmail -versus- smtp' choice?
I'll be running this script on a bunch of unix hosts, only some of which are listening on localhost:... | Header injection isn't a factor in how you send the mail, it's a factor in how you construct the mail. Check the [email](https://docs.python.org/2/library/email.html) package, construct the mail with that, serialise it, and send it to `/usr/sbin/sendmail` using the [subprocess](https://docs.python.org/2/library/subproc... |
73,785 | <p>I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the... | [
{
"answer_id": 73891,
"author": "Martin08",
"author_id": 8203,
"author_profile": "https://Stackoverflow.com/users/8203",
"pm_score": 0,
"selected": false,
"text": "<p>In Excel VBA, this function will give you the content of any cell in any worksheet.</p>\n\n<pre><code>Function getCellCon... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5899/"
] | I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the code s... | ```
Sub CheckValues1()
Dim rwIndex As Integer
Dim colIndex As Integer
For rwIndex = 1 To 10
For colIndex = 1 To 5
If Cells(rwIndex, colIndex).Value <> 0 Then _
Cells(rwIndex, colIndex).Value = 0
Next colIndex
Next rwIndex
End Sub
```
Found th... |
73,797 | <p>How do I tell Subversion (svn) to treat a file as a binary file?</p>
| [
{
"answer_id": 73820,
"author": "Jan Krüger",
"author_id": 12471,
"author_profile": "https://Stackoverflow.com/users/12471",
"pm_score": 3,
"selected": false,
"text": "<p>For example:</p>\n\n<pre><code>svn propset svn:mime-type image/png foo.png\n</code></pre>\n"
},
{
"answer_id"... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5222/"
] | How do I tell Subversion (svn) to treat a file as a binary file? | It is possible to manually identify a file located within a repository as *binary* by using:
```
svn propset svn:mime-type application/octet-stream <filename>
```
This is generally not necessary, as Subversion will attempt to determine whether a file is binary when the file is first added. If Subversion is incorrect... |
73,833 | <p>I want to search for files containing DOS line endings with grep on Linux. Something like this:</p>
<pre class="lang-sh prettyprint-override"><code>grep -IUr --color '\r\n' .
</code></pre>
<p>The above seems to match for literal <code>rn</code> which is not what is desired.</p>
<p>The output of this will be piped t... | [
{
"answer_id": 73886,
"author": "pjz",
"author_id": 8002,
"author_profile": "https://Stackoverflow.com/users/8002",
"pm_score": 7,
"selected": false,
"text": "<p>Use <kbd>Ctrl</kbd>+<kbd>V</kbd>, <kbd>Ctrl</kbd>+<kbd>M</kbd> to enter a literal Carriage Return character into your grep str... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10245/"
] | I want to search for files containing DOS line endings with grep on Linux. Something like this:
```sh
grep -IUr --color '\r\n' .
```
The above seems to match for literal `rn` which is not what is desired.
The output of this will be piped through xargs into todos to convert crlf to lf like this
```
grep -IUrl --col... | grep probably isn't the tool you want for this. It will print a line for every matching line in every file. Unless you want to, say, run todos 10 times on a 10 line file, grep isn't the best way to go about it. Using find to run file on every file in the tree then grepping through that for "CRLF" will get you one line ... |
73,885 | <p>How can I construct my ajaxSend call, this seems like the place to put it, to preview what is being passed back to the broker? also, can I stop the ajax call in ajaxSend?..so I can perfect my url string before dealing with errors from the broker?</p>
<p>This is the complete URL that, when passed to the broker, will... | [
{
"answer_id": 73916,
"author": "moswald",
"author_id": 8368,
"author_profile": "https://Stackoverflow.com/users/8368",
"pm_score": 3,
"selected": true,
"text": "<p>As far as I know, the only way to do that is to enter something (anything) on that line, then delete it. Or hit space and ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755/"
] | How can I construct my ajaxSend call, this seems like the place to put it, to preview what is being passed back to the broker? also, can I stop the ajax call in ajaxSend?..so I can perfect my url string before dealing with errors from the broker?
This is the complete URL that, when passed to the broker, will return th... | As far as I know, the only way to do that is to enter something (anything) on that line, then delete it. Or hit space and you'll never see it there until you return to that line.
Once VS determines that you've edited a line of text, it won't automatically modify it for you (at least, not in that way that you've descri... |
73,892 | <p>How can I <strong>pre pend</strong> (insert at beginning of file) a file to all files of a type in folder and sub-folders using <code>Powershell</code>?</p>
<p>I need to add a standard header file to all <code>.cs</code> and was trying to use <code>Powershell</code> to do so, but while I was able to append it in a ... | [
{
"answer_id": 74035,
"author": "agnul",
"author_id": 6069,
"author_profile": "https://Stackoverflow.com/users/6069",
"pm_score": 1,
"selected": false,
"text": "<p>Have no idea, but if you have the code to append just do it the other way round. Something like</p>\n\n<ol>\n<li>rename exis... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11673/"
] | How can I **pre pend** (insert at beginning of file) a file to all files of a type in folder and sub-folders using `Powershell`?
I need to add a standard header file to all `.cs` and was trying to use `Powershell` to do so, but while I was able to append it in a few lines of code I was stuck when trying to **pre-pend*... | Here is a very simple example to show you one of the ways it could be done.
```
$Content = "This is your content`n"
Get-ChildItem *.cs | foreach-object {
$FileContents = Get-Content -Path $_
Set-Content -Path $_ -Value ($Content + $FileContents)
}
``` |
73,930 | <p>What do I need to add to my <code>.spec</code> file to create the desktop shortcut and assign an icon to the shortcut during install of my <code>.rpm</code>? If a script is required, an example would be very helpful.</p>
| [
{
"answer_id": 74003,
"author": "akdom",
"author_id": 145,
"author_profile": "https://Stackoverflow.com/users/145",
"pm_score": 3,
"selected": false,
"text": "<p>You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environmen... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What do I need to add to my `.spec` file to create the desktop shortcut and assign an icon to the shortcut during install of my `.rpm`? If a script is required, an example would be very helpful. | You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environment you are using. Since I'm currently running Gnome on Fedora 9, I will answer it in those terms.
An example foo.desktop file would be:
```
[Desktop Entry]
Encoding=UTF-8
GenericName=Generic Pie... |
73,947 | <p>I'm talking about an action game with no upper score limit and no way to verify the score on the server by replaying moves etc. </p>
<p>What I really need is the strongest encryption possible in Flash/PHP, and a way to prevent people calling the PHP page other than through my Flash file. I have tried some simple me... | [
{
"answer_id": 74043,
"author": "Stephen Deken",
"author_id": 7154,
"author_profile": "https://Stackoverflow.com/users/7154",
"pm_score": 5,
"selected": false,
"text": "<p>You may be asking the wrong question. You seem focused on the methods people are using to game their way up the hig... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11911/"
] | I'm talking about an action game with no upper score limit and no way to verify the score on the server by replaying moves etc.
What I really need is the strongest encryption possible in Flash/PHP, and a way to prevent people calling the PHP page other than through my Flash file. I have tried some simple methods in t... | This is a classic problem with Internet games and contests. Your Flash code works with users to decide a score for a game. But users aren't trusted, and the Flash code runs on the user's computer. You're SOL. There is nothing you can do to prevent an attacker from forging high scores:
* Flash is even easier to reverse... |
73,958 | <p>In a shellscript, I'd like to set the IP of my box, run a command, then move to the next IP. The IPs are an entire C block.</p>
<p>The question is how do I set the IP of the box without editing a file? What command sets the IP on Slackware?</p>
<p>Thanks</p>
| [
{
"answer_id": 74039,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>It should be something like: <code>ifconfig eth0 192.168.0.42 up</code></p>\n\n<p>Replace eth0 by the network interface of y... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In a shellscript, I'd like to set the IP of my box, run a command, then move to the next IP. The IPs are an entire C block.
The question is how do I set the IP of the box without editing a file? What command sets the IP on Slackware?
Thanks | As mentioned in other answers, you can use either the ifconfig command or the ip command. ip is a much more robust command, and I prefer to use it. A full script which loops through a full class C subnet adding the IP, doing stuff, then removing it follows. Note that it doesn't use .0 or .255, which are the network and... |
73,960 | <p>In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. </p>
<p>This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possible. This makes my page lo... | [
{
"answer_id": 74062,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You can add a style directly to the select element:</p>\n\n<p><code><select name=\"foo\" style=\"width: 200px\"></code... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/747/"
] | In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content.
This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possible. This makes my page look very ug... | Here's another [jQuery](http://jquery.com) based example. In contrary to all the other answers posted here, it takes all keyboard and mouse events into account, especially clicks:
```
if (!$.support.leadingWhitespace) { // if IE6/7/8
$('select.wide')
.bind('focus mouseover', function() { $(this).addClass('... |
73,964 | <p>I would like to turn the HTML generated by my CFM page into a PDF, and have the user prompted with the standard "Save As" prompt when navigating to my page.</p>
| [
{
"answer_id": 73982,
"author": "Frank Wiles",
"author_id": 12568,
"author_profile": "https://Stackoverflow.com/users/12568",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not that familiar with ColdFusion, but what you need to do is set the Content-Type of the page when the user req... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2232/"
] | I would like to turn the HTML generated by my CFM page into a PDF, and have the user prompted with the standard "Save As" prompt when navigating to my page. | You should use the cfdocument tag (with format="PDF") to generate the PDF by placing it around the page you are generating. You'll want to specify a filename attribute, otherwise the document will just stream right to your browser.
After you have saved the content as a PDF, use cfheader and cfcontent in combination to... |
73,971 | <p>In JavaScript, what is the best way to determine if a date provided falls within a valid range?</p>
<p>An example of this might be checking to see if the user input <code>requestedDate</code> is part of the next valid work week. Note that this is not just checking to see if one date is larger than another as a vali... | [
{
"answer_id": 74024,
"author": "Jesper Blad Jensen",
"author_id": 11559,
"author_profile": "https://Stackoverflow.com/users/11559",
"pm_score": 3,
"selected": false,
"text": "<p>So if i understand currenctly, you need to look if one date is bigger than the other.</p>\n\n<pre><code>funct... | 2008/09/16 | [
"https://Stackoverflow.com/questions/73971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185/"
] | In JavaScript, what is the best way to determine if a date provided falls within a valid range?
An example of this might be checking to see if the user input `requestedDate` is part of the next valid work week. Note that this is not just checking to see if one date is larger than another as a valid date would be equal... | This is actually a problem that I have seen come up before a lot in my works and the following bit of code is my answer to the problem.
```
// checkDateRange - Checks to ensure that the values entered are dates and
// are of a valid range. By this, the dates must be no more than the
// built-in number of day... |
74,010 | <p>I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?</p>
| [
{
"answer_id": 74105,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 2,
"selected": false,
"text": "<p>An explicit cursor is one you declare, like:</p>\n\n<pre><code>CURSOR my_cursor IS\n SELECT table_name FROM USER_TABLE... | 2008/09/16 | [
"https://Stackoverflow.com/questions/74010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] | I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this? | An implicit cursor is one created "automatically" for you by Oracle when you execute a query. It is simpler to code, but suffers from
* inefficiency (the ANSI standard specifies that it must fetch twice to check if there is more than one record)
* vulnerability to data errors (if you ever get two rows, it raises a TO... |
74,019 | <p>How can I specify the filename when dumping data into the response stream?</p>
<p>Right now I'm doing the following:</p>
<pre><code>byte[] data= GetFoo();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(data);
Response.End();
</code></pre>
<p>Wi... | [
{
"answer_id": 74044,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 4,
"selected": false,
"text": "<pre><code>Response.AppendHeader(\"Content-Disposition\", \"attachment; filename=foo.pdf\");\n</code></pre>\n"
},
{
"... | 2008/09/16 | [
"https://Stackoverflow.com/questions/74019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1672/"
] | How can I specify the filename when dumping data into the response stream?
Right now I'm doing the following:
```
byte[] data= GetFoo();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(data);
Response.End();
```
With the code above, I get "foo.asp... | Add a content-disposition to the header:
```
Response.AddHeader("content-disposition", @"attachment;filename=""MyFile.pdf""");
``` |
74,032 | <p>I'm looking for real world best practices, how other people might have implemented solutions with complex domains.</p>
| [
{
"answer_id": 74070,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 2,
"selected": false,
"text": "<p>This is what <a href=\"http://msdn.microsoft.com/en-us/library/system.collections.iequalitycomparer.aspx\" rel=\"n... | 2008/09/16 | [
"https://Stackoverflow.com/questions/74032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5802/"
] | I'm looking for real world best practices, how other people might have implemented solutions with complex domains. | Any time you consider using an `IEqualityComparer<T>`, pause to think if the class could be made to implement `IEquatable<T>` instead. If a `Product` should always be compared by ID, just define it to be equated as such so you can use the default comparer.
That said, there are still a few of reasons you might want a c... |
74,057 | <p>Is there a way to use sql-server like analytic functions in Hibernate?</p>
<p>Something like </p>
<pre><code>select foo from Foo foo where f.x = max(f.x) over (partition by f.y)
</code></pre>
| [
{
"answer_id": 75287,
"author": "Jason Weathered",
"author_id": 3736,
"author_profile": "https://Stackoverflow.com/users/3736",
"pm_score": 3,
"selected": false,
"text": "<p>You are after a native SQL query.</p>\n\n<p>If you are using JPA the syntax is:</p>\n\n<pre><code>Query q = em.cre... | 2008/09/16 | [
"https://Stackoverflow.com/questions/74057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12905/"
] | Is there a way to use sql-server like analytic functions in Hibernate?
Something like
```
select foo from Foo foo where f.x = max(f.x) over (partition by f.y)
``` | You are after a native SQL query.
If you are using JPA the syntax is:
```
Query q = em.createNativeQuery("select foo.* from Foo foo " +
"where f.x = max(f.x) over " +
"(partition by f.y)", Foo.class);
```
If you need to return multiple types, take a look... |
74,083 | <p>When using Business Objects' CrystalReportViewer control, how can you detect and manually print the report the user has currently drilled into? You can print this automatically using the Print() method of the CrystalReportViewer, but I want to be able to do a manual printing of this report.</p>
<p>It is possible to... | [
{
"answer_id": 75287,
"author": "Jason Weathered",
"author_id": 3736,
"author_profile": "https://Stackoverflow.com/users/3736",
"pm_score": 3,
"selected": false,
"text": "<p>You are after a native SQL query.</p>\n\n<p>If you are using JPA the syntax is:</p>\n\n<pre><code>Query q = em.cre... | 2008/09/16 | [
"https://Stackoverflow.com/questions/74083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When using Business Objects' CrystalReportViewer control, how can you detect and manually print the report the user has currently drilled into? You can print this automatically using the Print() method of the CrystalReportViewer, but I want to be able to do a manual printing of this report.
It is possible to print the... | You are after a native SQL query.
If you are using JPA the syntax is:
```
Query q = em.createNativeQuery("select foo.* from Foo foo " +
"where f.x = max(f.x) over " +
"(partition by f.y)", Foo.class);
```
If you need to return multiple types, take a look... |