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 |
|---|---|---|---|---|---|---|
375,348 | <p>I am fairly new to using infragistics controls (started yesterday). While they are (very) impressive they do add another layer of complexity, which I am muddeling through. So I am asking what I feel to be a fairly simple issue:</p>
<p>I am trying to get the value from another column besides the one that is displaye... | [
{
"answer_id": 376186,
"author": "Sean",
"author_id": 5578,
"author_profile": "https://Stackoverflow.com/users/5578",
"pm_score": 1,
"selected": true,
"text": "<p>found correct combination:</p>\n\n<pre><code>LastName = ucboPatientInfo.Cells(5).Value\n</code></pre>\n"
},
{
"answer... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5578/"
] | I am fairly new to using infragistics controls (started yesterday). While they are (very) impressive they do add another layer of complexity, which I am muddeling through. So I am asking what I feel to be a fairly simple issue:
I am trying to get the value from another column besides the one that is displayed in the c... | found correct combination:
```
LastName = ucboPatientInfo.Cells(5).Value
``` |
375,351 | <p>I need to randomly 'sort' a list of integers (0-1999) in the most efficient way possible. Any ideas?</p>
<p>Currently, I am doing something like this:</p>
<pre><code>bool[] bIndexSet = new bool[iItemCount];
for (int iCurIndex = 0; iCurIndex < iItemCount; iCurIndex++)
{
int iSwapIndex = random.Next(iItemCo... | [
{
"answer_id": 375361,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 7,
"selected": true,
"text": "<p>A good linear-time shuffling algorithm is the <a href=\"http://en.wikipedia.org/wiki/Fisher-Yates_shuffle\" rel=\"noref... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44626/"
] | I need to randomly 'sort' a list of integers (0-1999) in the most efficient way possible. Any ideas?
Currently, I am doing something like this:
```
bool[] bIndexSet = new bool[iItemCount];
for (int iCurIndex = 0; iCurIndex < iItemCount; iCurIndex++)
{
int iSwapIndex = random.Next(iItemCount);
if (!bIndexSet[... | A good linear-time shuffling algorithm is the [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
One problem you'll find with your proposed algorithm is that as you near the end of the shuffle, your loop will spend a lot of time looking for randomly chosen elements that have not yet been swappe... |
375,355 | <p>I work on a database driven website. Most pages' titles are the names of partners we have, and served from a database using php.</p>
<p>For example one page might be called "Experian". The problem is that some of the values for partner names don't work because the values are things like </p>
<pre><code> $partne... | [
{
"answer_id": 375376,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 1,
"selected": false,
"text": "<p>Not AFAIK, but if you're already scripting out a string from the DB, why can't you script out the same string regex re... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43035/"
] | I work on a database driven website. Most pages' titles are the names of partners we have, and served from a database using php.
For example one page might be called "Experian". The problem is that some of the values for partner names don't work because the values are things like
```
$partnername22 = Discover<sup>... | For:
```
<title><?php echo $offer22name ?>is a magazine</title>
```
change to:
```
<title><?php echo preg_replace('|<sup>(.*?)</sup>|', '($1)', $offer22name) ?> is a magazine</title>
```
But like Bryan mentioned, you should use PHP's strip\_tags() in this scenario. So:
```
<title><?php echo strip_tags($offer22na... |
375,356 | <p>I have a simple cart page that displays items that are in someones cart, and having it display via an ASP while from my table. I have a column where a user can delete an entry. I have the ASP working properly, now I am trying to add some AJAX in to it. I have the following code:</p>
<pre><code>$("img.delete").click... | [
{
"answer_id": 375382,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 3,
"selected": true,
"text": "<p>You need to select only the item's row for removal. I'm not sure how you have it set up, but if the image element ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a simple cart page that displays items that are in someones cart, and having it display via an ASP while from my table. I have a column where a user can delete an entry. I have the ASP working properly, now I am trying to add some AJAX in to it. I have the following code:
```
$("img.delete").click(function() {
... | You need to select only the item's row for removal. I'm not sure how you have it set up, but if the image element is inside the row you could use:
```
$("img.delete").click(function() {
var row = $(this).parents('tr:first');
...
success: function(){
$(row).remove(); //Remove the row con... |
375,365 | <p>I am trying to make one field in a datagrid editable with a numeric stepper. My current attempts look like they are working, but the dataProvider is not actually being changed.</p>
<p>Based on what I have read in a billion different places, the syntax should be </p>
<pre>< mx:DataGridColumn dataField="a" itemR... | [
{
"answer_id": 375382,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 3,
"selected": true,
"text": "<p>You need to select only the item's row for removal. I'm not sure how you have it set up, but if the image element ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40397/"
] | I am trying to make one field in a datagrid editable with a numeric stepper. My current attempts look like they are working, but the dataProvider is not actually being changed.
Based on what I have read in a billion different places, the syntax should be
```
< mx:DataGridColumn dataField="a" itemRenderer="mx.control... | You need to select only the item's row for removal. I'm not sure how you have it set up, but if the image element is inside the row you could use:
```
$("img.delete").click(function() {
var row = $(this).parents('tr:first');
...
success: function(){
$(row).remove(); //Remove the row con... |
375,368 | <p>Is it possible with the wmd editor to add a button to let the user upload an image to the web server and place the corresponding img markdown in the textbox? If not, will another good inplace editor do it? Context: I'm using asp.net mvc, C# and I am a true beginner with javascript.</p>
| [
{
"answer_id": 375448,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 1,
"selected": false,
"text": "<p>A brief perusal of the <a href=\"http://wmd-editor.com/features\" rel=\"nofollow noreferrer\">WMD</a> seems to indi... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29244/"
] | Is it possible with the wmd editor to add a button to let the user upload an image to the web server and place the corresponding img markdown in the textbox? If not, will another good inplace editor do it? Context: I'm using asp.net mvc, C# and I am a true beginner with javascript. | A brief perusal of the [WMD](http://wmd-editor.com/features) seems to indicate that this feature is not supported directly and that the control is not particularly pluggable.
That being said, there's nothing stopping you from creating a button/upload-field/whatever that sends an image to your servers and injects the a... |
375,383 | <p>I'm executing the following query:</p>
<pre><code>Select guiPolygonID, dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318)
From [vPolygonSegments]
Where dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318) > 0
</code></pre>
<p>The important parts of function fn_Yval (all params are of type float):</p>
<pre><code>set @m = (@p2Y - @... | [
{
"answer_id": 375391,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>The problem occurs when @p2X = @p1X. What do you expect to happen in that case?</p>\n"
},
{
"answer_id": 3... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3420/"
] | I'm executing the following query:
```
Select guiPolygonID, dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318)
From [vPolygonSegments]
Where dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318) > 0
```
The important parts of function fn\_Yval (all params are of type float):
```
set @m = (@p2Y - @p1Y)/(@p2X - @p1X)
set @b = @p1Y - (@m*... | The problem here is that the function in the select cause is evaluated before the function in the where clause is evaluated. This condition is very rare, but it is possible, so you need to code against it. I would suggest that you modify the function so that it can safely handle divide by zero circumstances. Change thi... |
375,390 | <p>I have a MOSS 07 site that is configured for anonymous access. There is a document library within this site that also has anonymous access enabled. When an anonymous user clicks on a PDF file in this library, he or she can read or download it with no problem. When a user clicks on an Office document, he or she is pr... | [
{
"answer_id": 377684,
"author": "Lars Fastrup",
"author_id": 27393,
"author_profile": "https://Stackoverflow.com/users/27393",
"pm_score": 0,
"selected": false,
"text": "<p>My guess is that the Office client is loading the underlying document template from another location where anonymo... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a MOSS 07 site that is configured for anonymous access. There is a document library within this site that also has anonymous access enabled. When an anonymous user clicks on a PDF file in this library, he or she can read or download it with no problem. When a user clicks on an Office document, he or she is promp... | To disable login prompt opening office documents from SharePoint 2010 do the following settings in web.config
```
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<!-- here's where the magic happens -->
<verbs allowUnlisted="true">
<add verb="OPTIONS" allowed="false... |
375,395 | <p>What is a very good jsp framework to use with Spring MVC.
Are the only candidates SiteMesh and Tiles, and others?</p>
| [
{
"answer_id": 377684,
"author": "Lars Fastrup",
"author_id": 27393,
"author_profile": "https://Stackoverflow.com/users/27393",
"pm_score": 0,
"selected": false,
"text": "<p>My guess is that the Office client is loading the underlying document template from another location where anonymo... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13143/"
] | What is a very good jsp framework to use with Spring MVC.
Are the only candidates SiteMesh and Tiles, and others? | To disable login prompt opening office documents from SharePoint 2010 do the following settings in web.config
```
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<!-- here's where the magic happens -->
<verbs allowUnlisted="true">
<add verb="OPTIONS" allowed="false... |
375,406 | <p>What is the best way to close an ASPX page from the code-behind? </p>
<p>I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page. I have tried to programmatically add a JavaScript method that contains a <code>window.close()</code> command to the <code>O... | [
{
"answer_id": 375424,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "<p>A postback is the process of re-loading a page, so if you want the page to close after the postback then you need t... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] | What is the best way to close an ASPX page from the code-behind?
I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page. I have tried to programmatically add a JavaScript method that contains a `window.close()` command to the `OnClientClick` event to close... | **UPDATE:** I have taken all of your input and came up with the following solution:
In code behind:
```
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");
}
```
In aspx page:
```
function CloseW... |
375,408 | <p>If I have 3 different views which are defined in 3 corresponding functions, namely:</p>
<pre><code>- (UIView *)getView1 { /*...*/ }
- (UIView *)getView2 { /*...*/ }
- (UIView *)getView3 { /*...*/ }
</code></pre>
<p>These are added to <code>self.view</code> when a particular view is required.</p>
<p>My question is... | [
{
"answer_id": 375690,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 3,
"selected": false,
"text": "<p>You can tag each view with with an integer and later read the tag to determine which view is active (assuming you are... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47156/"
] | If I have 3 different views which are defined in 3 corresponding functions, namely:
```
- (UIView *)getView1 { /*...*/ }
- (UIView *)getView2 { /*...*/ }
- (UIView *)getView3 { /*...*/ }
```
These are added to `self.view` when a particular view is required.
My question is, how do we know which of these views is cur... | You can tag each view with with an integer and later read the tag to determine which view is active (assuming you are replacing `self.view`).
```
#define TAG_VIEW_1 1
#define TAG_VIEW_2 2
#define TAG_VIEW_3 3
...
[ [self getView1()] setTag:TAG_VIEW_1 ];
[ [self getView2()] setTag:TAG_VIEW_2 ];
[ [self getView3()] setT... |
375,420 | <p>I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code. I've run across something in PHP that doesn't seem to have a java equivalent:</p>
<pre><code>preg_replace_callback()
</code></pre>
<p>For every match in the regex, it calls a function that is pa... | [
{
"answer_id": 375479,
"author": "jdmichal",
"author_id": 12275,
"author_profile": "https://Stackoverflow.com/users/12275",
"pm_score": 6,
"selected": true,
"text": "<p><strong>IMPORTANT</strong>: As pointed out by <a href=\"https://stackoverflow.com/questions/375420/java-equivalent-to-p... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36316/"
] | I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code. I've run across something in PHP that doesn't seem to have a java equivalent:
```
preg_replace_callback()
```
For every match in the regex, it calls a function that is passed the match text as a pa... | **IMPORTANT**: As pointed out by [Kip](https://stackoverflow.com/questions/375420/java-equivalent-to-phps-preg-replace-callback/375479?noredirect=1#comment2566951_375479) in the comments, this class has an infinite loop bug if the matching regex matches on the replacement string. I'll leave it as an exercise to readers... |
375,427 | <p>I'm using the <a href="http://docs.python.org/library/subprocess.html" rel="noreferrer">subprocess module</a> to start a subprocess and connect to its output stream (standard output). I want to be able to execute non-blocking reads on its standard output. Is there a way to make .readline non-blocking or to check if ... | [
{
"answer_id": 375503,
"author": "monkut",
"author_id": 24718,
"author_profile": "https://Stackoverflow.com/users/24718",
"pm_score": 3,
"selected": false,
"text": "<p>One solution is to make another process to perform your read of the process, or make a thread of the process with a time... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861/"
] | I'm using the [subprocess module](http://docs.python.org/library/subprocess.html) to start a subprocess and connect to its output stream (standard output). I want to be able to execute non-blocking reads on its standard output. Is there a way to make .readline non-blocking or to check if there is data on the stream bef... | [`fcntl`](https://stackoverflow.com/questions/375427/non-blocking-read-on-a-stream-in-python/4025909#4025909), [`select`](https://stackoverflow.com/questions/375427/non-blocking-read-on-a-stream-in-python/375511#375511), [`asyncproc`](https://stackoverflow.com/questions/375427/non-blocking-read-on-a-stream-in-python/43... |
375,449 | <p>I have two fields in a table. One contains values such as BTA, BEA, REA. The other contains values such as 1,2,63,103.</p>
<p>I want to combine the 2 fields so they look like this BTA001, BTA002, BTA063, BTA103.</p>
<p>Notice how if the numbers are not 3 characters in length, I want to pad some 0's to the left o... | [
{
"answer_id": 375459,
"author": "D'Arcy Rittich",
"author_id": 39430,
"author_profile": "https://Stackoverflow.com/users/39430",
"pm_score": 4,
"selected": true,
"text": "<pre><code>select Type + right('00' + cast(id as varchar(10)), 3)\nfrom ...\n</code></pre>\n\n<p>Edit: if id can be ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | I have two fields in a table. One contains values such as BTA, BEA, REA. The other contains values such as 1,2,63,103.
I want to combine the 2 fields so they look like this BTA001, BTA002, BTA063, BTA103.
Notice how if the numbers are not 3 characters in length, I want to pad some 0's to the left of the number to mak... | ```
select Type + right('00' + cast(id as varchar(10)), 3)
from ...
```
Edit: if id can be null and you would like a zero to show, you can do:
```
select Type + right('00' + cast(isnull(id, 0) as varchar(10)), 3)
from ...
``` |
375,450 | <p>This recent question about <a href="https://stackoverflow.com/questions/375351/most-efficient-way-to-randomly-sort-shuffle-a-list-of-integers-in-c">sorting randomly using C#</a> got me thinking about the way I've sometimes shuffled my arrays in Perl.</p>
<pre><code>@shuffled = sort { rand() <=> rand() } @arra... | [
{
"answer_id": 375476,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "<p>This is just intuition, but I think that using a sort like this will produce a set whose order is to some degree ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40657/"
] | This recent question about [sorting randomly using C#](https://stackoverflow.com/questions/375351/most-efficient-way-to-randomly-sort-shuffle-a-list-of-integers-in-c) got me thinking about the way I've sometimes shuffled my arrays in Perl.
```
@shuffled = sort { rand() <=> rand() } @array;
```
The proposed solution ... | I'm not a Perl internals expert, so I don't know how "sort" will work here. However, most sort functions expect consistency in their comparisons, and I would expect them to work unpredictably if the function is itself random. Unfortunately, unpredictability is not the same as randomness, and so I'd have no confidence i... |
375,457 | <p>Using VS 2008, here is my COM object</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace TestCom
{
[Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[... | [
{
"answer_id": 375565,
"author": "Vyas Bharghava",
"author_id": 28413,
"author_profile": "https://Stackoverflow.com/users/28413",
"pm_score": 0,
"selected": false,
"text": "<p>This works for me from VBA... I tried it using Word & Excel 2003 (SP3).</p>\n\n<p>I'm not sure what you mea... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Using VS 2008, here is my COM object
```
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace TestCom
{
[Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("Test9.... | I'm going to answer my own question, hopefully to spare others the hours of tedious drudgery I have just endured.
If you get this, it **is** because the .NET based COM assembly can't find the .NET framework
The solution is simple. Create a file containing the following
```
<?xml version="1.0"?>
<configuration>
<st... |
375,492 | <p>Ok so I've spent a couple hours trying to resolve this issue and have had no leads so far, keep getting the same 404 error. What happens is the website picks up the Default.aspx page and displays it like it should. But the Home page has a clickable image where it routes to another view page. The image code is like s... | [
{
"answer_id": 375513,
"author": "Min",
"author_id": 14461,
"author_profile": "https://Stackoverflow.com/users/14461",
"pm_score": 3,
"selected": true,
"text": "<p>I noticed something odd in that tutorial link you posted. Verify File Exists should be unchecked.</p>\n"
},
{
"answe... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24130/"
] | Ok so I've spent a couple hours trying to resolve this issue and have had no leads so far, keep getting the same 404 error. What happens is the website picks up the Default.aspx page and displays it like it should. But the Home page has a clickable image where it routes to another view page. The image code is like so:
... | I noticed something odd in that tutorial link you posted. Verify File Exists should be unchecked. |
375,508 | <p>How do I remove items from, or add items to, a select box? I'm running jQuery, should that make the task easier. Below is an example select box.</p>
<pre><code><select name="selectBox" id="selectBox">
<option value="option1">option1</option>
<option value="option2">option2</option... | [
{
"answer_id": 375558,
"author": "Zachary Yates",
"author_id": 8360,
"author_profile": "https://Stackoverflow.com/users/8360",
"pm_score": 3,
"selected": false,
"text": "<p>I found two pages that seem helpful, it's written for ASP.Net, but the same stuff should apply:</p>\n\n<ol>\n<li><a... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | How do I remove items from, or add items to, a select box? I'm running jQuery, should that make the task easier. Below is an example select box.
```
<select name="selectBox" id="selectBox">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</op... | Remove an option:
```js
$("#selectBox option[value='option1']").remove();
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select name="selectBox" id="selectBox">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option va... |
375,512 | <p>I have a custom sharepoint web part that is throwing the following exception:</p>
<pre><code>System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' f... | [
{
"answer_id": 375533,
"author": "Cory Foy",
"author_id": 4083,
"author_profile": "https://Stackoverflow.com/users/4083",
"pm_score": 3,
"selected": true,
"text": "<p>There are several options you have. The first is to install your assembly into the GAC. It will then get full trust, but ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285/"
] | I have a custom sharepoint web part that is throwing the following exception:
```
System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.
at M... | There are several options you have. The first is to install your assembly into the GAC. It will then get full trust, but you have to install it in the GAC, strong name it, etc. The second option is to go into the web.config and add it to the trusted list. [This article](http://msdn.microsoft.com/en-us/library/ms916855.... |
375,518 | <p>In my code attached below, I'm trying to upload a file via ASP.NET. I am dynamically creating the FileUpload control so that means it's not in my ViewState which (I think) means I can't use the control for uploading files unless I use the old fashioned multipat/form-data way which I don't want to do. I need to be ... | [
{
"answer_id": 375538,
"author": "thinkbeforecoding",
"author_id": 47001,
"author_profile": "https://Stackoverflow.com/users/47001",
"pm_score": 2,
"selected": false,
"text": "<p>You can use Request.Files</p>\n\n<p>It contains the uploaded files as HttpPostedFile objects.</p>\n\n<pre><co... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47167/"
] | In my code attached below, I'm trying to upload a file via ASP.NET. I am dynamically creating the FileUpload control so that means it's not in my ViewState which (I think) means I can't use the control for uploading files unless I use the old fashioned multipat/form-data way which I don't want to do. I need to be able ... | here is a longer version of the above: C#
```
print("HttpFileCollection UploadedFiles = Request.Files;
HttpPostedFile UserPostedFile;
int UploadFileCount = UploadedFiles.Count;
if (UploadFileCount >= 1)
{
for (int i = 0; i < UploadFileCount; ++i)
{
UserPostedFile = UploadedFiles[i];
UserPos... |
375,520 | <p>How can i get all the class properties and its sub classes with properties from an RDF datasource using SPARQL query given a class name and namespace?</p>
| [
{
"answer_id": 636619,
"author": "Simon Gibbs",
"author_id": 13935,
"author_profile": "https://Stackoverflow.com/users/13935",
"pm_score": 2,
"selected": false,
"text": "<p>How about <a href=\"http://dbpedia.org/snorql/?query=%0D%0ASELECT+%3FsubClass%2C+%3Fpredicate+%0D%0AWHERE+%7B%0D%0A... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43049/"
] | How can i get all the class properties and its sub classes with properties from an RDF datasource using SPARQL query given a class name and namespace? | How about [this](http://dbpedia.org/snorql/?query=%0D%0ASELECT+%3FsubClass%2C+%3Fpredicate+%0D%0AWHERE+%7B%0D%0A+++%3FsubClass+rdfs%3AsubClassOf+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FWork%3E+.%0D%0A+++%3Fpredicate+rdfs%3Adomain+%3FsubClass%0D%0A%7D):
```
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ... |
375,524 | <p>I have a ASP.NET page which allows an administrator to change the password for a user. Since the administrator does not know the user's password, I am using the following:</p>
<pre><code>MembershipUser member = Membership.GetUser(_usernameTextBox.Text);
member.ChangePassword(member.ResetPassword(), _passNewTextBox... | [
{
"answer_id": 375537,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 0,
"selected": false,
"text": "<p>You can use a Regular Expression Validator to check if the password meets the complexity requirements.</p>\n... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24970/"
] | I have a ASP.NET page which allows an administrator to change the password for a user. Since the administrator does not know the user's password, I am using the following:
```
MembershipUser member = Membership.GetUser(_usernameTextBox.Text);
member.ChangePassword(member.ResetPassword(), _passNewTextBox.Text);
```
-... | You can use the following properties to test the password against:
* [Membership.PasswordStrengthRegularExpression](http://msdn.microsoft.com/en-us/library/system.web.security.membership.passwordstrengthregularexpression.aspx)
* [Membership.MinRequiredPasswordLength](http://msdn.microsoft.com/en-us/library/system.web.... |
375,525 | <p>I have a conflict when trying to mix those plugins, i have based my script in some demos.
The problem is that when i drag something inside the same list it triggers the drop event and that item is added to the end of the list, wich is correct if the item is dropped in another list, but not in the same, when i drop i... | [
{
"answer_id": 375986,
"author": "Eugene Lazutkin",
"author_id": 26394,
"author_profile": "https://Stackoverflow.com/users/26394",
"pm_score": 4,
"selected": true,
"text": "<p>You cannot mix those plugins: they process the same events, and cannot cooperate together. Either rethink your U... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43304/"
] | I have a conflict when trying to mix those plugins, i have based my script in some demos.
The problem is that when i drag something inside the same list it triggers the drop event and that item is added to the end of the list, wich is correct if the item is dropped in another list, but not in the same, when i drop it i... | You cannot mix those plugins: they process the same events, and cannot cooperate together. Either rethink your UI, or use different tools.
Is it possible to do it? Yes, of course. For example, [Dojo DnD](http://docs.dojocampus.org/dojo/dnd) allows both sorting and drag-and-drop using just one component: [test\_dnd.htm... |
375,548 | <p>I recently asked this question: <a href="https://stackoverflow.com/questions/368521/api-design-expose-xml-or-objects" title="Expose XML or Objects">Expose XML or Objects</a> - thanks all for the responses.</p>
<p>One point to clarify.</p>
<ul>
<li>The API will always be accessed remotely (i.e. as a service), most ... | [
{
"answer_id": 375597,
"author": "BenAlabaster",
"author_id": 40650,
"author_profile": "https://Stackoverflow.com/users/40650",
"pm_score": 1,
"selected": false,
"text": "<p>If you're looking for an argument in favour of XML (not that I am particularly in favour of XML) are:</p>\n\n<ul>\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36860/"
] | I recently asked this question: [Expose XML or Objects](https://stackoverflow.com/questions/368521/api-design-expose-xml-or-objects "Expose XML or Objects") - thanks all for the responses.
One point to clarify.
* The API will always be accessed remotely (i.e. as a service), most probably via webservices or WCF.
I ag... | * Objects can perform better (thinking binary serialization here).
* Objects can have stronger simple type validations.
* Objects allow you to put the validation and business rules closer to the data structure definition.
* Objects by their nature allow you to write simpler business rules and validation, since much of ... |
375,552 | <p>I have a 3rd party XLL addin I'd like to wrap in my own custom vba function. How would I call the 3rd party function from my code?</p>
| [
{
"answer_id": 375753,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 6,
"selected": true,
"text": "<p><strong>Edit:</strong> There are at least two ways to do this:</p>\n\n<hr>\n\n<p><strong>Option 1:</strong> <code>Applic... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | I have a 3rd party XLL addin I'd like to wrap in my own custom vba function. How would I call the 3rd party function from my code? | **Edit:** There are at least two ways to do this:
---
**Option 1:** `Application.Run(...)`
This looks like the best way to go about it, since your arguments are automatically converted to an appropriate type before being sent to the XLL function.
```
Public Function myVBAFunction(A as Integer, B as String, C as Dou... |
375,563 | <p>I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) but not when I try to to use it in PHP's ereg functions. I suspect there is something different about the PHP ereg functi... | [
{
"answer_id": 375568,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>You may need to escape the backslash:</p>\n\n<pre><code>$string = ereg_replace(\"<em\\\\b[^>]*>(.*?)</em&g... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45838/"
] | I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) but not when I try to to use it in PHP's ereg functions. I suspect there is something different about the PHP ereg function ... | PHP's ereg functions use a very limited regex flavor called [POSIX ERE](http://www.regular-expressions.info/posix.html). My [flavor comparison](http://www.regular-expressions.info/refflavors.html) indicates all that this flavor lacks compared with modern flavors.
In your case, the word boundary \b is not supported. A ... |
375,583 | <p>I have a nib that I load the usual way</p>
<p><code>[NSBundle loadNibNamed:@"AuthorizationWindow" owner:self];</code></p>
<p>and I see the window show on the screen briefly, and using NSLog() I can confirm that -awakeFromNib is called, but I can't figure out why the window does not stay on the screen. I had it wor... | [
{
"answer_id": 375696,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 0,
"selected": false,
"text": "<p>I would take a closer look at the object you are using to load the nib (<code>self</code>, in the code you provided). S... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34386/"
] | I have a nib that I load the usual way
`[NSBundle loadNibNamed:@"AuthorizationWindow" owner:self];`
and I see the window show on the screen briefly, and using NSLog() I can confirm that -awakeFromNib is called, but I can't figure out why the window does not stay on the screen. I had it working correctly for a bit, bu... | I'd guess your window is being deallocated (or if under GC, collected) right out from under you. There are about a million possible reasons for this (none of which we can diagnose from one line of code), but there mere fact you're using +loadNibNamed:owner: is a warning flag. The reason is that items instantiated in ni... |
375,589 | <p>I am getting comfortable writing regular queries in SPARQL, but I'm still having trouble with fancier stuff. My latest problem is trying to select everything except stuff that matches the where clause. For instance, say I want to find all the husbands who like a car color that their wife doesn't like (I'm working ... | [
{
"answer_id": 375607,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 3,
"selected": true,
"text": "<p>I realize that this isn't actually answering the question, but...</p>\n\n<p>On Windows, Helvetica isn't always install... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35600/"
] | I am getting comfortable writing regular queries in SPARQL, but I'm still having trouble with fancier stuff. My latest problem is trying to select everything except stuff that matches the where clause. For instance, say I want to find all the husbands who like a car color that their wife doesn't like (I'm working on a ... | I realize that this isn't actually answering the question, but...
On Windows, Helvetica isn't always installed. My machine at work (the one I'm using now) doesn't, despite having Microsoft Office XP. |
375,590 | <p>I'm loading an XML document in my C# application with the following:</p>
<pre><code>XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
</code></pre>
<p>but before that, I do test to make sure the file exists with:</p>
<pre><code>File.Exists(myfile);
</code></pre>
<p>But... is there an (easy) way to t... | [
{
"answer_id": 375617,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": false,
"text": "<p>Just load it and catch the exception. Same for <code>File.Exists()</code> - the file system is <em>volatile</em> s... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44004/"
] | I'm loading an XML document in my C# application with the following:
```
XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
```
but before that, I do test to make sure the file exists with:
```
File.Exists(myfile);
```
But... is there an (easy) way to test the file before the XDocument.Load() to make ... | It's probably just worth catching the specific exception if you want to show a message to the user:
```
try
{
XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
}
catch (XmlException exception)
{
ShowMessage("Your XML was probably bad...");
}
``` |
375,605 | <p>I need to keep a couple of <a href="http://jena.sf.net" rel="nofollow noreferrer">Jena</a> Models (OntModels, specifically) synchronized across a socket, and I'd like to do this one change at a time (for various reasons -- one being that each Statement added or removed from the OntModels is also adapting a JESS rule... | [
{
"answer_id": 413296,
"author": "Simon Gibbs",
"author_id": 13935,
"author_profile": "https://Stackoverflow.com/users/13935",
"pm_score": 1,
"selected": false,
"text": "<p>Not an area I've looked at in great depth, but I recalled Talis were doing some research and was able to <a href=\"... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3446/"
] | I need to keep a couple of [Jena](http://jena.sf.net) Models (OntModels, specifically) synchronized across a socket, and I'd like to do this one change at a time (for various reasons -- one being that each Statement added or removed from the OntModels is also adapting a JESS rule base.). I am able to listen to the add/... | I would serialize the changes out in N-TRIPLES format. Jena has built-in N-TRIPLES serializer and parser, but the N-TRIPLES syntax is (deliberately) very simple so it would be easy to generate manually in your code.
However, it might be even easier to keep a plain mem model around to hold the changes, have the event ... |
375,651 | <p>One of my favorite vim features is the ability to do</p>
<pre><code>set path=/my/project/root/**
</code></pre>
<p>and then use</p>
<pre><code>:find SomeClassFile.java
</code></pre>
<p>Only problem is, I've got some generated directories at that level that I cannot move and wish to exclude from such searches. I ... | [
{
"answer_id": 375699,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": true,
"text": "<p>I'm pretty sure you can't exclude things from a <code>\"**\"</code> search. Instead, you could specify all the subdi... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029/"
] | One of my favorite vim features is the ability to do
```
set path=/my/project/root/**
```
and then use
```
:find SomeClassFile.java
```
Only problem is, I've got some generated directories at that level that I cannot move and wish to exclude from such searches. I can't seem to figure out how to exclude those dirs... | I'm pretty sure you can't exclude things from a `"**"` search. Instead, you could specify all the subdirectories below that one that *don't* include generated code, like
```
set path=/my/project/root/src/**,/my/project/root/com/**,/my/project/root/foo/**
``` |
375,656 | <p>We have a (non-web app) Spring application that throws a NoSuchBeanDefinitionException when running tests on our CruiseControl continuous integration linux box. The test runs fine on Windows in Eclipse.</p>
<p>The exception is thrown on the getBean() method:</p>
<pre><code>ApplicationContext context = new ClassPat... | [
{
"answer_id": 375674,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 2,
"selected": false,
"text": "<p>Are you certain that there is a bean named \"myBean\" in the CONTEXT_FILE? Are you using more than one context file? Have ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18995/"
] | We have a (non-web app) Spring application that throws a NoSuchBeanDefinitionException when running tests on our CruiseControl continuous integration linux box. The test runs fine on Windows in Eclipse.
The exception is thrown on the getBean() method:
```
ApplicationContext context = new ClassPathXmlApplicationContex... | Solved. The instantiation of "myBean" in CONTEXT\_FILE occurred after another bean that depended on it. This really should not be an issue, but I suspect that the parser on the Linux box must be stricter. Anyway, changing the order of definitions made it work on both Windows and Linux. |
375,680 | <p>When I localize an asp.net page that is using bound controls (DetailsView, etc) that has TemplateFields bound using the <%# Bind() #> syntax, after the localization all of the bindings are removed and I have to go back in & rebind everything. I'm creating the localized resource file by switching to design vi... | [
{
"answer_id": 378978,
"author": "Reddog",
"author_id": 33969,
"author_profile": "https://Stackoverflow.com/users/33969",
"pm_score": 0,
"selected": false,
"text": "<p>Yes! I had this happen to me, but just on user controls as well. Is this a normal problem then? I don't know how to reso... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36297/"
] | When I localize an asp.net page that is using bound controls (DetailsView, etc) that has TemplateFields bound using the <%# Bind() #> syntax, after the localization all of the bindings are removed and I have to go back in & rebind everything. I'm creating the localized resource file by switching to design view, then To... | Just found this... <http://blog.smart-ms.ordina.nl/Generate+Local+Resource+Files.aspx>
Seems to do the trick without mangling your ASPX file at all... I've not run it over a master page / user control yet. |
375,764 | <p>I have an datetime object that I want to remove one hour to display the corect time in a different time zone. I am using datetime.addhours(-1) with the -1 being a config value. This works in most cases except when I set the time to 12:59 AM today it displays 11:59 AM today. When it should display 11:59 PM. Is it p... | [
{
"answer_id": 375777,
"author": "Yaakov Ellis",
"author_id": 51,
"author_profile": "https://Stackoverflow.com/users/51",
"pm_score": 2,
"selected": true,
"text": "<p>How about using the Subtract function:</p>\n\n<pre><code>DateTime.Now.Subtract(new TimeSpan(1, 0, 0));\n</code></pre>\n"
... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an datetime object that I want to remove one hour to display the corect time in a different time zone. I am using datetime.addhours(-1) with the -1 being a config value. This works in most cases except when I set the time to 12:59 AM today it displays 11:59 AM today. When it should display 11:59 PM. Is it possib... | How about using the Subtract function:
```
DateTime.Now.Subtract(new TimeSpan(1, 0, 0));
``` |
375,765 | <p>I have an application that uses DataTables to perform grouping, filtering and aggregation of data. I want to replace datatables with my own data structures so we don't have any unnecessary overhead that we get from using datatables. So my question is if Linq can be used to perform the grouping, filtering and aggreg... | [
{
"answer_id": 375795,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 0,
"selected": false,
"text": "<p>Why not use a local database like Sqlserver CE or firebird embedded? (or even ms access! :)). Store the data in the... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8219/"
] | I have an application that uses DataTables to perform grouping, filtering and aggregation of data. I want to replace datatables with my own data structures so we don't have any unnecessary overhead that we get from using datatables. So my question is if Linq can be used to perform the grouping, filtering and aggregatio... | Unless you go for simple classes (POCO etc), your own implementation is likely to have nearly as much overhead as `DataTable`. Personally, I'd look more at using tools like LINQ-to-SQL, Entity Framework, etc. Then you can use either LINQ-to-Objects against local data, or the provider-specific implementation for complex... |
375,784 | <p>I have an aspx page with 1 table containing 2 rows:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
html, body
{
... | [
{
"answer_id": 375844,
"author": "Skubs",
"author_id": 25609,
"author_profile": "https://Stackoverflow.com/users/25609",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use some kind of script to determine the total height of your page... something like this:</p>\n\n<pre><code>\nfun... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9266/"
] | I have an aspx page with 1 table containing 2 rows:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
html, body
{
height: 100%;
}
... | Try removing the 'Height' and 'Width' properties in your control, if you've defined the internal XAP's height and width correctly to scale (i.e. you've used "Auto"), then it should respect what DOM boundaries it's contained within on the page. |
375,820 | <p>I'm writing a GUI application in Python using wxPython and I want to display an image in a static control (<code>wx.StaticBitmap</code>).</p>
<p>I can use <a href="http://www.wxpython.org/docs/api/wx-module.html#ImageFromStream" rel="nofollow noreferrer"><code>wx.ImageFromStream</code></a> to load an image from a f... | [
{
"answer_id": 375836,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 0,
"selected": false,
"text": "<p>Since in Python you use Duck Typing you can write your own stream class and hand an instance of that class to ImageFromStre... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3853/"
] | I'm writing a GUI application in Python using wxPython and I want to display an image in a static control (`wx.StaticBitmap`).
I can use [`wx.ImageFromStream`](http://www.wxpython.org/docs/api/wx-module.html#ImageFromStream) to load an image from a file, and this works OK:
```
static_bitmap = wx.StaticBitmap(parent, ... | You should be able to use `StringIO` to wrap the buffer in a memory file object.
```
...
import StringIO
buf = open("test.jpg", "rb").read()
# buf = get_image_data()
sbuf = StringIO.StringIO(buf)
image = wx.ImageFromStream(sbuf)
...
```
`buf` can be replaced with any data string. |
375,841 | <p>I've been <a href="https://stackoverflow.com/questions/279557/how-do-i-keep-the-wpf-gridsplitter-from-changing-the-size-of-my-grid">struggling with the GridSplitter</a>. It seems to be incompatible with the WPF WebBrowser control.</p>
<p>If I resize my window and move the GridSplitter, then I can make my grid wide... | [
{
"answer_id": 375989,
"author": "Robert Macnee",
"author_id": 19273,
"author_profile": "https://Stackoverflow.com/users/19273",
"pm_score": 1,
"selected": false,
"text": "<p>I know you're probably sick of hearing this, but I can't reproduce your problem when I use the XAML above, slight... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I've been [struggling with the GridSplitter](https://stackoverflow.com/questions/279557/how-do-i-keep-the-wpf-gridsplitter-from-changing-the-size-of-my-grid). It seems to be incompatible with the WPF WebBrowser control.
If I resize my window and move the GridSplitter, then I can make my grid wider than my window and n... | I was able to reproduce this with a Border in a ScrollViewer (but not without a ScrollViewer), so my guess is that the scrolling messes it up somehow.
Setting a MaxWidth on the left column (a very large MaxWidth that should have no practical effect) seemed to fix it:
```
<Window xmlns="http://schemas.microsoft.com/wi... |
375,860 | <p>How can I obtain the .NET Framework directory path inside my C# application?</p>
<p>The folder that I refer is "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"</p>
| [
{
"answer_id": 375882,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 2,
"selected": false,
"text": "<p>You can grab it from the Windows Registry:</p>\n\n<pre><code>using System;\nusing Microsoft.Win32;\n</code><... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47196/"
] | How can I obtain the .NET Framework directory path inside my C# application?
The folder that I refer is "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" | The path to the installation directory of the CLR active for the current .NET application can be obtained by using the following method:
```
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
```
I would **strongly** advice against reading the registry directly. For example, when a .NET applicat... |
375,868 | <p>I haven't got a unique problem, but for the life of me I can't figure out what I'm doing wrong.</p>
<p>I have a page that has a series of sections. Part of the section is a little image. When the image is clicked, I want to show a custom control. Showing the control is trivial, set the z-index a bit higher to en... | [
{
"answer_id": 375947,
"author": "Jason Jackson",
"author_id": 13103,
"author_profile": "https://Stackoverflow.com/users/13103",
"pm_score": 0,
"selected": false,
"text": "<p>Here is how we do oppacity on our project:</p>\n\n<pre><code>.SomeStyle\n{\nfilter:alpha(opacity=10);\n-moz-opaci... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12968/"
] | I haven't got a unique problem, but for the life of me I can't figure out what I'm doing wrong.
I have a page that has a series of sections. Part of the section is a little image. When the image is clicked, I want to show a custom control. Showing the control is trivial, set the z-index a bit higher to ensure the cont... | [scunliffe](https://stackoverflow.com/users/6144/scunliffe) was the closest (answered in a comment I can't link to). The custom control is inside of a relatively positioned div (several down actually). the blanket was simply appended onto the end of the body. Therefore it was outside the relatively positioned div and s... |
375,887 | <p>I have an existing fairly large classic asp website, with virtual directories configured to centralize certain resources. My problem is for some reason I can't access any of my namespaces and classes. I tried adding a reference to another project where I have classes in a namespace "DAL" and even though intellisense... | [
{
"answer_id": 375908,
"author": "Chane",
"author_id": 43808,
"author_profile": "https://Stackoverflow.com/users/43808",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe make the website route folder a nested application in IIS?</p>\n"
},
{
"answer_id": 8185359,
"author": ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42987/"
] | I have an existing fairly large classic asp website, with virtual directories configured to centralize certain resources. My problem is for some reason I can't access any of my namespaces and classes. I tried adding a reference to another project where I have classes in a namespace "DAL" and even though intellisense se... | Using an NTFS Junction Point to achieve what sounds like the same goal has been working for me.
By way of an example, I have a web site with 20+ child IIS Applications that are largely identical (don't ask!), rather than duplicating the 'bin' folder in each of these (they would be identical) each child application has... |
375,895 | <p>An html template is compiled into the application as a resource. A <strong>fragment</strong> of the HTML template looks like:</p>
<pre><code><A href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR>
%CAPTIONTEXT%
</code></pre>
<p>i like it l... | [
{
"answer_id": 375969,
"author": "rasx",
"author_id": 22944,
"author_profile": "https://Stackoverflow.com/users/22944",
"pm_score": 4,
"selected": false,
"text": "<p>My reputation points in this game already being low gives me the freedom to tell you quite plainly that you, sir or madame... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | An html template is compiled into the application as a resource. A **fragment** of the HTML template looks like:
```
<A href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR>
%CAPTIONTEXT%
```
i like it like this because the larger resource HTML file contains styling... | What about this: Store XML as your fragment:
```
<fragment type="link_img_caption">
<link href="%PANELLINK%" />
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" />
<caption text="%CAPTIONTEXT%" />
</fragment>
```
Pull it out, replace the placeholders with the "real" strings (that you have carefully XML-escaped of ... |
375,913 | <p>How do I find areas of my code that run slowly in a C++ application running on Linux?</p>
| [
{
"answer_id": 375930,
"author": "Nazgob",
"author_id": 3579,
"author_profile": "https://Stackoverflow.com/users/3579",
"pm_score": 9,
"selected": false,
"text": "<p>I assume you're using GCC. The standard solution would be to profile with <a href=\"http://www.math.utah.edu/docs/info/gpr... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1473493/"
] | How do I find areas of my code that run slowly in a C++ application running on Linux? | If your goal is to use a profiler, use one of the suggested ones.
However, if you're in a hurry and you can manually interrupt your program under the debugger while it's being subjectively slow, there's a simple way to find performance problems.
Just halt it several times, and each time look at the call stack. If the... |
375,915 | <p>I'm playing around with some Linq-SQL stuff, doing something like this:</p>
<pre><code>var foo = from f in db.Foo where f.Bar > 5 select f;
</code></pre>
<p>which is all fine and dandy, and I know I can also do this:</p>
<pre><code>var foo = from f in db.Foo where f.Bar > 5 select new { f.Bar, f.Baz };
</co... | [
{
"answer_id": 375931,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 2,
"selected": false,
"text": "<p>Sure, although it's easier in the fluent syntax:</p>\n\n<pre><code>var query_foo = db.Foo.Where(f=>f.Bar > ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5480/"
] | I'm playing around with some Linq-SQL stuff, doing something like this:
```
var foo = from f in db.Foo where f.Bar > 5 select f;
```
which is all fine and dandy, and I know I can also do this:
```
var foo = from f in db.Foo where f.Bar > 5 select new { f.Bar, f.Baz };
```
What I want to know, is can I factor out ... | Sure, although it's easier in the fluent syntax:
```
var query_foo = db.Foo.Where(f=>f.Bar > 5);
// :
var foo =query_foo.Select(f=>SomeMethodThatReturnsEtc(f));
``` |
375,928 | <p>Does anyone have an example (code or a link) that will allow me to export a gridview template field to excel? Here is an example of what I mean. Assume I have the following GridView Declaration:</p>
<pre><code><asp:GridView Id="gvResults" runat="server">
<Columns>
<asp:TemplateField Hea... | [
{
"answer_id": 375931,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 2,
"selected": false,
"text": "<p>Sure, although it's easier in the fluent syntax:</p>\n\n<pre><code>var query_foo = db.Foo.Where(f=>f.Bar > ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | Does anyone have an example (code or a link) that will allow me to export a gridview template field to excel? Here is an example of what I mean. Assume I have the following GridView Declaration:
```
<asp:GridView Id="gvResults" runat="server">
<Columns>
<asp:TemplateField HeaderText="Contact Info">
... | Sure, although it's easier in the fluent syntax:
```
var query_foo = db.Foo.Where(f=>f.Bar > 5);
// :
var foo =query_foo.Select(f=>SomeMethodThatReturnsEtc(f));
``` |
375,940 | <p>I have an XML feed (which I don't control) and I am trying to figure out how to detect the volume of certain attribute values within the document.</p>
<p>I am also parsing the XML and separating attributes into Arrays (for other functionality) </p>
<p>Here is a sample of my XML</p>
<pre><code><items>
<it... | [
{
"answer_id": 375964,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "<p>If you have the values, you should be able to use LINQ's GroupBy...</p>\n\n<pre><code> XDocument doc = XDocu... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30408/"
] | I have an XML feed (which I don't control) and I am trying to figure out how to detect the volume of certain attribute values within the document.
I am also parsing the XML and separating attributes into Arrays (for other functionality)
Here is a sample of my XML
```
<items>
<item att1="ABC123" att2="uID" />
<item ... | If you have the values, you should be able to use LINQ's GroupBy...
```
XDocument doc = XDocument.Parse(xml);
var query = from item in doc.Descendants("item")
select new
{
att1 = (string)item.Attribute("att1"),
att2... |
375,956 | <p>I use <code>ftp_put / ftp_nb_put</code> to upload files from my PHP server to another machine. I am frequently (90% of the time) getting absurd error messages like:</p>
<pre><code>Warning: ftp_nb_put(): 2 matches total
Warning: ftp_nb_put(): Transfer complete
Warning: ftp_nb_continue(): Opening BINARY mode data co... | [
{
"answer_id": 380732,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 0,
"selected": false,
"text": "<p>This is not extremly helpful, but I also suggest that while you watch the php error log, open the ftp's in another window an... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47203/"
] | I use `ftp_put / ftp_nb_put` to upload files from my PHP server to another machine. I am frequently (90% of the time) getting absurd error messages like:
```
Warning: ftp_nb_put(): 2 matches total
Warning: ftp_nb_put(): Transfer complete
Warning: ftp_nb_continue(): Opening BINARY mode data connection
```
Now errors... | The messages where symptoms of some arcane networking problems the server had. PHP does not diagnose such problems correctly and outputs seemingly random snippets from the communication between servers.
Not actually a programming question, rather a "server fault" issue (or rather a "get a better webhoster" issue). |
375,968 | <p>I recently started working on a large complex application, and I've just been assigned a bug due to this error:</p>
<pre><code>ORA-04091: table SCMA.TBL1 is mutating, trigger/function may not see it
ORA-06512: at "SCMA.TRG_T1_TBL1_COL1", line 4
ORA-04088: error during execution of trigger 'SCMA.TRG_T1_TBL1_COL1'
</... | [
{
"answer_id": 376029,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 4,
"selected": true,
"text": "<p>I think I disagree with your description of what the trigger is trying to\ndo. It looks to me like it is meant to enfo... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3333/"
] | I recently started working on a large complex application, and I've just been assigned a bug due to this error:
```
ORA-04091: table SCMA.TBL1 is mutating, trigger/function may not see it
ORA-06512: at "SCMA.TRG_T1_TBL1_COL1", line 4
ORA-04088: error during execution of trigger 'SCMA.TRG_T1_TBL1_COL1'
```
The trigge... | I think I disagree with your description of what the trigger is trying to
do. It looks to me like it is meant to enforce this business rule: For a
given value of t1\_appnt\_event, only one row can have a non-NULL value of
t1\_prnt\_t1\_pk at a time. (It doesn't matter if they have the same value in the second column or... |
375,976 | <p>For some reason when I download a zip folder from my server's folder it is always corrupted. Here is the code: </p>
<pre><code> protected void gvFiles_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
{
string fileUrl = String.Empty;
if(e.CommandName.... | [
{
"answer_id": 376001,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know asp.net at all, but this is pretty commonly a result of doing the download in a text mode instead o... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3797/"
] | For some reason when I download a zip folder from my server's folder it is always corrupted. Here is the code:
```
protected void gvFiles_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
{
string fileUrl = String.Empty;
if(e.CommandName.Equals("Downlo... | I just tried the same code with the .docx file and same result (The file is corrupted): Here is the code:
```
if(e.CommandName.Equals("DownloadFile"))
{
fileUrl = e.CommandArgument as String;
string fileName = Path.GetFileName(fileUrl);
FileInfo info = new ... |
375,977 | <p>What would be the best way to call a method in the code-behind of parent page from the code behind of the child page in the ASP.NET 2.0 Web Site model?</p>
<p><b>Scenario:</b> User clicks a link in the parent page to view a data record's detail in child page (The parent and child are tow seperate pages). The user ... | [
{
"answer_id": 375994,
"author": "Matt Briggs",
"author_id": 10771,
"author_profile": "https://Stackoverflow.com/users/10771",
"pm_score": 1,
"selected": false,
"text": "<p>Easiest way would be to do the whole thing on one page using a multiview or some such thing.</p>\n\n<p>Other then t... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] | What would be the best way to call a method in the code-behind of parent page from the code behind of the child page in the ASP.NET 2.0 Web Site model?
**Scenario:** User clicks a link in the parent page to view a data record's detail in child page (The parent and child are tow seperate pages). The user will modified ... | Easiest way would be to do the whole thing on one page using a multiview or some such thing.
Other then that, with javascript you can call
```
document.opener.location.href = "url";
```
to change the url on the parent page. You could just keep it the same, or stick stuff in the query string and muck with those va... |
376,003 | <p>I have a problem related to the <a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="noreferrer">subset sum problem</a> and am wondering if the differences make it easier, i.e. solvable in a reasonable amount of time.</p>
<p>Given a value V, a set size L, and a sequence of numbers [1,N] S, how many size L... | [
{
"answer_id": 376023,
"author": "Vilx-",
"author_id": 41360,
"author_profile": "https://Stackoverflow.com/users/41360",
"pm_score": 1,
"selected": false,
"text": "<p>One optimization that comes to mind is this: Order your sequence (if it alerady isn't so). Pick the first L-1 items from ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23903/"
] | I have a problem related to the [subset sum problem](http://en.wikipedia.org/wiki/Subset_sum_problem) and am wondering if the differences make it easier, i.e. solvable in a reasonable amount of time.
Given a value V, a set size L, and a sequence of numbers [1,N] S, how many size L subsets of S sum to less than V?
Thi... | (The decision version of) your problem is still NP-complete. The idea is that if we could solve your problem, then (for each subset size, say) we could ask how many sets sum to less than V and how many sum to less than V-1, and the difference of those two numbers would tell us whether are subsets that sum to exactly V ... |
376,019 | <p>I would like information on algorithms that can help identify commonality and differences between sets of overlapping data. </p>
<p>Using stackoverflow's tag system as an example:</p>
<p>Let's say this question has been given 5 tags. Let's say there are 1000 other questions that have at least one of these tags. ... | [
{
"answer_id": 376041,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": false,
"text": "<p>Look into Wager-Hamming distance. This is the Hamming distance defined on strings as the number of edit operati... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47207/"
] | I would like information on algorithms that can help identify commonality and differences between sets of overlapping data.
Using stackoverflow's tag system as an example:
Let's say this question has been given 5 tags. Let's say there are 1000 other questions that have at least one of these tags. Of these 1000 quest... | I don't know of any specific algorithms or data structures, but I could suggest a basic way of handling this:
Assumption: each entry has five unique tags.
* Collect all entries containing any one of the five tags (no duplicates).
* For each entry in the list, use an associative array (hashtable) for each tag, increme... |
376,021 | <p>Consider this sample code:</p>
<pre><code><div class="containter" id="ControlGroupDiv">
<input onbeforeupdate="alert('bingo 0'); return false;" onclick="alert('click 0');return false;" id="Radio1" type="radio" value="0" name="test" checked="checked" />
<input onbeforeupdate="alert('bingo 1'); r... | [
{
"answer_id": 376096,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<p>Yup, that's a strange bug. I did manage to cook up a workaround. I use a bit of Prototype to handle ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14894/"
] | Consider this sample code:
```
<div class="containter" id="ControlGroupDiv">
<input onbeforeupdate="alert('bingo 0'); return false;" onclick="alert('click 0');return false;" id="Radio1" type="radio" value="0" name="test" checked="checked" />
<input onbeforeupdate="alert('bingo 1'); return false;" onclick="alert(... | None of these approaches worked - we wound up using the checkbox jQuery plug-in that replaces the checkboxes and radio buttons with shiftable images. That means that we can control the view of the disabled controls.
PITA but it works. |
376,068 | <p>If I wrap a SQLConnection in a Using, should I close it or does the end using handle it?</p>
<pre><code>using cn as new system.data.sqlclient.sqlconnection()
cn.open
'{do a bunch of other stuff with commands and datareaders here}
cn.close 'Do I need this?
end using
</code></pre>
| [
{
"answer_id": 376070,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 8,
"selected": true,
"text": "<p>Exiting a using block calls .Dispose() on the object in question (<code>cn</code> in your example) which for a SqlConnectio... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1616/"
] | If I wrap a SQLConnection in a Using, should I close it or does the end using handle it?
```
using cn as new system.data.sqlclient.sqlconnection()
cn.open
'{do a bunch of other stuff with commands and datareaders here}
cn.close 'Do I need this?
end using
``` | Exiting a using block calls .Dispose() on the object in question (`cn` in your example) which for a SqlConnection will close the connection and any open resources. |
376,071 | <p>My windows service is creating a directory on a shared folder, and I am getting a error:</p>
<pre><code>at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path,DirectorySecurity dirSecurity)
at System.IO.Directory.CreateDirec... | [
{
"answer_id": 376077,
"author": "FerranB",
"author_id": 40441,
"author_profile": "https://Stackoverflow.com/users/40441",
"pm_score": 0,
"selected": false,
"text": "<p>For security in shared folders on .net you need to configure the .net security with <a href=\"http://msdn.microsoft.com... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | My windows service is creating a directory on a shared folder, and I am getting a error:
```
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path,DirectorySecurity dirSecurity)
at System.IO.Directory.CreateDirectory(String pa... | This could be a couple of things depending upon the platform your server runs. As a complete (and assuming a windows based server) guess cross check both the share AND the folder have write permissions given to the appropriate user account.
Just providing permissions on the share only may not work.
Hope that helps! |
376,081 | <p>I am trying to work out how to get the value of table cell for each row using jQuery.</p>
<p>My table looks like this:</p>
<pre><code><table id="mytable">
<tr>
<th>Customer Id</th>
<th>Result</th>
</tr>
<tr>
<td>123</td>
<td>&l... | [
{
"answer_id": 376091,
"author": "Strelok",
"author_id": 2788,
"author_profile": "https://Stackoverflow.com/users/2788",
"pm_score": 3,
"selected": false,
"text": "<pre><code>$('#mytable tr').each(function() {\n // need this to skip the first row\n if ($(this).find(\"td:first\").length... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47212/"
] | I am trying to work out how to get the value of table cell for each row using jQuery.
My table looks like this:
```
<table id="mytable">
<tr>
<th>Customer Id</th>
<th>Result</th>
</tr>
<tr>
<td>123</td>
<td></td>
</tr>
<tr>
<td>456</td>
<td></td>
</tr>
<tr>
<td>789</td>
<... | If you can, it might be worth using a class attribute on the TD containing the customer ID so you can write:
```
$('#mytable tr').each(function() {
var customerId = $(this).find(".customerIDCell").html();
});
```
Essentially this is the same as the other solutions (possibly because I copy-pasted), but has t... |
376,093 | <pre><code>@Column(name="DateOfBirth")
private Date dateOfBirth;
</code></pre>
<p>I specifically need the above code to create a column named "DateOfBirth," instead Hibernate gives me a column named date_of_birth. How can I change this? Is there a web.xml property? I came across DefaultNamingStrategy and ImprovedNa... | [
{
"answer_id": 376102,
"author": "davetron5000",
"author_id": 3029,
"author_profile": "https://Stackoverflow.com/users/3029",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not 100% sure, but don't you need to annotate the get method and not the private variable?</p>\n"
},
{
"... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31172/"
] | ```
@Column(name="DateOfBirth")
private Date dateOfBirth;
```
I specifically need the above code to create a column named "DateOfBirth," instead Hibernate gives me a column named date\_of\_birth. How can I change this? Is there a web.xml property? I came across DefaultNamingStrategy and ImprovedNamingStrategy, but no... | Here is a possible workaround: if you name it `dateofbirth` the column in the DB would be named like that, but the attribute name should be the same.
Hibernate takes the camel case format to create/read database columns.
I've had this problem before. I worked with a legacy columns where there was no space in the colu... |
376,101 | <p>I did see the question about setting the proxy for the JVM but what I want to ask is how one can utilize the proxy that is already configured (on Windows).</p>
<p>Here is a demonstration of my issue: </p>
<blockquote>
<blockquote>
<ol>
<li>Go to your Control Panel->Java and set a proxy address. </li>
... | [
{
"answer_id": 381698,
"author": "t3rse",
"author_id": 64,
"author_profile": "https://Stackoverflow.com/users/64",
"pm_score": 6,
"selected": true,
"text": "<p>It is possible to detect the proxy using the <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/net/ProxySelector.html\" rel... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64/"
] | I did see the question about setting the proxy for the JVM but what I want to ask is how one can utilize the proxy that is already configured (on Windows).
Here is a demonstration of my issue:
>
>
> >
> > 1. Go to your Control Panel->Java and set a proxy address.
> > 2. Run the following simple applet code (I'm u... | It is possible to detect the proxy using the [ProxySelector](http://java.sun.com/j2se/1.5.0/docs/api/java/net/ProxySelector.html) class and assign the system proxy by assigning environment variables with the [setProperty method of the System class](http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#setProper... |
376,104 | <p>I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn't cover it up with the following code:</p>
<pre><code>[dialog setDelegate:self];
[dialog setTitle:@"Enter Name"];
[dialog addButtonWithTitle:@"Cancel"];
[dialog addButtonWithTitle:@"OK"];
UITextField * nameField = [[UITextField alloc] ... | [
{
"answer_id": 376546,
"author": "user21293",
"author_id": 21293,
"author_profile": "https://Stackoverflow.com/users/21293",
"pm_score": 6,
"selected": true,
"text": "<p>For those who may care, here's a working solution:</p>\n\n<pre><code>UIAlertView* dialog = [[UIAlertView alloc] init];... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21293/"
] | I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn't cover it up with the following code:
```
[dialog setDelegate:self];
[dialog setTitle:@"Enter Name"];
[dialog addButtonWithTitle:@"Cancel"];
[dialog addButtonWithTitle:@"OK"];
UITextField * nameField = [[UITextField alloc] initWithFrame:... | For those who may care, here's a working solution:
```
UIAlertView* dialog = [[UIAlertView alloc] init];
[dialog setDelegate:self];
[dialog setTitle:@"Enter Name"];
[dialog setMessage:@" "];
[dialog addButtonWithTitle:@"Cancel"];
[dialog addButtonWithTitle:@"OK"];
nameField = [[UITextField alloc] initWithFrame:CGRect... |
376,105 | <p>I'm attempting to use Assembly.GetType("MyCompany.Class1.Class2") to dynamically get a type from a string.</p>
<pre><code>Assembly.GetType("MyCompany.Class1");
</code></pre>
<p>works as expected.</p>
<p>If I embed a class within another class such as:</p>
<pre><code>namespace MyCompany
{
public class Class1
... | [
{
"answer_id": 376113,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 5,
"selected": true,
"text": "<p>You need the Plus sign to get Nested Classes to be mapped using Assembly.GeType.</p>\n\n<pre><code> Assembly.... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2723/"
] | I'm attempting to use Assembly.GetType("MyCompany.Class1.Class2") to dynamically get a type from a string.
```
Assembly.GetType("MyCompany.Class1");
```
works as expected.
If I embed a class within another class such as:
```
namespace MyCompany
{
public class Class1
{
//.....
public class Class2
... | You need the Plus sign to get Nested Classes to be mapped using Assembly.GeType.
```
Assembly.GetType("MyCompany.Class1+Class2");
``` |
376,111 | <p>I would like to set some vim options in one file in the comments section.</p>
<p>For example, I would like to set this option in one file</p>
<pre><code>set syntax=python
</code></pre>
<p>The file does not have a .py extension and I am not interested in making my vim installation recognise all files with this ext... | [
{
"answer_id": 376200,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 7,
"selected": true,
"text": "<p>You're wanting a <a href=\"http://vim.wikia.com/wiki/Modeline_magic\" rel=\"noreferrer\">modeline</a> syntax, e.g.... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045/"
] | I would like to set some vim options in one file in the comments section.
For example, I would like to set this option in one file
```
set syntax=python
```
The file does not have a .py extension and I am not interested in making my vim installation recognise all files with this extension as python files.
I know t... | You're wanting a [modeline](http://vim.wikia.com/wiki/Modeline_magic) syntax, e.g.
```
# vim: set syntax=python:
```
See: [Modeline magic](http://vim.wikia.com/wiki/Modeline_magic) at Vim Wikia for more details. |
376,128 | <p>I have a dotnet windows service that's currently hung, but running. Is there anyway to attach a debugger to it, despite the lack of symbols; and that it's already running?</p>
| [
{
"answer_id": 376146,
"author": "Tim",
"author_id": 10755,
"author_profile": "https://Stackoverflow.com/users/10755",
"pm_score": 2,
"selected": false,
"text": "<p>From MS dev IDE\nDebug -> Processes -> Attach (After you choose a process.) You might have to click the \"show system proc... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7756/"
] | I have a dotnet windows service that's currently hung, but running. Is there anyway to attach a debugger to it, despite the lack of symbols; and that it's already running? | Ignore the "no symbols" warning. Once you have a native debugger attached (i prefer WinDbg for stuff like this), then load up the SoS tool pack:
```
.loadby sos mscorwks
```
Now you can get a managed callstack using the `!clrstack` command, and hope that gives you enough information to figure out the hang. Here's [a... |
376,130 | <p>I Have following code:</p>
<p>Controller:</p>
<pre><code>public ActionResult Step1()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1(FormCollection form)
{
TempData["messageStatus"] = new Random().Next(1, 1000);
return RedirectToAction("Step1");
}
</code></pre>
... | [
{
"answer_id": 376137,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 1,
"selected": false,
"text": "<p>Don't new up a new Random object every time. Use the same one. Remember, the .Net Random is only a Pseudo random number g... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2246271/"
] | I Have following code:
Controller:
```
public ActionResult Step1()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1(FormCollection form)
{
TempData["messageStatus"] = new Random().Next(1, 1000);
return RedirectToAction("Step1");
}
```
View:
```
<%=TempData["messag... | I'm guessing you're running into caching problems. It's not a problem with redirect to action. All RedirectToAction does is issues a redirect response to your browser telling it to request Step01. Then your browser makes a request for Step01.
In that case, your browser might have Step01 cached. So you need to add a Re... |
376,135 | <p>I've got a C# program with values in a config file. What I want is to store ampersands for an url value like...</p>
<pre><code><appSettings>
<add key="myurl" value="http://www.myurl.com?&cid=&sid="/>
</appSettings>
</code></pre>
<p>But I get errors building my site. The ampersand is n... | [
{
"answer_id": 376140,
"author": "Eric Rosenberger",
"author_id": 41624,
"author_profile": "https://Stackoverflow.com/users/41624",
"pm_score": 10,
"selected": true,
"text": "<p>Use \"<code>&amp;</code>\" instead of \"&\".</p>\n"
},
{
"answer_id": 376150,
"author": "I... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7285/"
] | I've got a C# program with values in a config file. What I want is to store ampersands for an url value like...
```
<appSettings>
<add key="myurl" value="http://www.myurl.com?&cid=&sid="/>
</appSettings>
```
But I get errors building my site. The ampersand is not allowed. I've tried various forms of escaping the a... | Use "`&`" instead of "&". |
376,136 | <p>I have a Windows C++ program that is doing something like:<br></p>
<pre>
FILE* pf = ...;
*stdout = *pf; // stdout is defined in stdio.h
</pre>
<p>I'm looking for an explanation about what happens when you change the value of the stdout file handle. Is this just a way of redirecting stdout?</p>
<p>-cr</p>
| [
{
"answer_id": 376151,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, when you change stdout, you're effectively redirecting it elsewhere. However, you should <strong>not</stron... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47154/"
] | I have a Windows C++ program that is doing something like:
```
FILE* pf = ...;
*stdout = *pf; // stdout is defined in stdio.h
```
I'm looking for an explanation about what happens when you change the value of the stdout file handle. Is this just a way of redirecting stdout?
-cr | If you change `stdout` by assignment instead of by using the tool designated (in C, `freopen()` as Adam Rosenfield said - and by extension, in C++), then you leave yourself open to all sorts of liabilities.
* It is not clear that `cout` will also be redirected.
* You will likely leak a file descriptor (which may not m... |
376,142 | <p>Is it possible to get a list of events (with recurring events expanded) out of Sharepoint's Calendar using the Web Service exposed through Lists.aspx?</p>
<p>This is evidently possible if you are using C# or VB, as described <a href="http://blogs.msdn.com/sharepoint/archive/2007/05/14/understanding-the-sharepoint-c... | [
{
"answer_id": 523400,
"author": "Tommy Hui",
"author_id": 60927,
"author_profile": "https://Stackoverflow.com/users/60927",
"pm_score": 0,
"selected": false,
"text": "<p>The way I would track down this problem would be to use something like TcpTrace (<a href=\"http://www.pocketsoap.com\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23977/"
] | Is it possible to get a list of events (with recurring events expanded) out of Sharepoint's Calendar using the Web Service exposed through Lists.aspx?
This is evidently possible if you are using C# or VB, as described [here](http://blogs.msdn.com/sharepoint/archive/2007/05/14/understanding-the-sharepoint-calendar-and-... | Nope is not possible. You would need to use the SP Object model via, for example the SPQuery object. But that would mean that you would have to run that code directly on the sharepoint server, instead of calling in from a client.
Please see this post of mine; <http://social.msdn.microsoft.com/Forums/en-US/sharepointde... |
376,144 | <p>I'm writing some routes for a REST service. One of my resource's URI looks like this</p>
<p>resources/user/:id</p>
<p>I also want to give access to individual attributes of a user, which would look like this</p>
<p>resources/user/:id/:attribute</p>
<p>But when I try to define that latter route, it doesn't work.... | [
{
"answer_id": 523400,
"author": "Tommy Hui",
"author_id": 60927,
"author_profile": "https://Stackoverflow.com/users/60927",
"pm_score": 0,
"selected": false,
"text": "<p>The way I would track down this problem would be to use something like TcpTrace (<a href=\"http://www.pocketsoap.com\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8815/"
] | I'm writing some routes for a REST service. One of my resource's URI looks like this
resources/user/:id
I also want to give access to individual attributes of a user, which would look like this
resources/user/:id/:attribute
But when I try to define that latter route, it doesn't work. Here's my ini where the routes ... | Nope is not possible. You would need to use the SP Object model via, for example the SPQuery object. But that would mean that you would have to run that code directly on the sharepoint server, instead of calling in from a client.
Please see this post of mine; <http://social.msdn.microsoft.com/Forums/en-US/sharepointde... |
376,154 | <p>This is a follow-up to my <a href="https://stackoverflow.com/questions/372695/is-there-a-standard-c-function-object-for-taking-apart-a-stdpair">question from yesterday</a>. I have Scott Meyers' warning about write-only code on my mind. I like the idea in principle of using standard algorithms to access the keys or... | [
{
"answer_id": 376177,
"author": "Nemanja Trifunovic",
"author_id": 8899,
"author_profile": "https://Stackoverflow.com/users/8899",
"pm_score": 2,
"selected": false,
"text": "<p>I say go for 2)</p>\n\n<p>To improve performance, you could get <code>m.end()</code> out of the loop and reser... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46821/"
] | This is a follow-up to my [question from yesterday](https://stackoverflow.com/questions/372695/is-there-a-standard-c-function-object-for-taking-apart-a-stdpair). I have Scott Meyers' warning about write-only code on my mind. I like the idea in principle of using standard algorithms to access the keys or values of a std... | Clarity always beats clever. Do what you can read later.
You're not alone in thinking that the standard code is a little obtuse. The next C++ standard will introduce [lambda functions](http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions) so you can write more legible code with the standard algorith... |
376,156 | <p>I don't really get it and it's driving me nuts.
i've these 4 lines:</p>
<pre><code>Image img = Image.FromFile("F:\\Pulpit\\soa.bmp");
MemoryStream imageStream = new MemoryStream();
img.Save(imageStream, ImageFormat.Bmp);
byte[] contentBuffer = new byte[imageStream.Length];
imageStream.Read(contentBuffer, 0, content... | [
{
"answer_id": 376171,
"author": "Joel Lucsy",
"author_id": 645,
"author_profile": "https://Stackoverflow.com/users/645",
"pm_score": 5,
"selected": false,
"text": "<p>You need to reset the file pointer. </p>\n\n<pre><code>imageStream.Seek( 0, SeekOrigin.Begin );\n</code></pre>\n\n<p>Oth... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40872/"
] | I don't really get it and it's driving me nuts.
i've these 4 lines:
```
Image img = Image.FromFile("F:\\Pulpit\\soa.bmp");
MemoryStream imageStream = new MemoryStream();
img.Save(imageStream, ImageFormat.Bmp);
byte[] contentBuffer = new byte[imageStream.Length];
imageStream.Read(contentBuffer, 0, contentBuffer.Length)... | Try setting imageStream.Position to 0. When you write to the MemoryStream it moves the Position after the bytes you just wrote so if you try to read there's nothing there. |
376,174 | <p>I am having an issue with linq updating in linqtosql</p>
<p>from the code below</p>
<pre><code>Dim lqPatientTable As New lqHospitalDataContext
Dim strPatientId As String
strPatientId = Me.ucboPatientInfo.SelectedRow.Cells(5).Value
Dim lqPatientName = (From lqp In lqPatientTable.Patients _
... | [
{
"answer_id": 376198,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 1,
"selected": false,
"text": "<p>You assign to row.LastName in the first line of the \"For Each\" loop. </p>\n\n<p>Are you copmiling with option stric... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5578/"
] | I am having an issue with linq updating in linqtosql
from the code below
```
Dim lqPatientTable As New lqHospitalDataContext
Dim strPatientId As String
strPatientId = Me.ucboPatientInfo.SelectedRow.Cells(5).Value
Dim lqPatientName = (From lqp In lqPatientTable.Patients _
Wher... | When you select just individual fields you are creating an anonymous type on the fly that is no longer part of the ORM's change tracking/update mechanism.
You will need to change the select part to be "Select lqp" for this to work. |
376,188 | <p>I have a class that extends Zend_Form like this (simplified):</p>
<pre><code>class Core_Form extends Zend_Form
{
protected static $_elementDecorators = array(
'ViewHelper',
'Errors',
array('Label'),
array('HtmlTag', array('tag' => 'li')),
);
public function loadDefa... | [
{
"answer_id": 376487,
"author": "Barrett Conrad",
"author_id": 1227,
"author_profile": "https://Stackoverflow.com/users/1227",
"pm_score": 2,
"selected": false,
"text": "<p>Reset the decorators for the form element to only use 'ViewHelper'. For example:</p>\n\n<pre><code><?php echo ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765/"
] | I have a class that extends Zend\_Form like this (simplified):
```
class Core_Form extends Zend_Form
{
protected static $_elementDecorators = array(
'ViewHelper',
'Errors',
array('Label'),
array('HtmlTag', array('tag' => 'li')),
);
public function loadDefaultDecorators()
... | the best place to set it is public function loadDefaultDecorators()
for example like this:
```
class ExampleForm extends Core_Form
{
public function init()
{
//Example Field
$example = new Zend_Form_Element_Hidden('example');
$this->addElement($example);
... |
376,201 | <p>Normally to attach a debuger to a running jvm you would need start the jvm with arguments such as the following:</p>
<pre><code>> java -Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n
</code></pre>
<p>Now if I want to debug a process that wasn't started in debug mode, what can I do?</p>
<p... | [
{
"answer_id": 376276,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 7,
"selected": true,
"text": "<p>You may be able to use <a href=\"http://docs.oracle.com/javase/7/docs/technotes/tools/share/jsadebugd.html\" rel=\"noreferr... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42303/"
] | Normally to attach a debuger to a running jvm you would need start the jvm with arguments such as the following:
```
> java -Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n
```
Now if I want to debug a process that wasn't started in debug mode, what can I do?
This situation arrises when a produ... | You may be able to use [jsadebugd](http://docs.oracle.com/javase/7/docs/technotes/tools/share/jsadebugd.html) ([JDK](http://docs.oracle.com/javase/7/docs/technotes/tools/)) to attach a debug server to the process (available on Windows with the [Debugging Tools for Windows](http://msdn.microsoft.com/en-US/windows/hardwa... |
376,208 | <p>I'm trying to connect to a remote private MSMQ queue using the path:</p>
<pre><code>"FormatName:DIRECT=OS:remoteMachineName\Private$\MyQueue"
</code></pre>
<p>and I'm getting the following error: </p>
<pre><code>"The specified format name does not support the requested operation. For example, a direct queue forma... | [
{
"answer_id": 376257,
"author": "Igal Serban",
"author_id": 25737,
"author_profile": "https://Stackoverflow.com/users/25737",
"pm_score": 3,
"selected": false,
"text": "<p>Is this a transactional queue? Remote read from transactional queue is not possible. Maybe the spring framework try... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2311/"
] | I'm trying to connect to a remote private MSMQ queue using the path:
```
"FormatName:DIRECT=OS:remoteMachineName\Private$\MyQueue"
```
and I'm getting the following error:
```
"The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted."
```
I'm ... | Is this a transactional queue? Remote read from transactional queue is not possible. Maybe the spring framework try to check if this a transactional queue, and this is also an operation that is supported only on local queue.
The recommanded why to work with queues is to write to remote queue and read from local queue.... |
376,232 | <p>I'm using C++ .NET 2.0</p>
<p>I have 2 forms</p>
<p>the first one is declared as follow</p>
<pre><code>#include "stdafx.h"
namespace myNamespace{
public ref class frmMain : public System::Windows::Forms::Form {
/*... snip ...*/
public void addNewRow(String^ text){ /*... snip... */ }
... | [
{
"answer_id": 376287,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 3,
"selected": true,
"text": "<p>This is because <i>both</i> of these header files include \"stdafx.h\", and stdafx.h includes \"SubForm.h\" <i>before</i... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6367/"
] | I'm using C++ .NET 2.0
I have 2 forms
the first one is declared as follow
```
#include "stdafx.h"
namespace myNamespace{
public ref class frmMain : public System::Windows::Forms::Form {
/*... snip ...*/
public void addNewRow(String^ text){ /*... snip... */ }
public void launchSubForm() ... | This is because *both* of these header files include "stdafx.h", and stdafx.h includes "SubForm.h" *before* "frmMain.h".
So, in "SubForm.h", the compiler wants to define SubForm before frmMain has been defined, leading to the error.
The proper way to solve this problem is to keep all of the code for your classes in t... |
376,234 | <p>System.Drawing.Color objects apparently won't serialize with XmlSerializer. What is the best way to xml serialize colors?</p>
| [
{
"answer_id": 376254,
"author": "BenAlabaster",
"author_id": 40650,
"author_profile": "https://Stackoverflow.com/users/40650",
"pm_score": 6,
"selected": true,
"text": "<p>The simplest method uses this at it's heart:</p>\n\n<pre><code>String HtmlColor = System.Drawing.ColorTranslator.To... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28343/"
] | System.Drawing.Color objects apparently won't serialize with XmlSerializer. What is the best way to xml serialize colors? | The simplest method uses this at it's heart:
```
String HtmlColor = System.Drawing.ColorTranslator.ToHtml(MyColorInstance);
```
It will just convert whatever the color is to the standard hex string used by HTML which is just as easily deserialized using:
```
Color MyColor = System.Drawing.ColorTranslator.FromHtml(M... |
376,236 | <p>I have a basically sql select question that people gave me different answers over the years. Say I have a couple of tables designed each with over 40 columns and potentially will hold ten and thousands of row, I'm using SqlServer2005.</p>
<p>On joining these tables, in the where clause if I have things like</p>
<... | [
{
"answer_id": 376326,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 2,
"selected": false,
"text": "<p>In general, with database optimization, you should write SQL which is conceptually correct first, and then tweak per... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32240/"
] | I have a basically sql select question that people gave me different answers over the years. Say I have a couple of tables designed each with over 40 columns and potentially will hold ten and thousands of row, I'm using SqlServer2005.
On joining these tables, in the where clause if I have things like
```
select * fro... | In general, with database optimization, you should write SQL which is conceptually correct first, and then tweak performance if profiling shows it to be necessary. When doing an inner join, it is better to use SQL-92, explicit INNER JOINs than Cartesian products. So I would begin by writing your SQL as follows:
```
SE... |
376,237 | <p>We have an HTML page which displays a bunch of pretty bars using divs and repeating backgrounds. We are in the process of making a report out of this that can be printed nicely, but this may take some time because we don't have a reporting framework in place. As an interm solution we'd like to make the HTML version ... | [
{
"answer_id": 376326,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 2,
"selected": false,
"text": "<p>In general, with database optimization, you should write SQL which is conceptually correct first, and then tweak per... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45/"
] | We have an HTML page which displays a bunch of pretty bars using divs and repeating backgrounds. We are in the process of making a report out of this that can be printed nicely, but this may take some time because we don't have a reporting framework in place. As an interm solution we'd like to make the HTML version pri... | In general, with database optimization, you should write SQL which is conceptually correct first, and then tweak performance if profiling shows it to be necessary. When doing an inner join, it is better to use SQL-92, explicit INNER JOINs than Cartesian products. So I would begin by writing your SQL as follows:
```
SE... |
376,239 | <p>I have an aspx page with a gridview. In my page load event, I load a datatable with all the data like so:</p>
<pre><code>HistoricalPricing historicalPricing = new HistoricalPricing();
DataTable dtHistoricalPricing = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPo... | [
{
"answer_id": 376267,
"author": "Xaisoft",
"author_id": 33690,
"author_profile": "https://Stackoverflow.com/users/33690",
"pm_score": 1,
"selected": false,
"text": "<p>I think I figured it out, is it because when I click on the ListBox, it does a postback and I am only loading the data ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | I have an aspx page with a gridview. In my page load event, I load a datatable with all the data like so:
```
HistoricalPricing historicalPricing = new HistoricalPricing();
DataTable dtHistoricalPricing = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
... | Every time you do a postback you're dealing with a new instance of your page class. That means a new datatable object as well.
If you *really* want to persist it between postbacks (and make sure you consider the memory implications for that when you may have 1000 people hitting this web server at the same time) then y... |
376,242 | <p>What approach is the best way to make content-types restricted to a user in Django?</p>
<p>Let us say I want all users with the user-role "blogger" to have its own blog.</p>
<p>I have created a weblog app. How do I restrict it so that the user logged in can only post in his "own" blog, and how do I make views that... | [
{
"answer_id": 376739,
"author": "rombarcz",
"author_id": 47267,
"author_profile": "https://Stackoverflow.com/users/47267",
"pm_score": 3,
"selected": true,
"text": "<p>First your blog entries has to be attached to user, so you know on whos blog display, it, right? models.py:</p>\n\n<pre... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42546/"
] | What approach is the best way to make content-types restricted to a user in Django?
Let us say I want all users with the user-role "blogger" to have its own blog.
I have created a weblog app. How do I restrict it so that the user logged in can only post in his "own" blog, and how do I make views that shows only a use... | First your blog entries has to be attached to user, so you know on whos blog display, it, right? models.py:
```
class BlogEntry(models.Model):
user = models.ForeignKey(User, related_name='blog_entries')
other_field_1 = ...
other_field_2 = ...
```
Next, skip it in ModelForm, forms.py:
```
class BlogEntry... |
376,248 | <p>Simple question, and probably reflects my inexperience with CSS, but...</p>
<p>When creating a style sheet I like to explicitly specify the '*' wild card, so:</p>
<pre><code>*.TitleText {
</code></pre>
<p>instead of just</p>
<pre><code>.TitleText {
</code></pre>
<p>I find it reminds me that TitleText is applied... | [
{
"answer_id": 376262,
"author": "ahockley",
"author_id": 8209,
"author_profile": "https://Stackoverflow.com/users/8209",
"pm_score": 3,
"selected": false,
"text": "<p>I don't know whether it's good or bad, but I've been doing CSS work as part of web app development for several years and... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8946/"
] | Simple question, and probably reflects my inexperience with CSS, but...
When creating a style sheet I like to explicitly specify the '\*' wild card, so:
```
*.TitleText {
```
instead of just
```
.TitleText {
```
I find it reminds me that TitleText is applied to "any" tag, and can be overridden by a subsequent h1... | While both are equivalent in terms of the style outcome, there are a couple other factors to keep in mind.
Using `*` increases the file size
=================================
If you do not use a CSS minifier (gets rid of unneeded data such as extra whitespace) that removes unneeded asterisks, using `*` every time a t... |
376,253 | <p>Is there a way to get a background in CSS to stretch or scale to fill its container?</p>
| [
{
"answer_id": 376270,
"author": "Vilx-",
"author_id": 41360,
"author_profile": "https://Stackoverflow.com/users/41360",
"pm_score": 3,
"selected": false,
"text": "<p><s>In one word: no. The only way to stretch an image is with the <code><img></code> tag. You'll have to be creative... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8946/"
] | Is there a way to get a background in CSS to stretch or scale to fill its container? | For modern browsers, you can accomplish this by using [`background-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size):
```css
body {
background-image: url(bg.jpg);
background-size: cover;
}
```
`cover` means stretching the image either vertically or horizontally so it never tiles/repeat... |
376,278 | <p>Can it be assumed a evaluation order of the function parameters when calling it in C ? According to the following program, it seems that there is not a particular order when I executed it. </p>
<pre><code>#include <stdio.h>
int main()
{
int a[] = {1, 2, 3};
int * pa;
pa = &a[0];
printf("a[0... | [
{
"answer_id": 376288,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 7,
"selected": true,
"text": "<p>No, function parameters are not evaluated in a defined order in C.</p>\n\n<p>See Martin York's answers to <a href=\"h... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44808/"
] | Can it be assumed a evaluation order of the function parameters when calling it in C ? According to the following program, it seems that there is not a particular order when I executed it.
```
#include <stdio.h>
int main()
{
int a[] = {1, 2, 3};
int * pa;
pa = &a[0];
printf("a[0] = %d\ta[1] = %d\ta[2] ... | No, function parameters are not evaluated in a defined order in C.
See Martin York's answers to [What are all the common undefined behaviour that c++ programmer should know about?](https://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-c-programmer-should-know-about). |
376,279 | <p>I have a script that needs to run after tomcat has finished starting up and is ready to start deploying applications. I'm using <code>$TOMCAT_HOME/bin/startup.sh</code> which returns immediately. How can I wait until tomcat has finished starting up?</p>
| [
{
"answer_id": 376286,
"author": "Dustin",
"author_id": 39975,
"author_profile": "https://Stackoverflow.com/users/39975",
"pm_score": 1,
"selected": false,
"text": "<p>Depends on what you mean by finishing. What do you want to wait for?</p>\n\n<p>You could, for example, have a script th... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14481/"
] | I have a script that needs to run after tomcat has finished starting up and is ready to start deploying applications. I'm using `$TOMCAT_HOME/bin/startup.sh` which returns immediately. How can I wait until tomcat has finished starting up? | There are probably several ways to do this. The trick we use is:
```
#!/bin/bash
until [ "`curl --silent --show-error --connect-timeout 1 -I http://localhost:8080 | grep 'Coyote'`" != "" ];
do
echo --- sleeping for 10 seconds
sleep 10
done
echo Tomcat is ready!
```
Hope this helps! |
376,306 | <p>Is '' a valid piece of XML?
Can '' insert into oracle xblob column or XML column from MSSQL?</p>
| [
{
"answer_id": 376319,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>It's not valid xml. Valid xml requires an xml declaration with encoding type and a root node. Whether or not Orac... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11413/"
] | Is '' a valid piece of XML?
Can '' insert into oracle xblob column or XML column from MSSQL? | It's not valid xml, but it can be inserted into an XML column in SQL Server 2005. Obviously with SQL Server 2005, you need to trade up the double quote for single quotes:
```
Insert Into MyTestTable(MyXmlColumn) Values('');
```
That works just fine - I just tested it and the insert was successful.
But Oracle does n... |
376,335 | <p>I'm in the process of implementing a binary tree in C++. Traditionally, I'd have a pointer to left and a pointer to right, but manual memory management typically ends in tears. Which leads me to my question...</p>
<p>Are data structures an appropriate place to use shared_ptr?</p>
| [
{
"answer_id": 376350,
"author": "David Norman",
"author_id": 34502,
"author_profile": "https://Stackoverflow.com/users/34502",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, absolutely.</p>\n\n<p>But be careful if you have a circular data structure. If you have two objects, both wi... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1473493/"
] | I'm in the process of implementing a binary tree in C++. Traditionally, I'd have a pointer to left and a pointer to right, but manual memory management typically ends in tears. Which leads me to my question...
Are data structures an appropriate place to use shared\_ptr? | I think it depends on where you'd be using them. I'm assuming that what you're thinking of doing is something like this:
```
template <class T>
class BinaryTreeNode
{
//public interface ignored for this example
private:
shared_ptr<BinaryTreeNode<T> > left;
shared_ptr<BinaryTreeNode<T> > right;... |
376,344 | <p>I have a simple piece of code:</p>
<pre><code>public string GenerateRandomString()
{
string randomString = string.Empty;
Random r = new Random();
for (int i = 0; i < length; i++)
randomString += chars[r.Next(chars.Length)];
return randomStr... | [
{
"answer_id": 376348,
"author": "Paulius",
"author_id": 1353085,
"author_profile": "https://Stackoverflow.com/users/1353085",
"pm_score": 4,
"selected": true,
"text": "<p>This is happening, because the calls happen very close to each other (during the same milli-second), then the Random... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40872/"
] | I have a simple piece of code:
```
public string GenerateRandomString()
{
string randomString = string.Empty;
Random r = new Random();
for (int i = 0; i < length; i++)
randomString += chars[r.Next(chars.Length)];
return randomString;
}
`... | This is happening, because the calls happen very close to each other (during the same milli-second), then the Random constructor will seed the Random object with the same value (it uses date & time by default).
So, there are two solutions, actually.
**1. Provide your own seed value**, that would be unique each time y... |
376,346 | <p>Hi I'm doing the Collatz sequence problem in project Euler (problem 14). My code works with numbers below 100000 but with numbers bigger I get stack over-flow error. </p>
<p>Is there a way I can re-factor the code to use tail recursion, or prevent the stack overflow. The code is below:</p>
<pre><code>import java.u... | [
{
"answer_id": 376408,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 3,
"selected": false,
"text": "<p>Your problem is not with the size of the stack (you're already memoizing the values), but with </p>\n\n<ol>\n<li>the size o... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hi I'm doing the Collatz sequence problem in project Euler (problem 14). My code works with numbers below 100000 but with numbers bigger I get stack over-flow error.
Is there a way I can re-factor the code to use tail recursion, or prevent the stack overflow. The code is below:
```
import java.util.*;
public class ... | Your problem is not with the size of the stack (you're already memoizing the values), but with
1. the size of some of the numbers in the sequences, and
2. the upper limits of a 32-bit integer.
Hint:
```
public static int seqCount(int n)
{
if(hm.get(n) != null) {
return hm.get(n);
}
if (n < 1) {
... |
376,352 | <p>I have a feeling I'm being too "webforms" with this, but I'll ask anyway. I have a form in an ASP.NET MVC project that has some input fields and two buttons on it. One button is used to 'filter' one of the list boxes. The other is used to submit the form. My view looks something like this:</p>
<pre><code><%u... | [
{
"answer_id": 376382,
"author": "Odd",
"author_id": 11908,
"author_profile": "https://Stackoverflow.com/users/11908",
"pm_score": 1,
"selected": false,
"text": "<p>No need for a hidden field, you can set the form's action on the button's click event.</p>\n\n<p>The javascript (in jQuery)... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47225/"
] | I have a feeling I'm being too "webforms" with this, but I'll ask anyway. I have a form in an ASP.NET MVC project that has some input fields and two buttons on it. One button is used to 'filter' one of the list boxes. The other is used to submit the form. My view looks something like this:
```
<%using (Html.BeginForm(... | I would suggest multiple forms with 2 different actions. This I think is also more testable:
(c => c.Search(), FormMethod.Get);
{ %>
Find
(c => c.Send(), FormMethod.Post);
{ %>
Send
or something like that. Then in the controller you have 2 corresponding actions. This means the responsibility is broken out. With MV... |
376,361 | <p>I'm currently using winforms databinding to wire up a data editing form. I'm using the netTiers framework through CodeSmith to generate my data objects. For database fields that allow nulls it creates nullable types. I've found that using winforms databinding the controls won't bind properly to nullable types.</p... | [
{
"answer_id": 376726,
"author": "BenAlabaster",
"author_id": 40650,
"author_profile": "https://Stackoverflow.com/users/40650",
"pm_score": 2,
"selected": false,
"text": "<p>Ooh, nasty... I can only think of a couple of ways to achieve this and neither of them are what I would call ideal... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10221/"
] | I'm currently using winforms databinding to wire up a data editing form. I'm using the netTiers framework through CodeSmith to generate my data objects. For database fields that allow nulls it creates nullable types. I've found that using winforms databinding the controls won't bind properly to nullable types.
I've se... | In the comments section of the article referenced above one of the posters comes up with a simple solution.
Instead of binding with:
```
textBox1.DataBindings.Add("Text", myClass, "MyTextProperty");
```
Bind with:
```
textBox1.DataBindings.Add("Text", myClass, "MyTextProperty", true, DataSourceUpdateMode.OnProper... |
376,366 | <p>I want pass values between web user controls without writing any code to the main page which user controls are put on. I do something like that but after doing that I need to click double to pass the value.</p>
<p>The example of what I've done :</p>
<p><strong><em>Department User Control (Code-Behind)</em></stron... | [
{
"answer_id": 376393,
"author": "dtc",
"author_id": 32892,
"author_profile": "https://Stackoverflow.com/users/32892",
"pm_score": 2,
"selected": true,
"text": "<p>In your Department User Control you are trying to get the value of selectedProductId before it is set in the Product User Co... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44852/"
] | I want pass values between web user controls without writing any code to the main page which user controls are put on. I do something like that but after doing that I need to click double to pass the value.
The example of what I've done :
***Department User Control (Code-Behind)***
```
protected void Page_L... | In your Department User Control you are trying to get the value of selectedProductId before it is set in the Product User Control. That's why you don't get the value you expect until you postback twice.
You'll need to get it after the Product User Control sets it in the ItemCommand event. Perhaps placing the Departmen... |
376,369 | <p>Can I with ASP.NET Resources/Localization translate strings to depend on one or other (the English grammar) in a easy way, like I pass number 1 in my translate, it return "You have one car" or with 0, 2 and higher, "You have %n cars"?</p>
<p>Or I'm forced to have logic in my view to see if it's singular or plural?<... | [
{
"answer_id": 376449,
"author": "Troy Howard",
"author_id": 19258,
"author_profile": "https://Stackoverflow.com/users/19258",
"pm_score": 1,
"selected": false,
"text": "<p>AFAIK, there's nothing built-in to the framework to do it.. </p>\n\n<p>Here's an example of one generalized solutio... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can I with ASP.NET Resources/Localization translate strings to depend on one or other (the English grammar) in a easy way, like I pass number 1 in my translate, it return "You have one car" or with 0, 2 and higher, "You have %n cars"?
Or I'm forced to have logic in my view to see if it's singular or plural? | JasonTrue wrote:
>
> To the best of my knowledge, there isn't a language that requires something more complicated than singular/plural
>
>
>
Such languages do exist. In my native Polish, for example, there are three forms: for 1, for 2-4 and for zero and numbers greater than 4. Then after you reach 20, the forms ... |
376,373 | <p>I have a string that represents a non indented XML that I would like to pretty-print. For example:</p>
<pre><code><root><node/></root>
</code></pre>
<p>should become:</p>
<pre><code><root>
<node/>
</root>
</code></pre>
<p>Syntax highlighting is not a requirement. To tackle t... | [
{
"answer_id": 376438,
"author": "aprilchild",
"author_id": 25339,
"author_profile": "https://Stackoverflow.com/users/25339",
"pm_score": 2,
"selected": false,
"text": "<p>what about creating a stub node (document.createElement('div') - or using your library equivalent), filling it with ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29407/"
] | I have a string that represents a non indented XML that I would like to pretty-print. For example:
```
<root><node/></root>
```
should become:
```
<root>
<node/>
</root>
```
Syntax highlighting is not a requirement. To tackle the problem I first transform the XML to add carriage returns and white spaces and the... | From the text of the question **I get the impression that a string result is expected**, as opposed to an HTML-formatted result.
If this is so, **the simplest way to achieve this is to process the XML document with the [identity transformation](http://www.w3.org/TR/xslt#copying) and with an [`<xsl:output indent="yes"/... |
376,375 | <p>I am working on someone else's PHP code and seeing this pattern over and over:</p>
<p>(pseudocode)</p>
<pre><code>result = SELECT blah1, blah2, foreign_key FROM foo WHERE key=bar
if foreign_key > 0
other_result = SELECT something FROM foo2 WHERE key=foreign_key
end
</code></pre>
<p>The code needs to bra... | [
{
"answer_id": 376388,
"author": "hamishmcn",
"author_id": 3590,
"author_profile": "https://Stackoverflow.com/users/3590",
"pm_score": 2,
"selected": false,
"text": "<p>I'm with you - a single SQL would be better</p>\n"
},
{
"answer_id": 376398,
"author": "Jonathan Leffler",
... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17410/"
] | I am working on someone else's PHP code and seeing this pattern over and over:
(pseudocode)
```
result = SELECT blah1, blah2, foreign_key FROM foo WHERE key=bar
if foreign_key > 0
other_result = SELECT something FROM foo2 WHERE key=foreign_key
end
```
The code needs to branch if there is no related row in th... | There is not enough information to really answer the question. I've worked on applications where decreasing the query count for one reason and increasing the query count for another reason *both* gave performance improvements. In the same application!
For certain combinations of table size, database configuration and ... |
376,376 | <p>I found this question: How to find out which CVS tags cover which files and paths?</p>
<p>However, the results are not at all what I'm expecting.
I'm using the following:</p>
<pre><code>cvs -n -q update -r ET30908
</code></pre>
<p>I'm looking for every file tagged with 'ET30908'.</p>
| [
{
"answer_id": 376418,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 0,
"selected": false,
"text": "<p>The only way to know this is to iterate on all files as CVS is file-oriented, not changeset or snapshot-oriented. There... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I found this question: How to find out which CVS tags cover which files and paths?
However, the results are not at all what I'm expecting.
I'm using the following:
```
cvs -n -q update -r ET30908
```
I'm looking for every file tagged with 'ET30908'. | I find the easiest way to do this is to check out the project.
```
cvs co -d tag-ET30908 -r ET30908 modulename
```
This will create a directory on disk called "tag-ET30908" that contains only those files with the tag specified.
You can even keep this directory around and later do updates with `cvs update` to see w... |
376,403 | <p>In the application I'm writing using a combination of development environments and languages, I have need of accessing a cookie from two different subdomains, each on a separate host.</p>
<p>The cookie is being set on <code>www.mydomain.com</code> using the PHP code that follows, and I'm attempting to access it fro... | [
{
"answer_id": 376491,
"author": "Martijn Laarman",
"author_id": 47020,
"author_profile": "https://Stackoverflow.com/users/47020",
"pm_score": 2,
"selected": false,
"text": "<p>Does one of the subdomains use an underscore ? IE has problems accepting cookies from subdomain's that dont fol... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35579/"
] | In the application I'm writing using a combination of development environments and languages, I have need of accessing a cookie from two different subdomains, each on a separate host.
The cookie is being set on `www.mydomain.com` using the PHP code that follows, and I'm attempting to access it from `distant.mydomain.c... | For the benefit of anyone reading this question the code and information contained in the original post are exactly correct and work fine.
The problem is when you introduce other technology. For instance, **I have since learned that sending PHP code through a Python module, one that allows Django to serve PHP files/co... |
376,404 | <p>Can I load an stand alone aspx page in another stand alone aspx page using System.Reflection? </p>
<p>I am using the ASP.NET 2.0 Web site project model.</p>
| [
{
"answer_id": 376499,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 0,
"selected": false,
"text": "<p>Don't know about doing it using Reflection, which may well be possible, but you can capture the output of an aspx or asp pa... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] | Can I load an stand alone aspx page in another stand alone aspx page using System.Reflection?
I am using the ASP.NET 2.0 Web site project model. | Try using [BuildManager.CreateInstanceFromVirtualPath](http://msdn.microsoft.com/en-us/library/system.web.compilation.buildmanager.createinstancefromvirtualpath.aspx). Sample usage:
```
Page p = BuildManager.CreateInstanceFromVirtualPath("~/Default.aspx", typeof(Page))
```
This answers this specific question, althou... |
376,437 | <p>How can I determine if I'm in the final loop of a For Each statement in VB.NET?</p>
| [
{
"answer_id": 376445,
"author": "Tamara Wijsman",
"author_id": 47064,
"author_profile": "https://Stackoverflow.com/users/47064",
"pm_score": 1,
"selected": false,
"text": "<p>Check if the element is the last element of the container.</p>\n\n<p>Why do you want to do that?<br>\nYou could ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47167/"
] | How can I determine if I'm in the final loop of a For Each statement in VB.NET? | The generally, collections on which you can perform `For Each` on implement the [`IEnumerator`](http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx) interface. This interface has only two methods, `MoveNext` and `Reset` and one property, `Current`.
Basically, when you use a `For Each` on a coll... |
376,452 | <p>Is there a way to enforce explicit cast for typedefs of the same type? I've to deal with utf8 and sometimes I get confused with the indices for the character count and the byte count. So it be nice to have some typedefs:</p>
<pre><code>typedef unsigned int char_idx_t;
typedef unsigned int byte_idx_t;
</code></pre>
... | [
{
"answer_id": 376457,
"author": "John D. Cook",
"author_id": 25188,
"author_profile": "https://Stackoverflow.com/users/25188",
"pm_score": 2,
"selected": false,
"text": "<p>If you were writing C++, you could make two identically defined classes with different names that were wrappers ar... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18687/"
] | Is there a way to enforce explicit cast for typedefs of the same type? I've to deal with utf8 and sometimes I get confused with the indices for the character count and the byte count. So it be nice to have some typedefs:
```
typedef unsigned int char_idx_t;
typedef unsigned int byte_idx_t;
```
With the addition that... | For "handle" types (opaque pointers), Microsoft uses the trick of declaring structures and then typedef'ing a pointer to the structure:
```
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; \
typedef struct name##__ *name
```
Then instead of
```
typedef void* FOOHANDLE;
type... |
376,454 | <p>I have an application (ASP.NET 3.5) that allows users to rerun a particular process if required. The process inserts records into an MS SQL table. I have the insert in a Try / Catch and ignore the catch if a record already exists (the error in the Title would be valid). This worked perfectly using ADO but after I co... | [
{
"answer_id": 376457,
"author": "John D. Cook",
"author_id": 25188,
"author_profile": "https://Stackoverflow.com/users/25188",
"pm_score": 2,
"selected": false,
"text": "<p>If you were writing C++, you could make two identically defined classes with different names that were wrappers ar... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an application (ASP.NET 3.5) that allows users to rerun a particular process if required. The process inserts records into an MS SQL table. I have the insert in a Try / Catch and ignore the catch if a record already exists (the error in the Title would be valid). This worked perfectly using ADO but after I conve... | For "handle" types (opaque pointers), Microsoft uses the trick of declaring structures and then typedef'ing a pointer to the structure:
```
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; \
typedef struct name##__ *name
```
Then instead of
```
typedef void* FOOHANDLE;
type... |
376,461 | <p>In Python, the where and when of using string concatenation versus string substitution eludes me. As the string concatenation has seen large boosts in performance, is this (becoming more) a stylistic decision rather than a practical one?</p>
<p>For a concrete example, how should one handle construction of flexible ... | [
{
"answer_id": 376490,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 0,
"selected": false,
"text": "<p>I use substitution wherever I can. I only use concatenation if I'm building a string up in say a for-loop.</p>\n"
},
... | 2008/12/17 | [
"https://Stackoverflow.com/questions/376461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38140/"
] | In Python, the where and when of using string concatenation versus string substitution eludes me. As the string concatenation has seen large boosts in performance, is this (becoming more) a stylistic decision rather than a practical one?
For a concrete example, how should one handle construction of flexible URIs:
```... | Concatenation is (significantly) faster according to my machine. But stylistically, I'm willing to pay the price of substitution if performance is not critical. Well, and if I need formatting, there's no need to even ask the question... there's no option but to use interpolation/templating.
```
>>> import timeit
>>> d... |