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 |
|---|---|---|---|---|---|---|
331,963 | <p>I'm trying to "single source" a form page which can be in edit mode or view mode. For various reasons, this isn't using the ASP.Net FormView or DetailsView controls.</p>
<p>Since there is no way to disable a textbox without turning its contents gray (well, we could "eat" all of the keystrokes into it, but that isn'... | [
{
"answer_id": 331997,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>When I've done this, I've had to \"eat\" each keystroke as you describe and mirror it into a \"hidden\" span tag th... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14894/"
] | I'm trying to "single source" a form page which can be in edit mode or view mode. For various reasons, this isn't using the ASP.Net FormView or DetailsView controls.
Since there is no way to disable a textbox without turning its contents gray (well, we could "eat" all of the keystrokes into it, but that isn't very ele... | This may not suit your needs, but it's a possibility.
`<input>` and `<textarea>` tags support the read-only property. The behavior of read-only fields is slightly different than disabled. Here's what the [HTML 4.01 Recommendation](http://www.w3.org/TR/html401/) says:
>
> When set, the readonly attribute has the foll... |
331,972 | <p>I'm working on a menu-generating HtmlHelper extension method. This method will need to know which Action is being executed. So if Home/Index is executing, the extension method would show all links to other actions that're "coordinated." In a sense, all I need to know during the execution of the Home controller's Ind... | [
{
"answer_id": 331998,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 3,
"selected": true,
"text": "<p>Try this</p>\n\n<pre><code>var action = HtmlHelper.ViewContext.RouteData.Values[\"action\"];\nvar controller = HtmlHelper... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28686/"
] | I'm working on a menu-generating HtmlHelper extension method. This method will need to know which Action is being executed. So if Home/Index is executing, the extension method would show all links to other actions that're "coordinated." In a sense, all I need to know during the execution of the Home controller's Index ... | Try this
```
var action = HtmlHelper.ViewContext.RouteData.Values["action"];
var controller = HtmlHelper.ViewContext.RouteData.Values["controller"];
``` |
331,976 | <p>I'm attempting to use the following code to serialize an anonymous type to JSON:</p>
<pre><code>var serializer = new DataContractJsonSerializer(thing.GetType());
var ms = new MemoryStream();
serializer.WriteObject(ms, thing);
var json = Encoding.Default.GetString(ms.ToArray());
</code></pre>
<p>However, I get the... | [
{
"answer_id": 331983,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 8,
"selected": true,
"text": "<p>Try the JavaScriptSerializer instead of the DataContractJsonSerializer</p>\n\n<pre><code>JavaScriptSerializer serializer ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4541/"
] | I'm attempting to use the following code to serialize an anonymous type to JSON:
```
var serializer = new DataContractJsonSerializer(thing.GetType());
var ms = new MemoryStream();
serializer.WriteObject(ms, thing);
var json = Encoding.Default.GetString(ms.ToArray());
```
However, I get the following exception when ... | Try the JavaScriptSerializer instead of the DataContractJsonSerializer
```
JavaScriptSerializer serializer = new JavaScriptSerializer();
var output = serializer.Serialize(your_anon_object);
``` |
331,992 | <p>My list (@degree) is built from a SQL command. The NVL command in the SQL isn't working, neither are tests such as:</p>
<pre><code>if (@degree[$i] == "")
if (@degree[$i] == " ")
if (@degree[$i] == '')
if (@degree[$i] == -1)
if (@degree[$i] == 0)
if (@degree[$i] == ())
if (@degree[$i] == undef)
</code></pre>
<p>$i ... | [
{
"answer_id": 332011,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 4,
"selected": true,
"text": "<p>First of all, the ith element in an array is $degree[$i], not @degree[$i]. Second, \"==\" is for numerical compariso... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | My list (@degree) is built from a SQL command. The NVL command in the SQL isn't working, neither are tests such as:
```
if (@degree[$i] == "")
if (@degree[$i] == " ")
if (@degree[$i] == '')
if (@degree[$i] == -1)
if (@degree[$i] == 0)
if (@degree[$i] == ())
if (@degree[$i] == undef)
```
$i is a counter variable in a... | First of all, the ith element in an array is $degree[$i], not @degree[$i]. Second, "==" is for numerical comparisons - use "eq" for lexical comparisons. Third of all, try `if (defined($degree[$i]))` |
331,996 | <p>I'm having quite a bit of pain inserting and deleting UITableViewCells from the same UITableView!</p>
<p>I don't normally post code, but I thought this was the best way of showing where I'm having the problem:</p>
<hr>
<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 5;
}
... | [
{
"answer_id": 332097,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 0,
"selected": false,
"text": "<p>In the code you posted, your loop index runs from 0 to 4, which suggests that it would delete <i>all</i> of the rows in... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1221378/"
] | I'm having quite a bit of pain inserting and deleting UITableViewCells from the same UITableView!
I don't normally post code, but I thought this was the best way of showing where I'm having the problem:
---
```
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 5;
}
- (NSInteger)tableVie... | FYI: This bug seems to have been fixed completely with the 2.2 iPhone update.
Thanks Apple!
Nick. |
332,005 | <p>When I look at a directory in Windows Explorer, I can see a ProductName and ProductVersion property for the DLL's in that directory.</p>
<p>I need to export this DLL list with ProductName and ProductVersion into a text file.</p>
<p>If I do <code>c:\>dir *.dll > test.log</code>, the test.log does not have the... | [
{
"answer_id": 332015,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 2,
"selected": true,
"text": "<p>Using VBScript you could do the following:</p>\n\n<pre><code>Set objShell = CreateObject (\"Shell.Application\")\nS... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32670/"
] | When I look at a directory in Windows Explorer, I can see a ProductName and ProductVersion property for the DLL's in that directory.
I need to export this DLL list with ProductName and ProductVersion into a text file.
If I do `c:\>dir *.dll > test.log`, the test.log does not have the ProductName and ProductVersion.
... | Using VBScript you could do the following:
```
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace ("C:\Scripts")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim arrHeaders(40)
For i = 0 to 40
arrHeaders(i) = objFolder.GetDetailsOf (objFolder.Items, i)
Next
For Each s... |
332,060 | <p>I have been working my way through Scott Guthrie's excellent post on <a href="http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx" rel="noreferrer">ASP.NET MVC Beta 1</a>. In it he shows the improvements made to the UpdateModel method and how they improve unit testing. I have recreated... | [
{
"answer_id": 332089,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 4,
"selected": true,
"text": "<p>I don't think it can be done since TryUpdateModel, which UpdateModel uses, references the ControllerContext which is ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32588/"
] | I have been working my way through Scott Guthrie's excellent post on [ASP.NET MVC Beta 1](http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx). In it he shows the improvements made to the UpdateModel method and how they improve unit testing. I have recreated a similar project however anytim... | I don't think it can be done since TryUpdateModel, which UpdateModel uses, references the ControllerContext which is null when invoked from a unit test. I use RhinoMocks to mock or stub the various components needed by the controller.
```
var routeData = new RouteData();
var httpContext = MockRepository.GenerateStub<H... |
332,067 | <p>My application's context root is /foobar and I am running an exploded deployment with maven-jetty-plugin.</p>
<p>I need to dynamically remap requets for /images/* to /foobar/images/*, and I cannot remap my application's context root to /.</p>
<p>For weblogic I have a halfwit solution where I deploy an additional w... | [
{
"answer_id": 332089,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 4,
"selected": true,
"text": "<p>I don't think it can be done since TryUpdateModel, which UpdateModel uses, references the ControllerContext which is ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23691/"
] | My application's context root is /foobar and I am running an exploded deployment with maven-jetty-plugin.
I need to dynamically remap requets for /images/\* to /foobar/images/\*, and I cannot remap my application's context root to /.
For weblogic I have a halfwit solution where I deploy an additional war containing a... | I don't think it can be done since TryUpdateModel, which UpdateModel uses, references the ControllerContext which is null when invoked from a unit test. I use RhinoMocks to mock or stub the various components needed by the controller.
```
var routeData = new RouteData();
var httpContext = MockRepository.GenerateStub<H... |
332,079 | <p>I'm working with some example java code for making md5 hashes. One part converts the results from bytes to a string of hex digits:</p>
<pre><code>byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i=0;i<messageDigest.length;i++) {
hexString.append(Integer.to... | [
{
"answer_id": 332093,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 2,
"selected": false,
"text": "<p>This what I am using for MD5 hashes:</p>\n\n<pre><code>public static String getMD5(String filename)\n throw... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25680/"
] | I'm working with some example java code for making md5 hashes. One part converts the results from bytes to a string of hex digits:
```
byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i=0;i<messageDigest.length;i++) {
hexString.append(Integer.toHexString(0xFF & ... | A simple approach would be to check how many digits are output by `Integer.toHexString()` and add a leading zero to each byte if needed. Something like this:
```
public static String toHexString(byte[] bytes) {
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
Str... |
332,102 | <p>In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (" ") in a form field?</p>
<pre><code>class Item(models.Model):
description = models.CharField(max_length=100)
class ItemForm(ModelForm):
class Meta:
model = Item
</code></pre>
<p>if user enters only whit... | [
{
"answer_id": 332947,
"author": "Carl Meyer",
"author_id": 3207,
"author_profile": "https://Stackoverflow.com/users/3207",
"pm_score": 3,
"selected": true,
"text": "<pre><code>class ItemForm(forms.ModelForm):\n class Meta:\n model = Item\n\n def clean_description(self):\n ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11452/"
] | In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (" ") in a form field?
```
class Item(models.Model):
description = models.CharField(max_length=100)
class ItemForm(ModelForm):
class Meta:
model = Item
```
if user enters only whitespace (" ") in descriptio... | ```
class ItemForm(forms.ModelForm):
class Meta:
model = Item
def clean_description(self):
if not self.cleaned_data['description'].strip():
raise forms.ValidationError('Your error message here')
```
The [forms validation documentation](http://docs.djangoproject.com/en/dev/ref/form... |
332,109 | <p>I have a website that employs a generic mod_rewrite rule to push all requests to the index.php page, with the exception of certain file extensions:</p>
<pre><code>RewriteRule !\.(js|ico|gif|jpg|JPG|png|css|php|phtml|pdf|txt|xml)$ index.php
</code></pre>
<p>What I need to be able to do is also exclude a certain dir... | [
{
"answer_id": 332185,
"author": "stesch",
"author_id": 41860,
"author_profile": "https://Stackoverflow.com/users/41860",
"pm_score": 0,
"selected": false,
"text": "<p>You could check with <code>RewriteCond %{REQUEST_FILENAME} !-f</code> for any request that doesn't match to an existing ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29538/"
] | I have a website that employs a generic mod\_rewrite rule to push all requests to the index.php page, with the exception of certain file extensions:
```
RewriteRule !\.(js|ico|gif|jpg|JPG|png|css|php|phtml|pdf|txt|xml)$ index.php
```
What I need to be able to do is also exclude a certain directory (including any fil... | Before the line you have quoted, for a directory named 'style' for instance, you need:
```
RewriteRule ^style/ - [L]
```
The hyphen means 'no redirection', and the '[L]' means 'last rule', as in don't carry on trying to match the URL to the follwing rules. You can put as many of these lines in as you like, but th... |
332,111 | <p>I need to store a double as a string. I know I can use <code>printf</code> if I wanted to display it, but I just want to store it in a string variable so that I can store it in a map later (as the <em>value</em>, not the <em>key</em>).</p>
| [
{
"answer_id": 332113,
"author": "Darron",
"author_id": 22704,
"author_profile": "https://Stackoverflow.com/users/22704",
"pm_score": 2,
"selected": false,
"text": "<p>Take a look at <code>sprintf()</code> and family.</p>\n"
},
{
"answer_id": 332115,
"author": "Firas Assaad",... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I need to store a double as a string. I know I can use `printf` if I wanted to display it, but I just want to store it in a string variable so that I can store it in a map later (as the *value*, not the *key*). | The *boost (tm)* way:
```
std::string str = boost::lexical_cast<std::string>(dbl);
```
The *Standard C++* way:
```
std::ostringstream strs;
strs << dbl;
std::string str = strs.str();
```
**Note**: Don't forget `#include <sstream>` |
332,120 | <p>I'm trying to build a video recorder without jailbreaking my iPhone (i've a Developer license).
I began using PhotoLibrary private framework, but i can only reach 2ftp (too slow).
Cycoder app have a fps of 15, i think it uses a different approach.
I tried to create a bitmap from the previewView of the CameraControll... | [
{
"answer_id": 332253,
"author": "August",
"author_id": 30966,
"author_profile": "https://Stackoverflow.com/users/30966",
"pm_score": 0,
"selected": false,
"text": "<p>If you're intending to ever release your app on the App Store, using a private framework will ensure that it will be rej... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42240/"
] | I'm trying to build a video recorder without jailbreaking my iPhone (i've a Developer license).
I began using PhotoLibrary private framework, but i can only reach 2ftp (too slow).
Cycoder app have a fps of 15, i think it uses a different approach.
I tried to create a bitmap from the previewView of the CameraController,... | Here is the code:
```
image = [window _createCGImageRefRepresentationInFrame:rectToCapture];
```
Marco |
332,122 | <p>I'm trying to embed my Subversion revision number in a C++ project and am having problems setting up GNU make to do so. My makefile currently looks something like this:</p>
<pre><code>check-svnversion:
../shared/update-svnversion-h.pl
../shared/svnversion.h: check-svnversion
shared/svnversion.o: ../shared/svnv... | [
{
"answer_id": 332191,
"author": "coppro",
"author_id": 16855,
"author_profile": "https://Stackoverflow.com/users/16855",
"pm_score": 1,
"selected": false,
"text": "<p>You can use Subversion's keyword substitution to put the version number into your code.</p>\n\n<p>It's detailed [in the ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25507/"
] | I'm trying to embed my Subversion revision number in a C++ project and am having problems setting up GNU make to do so. My makefile currently looks something like this:
```
check-svnversion:
../shared/update-svnversion-h.pl
../shared/svnversion.h: check-svnversion
shared/svnversion.o: ../shared/svnversion.h
.PHON... | I solved this by having my check-svnversion rule delete svnversion.o to force it to be recompiled if needed. This isn't exactly elegant, but it works; it looks similar to the autotools solution described in [CesarB's answer](https://stackoverflow.com/questions/332122/delaying-or-repeating-a-prerequisite-in-gnu-make#332... |
332,129 | <p>What is the most appropriate media type (formally MIME type) to use when sending data structured with YAML over HTTP and why?</p>
<p>There is no registered <a href="http://www.iana.org/assignments/media-types/application/" rel="noreferrer">application type</a> or <a href="http://www.iana.org/assignments/media-types/... | [
{
"answer_id": 332159,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 8,
"selected": true,
"text": "<p>Ruby on Rails uses <code>application/x-yaml</code> with an alternative of <code>text/yaml</code> (<a href=\"https:... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5343/"
] | What is the most appropriate media type (formally MIME type) to use when sending data structured with YAML over HTTP and why?
There is no registered [application type](http://www.iana.org/assignments/media-types/application/) or [text type](http://www.iana.org/assignments/media-types/text/) that I can see.
Example:
... | Ruby on Rails uses `application/x-yaml` with an alternative of `text/yaml` ([source](https://github.com/rails/rails/blob/d41d586/actionpack/lib/action_dispatch/http/mime_types.rb#L39)).
I think it's just a matter of convention, there is no *technical* why, as far as I can tell. |
332,178 | <p>What is the best method of hiding php errors from being displayed on the browser?</p>
<p>Would it be to use the following:</p>
<pre><code>ini_set("display_errors", 1);
</code></pre>
<p>Any best practice tips would be appreciated as well!</p>
<p>I am logging the errors, I just want to make sure that setting the d... | [
{
"answer_id": 332206,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 7,
"selected": true,
"text": "<p>The best way is to log your errors instead of displaying or ignoring them.</p>\n\n<p>This example will log the err... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42135/"
] | What is the best method of hiding php errors from being displayed on the browser?
Would it be to use the following:
```
ini_set("display_errors", 1);
```
Any best practice tips would be appreciated as well!
I am logging the errors, I just want to make sure that setting the display\_errors value to off (or 0) will ... | The best way is to log your errors instead of displaying or ignoring them.
This example will log the errors to syslog instead of displaying them in the browser.
```
ini_set("display_errors", 0);
ini_set("log_errors", 1);
//Define where do you want the log to go, syslog or a file of your liking with
ini_set("error_lo... |
332,193 | <p>Is there any way to do it? I only have client access and no access to the server. Is there a command I've missed or some software that I can install locally that can connect and find a file by filename?</p>
| [
{
"answer_id": 332609,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 0,
"selected": false,
"text": "<p>You can use</p>\n\n<pre><code> cvs rls -Rde <modulename>\n</code></pre>\n\n<p>which will give you all fil... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/543/"
] | Is there any way to do it? I only have client access and no access to the server. Is there a command I've missed or some software that I can install locally that can connect and find a file by filename? | You could grep the output of
```
cvs rlog -Nh .
```
(note the period character at the end - this effectively means: the whole repository).
That should give you info about the whole shebang including removed files and files added on branches. |
332,207 | <p>I have an OpenGl program in which I am displaying an image using textures. I want to be able to load a new image to be displayed. </p>
<p>In my Init function I call:</p>
<pre><code>Gl.glGenTextures(1, mTextures);
</code></pre>
<p>Since only one image will be displayed at time, I am using the same texture name for... | [
{
"answer_id": 333233,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 0,
"selected": false,
"text": "<p>When do you submit the geometry using these textures? I assume that is interleaved with the texture loading, although yo... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55638/"
] | I have an OpenGl program in which I am displaying an image using textures. I want to be able to load a new image to be displayed.
In my Init function I call:
```
Gl.glGenTextures(1, mTextures);
```
Since only one image will be displayed at time, I am using the same texture name for each image.
Each time a new im... | I don't think the problem is in the code you're showing. You'll need to provide more information as to how you draw with the texture, as well as what the texture data passed to `glTexImage2D` looks like. Are you sure it's still valid by the time you call `glTexImage2D` ? |
332,224 | <p>I was just curious how others work with this kind of WinForm code in C#.
Lets say I have a Form lets call it Form1. And I have a DataGridView called dgvMain.</p>
<p>Where do you put the code: </p>
<pre><code>this.dgvMain.CellEndEdit += new DataGridViewCellEventHandler(dgvMain_CellEndEdit);
</code></pre>
<p>Do yo... | [
{
"answer_id": 332234,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 0,
"selected": false,
"text": "<p>I use the <strong>Designer</strong> for all event related to Component.</p>\n\n<p>I use the <strong>code</st... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | I was just curious how others work with this kind of WinForm code in C#.
Lets say I have a Form lets call it Form1. And I have a DataGridView called dgvMain.
Where do you put the code:
```
this.dgvMain.CellEndEdit += new DataGridViewCellEventHandler(dgvMain_CellEndEdit);
```
Do you put it in the Form1 code or the ... | Short answer is yes.
Longer answer is that .designer.cs is there for code generated by the designer. if you put your own code in there, it has a chance of getting overwritten, screwing up the design time stuff in visual studio, and lowers maintainability because nobody expects custom code to be in there. |
332,230 | <p>I am looking for a way to get the essence or the most important aspect of a webpage? If I provide a URL, is there any external service which can accomplish this? I am not looking for snap.com like service as it provides a snapshot.</p>
<p>I might be willing to even implement such a system on my own. For beginning I... | [
{
"answer_id": 599496,
"author": "random",
"author_id": 9314,
"author_profile": "https://Stackoverflow.com/users/9314",
"pm_score": 0,
"selected": false,
"text": "<p>By snippet, do you mean like a quote that sums up the entire page you want to link to? </p>\n\n<p>So if snap.com isn't a f... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29653/"
] | I am looking for a way to get the essence or the most important aspect of a webpage? If I provide a URL, is there any external service which can accomplish this? I am not looking for snap.com like service as it provides a snapshot.
I might be willing to even implement such a system on my own. For beginning I do not wa... | You can try [Yahoo's Term extraction service](http://developer.yahoo.com/search/content/V2/termExtraction.html)
**Update 02-May-2012**
Yahoo has release a new [Content Analysis Web service](http://developer.yahoo.com/contentanalysis/) which will be replacing the Term extraction service. It can be invoked by syntactic... |
332,276 | <p>I have a ton of repeating code in my class that looks like the following:</p>
<pre><code>NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request
delegate:self];
</code></pre>
<p>The problem with asynchronous requests is when you h... | [
{
"answer_id": 332334,
"author": "Ben Gottlieb",
"author_id": 6694,
"author_profile": "https://Stackoverflow.com/users/6694",
"pm_score": 2,
"selected": false,
"text": "<p>I usually create an array of dictionaries. Each dictionary has a bit of identifying information, an NSMutableData ob... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40882/"
] | I have a ton of repeating code in my class that looks like the following:
```
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request
delegate:self];
```
The problem with asynchronous requests is when you have various requests going... | I track responses in an CFMutableDictionaryRef keyed by the NSURLConnection associated with it. i.e.:
```
connectionToInfoMapping =
CFDictionaryCreateMutable(
kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
```
It may seem odd to use this... |
332,285 | <p>In order to provide nice URLs between parts of our app we split everything up into several modules which are compiled independently. For example, there is a "manager" portion and an "editor" portion. The editor launches in a new window. By doing this we can link to the editor directly:</p>
<pre><code>/com.example.E... | [
{
"answer_id": 332620,
"author": "rustyshelf",
"author_id": 6044,
"author_profile": "https://Stackoverflow.com/users/6044",
"pm_score": 4,
"selected": true,
"text": "<p>I have built a few very large applications in GWT, and I find it best to split things up into modules, and move the com... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/758/"
] | In order to provide nice URLs between parts of our app we split everything up into several modules which are compiled independently. For example, there is a "manager" portion and an "editor" portion. The editor launches in a new window. By doing this we can link to the editor directly:
```
/com.example.EditorApp?id=1
... | I have built a few very large applications in GWT, and I find it best to split things up into modules, and move the common code into it's own area, like you've done. The reason in our case was simple, we had some parts of our application that were very different to the rest, so it made sense from a compile size point o... |
332,289 | <p>How do I change the size of figure drawn with Matplotlib?</p>
| [
{
"answer_id": 332311,
"author": "tatwright",
"author_id": 40849,
"author_profile": "https://Stackoverflow.com/users/40849",
"pm_score": 9,
"selected": false,
"text": "<blockquote>\n<p><strong>Deprecation note:</strong><br />\nAs per the <a href=\"https://matplotlib.org/2.0.2/faq/usage_f... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40849/"
] | How do I change the size of figure drawn with Matplotlib? | [`figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html) tells you the call signature:
```
from matplotlib.pyplot import figure
figure(figsize=(8, 6), dpi=80)
```
`figure(figsize=(1,1))` would create an inch-by-inch image, which would be 80-by-80 pixels unless you also give a different dp... |
332,291 | <p>What is the best way to build a loopback URL for an AJAX call? Say I have a page at</p>
<pre><code>http://www.mydomain.com/some/subdir/file.php
</code></pre>
<p>that I want to load with an AJAX call. In Firefox, using jQuery this works fine:</p>
<pre><code>$.post('/some/subdir/file.php', ...);
</code></pre>
<p>S... | [
{
"answer_id": 332311,
"author": "tatwright",
"author_id": 40849,
"author_profile": "https://Stackoverflow.com/users/40849",
"pm_score": 9,
"selected": false,
"text": "<blockquote>\n<p><strong>Deprecation note:</strong><br />\nAs per the <a href=\"https://matplotlib.org/2.0.2/faq/usage_f... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291/"
] | What is the best way to build a loopback URL for an AJAX call? Say I have a page at
```
http://www.mydomain.com/some/subdir/file.php
```
that I want to load with an AJAX call. In Firefox, using jQuery this works fine:
```
$.post('/some/subdir/file.php', ...);
```
Safari/WebKit tries to interpret this as a locatio... | [`figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html) tells you the call signature:
```
from matplotlib.pyplot import figure
figure(figsize=(8, 6), dpi=80)
```
`figure(figsize=(1,1))` would create an inch-by-inch image, which would be 80-by-80 pixels unless you also give a different dp... |
332,353 | <p>This is making me kind of crazy: I did a mysqldump of a partitioned table on one server, moved the resulting SQL dump to another server, and attempted to run the insert. It fails, but I'm having difficulty figuring out why. Google and the MySQL forums and docs have not been much help.</p>
<p>The failing query lo... | [
{
"answer_id": 332499,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://bugs.mysql.com/bug.php?id=19557\" rel=\"nofollow noreferrer\">http://bugs.mysql.com/bug.php?id=195... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40093/"
] | This is making me kind of crazy: I did a mysqldump of a partitioned table on one server, moved the resulting SQL dump to another server, and attempted to run the insert. It fails, but I'm having difficulty figuring out why. Google and the MySQL forums and docs have not been much help.
The failing query looks like this... | It turned out to be an SElinux issue - all my filesystem permissions were fine, but there was a higher-level policy set against MySQL accessing that disk partition.
Lesson: When you have a permissions issue but ownership and filesystem permissions are obviously correct, look to SElinux. |
332,364 | <p>Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window?</p>
<p>I basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as TortoiseSVN.</p>
| [
{
"answer_id": 335490,
"author": "Enrico Campidoglio",
"author_id": 26396,
"author_profile": "https://Stackoverflow.com/users/26396",
"pm_score": 3,
"selected": false,
"text": "<p>As far as I know, there isn't any File/Folder browser control out of the box in Windows Forms nor WPF.<br/>\... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window?
I basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as TortoiseSVN. | As far as I know, there isn't any File/Folder browser control out of the box in Windows Forms nor WPF.
However there are commercial third-party controls that offer a Windows Explorer-like interface to browse files and folders on disk. Take a look at these products from LogicNP:
* [FileView Control](http://www.sswar... |
332,365 | <p>Just looking at:</p>
<p><img src="https://i.stack.imgur.com/G0ifh.png" alt="XKCD Strip" title="Her daughter is named Help I'm trapped in a driver's license factory.">
<em>(Source: <a href="https://xkcd.com/327/" rel="noreferrer">https://xkcd.com/327/</a>)</em></p>
<p>What does this SQL do:</p>
<pre><code>... | [
{
"answer_id": 332367,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 11,
"selected": true,
"text": "<p><strong>It drops the students table.</strong></p>\n\n<p>The original code in the school's program probably looks something ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | Just looking at:

*(Source: <https://xkcd.com/327/>)*
What does this SQL do:
```
Robert'); DROP TABLE STUDENTS; --
```
I know both `'` and `--` are for comments, but doesn't the word `DROP` get... | **It drops the students table.**
The original code in the school's program probably looks something like
```
q = "INSERT INTO Students VALUES ('" + FNMName.Text + "', '" + LName.Text + "')";
```
This is the naive way to add text input into a query, and is *very bad*, as you will see.
After the values from the firs... |
332,384 | <p>I'm working on a page using jQuery's <a href="http://docs.jquery.com/UI/Accordion" rel="nofollow noreferrer">accordion UI element</a>. I modeled my HTML on that example, except that inside the <code><li></code> elements, I have some unordered lists of links. Like this:</p>
<pre><code> $(document).ready(functi... | [
{
"answer_id": 332502,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": -1,
"selected": false,
"text": "<p>As my answer to your other question says:</p>\n\n<pre><code> navigation: true\n</code></pre>\n\n<p>Should be set in ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4376/"
] | I'm working on a page using jQuery's [accordion UI element](http://docs.jquery.com/UI/Accordion). I modeled my HTML on that example, except that inside the `<li>` elements, I have some unordered lists of links. Like this:
```
$(document).ready(function() {
$(".ui-accordion-container").accordion(
{active... | By default, the accordian widget sets all the links to headers. To change it, you need to specify a selector with the `headers` option. So, your code would look like this:
```
$(".ui-accordion-container").accordion(
{ active: "a.default", ..., header: "a.accordion-label" }
);
``` |
332,390 | <p>I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this:</p>
<pre><code>SerialTestDataContext db = new SerialTestDataContext();
relation_table row = db.relation_tables.First();
MemoryS... | [
{
"answer_id": 332421,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Linq classes are partial classes. You can change the definition to mark the classes as implementing <a href=\"http://msdn.... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2191/"
] | I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this:
```
SerialTestDataContext db = new SerialTestDataContext();
relation_table row = db.relation_tables.First();
MemoryStream memStrea... | With linq-to-sql (from tags), then yes: you can mark the dmbl as serializable, which uses the [DataContract]/[DataMember] approach. You do this by setting the "Serialization Mode" to "Unidirectional" in the designer, or you can do it in the dbml itself:
```
<Database ... Serialization="Unidirectional">...
```
You ca... |
332,397 | <p>My function is pretty much a standard search function... I've included it below.</p>
<p>In the function I have 1 line of code responsible for weeding out Repart NTFS points. </p>
<pre><code>if (attributes.ToString().IndexOf("ReparsePoint") == -1)
</code></pre>
<p>The problem is now I am getting an error
<code>Ac... | [
{
"answer_id": 332412,
"author": "Greg Beech",
"author_id": 13552,
"author_profile": "https://Stackoverflow.com/users/13552",
"pm_score": 4,
"selected": false,
"text": "<p>I'm not sure what the answer to the question is, but <em>please</em> change your attribute check to use proper bitwi... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41291/"
] | My function is pretty much a standard search function... I've included it below.
In the function I have 1 line of code responsible for weeding out Repart NTFS points.
```
if (attributes.ToString().IndexOf("ReparsePoint") == -1)
```
The problem is now I am getting an error
`Access to the path 'c:\System Volume Inf... | Nobody has permission to access System Volume Information except the SYSTEM account. So either change the permissions on the directory. Or much, much better catch the exception and go on. |
332,405 | <p>I want to create a custom web part that has more than 1 filter web part and that can be connected to Report Viewer Web Part (Integrated Mode) at runtime/design time.</p>
<p>I searched a lot for this, but could not find a way to have single web part that is a provider to more than 1 filters.</p>
<p>Say for example ... | [
{
"answer_id": 332415,
"author": "rebra",
"author_id": 2282296,
"author_profile": "https://Stackoverflow.com/users/2282296",
"pm_score": 1,
"selected": false,
"text": "<p>You do not say what kind of framework/server you are using.</p>\n\n<p>Maybe the server reloads the file while it is s... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to create a custom web part that has more than 1 filter web part and that can be connected to Report Viewer Web Part (Integrated Mode) at runtime/design time.
I searched a lot for this, but could not find a way to have single web part that is a provider to more than 1 filters.
Say for example -
1. My `Report... | Try setting binary mode in your FTP client. That will allow you to experiment with different line endings (dos2unix) on the client side, without worrying about them being translated during transfer. |
332,422 | <p>Is there a <strong>JavaScript</strong> equivalent of <strong>Java</strong>'s <code>class.getName()</code>?</p>
| [
{
"answer_id": 332429,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 12,
"selected": true,
"text": "<blockquote>\n<p>Is there a JavaScript equivalent of Java's <code>class.getName()</code>?</p>\n</blockquote>\n<p><em><... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41595/"
] | Is there a **JavaScript** equivalent of **Java**'s `class.getName()`? | >
> Is there a JavaScript equivalent of Java's `class.getName()`?
>
>
>
***No***.
**ES2015 Update**: [the name of `class Foo {}` is `Foo.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#Function_names_in_classes). The name of `thing`'s class, regardless of `thi... |
332,441 | <p>I was at an interview for a C position in which they presented me with an idiom that I haven't previously encountered. This is a trick that simplifies implementation of various algorithms involving linked lists and I'm wondering if anybody else has encountered this.</p>
<p>Say we have a linked list record defined s... | [
{
"answer_id": 332463,
"author": "Frank Schwieterman",
"author_id": 32203,
"author_profile": "https://Stackoverflow.com/users/32203",
"pm_score": 2,
"selected": false,
"text": "<p>I don't see anything I'd call an idiom per se. It looks like standard coding for when you deal with datastr... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15109/"
] | I was at an interview for a C position in which they presented me with an idiom that I haven't previously encountered. This is a trick that simplifies implementation of various algorithms involving linked lists and I'm wondering if anybody else has encountered this.
Say we have a linked list record defined so:
```
ty... | I've used similar to this to insert into a binary tree. Because when iterating the tree, you usually stop when your pointer becomes `NULL` (you ran off the tree).
So to insert, you have 3 options,
1: use a variable which tracks the previous value of your iterating pointer.
2: stop when the pointer you would follow ... |
332,448 | <h2>Update</h2>
<p>I am making this a community wiki, for three reasons:</p>
<ul>
<li>I don't feel like I got a definitive answer, but</li>
<li>I have long since stopped needing an answer, because I rolled my own accordion function</li>
<li>this question gets tons of views, so clearly lots of people are still interes... | [
{
"answer_id": 332485,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": 0,
"selected": false,
"text": "<p>In options you should set:</p>\n\n<pre><code> navigation: true\n</code></pre>\n"
},
{
"answer_id": 332739,
... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4376/"
] | Update
------
I am making this a community wiki, for three reasons:
* I don't feel like I got a definitive answer, but
* I have long since stopped needing an answer, because I rolled my own accordion function
* this question gets tons of views, so clearly lots of people are still interested
So if anybody wants to ch... | I feel your pain! I recently went through a ridiculous troubleshoot where I tore everything out of the master page and page layout block by block (this was actually in SharePoint), continuously slimming down the page.
The end result ended up being **not having a doc type** for the html document (some developer had rem... |
332,454 | <p>I want to do this C# code in F#</p>
<pre><code> string[] a = new string[5];
string b = string.Empty;
a[0] = "Line 1";
a[2] = "Line 2";
foreach (string c in a)
{
b = c + Environment.NewLine;
}
</code></pre>
| [
{
"answer_id": 332527,
"author": "Juliet",
"author_id": 40516,
"author_profile": "https://Stackoverflow.com/users/40516",
"pm_score": 5,
"selected": true,
"text": "<p>Its a lot better to use the built-in String.Join method than rolling your own function based on repeated string concattin... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72123/"
] | I want to do this C# code in F#
```
string[] a = new string[5];
string b = string.Empty;
a[0] = "Line 1";
a[2] = "Line 2";
foreach (string c in a)
{
b = c + Environment.NewLine;
}
``` | Its a lot better to use the built-in String.Join method than rolling your own function based on repeated string concatting. Here's the code in F#:
```
open System
let a = [| "Line 1"; null; "Line 2"; null; null;|]
let b = String.Join(Environment.NewLine, a)
``` |
332,460 | <p>Is their a way to use a non-member non-friend function on an object using the same "dot" notation as member functions?</p>
<p>Can I pull a (any) member out of a class, and have users use it in the same way they always have?</p>
<p>Longer Explanation:</p>
<p><a href="http://www.ddj.com/cpp/184401197" rel="nofollow... | [
{
"answer_id": 332475,
"author": "Filip Frącz",
"author_id": 21704,
"author_profile": "https://Stackoverflow.com/users/21704",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, they should be either global or namespace-scoped.\nNon-member non-friend functions look much prettier in C# wh... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29701/"
] | Is their a way to use a non-member non-friend function on an object using the same "dot" notation as member functions?
Can I pull a (any) member out of a class, and have users use it in the same way they always have?
Longer Explanation:
[Scott Meyers](http://www.ddj.com/cpp/184401197), Herb Sutter, et all, argue tha... | You *can* use a single syntax, but perhaps not the one you like. Instead of placing one insert() inside your class scope, you make it a friend of your class. Now you can write
```
mystring s;
insert(s, "hello");
insert(s, other_s.begin(), other_s.end());
insert(s, 10, '.');
```
For any non-virtual, public method, it... |
332,473 | <p>I've created a DLL project in VS 2005 for native Win32/unmanaged C++, call it myProj.dll. It depends on a 3rd-party commercial DLL that in turn depends on msvcr90.dll (I assume it was built from a VS 2008 project). I'll call it thirdParty.dll.</p>
<p>My DLL project builds just fine in VS2005. I've built a test a... | [
{
"answer_id": 332491,
"author": "Tim",
"author_id": 10755,
"author_profile": "https://Stackoverflow.com/users/10755",
"pm_score": 1,
"selected": false,
"text": "<p>I would ask the third party dll people about this. </p>\n"
},
{
"answer_id": 332500,
"author": "wimh",
"au... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've created a DLL project in VS 2005 for native Win32/unmanaged C++, call it myProj.dll. It depends on a 3rd-party commercial DLL that in turn depends on msvcr90.dll (I assume it was built from a VS 2008 project). I'll call it thirdParty.dll.
My DLL project builds just fine in VS2005. I've built a test app (again, VS... | This looks like a *"Side-by-Side Assemblies"* issue to me.
From what I can tell, Microsoft in an attempt to stop the *DLL Hell* problems of past years has introduced a concept of *"Side-by-Side Assemblies".*
In a nut shell it means that your application needs to tell **Windows** which version of the **CRT** it was d... |
332,477 | <p>I need to revoke an authentication cookie if the user no longer exists (or some other condition), after the forms authentication mechanism already have received the authentication cookie from the browser and have validated it. I.e. here is the use scenario:</p>
<ol>
<li>The user have been authenticated, and granted... | [
{
"answer_id": 332644,
"author": "marto",
"author_id": 29555,
"author_profile": "https://Stackoverflow.com/users/29555",
"pm_score": 3,
"selected": true,
"text": "<p>I don't think there is an automated way to achive this. \nI think the best way would be to add a date to the auth cookie w... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8220/"
] | I need to revoke an authentication cookie if the user no longer exists (or some other condition), after the forms authentication mechanism already have received the authentication cookie from the browser and have validated it. I.e. here is the use scenario:
1. The user have been authenticated, and granted non-expiring... | I don't think there is an automated way to achive this.
I think the best way would be to add a date to the auth cookie which will be the last time you checked whether the user exists.
So when a user logs-in you'll:
```
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket vers... |
332,479 | <p>i get this error </p>
<pre><code>{"Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL."}
</code></pre>
<p>when i try to execute this linq to sql</p>
<pre><code>var query = from p in db.Posts
let categories = GetCategoriesByPostId(p.P... | [
{
"answer_id": 332490,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "<p>LINQ-to-SQL only translates a subset of operations - and it trying (and failing) to write ConvertTimeFromUtc as TSQ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31296/"
] | i get this error
```
{"Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL."}
```
when i try to execute this linq to sql
```
var query = from p in db.Posts
let categories = GetCategoriesByPostId(p.PostId)
let comments = Get... | LINQ-to-SQL only translates a subset of operations - and it trying (and failing) to write ConvertTimeFromUtc as TSQL. Some operations have TSQL counterparts (dateadd/datediff/etc) - but not all. You might choose to do your projection (select) using the raw value, and only do the ConvertTimeFromUtc once you have the obj... |
332,486 | <p>How can I programmatically change my browser's default home page with C#?</p>
| [
{
"answer_id": 332494,
"author": "Will Dean",
"author_id": 987,
"author_profile": "https://Stackoverflow.com/users/987",
"pm_score": 1,
"selected": false,
"text": "<p>See this, which is not in C#, but you should be able to work out the registry stuff in C# pretty easily.</p>\n\n<p><a hre... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33185/"
] | How can I programmatically change my browser's default home page with C#? | Set it in this registry setting:
```
HKCU\Software\Microsoft\Internet Explorer\Main\Start Page
``` |
332,492 | <p>I'm seeing conflicting references in <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i16209" rel="noreferrer">Oracles documentation</a>. Is there any difference between how decimals are stored in a FLOAT and a NUMBER types in the database?</p>
<p>As I recall from C, et al, a flo... | [
{
"answer_id": 332503,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": false,
"text": "<p>Oracle's Number is in fact a Decimal (base-10) floating point representation... \nFloat is just an alias for Nu... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685/"
] | I'm seeing conflicting references in [Oracles documentation](http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i16209). Is there any difference between how decimals are stored in a FLOAT and a NUMBER types in the database?
As I recall from C, et al, a float has accuracy limitations that an in... | Oracle's `BINARY_FLOAT` stores the data internally using IEEE 754 floating-point representation, like C and many other languages do. When you fetch them from the database, and typically store them in an IEEE 754 data type in the host language, it's able to copy the value without transforming it.
Whereas Oracle's `FLOA... |
332,515 | <p>Here is a specific example which is not CLS-complaint according to VS.NET 2005.</p>
<pre><code>Public Interface IDbId
Function GetNativeObject() As Object
Function Equals(ByVal compObj As IDbId) As Boolean
Function CompareTo(ByVal compObj As IDbId) As Integer
Function ToString() As String
End Inte... | [
{
"answer_id": 332531,
"author": "Andrew Rollings",
"author_id": 40410,
"author_profile": "https://Stackoverflow.com/users/40410",
"pm_score": 1,
"selected": false,
"text": "<p>Use .net reflector to take a look at the generated code both with and without the attribute, and see if there i... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5458/"
] | Here is a specific example which is not CLS-complaint according to VS.NET 2005.
```
Public Interface IDbId
Function GetNativeObject() As Object
Function Equals(ByVal compObj As IDbId) As Boolean
Function CompareTo(ByVal compObj As IDbId) As Integer
Function ToString() As String
End Interface
```
Th... | I think it's due to the MustOverride keyword modifier in your example.
Check this out:
[Non-CLS-compliant 'MustOverride' member is not allowed in a CLS-compliant class](http://msdn.microsoft.com/en-us/library/0haa76bc.aspx) |
332,522 | <p>I've been trying to run a jar file - let's call it test.jar - that uses the Sybase jconn3.jar on a Unix system.</p>
<p>I have created a MANIFEST.MF file that has the following:</p>
<pre><code>Class-Path: $SYBASE/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
</code></pre>
<p>This gives a ClassNotFoundError... | [
{
"answer_id": 332543,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 5,
"selected": true,
"text": "<p>The entries in the class-path are either relative to the JAR in which they are embedded (which you have working) or are U... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been trying to run a jar file - let's call it test.jar - that uses the Sybase jconn3.jar on a Unix system.
I have created a MANIFEST.MF file that has the following:
```
Class-Path: $SYBASE/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
```
This gives a ClassNotFoundError. $SYBASE is the system variable ... | The entries in the class-path are either relative to the JAR in which they are embedded (which you have working) or are URLs. To make your absolute paths work, you'll need to convert them to URLs, e.g.,
`file:/opt/sybase13/...`
There's no mechanism for using variables.
Although the JAR specification doesn't say it ... |
332,528 | <p>Let's say that I want to merge from a release branch to the master branch and there are some commits in the release branch that I don't want to include in the master branch. Is there a way to do the merge so that one or more of those commits will not be merged?</p>
<p>My strategy so far is to do the following (in ... | [
{
"answer_id": 332550,
"author": "Dustin",
"author_id": 39975,
"author_profile": "https://Stackoverflow.com/users/39975",
"pm_score": 7,
"selected": true,
"text": "<p>Create a new branch, rebase the branch interactively and drop commits you don't want, and then merge that.</p>\n\n<p>You ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | Let's say that I want to merge from a release branch to the master branch and there are some commits in the release branch that I don't want to include in the master branch. Is there a way to do the merge so that one or more of those commits will not be merged?
My strategy so far is to do the following (in master):
`... | Create a new branch, rebase the branch interactively and drop commits you don't want, and then merge that.
You can't take changes out of the middle of a branch without rehashing, but the right thing will happen when it sees the same changes in a later merge (e.g. from cherry-picking and what-not). |
332,534 | <p>Please advise if you can.</p>
<p>I am building an SMS web service API that will allow people to send SMS to their desired cellphone numbers. A request will be sent to the interface, we then process that request based on the account details provided and credits available on their account.</p>
<p>We have two propose... | [
{
"answer_id": 332538,
"author": "Shawn Miller",
"author_id": 247,
"author_profile": "https://Stackoverflow.com/users/247",
"pm_score": 1,
"selected": false,
"text": "<p>Interface A. It's shorter.</p>\n"
},
{
"answer_id": 332541,
"author": "dacracot",
"author_id": 13930,
... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16092/"
] | Please advise if you can.
I am building an SMS web service API that will allow people to send SMS to their desired cellphone numbers. A request will be sent to the interface, we then process that request based on the account details provided and credits available on their account.
We have two proposed XML structures ... | Interface A.
Interface B is essentially just a list of key/values, where as Interface A takes advantage of the structured nature of XML and provides meaning through the structure.
For example: ClientId is an attribute of the Message, not the Request itself. This is clear from looking at A, but not from B. |
332,554 | <p>I don't understand how GCC works under Linux. In a source file, when I do a:</p>
<pre><code>#include <math.h>
</code></pre>
<p>Does the compiler extract the appropriate binary code and insert it into the compiled executable OR does the compiler insert a reference to an external binary file (a-la Windows DLL... | [
{
"answer_id": 332561,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 1,
"selected": false,
"text": "<p>The compiler is allowed to do whatever it pleases, as long as, in effect, it acts as if you'd included the file. (All the com... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11760/"
] | I don't understand how GCC works under Linux. In a source file, when I do a:
```
#include <math.h>
```
Does the compiler extract the appropriate binary code and insert it into the compiled executable OR does the compiler insert a reference to an external binary file (a-la Windows DLL?)
I guess a generic version of ... | Well. When you include `math.h` the compiler will read the file that contains declarations of the functions and macros that can be used. If you call a function declared in that file (*header*), then the compiler inserts a call instruction into that place in your object file that will be made from the file you compile (... |
332,558 | <p>I have a database where I store objects. I have the following (simplified) schema</p>
<pre><code>CREATE TABLE MyObjects
(
UniqueIdentifier Id;
BigInt GenerationId;
BigInt Value;
Bit DeleteAction;
)
</code></pre>
<p>Each object has a unique identifier ("Id"), and a (set of) ... | [
{
"answer_id": 332584,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure whether that's standard SQL, but in Postgres, you can use the LIMIT flag:</p>\n\n<pre><code> select Ge... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33272/"
] | I have a database where I store objects. I have the following (simplified) schema
```
CREATE TABLE MyObjects
(
UniqueIdentifier Id;
BigInt GenerationId;
BigInt Value;
Bit DeleteAction;
)
```
Each object has a unique identifier ("Id"), and a (set of) property ("Value"). Each t... | Here's the working version:
```
SELECT MyObjects.Id,Value
FROM Myobjects
INNER JOIN
(
SELECT Id, max(GenerationId) as LastGen
FROM MyObjects
WHERE GenerationId <= @TargetGeneration
Group by Id
) T1
ON MyObjects.Id = T1.Id AND MyObjects.GenerationId = LastGen
WHERE DeleteAction = 'False'
``` |
332,574 | <p>I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time.</p>
| [
{
"answer_id": 332577,
"author": "Keith Walton",
"author_id": 22448,
"author_profile": "https://Stackoverflow.com/users/22448",
"pm_score": 4,
"selected": true,
"text": "<p>Management Studio supports an undocumented feature that <a href=\"https://stackoverflow.com/questions/84209/vertica... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22448/"
] | I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time. | Management Studio supports an undocumented feature that [Visual Studio has as well](https://stackoverflow.com/questions/84209/vertical-line-after-a-certain-amount-of-characters-in-visual-studio). It adds vertical guide lines to the editor window at specific column locations.
Create a .reg file using the text below and... |
332,580 | <p>Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas?</p>
| [
{
"answer_id": 332586,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": -1,
"selected": false,
"text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/ms526809(EXCHG.10).aspx\" rel=\"nofollow nore... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas? | >
> Use UUIDGen.
>
>
>
Don't. GUIDs aren't really random. You can actually generate large amounts of data very fast using the `System.Random` class in VB.NET. 500,000 characters/bytes are no problem:
```
Dim buffer As Byte() = Nothing
Array.Resize(buffer, 500000)
Call New Random().NextBytes(buffer)
My.Computer.Fi... |
332,585 | <p>It was a long holiday weekend, so I got the coding bug again and started playing around:</p>
<p><a href="http://gfilter.net/junk/tileengine.jpg" rel="nofollow noreferrer">Mario http://gfilter.net/junk/tileengine.jpg</a></p>
<p>I wrote a basic tile engine, but having never attempted this before, I am really struggl... | [
{
"answer_id": 332610,
"author": "Michael Stum",
"author_id": 91,
"author_profile": "https://Stackoverflow.com/users/91",
"pm_score": 1,
"selected": false,
"text": "<p>That may be a detour, but try the Platformer starter kit from XNA 3.0, that contains stuff like Physics and basic Collis... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | It was a long holiday weekend, so I got the coding bug again and started playing around:
[Mario http://gfilter.net/junk/tileengine.jpg](http://gfilter.net/junk/tileengine.jpg)
I wrote a basic tile engine, but having never attempted this before, I am really struggling with handling sprite collision detection and imple... | Download the FarseerPhysics engine, have a look at how it works <http://www.codeplex.com/FarseerPhysics> I think it's the best thing available for XNA/Silverlight! |
332,592 | <p>I have a set of divs that I want to make <code>collapsible/expandable</code> using jQuery's <code>slideToggle()</code> method. How do I make all of these divs collapsed by default? I'd like to avoid explicitly calling <code>slideToggle()</code> on each element during/after page rendering.</p>
| [
{
"answer_id": 332596,
"author": "Anne Porosoff",
"author_id": 28701,
"author_profile": "https://Stackoverflow.com/users/28701",
"pm_score": 4,
"selected": false,
"text": "<p>you probably can do something like this:</p>\n\n<pre><code>$(document).ready(function(){\n $('div').hide();\n});... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3488/"
] | I have a set of divs that I want to make `collapsible/expandable` using jQuery's `slideToggle()` method. How do I make all of these divs collapsed by default? I'd like to avoid explicitly calling `slideToggle()` on each element during/after page rendering. | You will have to assign a style: display:none to these layers, so that they are not displayed before javascript rendering. Then you can call slideToggle() without problems. Example:
```
<style type="text/css">
.text{display:none}
</style>
<script type="text/javascript">
$(document).ready(function() {
... |
332,601 | <p>When I switch tabs with the following code</p>
<pre><code>tabControl1.SelectTab("MyNextTab");
</code></pre>
<p>It calls the tabPage_Enter for the tab it is switching from and the tab it is switching to. I want it to be called for the tab it is switching to, but not the tab it is switching from. How would I turn th... | [
{
"answer_id": 332640,
"author": "Richard Ev",
"author_id": 39709,
"author_profile": "https://Stackoverflow.com/users/39709",
"pm_score": 0,
"selected": false,
"text": "<p>Can you check the index of the active tab and workaround using that?</p>\n"
},
{
"answer_id": 332761,
"a... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19802/"
] | When I switch tabs with the following code
```
tabControl1.SelectTab("MyNextTab");
```
It calls the tabPage\_Enter for the tab it is switching from and the tab it is switching to. I want it to be called for the tab it is switching to, but not the tab it is switching from. How would I turn this off. I do know when it... | Yes, I repro if I use a button to change the selected tab. TabControl forces the focus onto itself before it changes SelectedIndex. This appears to have been done to avoid problems with the Validating event. The focus change produces the first Enter event, for the active tab, the tab change then produces the second Ent... |
332,602 | <p>Let's say I have a table that represents a super class, <strong>students</strong>. And then I have N tables that represent subclasses of that object (<strong>athletes</strong>, <strong>musicians</strong>, etc). How can I express a constraint such that a student must be modeled in one (not more, not less) subclass?</... | [
{
"answer_id": 332615,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 3,
"selected": true,
"text": "<p>Here are a couple of possibilities. One is a <code>CHECK</code> in each table that the <code>student_id</code> does... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40725/"
] | Let's say I have a table that represents a super class, **students**. And then I have N tables that represent subclasses of that object (**athletes**, **musicians**, etc). How can I express a constraint such that a student must be modeled in one (not more, not less) subclass?
Clarifications regarding comments:
* This... | Here are a couple of possibilities. One is a `CHECK` in each table that the `student_id` does not appear in any of the other sister subtype tables. This is probably expensive and every time you need a new subtype, you need to modify the constraint in all the existing tables.
```
CREATE TABLE athletes (
student_id IN... |
332,603 | <p>When I get AuthenticationStatus.Authenticated (DotNetOpenId library)
response from myopenid provider, i'd like to redirect user from login page
to another one using MVC Redirect(myurl). But unfortunately, instead of
getting to myurl, user is redirected to empty page:</p>
<p>myurl?token=AWSe9PSLwx0RnymcW0q.... (+ se... | [
{
"answer_id": 550709,
"author": "zihotki",
"author_id": 66591,
"author_profile": "https://Stackoverflow.com/users/66591",
"pm_score": 1,
"selected": false,
"text": "<p>First of all you should set authorization cookie:</p>\n\n<pre><code>FormsAuth.SetAuthCookie(UserName, RememberMe);\n</c... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I get AuthenticationStatus.Authenticated (DotNetOpenId library)
response from myopenid provider, i'd like to redirect user from login page
to another one using MVC Redirect(myurl). But unfortunately, instead of
getting to myurl, user is redirected to empty page:
myurl?token=AWSe9PSLwx0RnymcW0q.... (+ several kilo... | First of all you should set authorization cookie:
```
FormsAuth.SetAuthCookie(UserName, RememberMe);
```
After this you should return RedirectToAction result:
```
return RedirectToAction(actionName, controllerName);
```
Or Redirect result:
```
return Redirect(url);
```
When you use "return Redirect(url);" it u... |
332,623 | <p>I would like to implement a search engine which should crawl a set of web sites, extract specific information from the pages and create full-text index of that specific information.</p>
<p>It seems to me that Xapian could be a good choice for the search engine library.</p>
<p>What are the options for a crawler/par... | [
{
"answer_id": 550709,
"author": "zihotki",
"author_id": 66591,
"author_profile": "https://Stackoverflow.com/users/66591",
"pm_score": 1,
"selected": false,
"text": "<p>First of all you should set authorization cookie:</p>\n\n<pre><code>FormsAuth.SetAuthCookie(UserName, RememberMe);\n</c... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19808/"
] | I would like to implement a search engine which should crawl a set of web sites, extract specific information from the pages and create full-text index of that specific information.
It seems to me that Xapian could be a good choice for the search engine library.
What are the options for a crawler/parser to integrate ... | First of all you should set authorization cookie:
```
FormsAuth.SetAuthCookie(UserName, RememberMe);
```
After this you should return RedirectToAction result:
```
return RedirectToAction(actionName, controllerName);
```
Or Redirect result:
```
return Redirect(url);
```
When you use "return Redirect(url);" it u... |
332,629 | <p>I've <code>rm</code>'ed a 2.5gb log file - but it doesn't seemed to have freed any space.</p>
<p>I did:</p>
<pre><code>rm /opt/tomcat/logs/catalina.out
</code></pre>
<p>then this:</p>
<pre><code>df -hT
</code></pre>
<p>and <code>df</code> reported my <code>/opt</code> mount still at 100% used.</p>
<p>Any sugge... | [
{
"answer_id": 332632,
"author": "FerranB",
"author_id": 40441,
"author_profile": "https://Stackoverflow.com/users/40441",
"pm_score": 7,
"selected": true,
"text": "<p>Restart tomcat, if the file is in use and you remove it, the space becomes available when that process finishes.</p>\n"
... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3966/"
] | I've `rm`'ed a 2.5gb log file - but it doesn't seemed to have freed any space.
I did:
```
rm /opt/tomcat/logs/catalina.out
```
then this:
```
df -hT
```
and `df` reported my `/opt` mount still at 100% used.
Any suggestions? | Restart tomcat, if the file is in use and you remove it, the space becomes available when that process finishes. |
332,630 | <p>Let's say I have an existing System.Threading.Timer instance and I'd like to call Change on it to push it's firing time back:</p>
<pre><code>var timer = new Timer(DelayCallback, null, 10000, Timeout.Infinite);
// ... (sometime later but before DelayCallback has executed)
timer.Change(20000, Timeout.Infinite);
</cod... | [
{
"answer_id": 332677,
"author": "Timothy Khouri",
"author_id": 11917,
"author_profile": "https://Stackoverflow.com/users/11917",
"pm_score": 0,
"selected": false,
"text": "<p>I've actually had to build my own \"Timing\" class for an MMORPG I've made. It could keep track of over 100,000 ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/332630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42286/"
] | Let's say I have an existing System.Threading.Timer instance and I'd like to call Change on it to push it's firing time back:
```
var timer = new Timer(DelayCallback, null, 10000, Timeout.Infinite);
// ... (sometime later but before DelayCallback has executed)
timer.Change(20000, Timeout.Infinite);
```
I'm using thi... | it sounds like what you really want is the application-idle event
```
System.Windows.Forms.Application.Idle
``` |
332,651 | <p>I know how to set up a local webserver using xampp on windows... I enter my alias and target on the hosts file (c:\windows\system32\drivers\etc\hosts) and then add a respective entry on my apache vhosts config file. This way, assuming that my webserver is listening to port 80, I can for example map <code>example.com... | [
{
"answer_id": 332699,
"author": "Rob Williams",
"author_id": 26682,
"author_profile": "https://Stackoverflow.com/users/26682",
"pm_score": 2,
"selected": false,
"text": "<p>You are playing in the area of domain name services (DNS). Technically, with an advanced DNS configuration (which... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5005/"
] | I know how to set up a local webserver using xampp on windows... I enter my alias and target on the hosts file (c:\windows\system32\drivers\etc\hosts) and then add a respective entry on my apache vhosts config file. This way, assuming that my webserver is listening to port 80, I can for example map `example.com` to my ... | Internet Junkbuster (a proxy server) can do this using its [forwarding](http://www.junkbuster.com/ijbman.html#o_f) functionality.
Just add a line like
```
example.com:8080 localhost:80 . .
```
to `sforward.ini`, and uncomment the `forwardfile` line in `junkbstr.ini`. Now configure your browser to use a proxys... |
332,668 | <p>How to figure out if a table is in use in SQL (on any type database)? if somebody is already using it, or have it "open" then its in use.</p>
| [
{
"answer_id": 332671,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 2,
"selected": false,
"text": "<p>Check for open locks on the table.</p>\n\n<p>Have a look on the syslockinfo table.</p>\n"
},
{
"answer_id"... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29253/"
] | How to figure out if a table is in use in SQL (on any type database)? if somebody is already using it, or have it "open" then its in use. | Actually this will give you a better result:
```
select spid
from master..sysprocesses
where dbid = db_id('Works') and spid <> @@spid
``` |
332,681 | <p>Greetings!</p>
<p>I'm calling a Web service from Javascript when a user clicks on a link. I need to get the coordinates where the user clicked so that I can display a DIV in an appropriate location. My client-side script looks like the following:</p>
<pre><code>var g_event;
function DoWork(event, theId)
{
... | [
{
"answer_id": 332843,
"author": "Nathaniel Reinhart",
"author_id": 41122,
"author_profile": "https://Stackoverflow.com/users/41122",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried setting <code>window.event.cancelBubble = true</code> in your DoWork function?</p>\n\n<p>If n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] | Greetings!
I'm calling a Web service from Javascript when a user clicks on a link. I need to get the coordinates where the user clicked so that I can display a DIV in an appropriate location. My client-side script looks like the following:
```
var g_event;
function DoWork(event, theId)
{
if (IsIE())
g_ev... | Why not extract and save the coordinates in DoWork and simply use them in DoWorkSuccess rather than saving the event. Of course this won't work if there is more data you are extracting from the event.
```
var client_x;
var client_y;
function DoWork(event, theId)
{
var g_event;
if (IsIE())
g_event = wi... |
332,697 | <p><strong>This problem has been solved thanks to your suggestions.</strong> See the bottom for details. Thanks very much for your help!</p>
<p>Our ASP.NET website is accessed from several specific and highly secure international locations. It has been operating fine, but we have added another client location which is... | [
{
"answer_id": 332937,
"author": "Turnkey",
"author_id": 13144,
"author_profile": "https://Stackoverflow.com/users/13144",
"pm_score": 1,
"selected": false,
"text": "<p>Is it possible the client has disabled Javascript and it's not picking up the _EVENTTARGET form value?</p>\n"
},
{
... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20118/"
] | **This problem has been solved thanks to your suggestions.** See the bottom for details. Thanks very much for your help!
Our ASP.NET website is accessed from several specific and highly secure international locations. It has been operating fine, but we have added another client location which is exhibiting very strang... | If they're at all tech-savvy, I would have them download Fiddler or something similar, capture the entire HTTP session, and then send you the saved session. Maybe something in there will stick out.
Meanwhile, see if you can get an install of ISA Server (an evaluation install, if you have to, or one from MSDN if you ha... |
332,700 | <p>I've got a whole host of values stored in a .net 2.0 hashtable. What I would really like to find is a way to, essentially, do a SQL select statement on the table.</p>
<p>Meaning, I'd like to get a list of keys whose associated values match a very simple text pattern (along the lines of "starts with a number".)</p... | [
{
"answer_id": 332706,
"author": "Nathan W",
"author_id": 6335,
"author_profile": "https://Stackoverflow.com/users/6335",
"pm_score": 3,
"selected": true,
"text": "<p>You could use a regex against every key in the hashtable. This is very dirty but it works:</p>\n\n<pre><code> static ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] | I've got a whole host of values stored in a .net 2.0 hashtable. What I would really like to find is a way to, essentially, do a SQL select statement on the table.
Meaning, I'd like to get a list of keys whose associated values match a very simple text pattern (along the lines of "starts with a number".)
The final goa... | You could use a regex against every key in the hashtable. This is very dirty but it works:
```
static void Main(string[] args)
{
Hashtable myhashtable = new Hashtable();
myhashtable.Add("Teststring", "Hello");
myhashtable.Add("1TestString1", "World");
myhashtable.Add("2TestStrin... |
332,701 | <p>I'm dealing with a large group of entities that store locations. They are displayed on a map. I'm trying to come up with an efficient way to group near located entities into one entity when viewed from a higher location. So, for example, if you are very high, when looking down, you will see one entity that represent... | [
{
"answer_id": 332706,
"author": "Nathan W",
"author_id": 6335,
"author_profile": "https://Stackoverflow.com/users/6335",
"pm_score": 3,
"selected": true,
"text": "<p>You could use a regex against every key in the hashtable. This is very dirty but it works:</p>\n\n<pre><code> static ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9450/"
] | I'm dealing with a large group of entities that store locations. They are displayed on a map. I'm trying to come up with an efficient way to group near located entities into one entity when viewed from a higher location. So, for example, if you are very high, when looking down, you will see one entity that represents a... | You could use a regex against every key in the hashtable. This is very dirty but it works:
```
static void Main(string[] args)
{
Hashtable myhashtable = new Hashtable();
myhashtable.Add("Teststring", "Hello");
myhashtable.Add("1TestString1", "World");
myhashtable.Add("2TestStrin... |
332,703 | <p>I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments:</p>
<p>customer.hbm.xml:</p>
<pre><code><bag name="Orders" cascade="all-delete-orphan" inverse="false" fetch="join">
&... | [
{
"answer_id": 333382,
"author": "Tigraine",
"author_id": 21699,
"author_profile": "https://Stackoverflow.com/users/21699",
"pm_score": 3,
"selected": false,
"text": "<p>I just read <a href=\"http://feeds.feedburner.com/~r/AyendeRahien/~3/470968251/solving-the-select-n1-problem.aspx\" re... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2918/"
] | I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments:
customer.hbm.xml:
```
<bag name="Orders" cascade="all-delete-orphan" inverse="false" fetch="join">
<key column="CustomerID" />
... | You're getting 4XOrder and 4XLines because the join with lines doubles the results . You can set a Transformer on the ICriteria like :
```
.SetResultTransformer(new DistinctRootEntityResultTransformer())
``` |
332,709 | <p>This is for my DB class. I am new to OO, been a procedural lad for some time, so I'm still a bit murky.</p>
<p>My first idea was using a bunch of setter functions/methods.. but after writing a whole bunch, I thought about using PHP's define function, like so.</p>
<pre><code>define('MYSQL_USERNAME', 'jimbo');
</cod... | [
{
"answer_id": 332724,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 2,
"selected": false,
"text": "<p>there are probably a few options to deal with this:</p>\n\n<ol>\n<li><p>just use setters, it's perfectly acceptable, but can... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31671/"
] | This is for my DB class. I am new to OO, been a procedural lad for some time, so I'm still a bit murky.
My first idea was using a bunch of setter functions/methods.. but after writing a whole bunch, I thought about using PHP's define function, like so.
```
define('MYSQL_USERNAME', 'jimbo');
```
Is this an accepted ... | I use `const` only for creating mnemonic names for immutable constants in the class. The `define()` function does not create constants as part of the class, it creates constants in the global space.
```
class MyClass
{
const CONFIG_FILE = 'myapp.ini';
```
Class configuration data I usually declare as a `protected`... |
332,738 | <p>I'm trying to write a simple ruby function that can prompt the user for a value and if the user presses ENTER by itself, then a default value is used.
In the following example, the first call to the Prompt function can be handled by pressing ENTER by itself and the default value will be used. However, the second tim... | [
{
"answer_id": 332747,
"author": "Ana Betts",
"author_id": 5728,
"author_profile": "https://Stackoverflow.com/users/5728",
"pm_score": 1,
"selected": false,
"text": "<p>This isn't technically an answer, but it'll help you anyways: use Highline (<a href=\"http://highline.rubyforge.org/\" ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to write a simple ruby function that can prompt the user for a value and if the user presses ENTER by itself, then a default value is used.
In the following example, the first call to the Prompt function can be handled by pressing ENTER by itself and the default value will be used. However, the second time I... | This isn't technically an answer, but it'll help you anyways: use Highline (<http://highline.rubyforge.org/>), it'll save you a lot of grief if you're making a command-line interactive interface like this |
332,757 | <p>I get a 404 response from .Net MVC when I try to make a request where my search term ends with a <code>.</code> (period). This is the route that I'm using:</p>
<pre><code>routes.MapRoute(
"Json",
"Remote.mvc/{action}/{searchTerm}/{count}",
new { controller="Remote", c... | [
{
"answer_id": 3542524,
"author": "bkaid",
"author_id": 265570,
"author_profile": "https://Stackoverflow.com/users/265570",
"pm_score": 3,
"selected": false,
"text": "<p>If you are using .NET 4.0, you can set this flag in the system.web section of your web.config and it will be allowed:<... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I get a 404 response from .Net MVC when I try to make a request where my search term ends with a `.` (period). This is the route that I'm using:
```
routes.MapRoute(
"Json",
"Remote.mvc/{action}/{searchTerm}/{count}",
new { controller="Remote", count=10}
);
... | I have solved a similar issue (I had trouble with paths like /music/R.E.M.)
I've added the following line into the system.webServer/handlers section (adjusted for your case):
```
<add name="UrlRoutingHandler" type="System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f... |
332,758 | <p>I have a desktop application having heavyweight components (JxBrowser) in a JFrame. How can I make a snapshot from the GUI and save it to for example a png file? </p>
<p>Note: The method using Graphics2d and Component.paint()/paintAll()/print/printAll works only for lightweight components. </p>
<p>Any answers appr... | [
{
"answer_id": 332765,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 1,
"selected": false,
"text": "<p>You mean programmatically? </p>\n\n<p>What about </p>\n\n<pre><code>Point p = yourAwtComponent.getLocationOnScreen();\... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19621/"
] | I have a desktop application having heavyweight components (JxBrowser) in a JFrame. How can I make a snapshot from the GUI and save it to for example a png file?
Note: The method using Graphics2d and Component.paint()/paintAll()/print/printAll works only for lightweight components.
Any answers appreciated!
**EDIT*... | My name is Roman and I'm developer at TeamDev.
JxBrowser component it's a heavyweight component that embedds a native mozilla window to display web pages. To get screenshot of a full web page from JxBrowser component you can really use the Java Robot functionality with web page scrolling. For small web pages this solu... |
332,766 | <p>Here's a code snippet. . .</p>
<pre><code><form name="FinalAccept" method="get"><br>
<input type="radio" name="YesNo" value="Yes" onclick="/accept"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="/accept"> No<br>
</code></pre>
<p>Clearly, what I'm trying to do is... | [
{
"answer_id": 332772,
"author": "BoltBait",
"author_id": 20848,
"author_profile": "https://Stackoverflow.com/users/20848",
"pm_score": 2,
"selected": false,
"text": "<p>Your onClick event is expecting some javascript code:</p>\n\n<pre><code>onclick=\"SomeJavaScriptCode\"\n</code></pre>\... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1179/"
] | Here's a code snippet. . .
```
<form name="FinalAccept" method="get"><br>
<input type="radio" name="YesNo" value="Yes" onclick="/accept"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="/accept"> No<br>
```
Clearly, what I'm trying to do is call the routine linked to /accept when the user clicks on th... | If you want to submit the entire form when the user clicks on a radio button, then try this:
```
<form name="FinalAccept" method="get" action="accept"><br>
<input type="radio" name="YesNo" value="Yes" onclick="this.form.submit();"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="this.form.submit();"> No<b... |
332,767 | <p>I get this error when I do the make:</p>
<pre><code>relocation R_X86_64_32 against `vtable for Torch::MemoryDataSet' can not be used
when making a shared object; recompile with -fPIC
</code></pre>
<p>It says that I should recompile with the <code>-fPIC</code> option. I did that, adding
the <code>-fPIC</code> opt... | [
{
"answer_id": 336146,
"author": "clintm",
"author_id": 42631,
"author_profile": "https://Stackoverflow.com/users/42631",
"pm_score": 4,
"selected": false,
"text": "<p>I had this problem quite a while back and if I remember correctly, the fix was moving the placement of -fPIC just after ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39160/"
] | I get this error when I do the make:
```
relocation R_X86_64_32 against `vtable for Torch::MemoryDataSet' can not be used
when making a shared object; recompile with -fPIC
```
It says that I should recompile with the `-fPIC` option. I did that, adding
the `-fPIC` option to `CFLAGS` and `CXXFLAGS`, but I still get ... | I had this problem quite a while back and if I remember correctly, the fix was moving the placement of -fPIC just after gcc in the command line. Made absolutely no sense, and less so now, but as I remember, that fixed it. |
332,788 | <p>How can I maintain the scroll position of a treeview control in .NET application? For example, I have a treeview control and go through a process of adding various nodes to it tacking them on to the bottom. During this process, I can scroll through the treeview and view different nodes. The problem is when the proce... | [
{
"answer_id": 332841,
"author": "Matt Hanson",
"author_id": 5473,
"author_profile": "https://Stackoverflow.com/users/5473",
"pm_score": 5,
"selected": true,
"text": "<p>I think I figured it out:</p>\n\n<ol>\n<li>Get the node at the top of the treeview.</li>\n<li>Expand the parent node.<... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5473/"
] | How can I maintain the scroll position of a treeview control in .NET application? For example, I have a treeview control and go through a process of adding various nodes to it tacking them on to the bottom. During this process, I can scroll through the treeview and view different nodes. The problem is when the process ... | I think I figured it out:
1. Get the node at the top of the treeview.
2. Expand the parent node.
3. Make the node that was previously at the top visible.
>
>
> ```
> If treeNodeParent.IsExpanded = False Then
> Dim currentNode As TreeNode = TreeViewHosts.GetNodeAt(0, 0)
> treeNodeParent.Expand()
> curren... |
332,798 | <p>What is the equivalent of varchar(max) in MySQL?</p>
| [
{
"answer_id": 332805,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 9,
"selected": true,
"text": "<p>The max length of a varchar is subject to the max row size in MySQL, which is 64KB (not counting BLOBs):</p>\n\n<pre... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] | What is the equivalent of varchar(max) in MySQL? | The max length of a varchar is subject to the max row size in MySQL, which is 64KB (not counting BLOBs):
```
VARCHAR(65535)
```
However, note that the limit is lower if you use a multi-byte character set:
```
VARCHAR(21844) CHARACTER SET utf8
```
---
Here are some examples:
The maximum row size is 65535, but a ... |
332,803 | <p>The current guidlelines for explicit member implementation recommend:</p>
<ul>
<li>Using explicit members to approximate private interface implementations. <em>If you need to implement an interface for only infrastructure reasons and you <strong>never</strong> expect developers to directly call methods on that inte... | [
{
"answer_id": 332818,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 2,
"selected": false,
"text": "<p>No, the cost of writing a bunch of data to an XmlWriter is going to dwarf the boxing cost.</p>\n\n<p>Boxing consists ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029/"
] | The current guidlelines for explicit member implementation recommend:
* Using explicit members to approximate private interface implementations. *If you need to implement an interface for only infrastructure reasons and you **never** expect developers to directly call methods on that interface from this type then impl... | There's no boxing taking place in your example... it's just a cast, and it's resolvable at compile time, so it should not have any impact on performance at all.
**Edit:** Looking at it with ILDASM, the interface cast will give you a virtual method call versus a regular method call, but this is negligible (there is sti... |
332,809 | <p>I am trying to get a header that will work with Apache, IIS 6, and IIS 7. I won't go into the reason for that here. Let's just say that it's not as easy as I thought it would be :-)</p>
<p>Anyway, the problem has something to do with NPH. In our code (originally written for IIS 6) we have</p>
<pre><code>use CGI... | [
{
"answer_id": 332856,
"author": "brian d foy",
"author_id": 2766176,
"author_profile": "https://Stackoverflow.com/users/2766176",
"pm_score": 1,
"selected": false,
"text": "<p>I'd just create a subroutine that does the right thing depending on the server. You know what you have to do in... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12448/"
] | I am trying to get a header that will work with Apache, IIS 6, and IIS 7. I won't go into the reason for that here. Let's just say that it's not as easy as I thought it would be :-)
Anyway, the problem has something to do with NPH. In our code (originally written for IIS 6) we have
```
use CGI qw(:standard);
print "... | Brian (and others) have told me to write a subroutine that would Do The Right Thing. Hope this helps someone else!
```
sub header {
return (($ENV{PERLXS})?"HTTP/1.0 200 OK\r\n":"").CGI->header(@_);
}
``` |
332,810 | <p>when I apply the tag above my methods I get the error </p>
<blockquote>
<p>Type System.Runtime.CompilerServices.Extension is not defined.</p>
</blockquote>
<p>Here is my sample</p>
<pre><code><System.Runtime.CompilerServices.Extension()> _
Public Sub test()
End Sub
</code></pre>
<p>Where am I goin... | [
{
"answer_id": 332860,
"author": "shahkalpesh",
"author_id": 23574,
"author_profile": "https://Stackoverflow.com/users/23574",
"pm_score": 4,
"selected": true,
"text": "<p>What version of .net framework the IDE is pointing towards?</p>\n\n<p>Also, at first glance the syntax of extension ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | when I apply the tag above my methods I get the error
>
> Type System.Runtime.CompilerServices.Extension is not defined.
>
>
>
Here is my sample
```
<System.Runtime.CompilerServices.Extension()> _
Public Sub test()
End Sub
```
Where am I going wrong?
Edit ~ Straight from the MSDN Article [here](http://... | What version of .net framework the IDE is pointing towards?
Also, at first glance the syntax of extension method looks incorrect.
The code is incomplete. Please put the using statements in the example for anyone to use the code and compile it - to reproduce the error. |
332,849 | <p>How can I parse integers passed to an application as command line arguments if the app is unicode?</p>
<p>Unicode apps have a main like this:</p>
<pre><code>int _tmain(int argc, _TCHAR* argv[])
</code></pre>
<p>argv[?] is a wchar_t*. That means i can't use atoi. How can I convert it to an integer? Is stringstream... | [
{
"answer_id": 332900,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": true,
"text": "<p>if you have a TCHAR array or a pointer to the begin of it, you can use <code>std::basic_istringstream</co... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78828/"
] | How can I parse integers passed to an application as command line arguments if the app is unicode?
Unicode apps have a main like this:
```
int _tmain(int argc, _TCHAR* argv[])
```
argv[?] is a wchar\_t\*. That means i can't use atoi. How can I convert it to an integer? Is stringstream the best option? | if you have a TCHAR array or a pointer to the begin of it, you can use `std::basic_istringstream` to work with it:
```
std::basic_istringstream<_TCHAR> ss(argv[x]);
int number;
ss >> number;
```
Now, `number` is the converted number. This will work in ANSI mode (\_TCHAR is typedef'ed to `char`) and in Unicode (\_TCH... |
332,852 | <p>So I am currently learning C++ and decided to make a program that tests my skills I have learned so far. Now in my code I want to check if the value that the user enters is a double, if it is not a double I will put a if loop and ask them to reenter it. The problem I have is how do I go about checking what type of v... | [
{
"answer_id": 332886,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": false,
"text": "<h2>Safe C++ Way</h2>\n\n<p>You can define a function for this using <code>std::istringstream</code>:</p>\n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265448/"
] | So I am currently learning C++ and decided to make a program that tests my skills I have learned so far. Now in my code I want to check if the value that the user enters is a double, if it is not a double I will put a if loop and ask them to reenter it. The problem I have is how do I go about checking what type of vari... | There is no suitable way to check if a string *really* contains a double within the standard library. You probably want to use [Boost](http://www.boost.org/). The following solution is inspired by recipe 3.3 in [C++ Cookbook](https://rads.stackoverflow.com/amzn/click/com/0596007612):
```
#include <iostream>
#include <... |
332,862 | <p>When in release it crashes with an unhandled exception: std::length error.</p>
<p>The call stack looks like this:</p>
<pre><code>msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!_getptd_noexit() Line 616 + 0x7 bytes C
msvcr90.dll!_get... | [
{
"answer_id": 332869,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://Stackoverflow.com/users/5324",
"pm_score": 0,
"selected": false,
"text": "<p>Crashes before main() are usually caused by a bad constructor in a global or static variable.</p>\n\n<p>Looks like th... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78828/"
] | When in release it crashes with an unhandled exception: std::length error.
The call stack looks like this:
```
msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!_getptd_noexit() Line 616 + 0x7 bytes C
msvcr90.dll!_getptd() Line 641 + 0x5... | Examining the stack dump:
InitTerm is simply a function that walks a list of other functions and executes each in step - this is used for, amongst other things, global constructors (on startup), global destructors (on shutdown) and atexit lists (also on shutdown).
You are linking with CGAL, since that `CGAL::Random::... |
332,864 | <p>In another question on SO I answered with code like the one below and got a comment that the LINQ-query probably was evaluated in every iteration of the for/each. Is that true?</p>
<p>I know that LINQ-querys does not executes before its items is evaluated so it seems possible that this way to iterate the result can... | [
{
"answer_id": 332889,
"author": "Stefan",
"author_id": 19307,
"author_profile": "https://Stackoverflow.com/users/19307",
"pm_score": 0,
"selected": false,
"text": "<p>I looked up the FOR EACH...NEXT statement and it seems like Visual Basic evaluates the collection only once, before the ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19307/"
] | In another question on SO I answered with code like the one below and got a comment that the LINQ-query probably was evaluated in every iteration of the for/each. Is that true?
I know that LINQ-querys does not executes before its items is evaluated so it seems possible that this way to iterate the result can make it r... | NO... in a foreach, the "GetEnumerator" is called only once (ever), and that is used going forward.
EDIT: I put a statement here about the result set being stored temporarily... that's only true for some cases... not this one, so I took it out.
EDIT: Please forgive this for being overly verbose... but I wanted to *sh... |
332,871 | <p>this c# code is probably not the most efficient but gets what I want done. </p>
<p>How do I accomplish the same thing in F# code?</p>
<pre><code> string xml = " <EmailList> " +
" <Email>test@email.com</Email> " +
" <Email>test2@email.com</Email... | [
{
"answer_id": 332912,
"author": "Cory Foy",
"author_id": 4083,
"author_profile": "https://Stackoverflow.com/users/4083",
"pm_score": 1,
"selected": false,
"text": "<p>If you look at your code, you have a couple of things going on. The first is loading the collection for the Email nodes,... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72123/"
] | this c# code is probably not the most efficient but gets what I want done.
How do I accomplish the same thing in F# code?
```
string xml = " <EmailList> " +
" <Email>test@email.com</Email> " +
" <Email>test2@email.com</Email> " +
" </EmailList> ";
XmlDo... | ```
let doc = new XmlDocument() in
doc.LoadXml xml;
doc.SelectNodes "/EmailList/Email/text()"
|> Seq.cast<XmlNode>
|> Seq.map (fun node -> node.Value)
|> String.concat Environment.NewLine
```
If you actually want the final trailing newline you can add it in the map and String.concat wi... |
332,872 | <p>How do you safely encode a URL using JavaScript such that it can be put into a GET string?</p>
<pre><code>var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = "http://example.com/index.html?url=" + myUrl;
</code></pre>
<p>I assume that you need to encode the <code>myUrl</code> v... | [
{
"answer_id": 332888,
"author": "Buu",
"author_id": 17815,
"author_profile": "https://Stackoverflow.com/users/17815",
"pm_score": 13,
"selected": true,
"text": "<p>Check out the built-in function <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | How do you safely encode a URL using JavaScript such that it can be put into a GET string?
```
var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = "http://example.com/index.html?url=" + myUrl;
```
I assume that you need to encode the `myUrl` variable on that second line? | Check out the built-in function [encodeURIComponent(str)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) and [encodeURI(str)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI).
In your case, this should work:
```
var myO... |
332,920 | <p>In java, there's three levels of access:</p>
<ul>
<li>Public - Open to the world</li>
<li>Private - Open only to the class </li>
<li>Protected - Open only to the class and its subclasses (inheritance).</li>
</ul>
<p>So why does the java compiler allow this to happen?</p>
<p>TestBlah.java:</p>
<pre><code>public c... | [
{
"answer_id": 332933,
"author": "Lawrence Dol",
"author_id": 8946,
"author_profile": "https://Stackoverflow.com/users/8946",
"pm_score": 4,
"selected": false,
"text": "<p>Because protected means subclass <em>or</em> other classes in the same package.</p>\n\n<p>And there's actually a fou... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20526/"
] | In java, there's three levels of access:
* Public - Open to the world
* Private - Open only to the class
* Protected - Open only to the class and its subclasses (inheritance).
So why does the java compiler allow this to happen?
TestBlah.java:
```
public class TestBlah {
public static void main(String[] args) {... | Actually it should be:
>
> Open only to the [**classes on the same package**](http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html) the class and its subclasses (inheritance)
>
>
>
That's why |
332,930 | <p>I'm looking for something like: </p>
<pre><code>svnserve stop
</code></pre>
| [
{
"answer_id": 332940,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 6,
"selected": true,
"text": "<p>The recommended way is to do it is by using the <code>kill</code> command which will allow subversion to shut down... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3966/"
] | I'm looking for something like:
```
svnserve stop
``` | The recommended way is to do it is by using the `kill` command which will allow subversion to shut down properly. I don't think there is any better way to do it. |
332,948 | <p>I'm perplexed. At CodeRage today, Marco Cantu said that CharInSet was slow and I should try a Case statement instead. I did so in my parser and then checked with AQTime what the speedup was. I found the Case statement to be much slower.</p>
<p>4,894,539 executions of:</p>
<blockquote>
<p>while not CharInSet (P^,... | [
{
"answer_id": 332975,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 6,
"selected": true,
"text": "<p>AQTime is an instrumenting profiler. Instrumenting profilers often aren't suitable for measuring code time, particular... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30176/"
] | I'm perplexed. At CodeRage today, Marco Cantu said that CharInSet was slow and I should try a Case statement instead. I did so in my parser and then checked with AQTime what the speedup was. I found the Case statement to be much slower.
4,894,539 executions of:
>
> while not CharInSet (P^, [' ', #10,#13, #0]) do inc... | AQTime is an instrumenting profiler. Instrumenting profilers often aren't suitable for measuring code time, particularly in microbenchmarks like yours, because the cost of the instrumentation often outweighs the cost of the thing being measured. Instrumenting profilers, on the other hand, excel at profiling memory and ... |
332,955 | <p>As part of our unit tests, we restore a blank database when the tests start . The unit tests then perform their tests by calling web services (hosted in the Visual Studio ASP.NET host). </p>
<p>This works fine for us the first time the unit tests are run, however if they are re-run without restarting the web servic... | [
{
"answer_id": 333290,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 3,
"selected": true,
"text": "<p>After killing SQL Server, your connection pool will contain stale connections to the old instance of SQL Server.</p>\n\n<p>Y... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10784/"
] | As part of our unit tests, we restore a blank database when the tests start . The unit tests then perform their tests by calling web services (hosted in the Visual Studio ASP.NET host).
This works fine for us the first time the unit tests are run, however if they are re-run without restarting the web services, an exc... | After killing SQL Server, your connection pool will contain stale connections to the old instance of SQL Server.
You can call SqlConnection.ClearAllPools() to clear the stale connections from the pool after restarting SQL Server, e.g.:
```
static void Main(string[] args)
{
DoDBStuff();
new Server("loc... |
332,973 | <p>Any idea on how to check whether that list is a subset of another?</p>
<p>Specifically, I have</p>
<pre><code>List<double> t1 = new List<double> { 1, 3, 5 };
List<double> t2 = new List<double> { 1, 5 };
</code></pre>
<p>How to check that t2 is a subset of t1, using LINQ?</p>
| [
{
"answer_id": 332979,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": -1,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>static bool IsSubSet<A>(A[] set, A[] toCheck) {\n return set.Length == (toCheck.Int... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | Any idea on how to check whether that list is a subset of another?
Specifically, I have
```
List<double> t1 = new List<double> { 1, 3, 5 };
List<double> t2 = new List<double> { 1, 5 };
```
How to check that t2 is a subset of t1, using LINQ? | ```
bool isSubset = !t2.Except(t1).Any();
``` |
332,984 | <p>how do i get a list of user that have completed or not completed or not responded to a survey. </p>
<p>so i have a survey, lets say "survey A". in this survey i have a list of people or groups that must fill the survey. sharepoint already gives us a list of respondents, but i want to make a list of people that have... | [
{
"answer_id": 332979,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": -1,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>static bool IsSubSet<A>(A[] set, A[] toCheck) {\n return set.Length == (toCheck.Int... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23491/"
] | how do i get a list of user that have completed or not completed or not responded to a survey.
so i have a survey, lets say "survey A". in this survey i have a list of people or groups that must fill the survey. sharepoint already gives us a list of respondents, but i want to make a list of people that have not respo... | ```
bool isSubset = !t2.Except(t1).Any();
``` |
332,985 | <p>Trying to build a dashboard using Oracle's Brio. I have to access 6 different databases to grab the same type of data, aggregate it and display it. Except that when I do it, Brio grabs the data from the first source just fine. When I grab the data from the second data source, Brio replaces the original data with ... | [
{
"answer_id": 332979,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": -1,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>static bool IsSubSet<A>(A[] set, A[] toCheck) {\n return set.Length == (toCheck.Int... | 2008/12/02 | [
"https://Stackoverflow.com/questions/332985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Trying to build a dashboard using Oracle's Brio. I have to access 6 different databases to grab the same type of data, aggregate it and display it. Except that when I do it, Brio grabs the data from the first source just fine. When I grab the data from the second data source, Brio replaces the original data with the se... | ```
bool isSubset = !t2.Except(t1).Any();
``` |
333,029 | <p>I'll phrase this in the form of an example to make it more clear.</p>
<p>Say I have a vector of animals and I want to go through the array and see if the elements are either dogs or cats?</p>
<pre><code>class Dog: public Animal{/*...*/};
class Cat: public Animal{/*...*/};
int main()
{
vector<Animal*> stuff;... | [
{
"answer_id": 333036,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 2,
"selected": false,
"text": "<p>You can use <code>dynamic_cast</code>, as long as the vector contains Animal pointers.</p>\n\n<pre><code>vector <Ani... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39189/"
] | I'll phrase this in the form of an example to make it more clear.
Say I have a vector of animals and I want to go through the array and see if the elements are either dogs or cats?
```
class Dog: public Animal{/*...*/};
class Cat: public Animal{/*...*/};
int main()
{
vector<Animal*> stuff;
//cramming the dogs and ca... | As others has noted, you should neither use the `typeid`, nor the `dynamic_cast` operator to get the dynamic type of what your pointer points to. virtual functions were created to avoid this kind of nastiness.
Anyway here is what you do if you **really** want to do it (note that dereferencing an iterator will give yo... |
333,033 | <p>I was thinking it would be nice to create a base class for NUnit test fixtures that opens a TransactionScope during the SetUp phase, then rolls back the transaction during tear down.
Something like this:</p>
<pre><code> public abstract class TestFixtureBase
{
private TransactionScope _transaction;
[Test... | [
{
"answer_id": 333048,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>You want to be careful here. TransactionScope is going to promote the transaction to a distributed transaction if y... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21966/"
] | I was thinking it would be nice to create a base class for NUnit test fixtures that opens a TransactionScope during the SetUp phase, then rolls back the transaction during tear down.
Something like this:
```
public abstract class TestFixtureBase
{
private TransactionScope _transaction;
[TestFixtureSetUp]
... | I've used [XtUnit](http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx)
It automatically rolls back at the end of a unit test. You can simply add a [Rollback] attribute to the test. It's an extension to NUnit or MbUnit |
333,056 | <p>I have around 8-9 parameters to pass in a function which returns an array. I would like to know that its better to pass those parameters directly in the function or pass an array instead? Which will be a better way and why?</p>
| [
{
"answer_id": 333061,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 3,
"selected": false,
"text": "<p>Pass them individually, because:</p>\n\n<ul>\n<li>that is the type-safe way.</li>\n<li>IntelliSense will pick it up... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29515/"
] | I have around 8-9 parameters to pass in a function which returns an array. I would like to know that its better to pass those parameters directly in the function or pass an array instead? Which will be a better way and why? | If I would do anything, then it would be to create an structure that holds all parameters to get nice intellisence and strong names.
```
public struct user
{
public string FirstName;
public string LastName;
public string zilionotherproperties;
public bool SearchByLastNameOnly;
}
public user[] Ge... |
333,072 | <h2>Backstory</h2>
<p>I'm on Rails 2.1 and need to freeze the Capistrano gem to my vendor folder (as my host has broken their cap gem dependencies and I want to make myself as independent as possible).</p>
<p>On my local windows machine I've put the following my environment.rb</p>
<pre><code>config.gem "capistrano",... | [
{
"answer_id": 333279,
"author": "Gordon Wilson",
"author_id": 23071,
"author_profile": "https://Stackoverflow.com/users/23071",
"pm_score": 3,
"selected": true,
"text": "<p>You haven't done anything wrong. You're seeing this issue because the <code>cap</code> file under <code>capistran... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16779/"
] | Backstory
---------
I'm on Rails 2.1 and need to freeze the Capistrano gem to my vendor folder (as my host has broken their cap gem dependencies and I want to make myself as independent as possible).
On my local windows machine I've put the following my environment.rb
```
config.gem "capistrano", :version => "2.5.2"... | You haven't done anything wrong. You're seeing this issue because the `cap` file under `capistrano/bin/cap` isn't meant to be run as a stand-alone. You'll see the same result if you try to run it from your primary gem folder. The `cap` executable (stored at `/usr/bin/cap` on a standard linux install) requires `rubygems... |
333,086 | <p>I have a page which work like a navigation and a iframe in this page which show the content. </p>
<p>Now there are some situation when the inner page is directly shown in the browser.
eg: if somebody types the inner page's url in the browser address bar, the page is displayed in the window. </p>
<p>I want to prev... | [
{
"answer_id": 333115,
"author": "Ape-inago",
"author_id": 42082,
"author_profile": "https://Stackoverflow.com/users/42082",
"pm_score": 2,
"selected": false,
"text": "<pre><code><script language=\"Javascript\"><!-- \nif (top.location == self.location) { \n top.location = \"ind... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41968/"
] | I have a page which work like a navigation and a iframe in this page which show the content.
Now there are some situation when the inner page is directly shown in the browser.
eg: if somebody types the inner page's url in the browser address bar, the page is displayed in the window.
I want to prevent this.
Bette... | **window.parent**: The window object that contains the frame. If the the window is the top level window then window.parent refers the window itself. (It is never null.)
**window.top**: The top level window object, even if the current window is the top level window object.
**window.self**: The current window object. (... |
333,130 | <p>So I have a client who's current host does not allow me to use tar via exec()/passthru()/ect and I need to backup the site periodicly and programmaticly so is there a solution?</p>
<p>This is a linux server.</p>
| [
{
"answer_id": 333137,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 2,
"selected": false,
"text": "<p>There is the <a href=\"http://pear.php.net/package/Archive_Tar\" rel=\"nofollow noreferrer\">Archive_Tar</a> li... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] | So I have a client who's current host does not allow me to use tar via exec()/passthru()/ect and I need to backup the site periodicly and programmaticly so is there a solution?
This is a linux server. | At <http://pear.php.net/package/Archive_Tar> you can donload the PEAR tar package and use it like this to create the archive:
```
<?php
require 'Archive/Tar.php';
$obj = new Archive_Tar('archive.tar');
$path = '/path/to/folder/';
$handle=opendir($path);
$files = array();
while(false!==($file = readdir($handle)))
{
... |
333,141 | <p>I have a master page with a search box and button at the top. This search functionality is taking over the "enter" key for all my web forms that use this master page. That is, if I have a login page that uses this master page and the user enters in their username/password and hits "enter", instead of logging in th... | [
{
"answer_id": 333164,
"author": "Samiksha",
"author_id": 29515,
"author_profile": "https://Stackoverflow.com/users/29515",
"pm_score": 0,
"selected": false,
"text": "<p>set focus on the text box ,</p>\n\n<p>Page.RegisterStartupScript(\"SetFocus\", \"< script >document.getElementById(... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | I have a master page with a search box and button at the top. This search functionality is taking over the "enter" key for all my web forms that use this master page. That is, if I have a login page that uses this master page and the user enters in their username/password and hits "enter", instead of logging in the use... | use defaultbutton property of form or panel
```
<form defaultbutton=“button1” runat=“server”>
<asp:button id=“button1” text=“Same Page” runat=“server”/>
<asp:panel defaultbutton=“button2” runat=“server”>
<asp:textbox id=“foo” runat=“server”/>
<asp:button id=“button2” runat=“server... |
333,151 | <p>You can do it in .NET by using the keyword "ref". Is there any way to do so in Java?</p>
| [
{
"answer_id": 333166,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": 3,
"selected": false,
"text": "<p><strong>Java uses pass by value for method arguments</strong>. </p>\n\n<ul>\n<li><a href=\"http://java.sun.com/docs/books/t... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36816/"
] | You can do it in .NET by using the keyword "ref". Is there any way to do so in Java? | What are you doing in your method? If you're merely populating an existing array, then you don't need pass-by-reference semantics - either in .NET or in Java. In both cases, the reference will be passed by value - so changes to the *object* will be visible by the caller. That's like telling someone the address of your ... |
333,159 | <p>I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without ... | [
{
"answer_id": 333195,
"author": "Paulius",
"author_id": 1353085,
"author_profile": "https://Stackoverflow.com/users/1353085",
"pm_score": 5,
"selected": true,
"text": "<p>To set the include directories, you can add them into your INCLUDE environment variable. You use the same format as ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363/"
] | I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without thi... | To set the include directories, you can add them into your INCLUDE environment variable. You use the same format as in PATH env. variable - you separate paths with semicolons.
To set the library directories - you can do it in similar way, by putting them into your LIB environment variable.
To set environment variable... |
333,169 | <p>I am using CODBCRecordset (a class found on CodeProject) to find a single record in a table with 39 columns. If no record is found then the call to CRecordset::Open is fine. If a record matches the conditions then I get an Out of Memory exception when CRecordset::Open is called. I am selecting all the columns in the... | [
{
"answer_id": 333200,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 2,
"selected": false,
"text": "<p>Can we assume you mean you're calling C<strong>ODBC</strong>Recordset::Open(), yes? Or more precisely, something like... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42357/"
] | I am using CODBCRecordset (a class found on CodeProject) to find a single record in a table with 39 columns. If no record is found then the call to CRecordset::Open is fine. If a record matches the conditions then I get an Out of Memory exception when CRecordset::Open is called. I am selecting all the columns in the qu... | Read Pax's response. It gives a you a great understanding about why the problem happens.
Work Around:
This error will only happen if the field defined as (TEXT, LONGTEXT, etc) is NULL (and maybe empty). If there is data in the field then it will only allocate for the size the data in the field and not the max size (t... |
333,171 | <p>I would like to be able to show a non-modal form in an already existing application. At the moment I can do something like:</p>
<pre><code>myform.ShowDialog(handleToApp);
</code></pre>
<p>but that will create a modal form parented to the application and what I'm really looking for something that isn't modal so wh... | [
{
"answer_id": 333210,
"author": "Rad",
"author_id": 1349,
"author_profile": "https://Stackoverflow.com/users/1349",
"pm_score": -1,
"selected": false,
"text": "<p>How about a simple <code>myForm.Show()</code>?</p>\n"
},
{
"answer_id": 339689,
"author": "Nathan W",
"autho... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | I would like to be able to show a non-modal form in an already existing application. At the moment I can do something like:
```
myform.ShowDialog(handleToApp);
```
but that will create a modal form parented to the application and what I'm really looking for something that isn't modal so when the form loses focus it ... | I found what I was looking for, you have to make a class which looks like this:
```
public class MapinfoWindowHandle : System.Windows.Forms.IWin32Window
{
private IntPtr handle;
public MapinfoWindowHandle(IntPtr hWnd)
{
handle = hWnd;
}
#region IWin32Window Memb... |
333,175 | <p>My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for this?</p>
| [
{
"answer_id": 333268,
"author": "Jonathan Allen",
"author_id": 5274,
"author_profile": "https://Stackoverflow.com/users/5274",
"pm_score": 9,
"selected": true,
"text": "<p>Ugh, I hate it when people try to guess at which characters are valid. Besides being completely non-portable (alway... | 2008/12/02 | [
"https://Stackoverflow.com/questions/333175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13877/"
] | My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for this? | Ugh, I hate it when people try to guess at which characters are valid. Besides being completely non-portable (always thinking about Mono), both of the earlier comments missed more 25 invalid characters.
```
foreach (var c in Path.GetInvalidFileNameChars())
{
fileName = fileName.Replace(c, '-');
}
```
Or in VB:
... |