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 |
|---|---|---|---|---|---|---|
178,462 | <p>I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running.</p>
<p>Whenever I try to run a scrip... | [
{
"answer_id": 178487,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": true,
"text": "<p>You should have something like this in your httpd.conf file:</p>\n\n<pre><code>LoadModule php5_module \"c:/php/php5apache2_... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24098/"
] | I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running.
Whenever I try to run a script on my ma... | You should have something like this in your httpd.conf file:
```
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/php"
```
Make sure that's in place, and don't forget to restart apache!
In Windows, the default location for your conf file is `C:\Program Files\Apach... |
178,473 | <p>I have three TextBox controls on the page</p>
<pre><code><asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
OnTextChanged="TextBox_TextChanged" TabIndex="1">
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"
OnTextChanged="TextBox_TextChanged" TabIndex="2">
<asp... | [
{
"answer_id": 178507,
"author": "Paul Nearney",
"author_id": 24071,
"author_profile": "https://Stackoverflow.com/users/24071",
"pm_score": 1,
"selected": false,
"text": "<p>You should be able to use the OfType method, to only return controls of a given type.</p>\n\n<p>e.g. </p>\n\n<pre>... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11256/"
] | I have three TextBox controls on the page
```
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
OnTextChanged="TextBox_TextChanged" TabIndex="1">
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"
OnTextChanged="TextBox_TextChanged" TabIndex="2">
<asp:TextBox ID="TextBox3" runat=... | [OfType](http://msdn.microsoft.com/en-us/library/bb360913.aspx)
```
from control in changed_control
.Parent
.Controls
.OfType<WebControl>()
``` |
178,479 | <p>What are the best workarounds for using a SQL <code>IN</code> clause with instances of <code>java.sql.PreparedStatement</code>, which is not supported for multiple values due to SQL injection attack security issues: One <code>?</code> placeholder represents one value, rather than a list of values.</p>
<p>Consider t... | [
{
"answer_id": 178505,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": false,
"text": "<p>I've never tried it, but would .setArray() do what you're looking for?</p>\n\n<p><strong>Update</strong>: Evidently ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15816/"
] | What are the best workarounds for using a SQL `IN` clause with instances of `java.sql.PreparedStatement`, which is not supported for multiple values due to SQL injection attack security issues: One `?` placeholder represents one value, rather than a list of values.
Consider the following SQL statement:
```
SELECT my_... | An analysis of the various options available, and the pros and cons of each is available in Jeanne Boyarsky's *[Batching Select Statements in JDBC](http://www.javaranch.com/journal/200510/Journal200510.jsp#a2)* entry on JavaRanch Journal.
The suggested options are:
* Prepare `SELECT my_column FROM my_table WHERE sear... |
178,482 | <p>For a school project, I need to create a way to create personnalized queries based on end-user choices.<br />
Since the user can choose basically any fields from any combination of tables, I need to find a way to map the tables in order to make a join and not have extraneous data (This may lead to incoherent report... | [
{
"answer_id": 178505,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": false,
"text": "<p>I've never tried it, but would .setArray() do what you're looking for?</p>\n\n<p><strong>Update</strong>: Evidently ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25818/"
] | For a school project, I need to create a way to create personnalized queries based on end-user choices.
Since the user can choose basically any fields from any combination of tables, I need to find a way to map the tables in order to make a join and not have extraneous data (This may lead to incoherent reports, but ... | An analysis of the various options available, and the pros and cons of each is available in Jeanne Boyarsky's *[Batching Select Statements in JDBC](http://www.javaranch.com/journal/200510/Journal200510.jsp#a2)* entry on JavaRanch Journal.
The suggested options are:
* Prepare `SELECT my_column FROM my_table WHERE sear... |
178,519 | <p>I'm just starting with CodeIgniter, and I am not sure where things such as css, js, and images should go. Outside the whole system folder seems ok, but that means everything is seperate. Inside means the filepaths are longer, and I'm worried that it might mess things up. What's the best practice on this issue?</p>
| [
{
"answer_id": 178534,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>I usually put separate folders at the root level, so I end up with a directory structure like this:</p>\n\n<pre><code>/syste... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16511/"
] | I'm just starting with CodeIgniter, and I am not sure where things such as css, js, and images should go. Outside the whole system folder seems ok, but that means everything is seperate. Inside means the filepaths are longer, and I'm worried that it might mess things up. What's the best practice on this issue? | I usually put separate folders at the root level, so I end up with a directory structure like this:
```
/system
/css
/js
/img
```
Seems to work for me - when you use `site_url(url)`, the URL it generates is from the root, so you can use `site_url('css/file.css')` to generate URLs to your stylesheets etc. |
178,524 | <p>I recently read this Phil Haack post (<a href="http://haacked.com/archive/2007/06/13/the-most-useful-.net-utility-classes-developers-tend-to-reinvent.aspx" rel="nofollow noreferrer">The Most Useful .NET Utility Classes Developers Tend To Reinvent Rather Than Reuse</a>) from last year, and thought I'd see if anyone h... | [
{
"answer_id": 178542,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 5,
"selected": false,
"text": "<p>Enum.Parse()</p>\n"
},
{
"answer_id": 178544,
"author": "RB.",
"author_id": 15393,
"author_pro... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6624/"
] | I recently read this Phil Haack post ([The Most Useful .NET Utility Classes Developers Tend To Reinvent Rather Than Reuse](http://haacked.com/archive/2007/06/13/the-most-useful-.net-utility-classes-developers-tend-to-reinvent.aspx)) from last year, and thought I'd see if anyone has any additions to the list. | People tend to use the following which is ugly and bound to fail:
```
string path = basePath + "\\" + fileName;
```
Better and safer way:
```
string path = Path.Combine(basePath, fileName);
```
Also I've seen people writing custom method to read all bytes from file.
This one comes quite handy:
```
byte[] fileDat... |
178,530 | <p>In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server 2005 database and store Russian texts.</p>
<p>Database collation is <code>Cyrillic_General_CI_AS</code>, table collation is <code>Cyrillic_General_CI_AS</code>, column type is <code>NVARCHAR(MAX)</code>.</p>
<p>We tried connecting to a database using ... | [
{
"answer_id": 178581,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "<p>I've always had the best luck using utf8_general_ci across the board - for connections, collations - everything.</p>... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6647/"
] | In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server 2005 database and store Russian texts.
Database collation is `Cyrillic_General_CI_AS`, table collation is `Cyrillic_General_CI_AS`, column type is `NVARCHAR(MAX)`.
We tried connecting to a database using two following schemes, both causing different prob... | Try executing `SET NAMES "charset"` after you connect.
I don't know what the charset to match `Cyrillic_General_CI_AS` is, but try "Cyrillic"? |
178,532 | <p>I have a rather large and complex set of programs to port from VC8 to VC9. One of the modules has a number of layered typedefs, which cause the compiler to generate a C4503 warning (decorated name truncated). The generated LIB file will not properly link to other modules in the project. VC8 had no trouble with this,... | [
{
"answer_id": 218959,
"author": "Howard Lee Harkness",
"author_id": 25823,
"author_profile": "https://Stackoverflow.com/users/25823",
"pm_score": 2,
"selected": false,
"text": "<p>Since there does not appear to be a way to increase the compiler's internal limitation on the decorated nam... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25823/"
] | I have a rather large and complex set of programs to port from VC8 to VC9. One of the modules has a number of layered typedefs, which cause the compiler to generate a C4503 warning (decorated name truncated). The generated LIB file will not properly link to other modules in the project. VC8 had no trouble with this, le... | Since there does not appear to be a way to increase the compiler's internal limitation on the decorated name length, I bit the bullet and made the change suggested in the MSDN. see: <http://msdn.microsoft.com/en-us/library/074af4b6.aspx>
I only had to change the first typedef to a struct. This required about 200 other... |
178,539 | <p>How can I round a decimal number (floating point) to the nearest integer? </p>
<p>e.g.</p>
<pre><code>1.2 = 1
1.7 = 2
</code></pre>
| [
{
"answer_id": 178550,
"author": "EvdB",
"author_id": 5349,
"author_profile": "https://Stackoverflow.com/users/5349",
"pm_score": 6,
"selected": false,
"text": "<p>You can either use a module like <A href=\"http://search.cpan.org/dist/Math-Round\" rel=\"noreferrer\">Math::Round</a>:</p>\... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12850/"
] | How can I round a decimal number (floating point) to the nearest integer?
e.g.
```
1.2 = 1
1.7 = 2
``` | Output of [`perldoc -q round`](http://perldoc.perl.org/perlfaq4.html#Does-Perl-have-a-round%28)-function%3f--What-about-ceil()-and-floor()%3f--Trig-functions%3f)
>
> Does Perl have a round() function? What about ceil() and floor()?
> Trig functions?
>
> Remember that [`int()`](http://perldoc.perl.org/functions/int.h... |
178,561 | <p>I have the following VB.net interface that I need to port to C#. C# does not allow enumerations in interfaces. How can I port this without changing code that uses this interface?</p>
<pre><code>Public Interface MyInterface
Enum MyEnum
Yes = 0
No = 1
Maybe = 2
End Enum
ReadOnl... | [
{
"answer_id": 178573,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 4,
"selected": false,
"text": "<pre><code>public enum MyEnum\n{\n Yes = 0,\n No = 1,\n Maybe = 2\n}\n\npublic interface IMyInterface\n{... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25825/"
] | I have the following VB.net interface that I need to port to C#. C# does not allow enumerations in interfaces. How can I port this without changing code that uses this interface?
```
Public Interface MyInterface
Enum MyEnum
Yes = 0
No = 1
Maybe = 2
End Enum
ReadOnly Property Numbe... | In short, you can't change that interface without breaking code, because C# can't nest types in interfaces. When you implement the VB.NET versions's interface, you are specifying that Number will return a type of MyInterface.MyEnum:
```
class TestClass3 : TestInterfaces.MyInterface
{
TestInterfaces.MyInterface.My... |
178,578 | <p>I'm using Webbrowser control to login to HTTPS site with "untrusted certificate".
but I get popup such standart window "Security Alert" about untrusted certificate:</p>
<p><img src="https://i.stack.imgur.com/U01dp.jpg" alt="Security Alert window"></p>
<p>I have to find this window by title and send it <kbd>Alt</kb... | [
{
"answer_id": 178595,
"author": "bobwienholt",
"author_id": 24257,
"author_profile": "https://Stackoverflow.com/users/24257",
"pm_score": 3,
"selected": true,
"text": "<p>This should do it:</p>\n\n<pre><code>public static bool ValidateServerCertificate(object sender, X509Certificate cer... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25826/"
] | I'm using Webbrowser control to login to HTTPS site with "untrusted certificate".
but I get popup such standart window "Security Alert" about untrusted certificate:

I have to find this window by title and send it `Alt`+`Y` to press *Yes*:
```
int iHandle ... | This should do it:
```
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
```
Obv... |
178,580 | <p>We are trying to bind a Linux machine (debian 4.0) to W2k3 AD. We have configured kerberos properly so that we can get TGTs. And users authenticate properly. However, PAM seems to be the sticky wicket. For example when we try to SSH to the linux machine as one of the AD users, the authentication succeeds (as per... | [
{
"answer_id": 181906,
"author": "Pontus",
"author_id": 23483,
"author_profile": "https://Stackoverflow.com/users/23483",
"pm_score": 1,
"selected": false,
"text": "<p>If you're confident everything but PAM works correctly, I suggest passing the debug option to pam_krb5.so to see if that... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are trying to bind a Linux machine (debian 4.0) to W2k3 AD. We have configured kerberos properly so that we can get TGTs. And users authenticate properly. However, PAM seems to be the sticky wicket. For example when we try to SSH to the linux machine as one of the AD users, the authentication succeeds (as per the au... | If you're confident everything but PAM works correctly, I suggest passing the debug option to pam\_krb5.so to see if that gives a clue to what's happening.
I'd also suggest verifying that nss-ldap is set up correctly using
```
getent passwd avalidusername
``` |
178,600 | <p>The project is ASP.NET 2.0, I have never been able to reproduce this myself, but I get emails informing me it happens to clients many times a week, often a few times in a row.</p>
<p>Here is the full error:</p>
<p>Exception Details: </p>
<blockquote>
<p>Microsoft.Reporting.WebForms.AspNetSessionExpiredException... | [
{
"answer_id": 178638,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 0,
"selected": false,
"text": "<p>What is the question? The session expired and they cannot continue.</p>\n\n<p>Check the report process speed. Build in some ki... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21367/"
] | The project is ASP.NET 2.0, I have never been able to reproduce this myself, but I get emails informing me it happens to clients many times a week, often a few times in a row.
Here is the full error:
Exception Details:
>
> Microsoft.Reporting.WebForms.AspNetSessionExpiredException: ASP.NET session has expired
>
>... | We had the same problem. So far, we only found it when the session expired but they used the back button in a browser that does aggressive caching, which is fine. But the ReportViewer tried to to a refresh even though the main page did not. So, we just added some hacky Global.asax error handling:
```
protected void Ap... |
178,601 | <pre><code><div spry:region="ds1" spry:repeatchildren="ds1">
<b spry:if=" '{title}'!='' ">
<!-- this is the first if -->
<a href="#" spry:if=" '{author}'!='' ">{author}
<!-- this is the second if -->
</a>
</b>
</div>
</code></pre>
<p><br><br>
I wo... | [
{
"answer_id": 2810735,
"author": "porges",
"author_id": 10311,
"author_profile": "https://Stackoverflow.com/users/10311",
"pm_score": 1,
"selected": false,
"text": "<p>The syntax inside the <code>spry:if</code> attribute is Javascript, so you can use <code>&&</code>:</p>\n\n<pre... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24439/"
] | ```
<div spry:region="ds1" spry:repeatchildren="ds1">
<b spry:if=" '{title}'!='' ">
<!-- this is the first if -->
<a href="#" spry:if=" '{author}'!='' ">{author}
<!-- this is the second if -->
</a>
</b>
</div>
```
I wonder if there is any method as simple as
```
if(x==y && i>j)
```
in
... | The syntax inside the `spry:if` attribute is Javascript, so you can use `&&`:
```
<b spry:if="'{title}' != '' && '{author}' != ''">
<!-- ... -->
</b>
``` |
178,619 | <p>Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser".
The Exception also apears when I try to execute these lines:</p>
<pre><code>TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085");
tfserver.EnsureAuthenticated();
WorkI... | [
{
"answer_id": 1015728,
"author": "joshua.ewer",
"author_id": 28664,
"author_profile": "https://Stackoverflow.com/users/28664",
"pm_score": 0,
"selected": false,
"text": "<p>I just a very similar question <a href=\"https://stackoverflow.com/questions/1015648/how-do-i-distribute-a-service... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168/"
] | Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser".
The Exception also apears when I try to execute these lines:
```
TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085");
tfserver.EnsureAuthenticated();
WorkItemStore store... | This solved my problem: <http://blogs.msdn.com/b/jianges/archive/2008/03/28/tfs-sdk-will-cause-invalidprogramexception-while-running-as-64-bit.aspx> |
178,645 | <p>There is some magic going on with WCF deserialization. How does it instantiate an instance of the data contract type without calling its constructor?</p>
<p>For example, consider this data contract:</p>
<pre><code>[DataContract]
public sealed class CreateMe
{
[DataMember] private readonly string _name;
[Dat... | [
{
"answer_id": 179486,
"author": "Jason Jackson",
"author_id": 13103,
"author_profile": "https://Stackoverflow.com/users/13103",
"pm_score": 8,
"selected": true,
"text": "<p><code>FormatterServices.GetUninitializedObject()</code> will create an instance without calling a constructor. I ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] | There is some magic going on with WCF deserialization. How does it instantiate an instance of the data contract type without calling its constructor?
For example, consider this data contract:
```
[DataContract]
public sealed class CreateMe
{
[DataMember] private readonly string _name;
[DataMember] private reado... | `FormatterServices.GetUninitializedObject()` will create an instance without calling a constructor. I found this class by using [Reflector](http://www.red-gate.com/products/reflector/index.htm) and digging through some of the core .Net serialization classes.
I tested it using the sample code below and it looks like i... |
178,667 | <p>I have the following code:</p>
<pre><code>import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class ScratchPad {
public static void main(String args[]) throws Exception {
String html ="<html>"+
"<head>"+... | [
{
"answer_id": 270105,
"author": "micro",
"author_id": 23275,
"author_profile": "https://Stackoverflow.com/users/23275",
"pm_score": 1,
"selected": false,
"text": "<p>When I run the code, I can only see the HTML text when I delete the <strong><em>meta</em></strong> line. Maybe it has som... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | I have the following code:
```
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class ScratchPad {
public static void main(String args[]) throws Exception {
String html ="<html>"+
"<head>"+
"<meta http-equiv=\"Conten... | Use the follow line before setText and after setContentType.
```
editor.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE);
```
This is one of the mystic undocumented features. setContentType create a new Document that it has no effect if you set it before. |
178,669 | <p>How can i make my flash applications in a browser in full screen mode? I know that the stage can be put in that mode, but when i run the application in any browser this doesn't work. So, this can be done, but how?</p>
| [
{
"answer_id": 178709,
"author": "John Chuckran",
"author_id": 25511,
"author_profile": "https://Stackoverflow.com/users/25511",
"pm_score": -1,
"selected": false,
"text": "<p>I believe it is a simple actionscript command. <a href=\"http://www.adobe.com/support/flash/action_scripts/actio... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20601/"
] | How can i make my flash applications in a browser in full screen mode? I know that the stage can be put in that mode, but when i run the application in any browser this doesn't work. So, this can be done, but how? | In the HTML including the Flash SWF, add the following parameter to your <object> tag:
```
<param name="allowFullScreen" value="true" />
```
and the following attribute to your <embed> tag:
```
allowFullScreen="true"
```
Or, if you are using [SWFObject](http://code.google.com/p/swfobject/) (as you should be), add... |
178,675 | <p>Is it possible to split large ASP.NET-pages into pieces? JSP has the <a href="http://java.sun.com/products/jsp/tags/11/syntaxref1112.html" rel="nofollow noreferrer">jsp:include</a> directive. Is there any equivivalent in ASP.NET</p>
<p>I'm not interested in reusing the pieces. I just want to organize the HTML/ASP c... | [
{
"answer_id": 178682,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 3,
"selected": false,
"text": "<p>The <a href=\"http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx\" rel=\"noreferrer\">MasterPage model</a> and <a ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25833/"
] | Is it possible to split large ASP.NET-pages into pieces? JSP has the [jsp:include](http://java.sun.com/products/jsp/tags/11/syntaxref1112.html) directive. Is there any equivivalent in ASP.NET
I'm not interested in reusing the pieces. I just want to organize the HTML/ASP code.
Isn't User Controls and Master Pages over... | ```
<!--#include file="inc_footer.aspx"-->
``` |
178,696 | <p>I've got the following JavaScript on my web page...</p>
<pre><code>64 var description = new Array();
65 description[0] = "..."
66 description[1] = "..."
...
78 function init() {
79 document.getElementById('somedivid').innerHTML = description[0];
80 }
81
82 window.onload = init();
</code></p... | [
{
"answer_id": 178719,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "<p>Try to add an envent listener for 'load' instead, or use the declarative syntax <code><body onload=\"init()\"></c... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I've got the following JavaScript on my web page...
```
64 var description = new Array();
65 description[0] = "..."
66 description[1] = "..."
...
78 function init() {
79 document.getElementById('somedivid').innerHTML = description[0];
80 }
81
82 window.onload = init();
```
In Microsoft Inter... | Shouldn't line 82 read:
```
window.onload = init;
```
When you do "init()" it's a call to a function that returns void. You end up calling that function before the page loads. |
178,700 | <p>While simple, interface-driven event notification frameworks in Java have been around since pre-Cambrian times (e.g. java.beans.PropertyChangeSupport), it is becoming increasingly popular for frameworks to use annotation-driven event notification instead. </p>
<p>For an example, see <a href="http://www.jboss.org/f... | [
{
"answer_id": 179056,
"author": "oxbow_lakes",
"author_id": 16853,
"author_profile": "https://Stackoverflow.com/users/16853",
"pm_score": 2,
"selected": false,
"text": "<p>Don't mistake complicated for clever. It seems to me that this would be:</p>\n\n<ol>\n<li>A nightmare to debug</li>... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21234/"
] | While simple, interface-driven event notification frameworks in Java have been around since pre-Cambrian times (e.g. java.beans.PropertyChangeSupport), it is becoming increasingly popular for frameworks to use annotation-driven event notification instead.
For an example, see [JBossCache 2.2](http://www.jboss.org/file... | You can already do this today with [EventBus](http://eventbus.org "EventBus").
Following example is from [EventBus Getting Started guide](http://eventbus.org/confluence/display/EventBus/Getting+Started). Statusbar that updates based on published events, and no need to register statusbar control/widget as listener of p... |
178,712 | <p>I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull. </p>
<p>I already check for DBNull but I don't kno... | [
{
"answer_id": 178725,
"author": "Anders",
"author_id": 25515,
"author_profile": "https://Stackoverflow.com/users/25515",
"pm_score": -1,
"selected": false,
"text": "<p>You can encapsulate your block of code with a try ... catch statement, and when you run your code, if the column doesn'... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21186/"
] | I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull.
I already check for DBNull but I don't know how to m... | DataRow's are nice in the way that they have their underlying table linked to them. With the underlying table you can verify that a specific row has a specific column in it.
```
If DataRow.Table.Columns.Contains("column") Then
MsgBox("YAY")
End If
``` |
178,730 | <p>I have to lock user accounts in Active Directory programmatically in C#. </p>
<p>Unfortunately it doesn't work via the userAccountControl attribute. Every time I set userAccountControl to 528 (=normal account w/ lockout flag), Active Directory won't accept the value and resets it without further notice to 512 (=nor... | [
{
"answer_id": 178768,
"author": "Nick DeVore",
"author_id": 1380,
"author_profile": "https://Stackoverflow.com/users/1380",
"pm_score": 3,
"selected": true,
"text": "<p>Make sure the account you're using to disable the account has sufficient privileges to disable accounts. See <a href=... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/830/"
] | I have to lock user accounts in Active Directory programmatically in C#.
Unfortunately it doesn't work via the userAccountControl attribute. Every time I set userAccountControl to 528 (=normal account w/ lockout flag), Active Directory won't accept the value and resets it without further notice to 512 (=normal accoun... | Make sure the account you're using to disable the account has sufficient privileges to disable accounts. See [this example](http://msdn.microsoft.com/en-us/library/ms696026(VS.85).aspx) from Microsoft. |
178,738 | <p>Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the <code>Worksheet_SelectionChange</code> event, as that will not trigger multiple times if the cell is clicked multiple times. <code>BeforeDoubleClick</code> does not solve my problem either, as I do not want to require the user to ... | [
{
"answer_id": 178780,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think so. But you can create a shape object ( or wordart or something similiar ) hook Click event and place the ob... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12002/"
] | Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the `Worksheet_SelectionChange` event, as that will not trigger multiple times if the cell is clicked multiple times. `BeforeDoubleClick` does not solve my problem either, as I do not want to require the user to double click that frequen... | Clearly, there is no perfect answer. However, if you want to allow the user to
1. select certain cells
2. allow them to change those cells,
and
3. trap each click,even repeated clicks
on the same cell,
then the easiest way seems to be to move the focus off the selected cell, so that clicking it will trigger a Select... |
178,740 | <p>Trying to use an excpetion class which could provide location reference for XML parsing, found an interesting behavior - compiler could not choose between overload which consumes an interface and one which needs System.Exception when I trying to pass XmlReader as a parameter.</p>
<p>Detais are following:</p>
<pre>... | [
{
"answer_id": 178764,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 2,
"selected": true,
"text": "<p>The line:</p>\n\n<pre><code>//fails\nthrow new FilterXmlParseException(\"<Filter> element expected\", reader);\n</co... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21603/"
] | Trying to use an excpetion class which could provide location reference for XML parsing, found an interesting behavior - compiler could not choose between overload which consumes an interface and one which needs System.Exception when I trying to pass XmlReader as a parameter.
Detais are following:
```
//exception ove... | The line:
```
//fails
throw new FilterXmlParseException("<Filter> element expected", reader);
```
because XmlReader doesn't implement IXmlLineInfo. I am not sure if your cast works, but the casts are not checked statically. If it actually works, it is because the concrete class (that inherits from XmlReader) impleme... |
178,751 | <p>Here is the sample:</p>
<pre><code> Dim TestString As String = "Hello," & Chr(0) & "World"
MsgBox(TestString, , "TestString.Length=" & TestString.Length.ToString)
</code></pre>
<p>Result - Messagebox shows "Hello," with title says TestString.Length=12 </p>
<p>I guess the chr(0) is treated as th... | [
{
"answer_id": 178777,
"author": "Nick DeVore",
"author_id": 1380,
"author_profile": "https://Stackoverflow.com/users/1380",
"pm_score": 0,
"selected": false,
"text": "<p>chr(0) is null. Are you after a single space chr(32) or just type vblf or after Enter(Return) chr(13) or type vbcrlf... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12369/"
] | Here is the sample:
```
Dim TestString As String = "Hello," & Chr(0) & "World"
MsgBox(TestString, , "TestString.Length=" & TestString.Length.ToString)
```
Result - Messagebox shows "Hello," with title says TestString.Length=12
I guess the chr(0) is treated as the end of zero terminated string, but it's not... | The sample code in the questioner's example ("SCORE".ToString...) works fine for me in a console application. The VS2005 debugger does not show the string correctly, but it outputs to the console just fine. So, my feeling is either that you think it's incorrect because the debugger wrongly says so or your output string... |
178,762 | <p>Sorry, I couldn't figure out a good way to phrase my real question.</p>
<p>I run a high-traffic ASP.NET site on a 64-bit machine. I have IIS running in 32-bit mode, however, due to some legacy components of the app. I am running this particular web app inside an application pool that has the web garden option on ... | [
{
"answer_id": 178776,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": false,
"text": "<ul>\n<li><a href=\"http://msdn.microsoft.com/en-us/library/ms979205.aspx\" rel=\"nofollow noreferrer\">(MSDN) How To: U... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22299/"
] | Sorry, I couldn't figure out a good way to phrase my real question.
I run a high-traffic ASP.NET site on a 64-bit machine. I have IIS running in 32-bit mode, however, due to some legacy components of the app. I am running this particular web app inside an application pool that has the web garden option on (running 6 p... | * [(MSDN) How To: Use CLR Profiler](http://msdn.microsoft.com/en-us/library/ms979205.aspx)
* [(MSDN Magazine) Investigating Memory Issues](http://msdn.microsoft.com/en-us/magazine/cc163528.aspx) |
178,809 | <p>I am trying to fix some bugs in a product I inherited, and I have this snippet of javascript that is supposed to hilight a couple of boxes and pop up a confirm box. What currently happens is I see the boxes change color and there is a 5 or so second delay, then it's as if the missing confirm just accepts itself. D... | [
{
"answer_id": 178820,
"author": "17 of 26",
"author_id": 2284,
"author_profile": "https://Stackoverflow.com/users/2284",
"pm_score": 3,
"selected": false,
"text": "<p>The only thing I can think of is if one of the lines before the confirm is throwing an exception and you're never actual... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13593/"
] | I am trying to fix some bugs in a product I inherited, and I have this snippet of javascript that is supposed to hilight a couple of boxes and pop up a confirm box. What currently happens is I see the boxes change color and there is a 5 or so second delay, then it's as if the missing confirm just accepts itself. Does a... | The only thing I can think of is if one of the lines before the confirm is throwing an exception and you're never actually getting to the confirm.
If you're using IE, make sure script debugging is enabled. If you're using Firefox, install the Firebug add-on and enable it for your website.
Or, for very primitive debug... |
178,821 | <p>I have seen arguments for using explicit interfaces as a method of locking a classes usage to that interface. The argument seems to be that by forcing others to program to the interface you can ensure better decoupling of the classes and allow easier testing.</p>
<p>Example:</p>
<pre><code>public interface ICut
{... | [
{
"answer_id": 178830,
"author": "skaffman",
"author_id": 21234,
"author_profile": "https://Stackoverflow.com/users/21234",
"pm_score": 0,
"selected": false,
"text": "<p>If the client code doesn't care about anything other than the fact that it can use the object to <code>Cut()</code> th... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23855/"
] | I have seen arguments for using explicit interfaces as a method of locking a classes usage to that interface. The argument seems to be that by forcing others to program to the interface you can ensure better decoupling of the classes and allow easier testing.
Example:
```
public interface ICut
{
void Cut();
}
pub... | To quote GoF chapter 1:
* "Program to an interface, not an implementation".
* "Favor object composition over class inheritance".
As C# does not have multiple inheritance, object composition and programming to interfaces are the way to go.
ETA: And you should never use multiple inheritance anyway but that's another t... |
178,837 | <p>I am looking for a regex that will find repeating letters. So any letter twice or more, for example:</p>
<pre><code>booooooot or abbott
</code></pre>
<p>I won't know the letter I am looking for ahead of time. </p>
<p>This is a question I was asked in interviews and then asked in interviews. Not so many people get... | [
{
"answer_id": 178851,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 3,
"selected": false,
"text": "<p>Use \\N to refer to previous groups:</p>\n\n<pre><code>/(\\w)\\1+/g\n</code></pre>\n"
},
{
"answer_id... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] | I am looking for a regex that will find repeating letters. So any letter twice or more, for example:
```
booooooot or abbott
```
I won't know the letter I am looking for ahead of time.
This is a question I was asked in interviews and then asked in interviews. Not so many people get it correct. | You can find any letter, then use `\1` to find that same letter a second time (or more). If you only need to know the letter, then `$1` will contain it. Otherwise you can concatenate the second match onto the first.
```
my $str = "Foooooobar";
$str =~ /(\w)(\1+)/;
print $1;
# prints 'o'
print $1 . $2;
# prints 'oooo... |
178,838 | <p>Structs seem like a useful way to parse a binary blob of data (ie a file or network packet). This is fine and dandy until you have variable size arrays in the blob. For instance:</p>
<pre><code>struct nodeheader{
int flags;
int data_size;
char data[];
};
</code></pre>
<p>This allows me to... | [
{
"answer_id": 178877,
"author": "Mecki",
"author_id": 15809,
"author_profile": "https://Stackoverflow.com/users/15809",
"pm_score": 3,
"selected": true,
"text": "<p>You cannot have multiple variable sized arrays. How should the compiler at compile time know where friend[] is located? Th... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13257/"
] | Structs seem like a useful way to parse a binary blob of data (ie a file or network packet). This is fine and dandy until you have variable size arrays in the blob. For instance:
```
struct nodeheader{
int flags;
int data_size;
char data[];
};
```
This allows me to find the last data characte... | You cannot have multiple variable sized arrays. How should the compiler at compile time know where friend[] is located? The location of friend depends on the size of data[] and the size of data is unknown at compile time. |
178,846 | <p>I installed the ReSharper evaluation version and uninstalled it. Afterwards Visual Studio's Intellisense stopped working. I have restarted computer but I still have this problem. </p>
<p>Can anyone please help me here?</p>
<p>I am using Visual Studio 2005. Thanks.</p>
| [
{
"answer_id": 178874,
"author": "Matt Price",
"author_id": 852,
"author_profile": "https://Stackoverflow.com/users/852",
"pm_score": 3,
"selected": false,
"text": "<p>Sometimes deleting the ncb file helps. Go to your solution directory and find the sln file, there will also be a file wi... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20933/"
] | I installed the ReSharper evaluation version and uninstalled it. Afterwards Visual Studio's Intellisense stopped working. I have restarted computer but I still have this problem.
Can anyone please help me here?
I am using Visual Studio 2005. Thanks. | Try opening Visual Studio Command Prompt and entering:
```
devenv.exe /ResetSettings
``` |
178,857 | <p>Is it possible to get the text of an <code>OleDbCommand</code> with all parameters replaced with their values? E.g. in the code below I'm looking for a way to get the query text </p>
<pre><code>SELECT * FROM my_table WHERE c1 = 'hello' and c2 = 'world'
</code></pre>
<p>after I finished assigning the parameters.</p... | [
{
"answer_id": 178883,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": true,
"text": "<p>No: you have to iterate through the parameters collection yourself, doing a string.Replace() to get the equivalent.... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11387/"
] | Is it possible to get the text of an `OleDbCommand` with all parameters replaced with their values? E.g. in the code below I'm looking for a way to get the query text
```
SELECT * FROM my_table WHERE c1 = 'hello' and c2 = 'world'
```
after I finished assigning the parameters.
```
var query = "SELECT * FROM my_tabl... | No: you have to iterate through the parameters collection yourself, doing a string.Replace() to get the equivalent. It's particularly painful when you have to use the `?` syntax rather than the `@parametername` syntax.
The reason for this is that the full string is *never* assembled. The parameters and sent to the ser... |
178,860 | <p>I'm trying to use a Microsoft Access database for a demo project that I'm thinking of doing in either CodeIgniter or CakePHP. Ignoring the possible folly of using Microsoft Access, I haven't been able to figure out precisely how the connection string corresponds to the frameworks' database settings. In straight PHP,... | [
{
"answer_id": 260567,
"author": "JayTee",
"author_id": 20153,
"author_profile": "https://Stackoverflow.com/users/20153",
"pm_score": 3,
"selected": true,
"text": "<p>Try setting up a DSN and changing to the following:</p>\n\n<pre><code>$db['access']['hostname'] = \"<dsn name>\";\n... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24197/"
] | I'm trying to use a Microsoft Access database for a demo project that I'm thinking of doing in either CodeIgniter or CakePHP. Ignoring the possible folly of using Microsoft Access, I haven't been able to figure out precisely how the connection string corresponds to the frameworks' database settings. In straight PHP, I ... | Try setting up a DSN and changing to the following:
```
$db['access']['hostname'] = "<dsn name>";
$db['access']['username'] = "";
$db['access']['password'] = "";
$db['access']['database'] = "<dsn name>";
```
There's also a section in the CodeIgniter documentation that addresses connection strings:
<http://codeignit... |
178,863 | <p>I am building a product that we are eventually going to white-label. Right now I am trying to figure out the best way to facilitate these requirements programmatically so the user can update the basic design of the site (ie header color, etc) via their profile/settings form. </p>
<p>Requirements: </p>
<ol>
<li>Use... | [
{
"answer_id": 178878,
"author": "warren",
"author_id": 4418,
"author_profile": "https://Stackoverflow.com/users/4418",
"pm_score": 0,
"selected": false,
"text": "<p>Your proposed method is how I would go about solving this problem: upload the user-controllable values (maybe just colors ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12442/"
] | I am building a product that we are eventually going to white-label. Right now I am trying to figure out the best way to facilitate these requirements programmatically so the user can update the basic design of the site (ie header color, etc) via their profile/settings form.
Requirements:
1. User can update the log... | I've been there some months ago. While using dynamic CSS generated by a dedicated handler / servlet has been the first solution, to improve performances a customized CSS is now produced on file overrinding the basic elements of the standard CSS:
```
<link rel="stylesheet" href="standard.css" />
<link rel="stylesheet" ... |
178,876 | <p>In this asp.net I'm cleaning up it's possible for deadlocks to occur. I want to make sure that the code deals with them properly, so I'm trying to write NUnit tests which trigger a deadlock.....</p>
<p>The DAO is split by entity. Each entity has a set of tests which are surrounded by Startup() and Teardown() meth... | [
{
"answer_id": 178986,
"author": "Nick DeVore",
"author_id": 1380,
"author_profile": "https://Stackoverflow.com/users/1380",
"pm_score": 0,
"selected": false,
"text": "<p>What if one of your tests in the middle of your transaction just does a \"wait\" for like 5 minutes? Or, you simply ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6969/"
] | In this asp.net I'm cleaning up it's possible for deadlocks to occur. I want to make sure that the code deals with them properly, so I'm trying to write NUnit tests which trigger a deadlock.....
The DAO is split by entity. Each entity has a set of tests which are surrounded by Startup() and Teardown() methods which cr... | If your deadlock results in an exception being thrown, you want to use a Mock Object to emulate the exception being thrown.
The basic idea is that you tell your Mock Object framework (I like [TypeMock](http://www.typemock.com/)) to throw an exception instead, something like this:
```
MockObject mo = MockManager.MockO... |
178,888 | <p>This is a minor bug (one I'm willing to live with in the interest of go-live, frankly), but I'm wondering if anyone else has ideas to fix it.</p>
<p>I have a C# WinForms application. When the app is launched via the executable (not via the debugger), the first thing the user sees is a console window, followed by th... | [
{
"answer_id": 178923,
"author": "Nick",
"author_id": 22407,
"author_profile": "https://Stackoverflow.com/users/22407",
"pm_score": 3,
"selected": true,
"text": "<p>My first guess would be to double check your Project Property settings and make sure that the output type is Windows Applic... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14048/"
] | This is a minor bug (one I'm willing to live with in the interest of go-live, frankly), but I'm wondering if anyone else has ideas to fix it.
I have a C# WinForms application. When the app is launched via the executable (not via the debugger), the first thing the user sees is a console window, followed by the main win... | My first guess would be to double check your Project Property settings and make sure that the output type is Windows Application and not Console Application. |
178,898 | <p>I have a program that uses the built in webbrowser control. At some point during the usage of this, I'm not sure at what point, but it appears to be random, I get the following error:</p>
<pre><code>System.AccessViolationException
FullText = System.AccessViolationException: Attempted to read or write protected me... | [
{
"answer_id": 178972,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 2,
"selected": false,
"text": "<p>My gut feeling is that you are trying to manipulate the document before you've navigated to one. Try navigating to \... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12969/"
] | I have a program that uses the built in webbrowser control. At some point during the usage of this, I'm not sure at what point, but it appears to be random, I get the following error:
```
System.AccessViolationException
FullText = System.AccessViolationException: Attempted to read or write protected memory. This is o... | We have recently had a similar problem on the machines of several customers. The problem turned out to be a bug in the MSHTML control in certain environments. A common symptom for the problem seems to be the broken registration of the jscript.dll library.
Symptoms that may help to diagnose if it's the same problem - t... |
178,899 | <p>I have a collection of classes that I want to serialize out to an XML file. It looks something like this:</p>
<pre><code>public class Foo
{
public List<Bar> BarList { get; set; }
}
</code></pre>
<p>Where a bar is just a wrapper for a collection of properties, like this:</p>
<pre><code>public class Bar
{
... | [
{
"answer_id": 178931,
"author": "Carl",
"author_id": 951280,
"author_profile": "https://Stackoverflow.com/users/951280",
"pm_score": 6,
"selected": true,
"text": "<p>Just to check, have you marked Bar as [Serializable]?</p>\n\n<p>Also, you need a parameter-less ctor on Bar, to deseriali... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4019/"
] | I have a collection of classes that I want to serialize out to an XML file. It looks something like this:
```
public class Foo
{
public List<Bar> BarList { get; set; }
}
```
Where a bar is just a wrapper for a collection of properties, like this:
```
public class Bar
{
public string Property1 { get; set; }
pu... | Just to check, have you marked Bar as [Serializable]?
Also, you need a parameter-less ctor on Bar, to deserialize
Hmm, I used:
```
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Foo f = new F... |
178,904 | <pre><code>var something = {
wtf: null,
omg: null
};
</code></pre>
<p>My JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where can I learn more about it?</p>
| [
{
"answer_id": 178916,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 4,
"selected": false,
"text": "<p>It's object literal syntax. The 'wft' and 'omg' are property names while, null and null are the property values.</p... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19825/"
] | ```
var something = {
wtf: null,
omg: null
};
```
My JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where can I learn more about it? | It is an object literal with two properties. Usually this is how people create associative arrays or hashes because JS doesn't natively support that data structure. Though note that it is still a fully-fledged object, you can even add functions as properties:
```
var myobj = {
name: 'SO',
hello: function() {
... |
178,913 | <p>Here's the jist of the problem: Given a list of sets, such as:</p>
<pre><code>[ (1,2,3), (5,2,6), (7,8,9), (6,12,13), (21,8,34), (19,20) ]
</code></pre>
<p>Return a list of groups of the sets, such that sets that have a shared element are in the same group.</p>
<pre><code>[ [ (1,2,3), (5,2,6), (6,12,13) ], [ (7,8... | [
{
"answer_id": 178940,
"author": "Matt Price",
"author_id": 852,
"author_profile": "https://Stackoverflow.com/users/852",
"pm_score": 1,
"selected": false,
"text": "<p>You could think of it as a graph problem where the set (1,2,3) is connected to the set (5,2,6) via the 2. And then use a... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7581/"
] | Here's the jist of the problem: Given a list of sets, such as:
```
[ (1,2,3), (5,2,6), (7,8,9), (6,12,13), (21,8,34), (19,20) ]
```
Return a list of groups of the sets, such that sets that have a shared element are in the same group.
```
[ [ (1,2,3), (5,2,6), (6,12,13) ], [ (7,8,9), (21,8,34) ], [ (19,20) ] ]
```
... | The problem is exactly the computation of the connected components of an hypergraph: the integers are the vertices, and the sets are the hyperedges. A usual way of computing the connected components is by flooding them one after the other:
* for all i = 1 to N, do:
* if i has been tagged by some j < i, then continue (... |
178,915 | <p>What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone?</p>
| [
{
"answer_id": 179066,
"author": "Martin Gordon",
"author_id": 2481,
"author_profile": "https://Stackoverflow.com/users/2481",
"pm_score": 10,
"selected": true,
"text": "<p>You can use this function:</p>\n\n<pre><code>UIImageWriteToSavedPhotosAlbum(UIImage *image, \n ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20626/"
] | What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone? | You can use this function:
```
UIImageWriteToSavedPhotosAlbum(UIImage *image,
id completionTarget,
SEL completionSelector,
void *contextInfo);
```
You only need **completionTarget**, **completionSelector** and **contextIn... |
178,921 | <p>I have the following code in my file to load a div with HTML from an AJAX call:</p>
<pre><code>$('#searchButton').click( function() {
$('#inquiry').load('/search.php?pid=' + $('#searchValue').val());
});
</code></pre>
<p>This works fine in Firefox and Google Chrome, but whenever I do the search in IE I get red... | [
{
"answer_id": 178942,
"author": "Steve g",
"author_id": 12092,
"author_profile": "https://Stackoverflow.com/users/12092",
"pm_score": 2,
"selected": false,
"text": "<p>IE Handles default events differently (also beware of hitting enter in a text field). IE is causing some default event... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] | I have the following code in my file to load a div with HTML from an AJAX call:
```
$('#searchButton').click( function() {
$('#inquiry').load('/search.php?pid=' + $('#searchValue').val());
});
```
This works fine in Firefox and Google Chrome, but whenever I do the search in IE I get redirected back to index.php.... | More fun. I have the input text and button wrapped in this form:
```
<form onSubmit="return false;">
[HTML]
</form>
```
and IE seems to be ignoring the return false. I tried modding the jQuery function to be like Steve's but it was still refreshing inproperly.
I removed the form tags and that took care of it. |
178,934 | <p>In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g.</p>
<pre><code>for ( int i=0; i < vecVector.size(); i++ )
{
..
}
</code></pre>
<p>Can anyone tell me why and in what cases I should use... | [
{
"answer_id": 178950,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 4,
"selected": false,
"text": "<p>Using iterators allows your code to be agnostic about the implementation of your container. If random access for... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g.
```
for ( int i=0; i < vecVector.size(); i++ )
{
..
}
```
Can anyone tell me why and in what cases I should use iterators and in what cases ... | Note that the usually implementation of vector won't use an "int" as the type of the index/size. So your code will at the very least provoke compiler warnings.
### Genericity
Iterators increase the genericity of your code.
For example:
```
typedef std::vector<int> Container ;
void doSomething(Container & p_aC)
{
... |
178,936 | <p>I am working on a build system. The build system posts the results as a zip file in a directory. Unfortunately I have no easy way to know the name of the zip file, because it is timestamped. For the next operation, I must decompress this zip file to some specific location and then do some more file operations.</p... | [
{
"answer_id": 178941,
"author": "Rasmus",
"author_id": 25792,
"author_profile": "https://Stackoverflow.com/users/25792",
"pm_score": -1,
"selected": false,
"text": "<p>Why use bat files when you have powershell or console applications?</p>\n"
},
{
"answer_id": 178946,
"autho... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309/"
] | I am working on a build system. The build system posts the results as a zip file in a directory. Unfortunately I have no easy way to know the name of the zip file, because it is timestamped. For the next operation, I must decompress this zip file to some specific location and then do some more file operations.
I guess... | This should do it:
```
FOR /F usebackq %%i IN (`DIR /B /O-D *.ZIP`) DO UNZIP %%i && GOTO DONE || GOTO DONE
:DONE
```
This works as follows:
* `DIR /B /O-D *.ZIP` lists all ZIP files in reverse date order in a "bare" - i.e. name only - format.
* `FOR /F usebackq` is used to loop over the output of the command.
* `&&... |
178,948 | <p>I have a repeater that outputs divs like the following for every item returned from some method.</p>
<pre><code><div class="editor-area">
<div class="title">the title</div>
<div>the description</div>
<div class="bottom-bar">
<a href="link">Modify</a&g... | [
{
"answer_id": 179021,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, this is dead simple with jQuery. First hide everything:</p>\n\n<pre><code>$(\"div.title\").hide();\n</code></pre... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3226/"
] | I have a repeater that outputs divs like the following for every item returned from some method.
```
<div class="editor-area">
<div class="title">the title</div>
<div>the description</div>
<div class="bottom-bar">
<a href="link">Modify</a>
<a href="link2">Delete</a>
</div>
</div>
```
... | Yes, this is dead simple with jQuery. First hide everything:
```
$("div.title").hide();
```
(Matches elements of type "div" with class "title".) Now show the matches:
```
$("div.title:contains(searchText)").show();
```
[Help for "contains".](http://docs.jquery.com/Selectors/contains#text)
It should not take "sec... |
178,952 | <p>In the code below I use <code>mpf_add</code> to add the string representation of two floating values. What I don't understand at this point is why <code>2.2 + 3.2 = 5.39999999999999999999999999999999999999</code>. I would have thought that <code>gmp</code> was smart enough to give <code>5.4</code>. </p>
<p>What am ... | [
{
"answer_id": 178978,
"author": "warren",
"author_id": 4418,
"author_profile": "https://Stackoverflow.com/users/4418",
"pm_score": 3,
"selected": true,
"text": "<p>This is because of the inherent error of using floating-point arithmetic in a binary environment.</p>\n\n<p>See the <a href... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] | In the code below I use `mpf_add` to add the string representation of two floating values. What I don't understand at this point is why `2.2 + 3.2 = 5.39999999999999999999999999999999999999`. I would have thought that `gmp` was smart enough to give `5.4`.
What am I not comprehending about how gmp does floats?
(BTW, ... | This is because of the inherent error of using floating-point arithmetic in a binary environment.
See the [IEEE 754](http://en.wikipedia.org/wiki/IEEE_754) standard for more information. |
178,963 | <p>I have this working definition:</p>
<pre><code>IDENTIFIER [a-zA-Z][a-zA-Z0-9]*
</code></pre>
<p>I don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions</p>
<pre><code>DIGIT [0-9]
VALID [a-zA-Z]
</code></pre>
<p>How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID ... | [
{
"answer_id": 178987,
"author": "Keng",
"author_id": 730,
"author_profile": "https://Stackoverflow.com/users/730",
"pm_score": -1,
"selected": false,
"text": "<p>I think this will do it, but I can't test it. Do you have sample data?</p>\n\n<pre><code>(?:[a-zA-Z])+(?:[0-9])+\n</code></p... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18403/"
] | I have this working definition:
```
IDENTIFIER [a-zA-Z][a-zA-Z0-9]*
```
I don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions
```
DIGIT [0-9]
VALID [a-zA-Z]
```
How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?
I don't know how to do the "second"... | It looks like you actually want:
```
IDENTIFIER {VALID}({VALID}|{DIGIT})*
```
`[{VALID}{DIGIT}]` resolves to `[[A-Za-z][0-9]]` which is not a legal construct. |
178,964 | <p><a href="https://stackoverflow.com/q/133925">JavaScript post request like a form submit</a> shows you how to submit a form that you create via POST in JavaScript. Below is my modified code.</p>
<pre><code>var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "t... | [
{
"answer_id": 179015,
"author": "liggett78",
"author_id": 19762,
"author_profile": "https://Stackoverflow.com/users/19762",
"pm_score": 9,
"selected": true,
"text": "<p>Add </p>\n\n<pre><code><form target=\"_blank\" ...></form>\n</code></pre>\n\n<p>or</p>\n\n<pre><code>form.... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | [JavaScript post request like a form submit](https://stackoverflow.com/q/133925) shows you how to submit a form that you create via POST in JavaScript. Below is my modified code.
```
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "test.jsp");
var hiddenFie... | Add
```
<form target="_blank" ...></form>
```
or
```
form.setAttribute("target", "_blank");
```
to your form's definition. |
178,973 | <p>I'm a big fan of <a href="http://logging.apache.org/log4net" rel="noreferrer">log4net</a>, but recently, some (in my department) have questioned its inclusion in our projects because of the seemingly heaviness of each logging method. I would argue that there are better techniques than others, but that's another ques... | [
{
"answer_id": 179092,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"http://logging.apache.org/log4net/release/faq.html#perf-not-logging\" rel=\"nofollow noreferrer\">log4net FA... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5619/"
] | I'm a big fan of [log4net](http://logging.apache.org/log4net), but recently, some (in my department) have questioned its inclusion in our projects because of the seemingly heaviness of each logging method. I would argue that there are better techniques than others, but that's another question.
I'm curious to know, wha... | I am not familiar with log4net, or log.DebugFormat(...).
But the cost of logging is really in two areas.
The first is the logging call, and the second is the actual persisting of the log information.
The guards help reduce the logging call to a minimum when the logging is not actually necessary. It tends to be very ... |
178,976 | <p>I am wondering what everyone thinks the best method of handling results from your own database is. Other teams may be involved and there is always the chance the procedure/data could be altered and erroneous results would occur. My question is this. Is it better to let and exception occur, catch and log it or try to... | [
{
"answer_id": 178990,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>Personally I like failing fast - with an appropriately apologetic user message, of course. There are some things it's ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8873/"
] | I am wondering what everyone thinks the best method of handling results from your own database is. Other teams may be involved and there is always the chance the procedure/data could be altered and erroneous results would occur. My question is this. Is it better to let and exception occur, catch and log it or try to ha... | Personally I like failing fast - with an appropriately apologetic user message, of course. There are some things it's worth recovering from, but something like a column you expect to be non-null being null sounds more significant to me.
Of course, I'd also try to set up some smoke tests to make sure you find out about... |
178,977 | <p>In the Ajax toolkit you can use a Tab Container and add TabPanels to this. </p>
<p>I have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary. </p>
<p>My question is how do I reuse a panel on multiple tabs?
Essentially I after something like this</... | [
{
"answer_id": 179246,
"author": "Andy Brudtkuhl",
"author_id": 12442,
"author_profile": "https://Stackoverflow.com/users/12442",
"pm_score": 2,
"selected": true,
"text": "<p>Make the panel a user control and then drop the user control in each tab panel.</p>\n\n<pre><code><TabContaine... | 2008/10/07 | [
"https://Stackoverflow.com/questions/178977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] | In the Ajax toolkit you can use a Tab Container and add TabPanels to this.
I have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary.
My question is how do I reuse a panel on multiple tabs?
Essentially I after something like this
```
<TabContainer... | Make the panel a user control and then drop the user control in each tab panel.
```
<TabContainer>
<tabPanel1>
<contentTemplate>
<uc1:MyControl id="myControl" runat="server" />
</contentTemplate>
</tablPanel1>
<tabPanel2>
<contentTemplate>
<uc1:MyControl id="myControl2" runat="server" />... |
179,004 | <p>Every time I make a project I develop several generic routines/modules/libraries that I expect I'll be using with other projects.</p>
<p>Due to the speed of development I don't spend a lot of time making these modules perfect - just good enough for this project, and well enough documented and isolatable that I can ... | [
{
"answer_id": 179030,
"author": "Simon Howard",
"author_id": 24806,
"author_profile": "https://Stackoverflow.com/users/24806",
"pm_score": 0,
"selected": false,
"text": "<p>If the code is generic enough that you're using it in multiple projects, is it possible that you're reinventing th... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] | Every time I make a project I develop several generic routines/modules/libraries that I expect I'll be using with other projects.
Due to the speed of development I don't spend a lot of time making these modules perfect - just good enough for this project, and well enough documented and isolatable that I can easily add... | If you're using Subversion for all your projects, you can simply use `svn:externals`: this allows one repository to reference another repository, optionally fixed at a particular revision. For example,
```
svn://svn/shared
svn://svn/project1
|- dir1
|- dir2
\- svn:externals "shared -r 3 svn://svn/shared"
svn://s... |
179,014 | <p>I am using PHP with Apache on Linux, with Sendmail. I use the PHP <a href="http://php.net/manual/en/function.mail.php" rel="noreferrer"><code>mail</code></a> function. The email is sent, but the envelope has the <code>Apache_user@localhostname</code> in <code>MAIL FROM</code> (example nobody@conniptin.internal) and ... | [
{
"answer_id": 179061,
"author": "Lucas Oman",
"author_id": 6726,
"author_profile": "https://Stackoverflow.com/users/6726",
"pm_score": 7,
"selected": true,
"text": "<p>mail() has a 4th and 5th parameter (optional). The 5th argument is what should be passed as options directly to sendmai... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13667/"
] | I am using PHP with Apache on Linux, with Sendmail. I use the PHP [`mail`](http://php.net/manual/en/function.mail.php) function. The email is sent, but the envelope has the `Apache_user@localhostname` in `MAIL FROM` (example nobody@conniptin.internal) and some remote mail servers reject this because the domain doesn't ... | mail() has a 4th and 5th parameter (optional). The 5th argument is what should be passed as options directly to sendmail. I use the following:
```
mail('to@blah.com','subject!','body!','From: from@blah.com','-f from@blah.com');
``` |
179,026 | <p>In Gmail, I have a bunch of labeled messages.</p>
<p>I'd like to use an IMAP client to get those messages, but I'm not sure what the search incantation is.</p>
<pre><code>c = imaplib.IMAP4_SSL('imap.gmail.com')
c.list()
('OK', [..., '(\\HasNoChildren) "/" "GM"', ...])
c.search(???)
</code></pre>
<p>I'm not findin... | [
{
"answer_id": 179356,
"author": "Deestan",
"author_id": 6848,
"author_profile": "https://Stackoverflow.com/users/6848",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://mail.google.com/support/bin/answer.py?ctx=gmail&hl=en&answer=75725\" rel=\"noreferrer\">Labels a... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17732/"
] | In Gmail, I have a bunch of labeled messages.
I'd like to use an IMAP client to get those messages, but I'm not sure what the search incantation is.
```
c = imaplib.IMAP4_SSL('imap.gmail.com')
c.list()
('OK', [..., '(\\HasNoChildren) "/" "GM"', ...])
c.search(???)
```
I'm not finding many examples for this sort of ... | `imaplib` is intentionally a thin wrapper around the IMAP protocol, I assume to allow for a greater degree of user flexibility and a greater ability to adapt to changes in the IMAP specification. As a result, it doesn't really offer any structure for your search queries and requires you to be familiar with the [IMAP sp... |
179,054 | <p>I'm writing an app which for various reasons involves Internet Explorer (IE7, for the record), ActiveX controls, and a heroic amount of JavaScript, which is spread across multiple .js includes. </p>
<p>One of our remote testers is experiencing an error message and IE's error message says something to the effect of:... | [
{
"answer_id": 179076,
"author": "Matt R",
"author_id": 4298,
"author_profile": "https://Stackoverflow.com/users/4298",
"pm_score": 2,
"selected": false,
"text": "<p>The best way I found to debug javascript was to add several Response.Write() or alert message near the place i believed th... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2577/"
] | I'm writing an app which for various reasons involves Internet Explorer (IE7, for the record), ActiveX controls, and a heroic amount of JavaScript, which is spread across multiple .js includes.
One of our remote testers is experiencing an error message and IE's error message says something to the effect of:
```
Line... | In short. Not really. Try finding the error in FF first, and if that fails, you can get an almost as good debugger with [Visual Web Developer](http://www.berniecode.com/blog/2007/03/08/how-to-debug-javascript-with-visual-web-developer-express/). Debugging IE just sucks for the most part. |
179,072 | <p>So, I was looking over my standard cache utility when preparing to unit test a controller and thought, hey, is accessing the HttpRuntime.Cache directly considered harmful in MVC?</p>
<p>I wrap the cache in a proxy class that implements a cache-like interface (tho much simpler) so that I can mock it during tests. B... | [
{
"answer_id": 179433,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 1,
"selected": false,
"text": "<p>Add the OutputCache attribute to your controller action in order to tell the framework to cache the output for you. ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | So, I was looking over my standard cache utility when preparing to unit test a controller and thought, hey, is accessing the HttpRuntime.Cache directly considered harmful in MVC?
I wrap the cache in a proxy class that implements a cache-like interface (tho much simpler) so that I can mock it during tests. But I'm wond... | No, but the cache has changed in 3.5. 3.5 includes wrapper classes that make stubbing/mocking many of the static classes used in asp.net easy.
<http://www.codethinked.com/post/2008/12/04/Using-SystemWebAbstractions-in-Your-WebForms-Apps.aspx> |
179,085 | <p>What is the difference between creating one index across multiple columns versus creating multiple indexes, one <em>per</em> column?</p>
<p>Are there reasons why one should be used over the other?</p>
<p>For example:</p>
<pre><code>Create NonClustered Index IX_IndexName On TableName
(Column1 Asc, Column2 Asc, Column... | [
{
"answer_id": 179109,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 7,
"selected": false,
"text": "<p>Yes. I recommend you check out <a href=\"http://www.sqlskills.com/blogs/kimberly/category/indexes/\" rel=\"noreferre... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] | What is the difference between creating one index across multiple columns versus creating multiple indexes, one *per* column?
Are there reasons why one should be used over the other?
For example:
```
Create NonClustered Index IX_IndexName On TableName
(Column1 Asc, Column2 Asc, Column3 Asc)
```
Versus:
```
Create... | I agree with [Cade Roux](https://stackoverflow.com/a/179109/50776).
This article should get you on the right track:
* [Indexes in SQL Server 2005/2008 – Best Practices, Part 1](http://www.sqlskills.com/BLOGS/KIMBERLY/post.aspx?id=19f0ce1c-0d2f-4ad5-9b13-a615418422e0)
* [Indexes in SQL Server 2005/2008 – Part 2 – Inte... |
179,102 | <p>I want to get a <code>System.Type</code> given only the type name in a <code>string</code>.</p>
<p>For instance, if I have an object:</p>
<pre><code>MyClass abc = new MyClass();
</code></pre>
<p>I can then say:</p>
<pre><code>System.Type type = abc.GetType();
</code></pre>
<p>But what if all I have is:</p>
<pr... | [
{
"answer_id": 179110,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 5,
"selected": false,
"text": "<pre><code>Type type = Type.GetType(\"foo.bar.MyClass, foo.bar\");\n</code></pre>\n\n<p><a href=\"http://msdn.micros... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10722/"
] | I want to get a `System.Type` given only the type name in a `string`.
For instance, if I have an object:
```
MyClass abc = new MyClass();
```
I can then say:
```
System.Type type = abc.GetType();
```
But what if all I have is:
```
string className = "MyClass";
``` | ```
Type type = Type.GetType("foo.bar.MyClass, foo.bar");
```
[MSDN](http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx). Make sure the name is [Assembly Qualified](http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname.aspx). |
179,113 | <p>Say I've got two scheduled processes: A and B.</p>
<p>Given that B should not run until A has completed, how might I gracefully enforce this dependency?</p>
<p>Approaches that have been considered:</p>
<ol>
<li><p>Have A schedule B upon completion. This has the downside of B never being scheduled if for some reas... | [
{
"answer_id": 179118,
"author": "warren",
"author_id": 4418,
"author_profile": "https://Stackoverflow.com/users/4418",
"pm_score": 3,
"selected": true,
"text": "<p>Your option 1 directly answers your question: if B is dependent on A, and A fails, A not scheduling B means that B can't ha... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4061/"
] | Say I've got two scheduled processes: A and B.
Given that B should not run until A has completed, how might I gracefully enforce this dependency?
Approaches that have been considered:
1. Have A schedule B upon completion. This has the downside of B never being scheduled if for some reason A failed.
2. When B runs, h... | Your option 1 directly answers your question: if B is dependent on A, and A fails, A not scheduling B means that B can't happen.
Unless B merely has to run after A does, whether or not A was successful.
In that case, something like the following (in bash) would work:
```
A && B
``` |
179,123 | <p>I wrote the wrong thing in a commit message.</p>
<p>How can I change the message? The commit has not been pushed yet.</p>
| [
{
"answer_id": 179147,
"author": "EfForEffort",
"author_id": 14113,
"author_profile": "https://Stackoverflow.com/users/14113",
"pm_score": 15,
"selected": true,
"text": "<h1>Amending the most recent commit message</h1>\n<pre class=\"lang-sh prettyprint-override\"><code>git commit --amend... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] | I wrote the wrong thing in a commit message.
How can I change the message? The commit has not been pushed yet. | Amending the most recent commit message
=======================================
```sh
git commit --amend
```
will open your editor, allowing you to change the commit message of the most recent commit. Additionally, you can set the commit message directly in the command line with:
```sh
git commit --amend -m "New co... |
179,128 | <p>I'm starting a project which requires reading outlook msg files in c#. I have the specs for compound documents but am having trouble reading them in c#. Any pointers would be greatly appreciated.</p>
<p>Thanks.</p>
| [
{
"answer_id": 179205,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.aspx\" rel=\"nofollow noreferrer\">Ou... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16834/"
] | I'm starting a project which requires reading outlook msg files in c#. I have the specs for compound documents but am having trouble reading them in c#. Any pointers would be greatly appreciated.
Thanks. | Here is my shot. This is an initial translation of this [article](http://www.codeguru.com/cpp/cpp/cpp_mfc/files/article.php/c13487__1/).
```
namespace cs_console_app
{
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
[ComImport]
[Guid("0000000d-000... |
179,173 | <p>I have an XmlDocument that already exists and is read from a file. </p>
<p>I would like to add a chunk of Xml to a node in the document. Is there a good way to create and add all the nodes without cluttering my code with many .CreateNote and .AppendChild calls?</p>
<p>I would like some way of making a string or st... | [
{
"answer_id": 179191,
"author": "user7116",
"author_id": 7116,
"author_profile": "https://Stackoverflow.com/users/7116",
"pm_score": 8,
"selected": true,
"text": "<p>I suggest using <a href=\"http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createdocumentfragment.aspx\" re... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2871/"
] | I have an XmlDocument that already exists and is read from a file.
I would like to add a chunk of Xml to a node in the document. Is there a good way to create and add all the nodes without cluttering my code with many .CreateNote and .AppendChild calls?
I would like some way of making a string or stringBuilder of a ... | I suggest using [XmlDocument.CreateDocumentFragment](http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createdocumentfragment.aspx) if you have the data in free form strings. You'll still have to use AppendChild to add the fragment to a node, but you have the freedom of building the XML in your StringBuild... |
179,186 | <p>The problem is that the compiler says that there is a redefinition of a function between a library that belongs to MySQL and math.h from the std library.</p>
<p>I have been over this for two days and I still can't figure it out. </p>
<p>Has this ever happened to anyone?</p>
<p>This is the output from the compiler... | [
{
"answer_id": 179215,
"author": "TToni",
"author_id": 20703,
"author_profile": "https://Stackoverflow.com/users/20703",
"pm_score": 0,
"selected": false,
"text": "<p>In line 228 of c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h you should find a declaration/definiti... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366094/"
] | The problem is that the compiler says that there is a redefinition of a function between a library that belongs to MySQL and math.h from the std library.
I have been over this for two days and I still can't figure it out.
Has this ever happened to anyone?
This is the output from the compiler
---
```
C:\mingw\bin... | The problem was about an included library, which linux simply ignores, but windows want out. There is no problem letting it out in linux neither...
Somedays i feel SOOOOOOOOOOOOOOOOOOOOOOO STUPID:.. |
179,213 | <p>This is a multiple question for the same pre-processing instruction.</p>
<h2>1 - <> or "" ?</h2>
<p>Apart from the info found in the MSDN:</p>
<p><a href="https://msdn.microsoft.com/en-us/library/36k2cdd4.aspx" rel="noreferrer" title="#include Directive (C-C++)">#include Directive (C-C++)</a></p>
<p>... | [
{
"answer_id": 179244,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": 1,
"selected": false,
"text": "<p>If I remember right.</p>\n\n<p>You use the diamond for all libraries that can be found in your \"path\". So any library th... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14089/"
] | This is a multiple question for the same pre-processing instruction.
1 - <> or "" ?
--------------
Apart from the info found in the MSDN:
[#include Directive (C-C++)](https://msdn.microsoft.com/en-us/library/36k2cdd4.aspx "#include Directive (C-C++)")
1.a: What are the differences between the two notations?
1.b:... | After reading all answers, as well as compiler documentation, I decided I would follow the following standard.
For all files, be them project headers or external headers, always use the pattern:
```
#include <namespace/header.hpp>
```
The namespace being at least one directory deep, to avoid collision.
Of course, ... |
179,223 | <p>I want to add my own member to the StringBuilder class, but when I go to create it IntelliSense doesn't bring it up.</p>
<pre><code>public class myStringBuilder()
Inherits System.Text.[StringBuilder should be here]
....
end class
</code></pre>
<p>Is it even possible? thanks</p>
| [
{
"answer_id": 179235,
"author": "bdukes",
"author_id": 2688,
"author_profile": "https://Stackoverflow.com/users/2688",
"pm_score": 2,
"selected": false,
"text": "<p>No, <a href=\"http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx\" rel=\"nofollow noreferrer\">StringB... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I want to add my own member to the StringBuilder class, but when I go to create it IntelliSense doesn't bring it up.
```
public class myStringBuilder()
Inherits System.Text.[StringBuilder should be here]
....
end class
```
Is it even possible? thanks | `StringBuilder` is `NotInheritable` (aka `sealed` in C#) so you cannot derive from it. You could try wrapping `StringBuilder` in your own class or consider using [extension methods](http://msdn.microsoft.com/en-us/library/bb384936.aspx) instead. |
179,254 | <p>Has anyone got this working in a web application? </p>
<p>No matter what I do it seems that my appSettings section (redirected from web.config using appSettings file=".\Site\site.config") does not get reloaded. </p>
<p>Am I doomed to the case of having to just restart the application? I was hoping this method woul... | [
{
"answer_id": 179360,
"author": "Seibar",
"author_id": 357,
"author_profile": "https://Stackoverflow.com/users/357",
"pm_score": -1,
"selected": false,
"text": "<p>The App.Config settings are cached in memory when the application starts. For this reason, I don't think you'll be able to ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Has anyone got this working in a web application?
No matter what I do it seems that my appSettings section (redirected from web.config using appSettings file=".\Site\site.config") does not get reloaded.
Am I doomed to the case of having to just restart the application? I was hoping this method would lead me to a mo... | Make sure you are passing the correct [case sensitive](http://en.wikipedia.org/wiki/Case_sensitivity) value to RefreshSection, i.e.
```
ConfigurationManager.RefreshSection("appSettings");
``` |
179,255 | <p>If I have an Address object which implements IEditableObject, I might have EndEdit implementation like this:</p>
<pre><code>public void EndEdit()
{
// BeginEdit would set _editInProgress and update *Editing fields;
if (_editInProgress)
{
_line1 = _line1Editing;
_line2 = _line2Editing;
... | [
{
"answer_id": 179458,
"author": "akmad",
"author_id": 1314,
"author_profile": "https://Stackoverflow.com/users/1314",
"pm_score": 1,
"selected": false,
"text": "<p>First off, Kent is correct in wondering why setting a field would throw an exception.<br>\nIgnoring that question; you coul... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25856/"
] | If I have an Address object which implements IEditableObject, I might have EndEdit implementation like this:
```
public void EndEdit()
{
// BeginEdit would set _editInProgress and update *Editing fields;
if (_editInProgress)
{
_line1 = _line1Editing;
_line2 = _line2Editing;
_city = ... | First off, Kent is correct in wondering why setting a field would throw an exception.
Ignoring that question; you could just use a simple:
```
try {
//do stuff
}
catch (Exception ex) {
//reset
//rethrow exception
throw;
}
```
The complications come in with regards to what constitutes the reset value for ... |
179,259 | <p>In my app I have these Hibernate-mapped types (general case):</p>
<pre><code>class RoleRule {
private Role role;
private PermissionAwareEntity entity; // hibernate-mapped entity for which permission is granted
private PermissionType permissionType; // enum
@ManyToOne
@JoinColumn(name = "ROLE_ID")
publi... | [
{
"answer_id": 179324,
"author": "toolkit",
"author_id": 3295,
"author_profile": "https://Stackoverflow.com/users/3295",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure if this is the solution, but you might want to try:</p>\n\n<pre><code>@OneToMany(mappedBy = \"role\")\n</cod... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2819/"
] | In my app I have these Hibernate-mapped types (general case):
```
class RoleRule {
private Role role;
private PermissionAwareEntity entity; // hibernate-mapped entity for which permission is granted
private PermissionType permissionType; // enum
@ManyToOne
@JoinColumn(name = "ROLE_ID")
public Role getRole... | I've generally used two methods of updating a collection (the many side of a one-to-many) in Hibernate. The brute force way is to clear the collection, call save on the parent, and then call flush. Then add all of the collection members back and call save on the parent again. This will delete all and then insert all. T... |
179,264 | <p>I have an ASP.Net 3.5 platform and windows 2003 server with all the updates. </p>
<p>There is a limit with .Net that it cannot handle more than <a href="http://forums.iis.net/p/1105360/1689855.aspx" rel="noreferrer">260 characters</a>. Moreover if you look it up on web, you will find that IE 6 fails to work if it i... | [
{
"answer_id": 179271,
"author": "Mike Fielden",
"author_id": 4144,
"author_profile": "https://Stackoverflow.com/users/4144",
"pm_score": 0,
"selected": false,
"text": "<p>More information is needed but for normal situations I would say try to keep it under 150 for sure. If for nothing e... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9498/"
] | I have an ASP.Net 3.5 platform and windows 2003 server with all the updates.
There is a limit with .Net that it cannot handle more than [260 characters](http://forums.iis.net/p/1105360/1689855.aspx). Moreover if you look it up on web, you will find that IE 6 fails to work if it is not patched at above 100 charcters. ... | A Url is path + querystring, and the linked article only talks about limiting the path. Therefore, if you're using asp.net, don't exceed a path of 260 characters. Less than 260 will always work, and asp.net has no troubles with long querystrings.
```
http://somewhere.com/directory/filename.aspx?id=1234
... |
179,287 | <p>Let's say I have an existing trivial XML file named 'MyData.xml' that contains the following:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<myElement>foo</myElement>
</code></pre>
<p>I want to change the text value of 'foo' to 'bar' resulting in the following:</p>
<pre><code><?xml v... | [
{
"answer_id": 179305,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 2,
"selected": false,
"text": "<p>For quick, non-critical XML manipulations, i really like <a href=\"http://ponderer.org/p4x\" rel=\"nofollow noreferrer\"... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | Let's say I have an existing trivial XML file named 'MyData.xml' that contains the following:
```
<?xml version="1.0" encoding="utf-8" ?>
<myElement>foo</myElement>
```
I want to change the text value of 'foo' to 'bar' resulting in the following:
```
<?xml version="1.0" encoding="utf-8" ?>
<myElement>bar</myElement... | Use Python's [minidom](http://docs.python.org/library/xml.dom.minidom.html)
Basically you will take the following steps:
1. Read XML data into DOM object
2. Use DOM methods to modify the document
3. Save new DOM object to new XML document
The python spec should hold your hand rather nicely though this process. |
179,288 | <p>Say I have 3 frames in a frameset arranged in 3 rows. Frames 1 and 3 are from my site and frame 2 (the central one) is from an external website. Is there a cunning way to force the browser to centre align the data in frame 2?</p>
<p>I've found a small work-around which uses a frameset within a frameset which has 2 ... | [
{
"answer_id": 179403,
"author": "Mnebuerquo",
"author_id": 5114,
"author_profile": "https://Stackoverflow.com/users/5114",
"pm_score": 3,
"selected": true,
"text": "<p>I think what you are looking for is a way to inject some CSS into the other frame, even though it comes from another si... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21299/"
] | Say I have 3 frames in a frameset arranged in 3 rows. Frames 1 and 3 are from my site and frame 2 (the central one) is from an external website. Is there a cunning way to force the browser to centre align the data in frame 2?
I've found a small work-around which uses a frameset within a frameset which has 2 blank colu... | I think what you are looking for is a way to inject some CSS into the other frame, even though it comes from another site.
I think this will not be possible without a server side script to request the page and modify it.
Javascript has ways to modify other frames using window.frames[] and using DOM traversal just lik... |
179,291 | <p>I'm looking to call a subprocess with a file descriptor opened to a given pipe such that the open() call does not hang waiting for the other side of the pipe to receive a connection.</p>
<p>To demonstrate:</p>
<pre><code>$ mkfifo /tmp/foobar.pipe
$ some_program --command-fd=5 5</tmp/foobar.pipe
</code></pre>
<... | [
{
"answer_id": 179345,
"author": "Sec",
"author_id": 20555,
"author_profile": "https://Stackoverflow.com/users/20555",
"pm_score": 2,
"selected": false,
"text": "<p>The only way I know getting this kind of result is a hack:</p>\n\n<pre><code>mkfifo /tmp/foobar.in\nmkfifo /tmp/foobar.out\... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14122/"
] | I'm looking to call a subprocess with a file descriptor opened to a given pipe such that the open() call does not hang waiting for the other side of the pipe to receive a connection.
To demonstrate:
```
$ mkfifo /tmp/foobar.pipe
$ some_program --command-fd=5 5</tmp/foobar.pipe
```
In this case, `some_program` is no... | Opening the FD read/write rather than read-only when setting up the pipeline prevents blocking.
To be a bit more specific:
```
$ mkfifo /tmp/foobar.pipe
$ some_program --command-fd=5 5<>/tmp/foobar.pipe
```
prevents the undesired blocking behavior, as `5<>/tmp/foobar.pipe` opens in RW mode (as opposed to opening in... |
179,299 | <p>I'm fairly new at programming, but I've wondered how shell text editors such as vim, emacs, nano, etc are able to control the command-line window. I'm primarily a Windows programmer, so maybe it's different on *nix. As far as I know, it's only possible to print text to a console, and ask for input. How do text ed... | [
{
"answer_id": 179301,
"author": "EfForEffort",
"author_id": 14113,
"author_profile": "https://Stackoverflow.com/users/14113",
"pm_score": 2,
"selected": false,
"text": "<p>Learning about <a href=\"http://www.gnu.org/software/ncurses/\" rel=\"nofollow noreferrer\">ncurses</a> might be a ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25870/"
] | I'm fairly new at programming, but I've wondered how shell text editors such as vim, emacs, nano, etc are able to control the command-line window. I'm primarily a Windows programmer, so maybe it's different on \*nix. As far as I know, it's only possible to print text to a console, and ask for input. How do text editors... | By using libraries such as the following which, in turn, use escape character sequences
```
NAME
ncurses - CRT screen handling and optimization package
SYNOPSIS
#include
DESCRIPTION
The ncurses library routines give the user a terminal-independent
method of updating character screens with re... |
179,337 | <p>In c#</p>
<pre><code>double tmp = 3.0 * 0.05;
</code></pre>
<p>tmp = 0.15000000000000002</p>
<p>This has to do with money. The value is really $0.15, but the system wants to round it up to $0.16. 0.151 should probably be rounded up to 0.16, but not 0.15000000000000002</p>
<p>What are some ways I can get the corr... | [
{
"answer_id": 179346,
"author": "AaronSieb",
"author_id": 16911,
"author_profile": "https://Stackoverflow.com/users/16911",
"pm_score": 5,
"selected": true,
"text": "<p>Use a fixed-point variable type, or a base ten floating point type like Decimal. Floating point numbers are always so... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3800/"
] | In c#
```
double tmp = 3.0 * 0.05;
```
tmp = 0.15000000000000002
This has to do with money. The value is really $0.15, but the system wants to round it up to $0.16. 0.151 should probably be rounded up to 0.16, but not 0.15000000000000002
What are some ways I can get the correct numbers (ie 0.15, or 0.16 if the dec... | Use a fixed-point variable type, or a base ten floating point type like Decimal. Floating point numbers are always somewhat inaccurate, and binary floating point representations add another layer of inaccuracy when they convert to/from base two. |
179,355 | <p>How do you delete all the cookies for the current domain using JavaScript?</p>
| [
{
"answer_id": 179386,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 4,
"selected": false,
"text": "<p>As far as I know there's no way to do a blanket delete of any cookie set on the domain. You can clear a cookie if you kno... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3636/"
] | How do you delete all the cookies for the current domain using JavaScript? | ```
function deleteAllCookies() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 ... |
179,365 | <p>I am trying this:</p>
<pre><code>Provider=MSDASQL.1;Persist Security Info=False;User ID=sys;Password=pwd;Initial Catalog=DATABASE;Data Source=OdbcDataSource;DBA Privilege=SYSDBA
</code></pre>
<p>But I get the error:</p>
<pre><code>[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
</code></pre>
<... | [
{
"answer_id": 179383,
"author": "Matt R",
"author_id": 4298,
"author_profile": "https://Stackoverflow.com/users/4298",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure what you mean by connecting as a SYS, but there here is a link to sweet repository of <a href=\"http://www.co... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] | I am trying this:
```
Provider=MSDASQL.1;Persist Security Info=False;User ID=sys;Password=pwd;Initial Catalog=DATABASE;Data Source=OdbcDataSource;DBA Privilege=SYSDBA
```
But I get the error:
```
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
```
I'm using Delphi, but answers in any language a... | You can't connect as SYSDBA using standard System.Data.OracleClient, as stated by this post : <http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2245591&SiteID=1>.
You can do that using ODP .NET (Oracle Data Provider for .NET), or other third parties library. If you're planning to build serious Oracle Application ... |
179,369 | <p>I have a simple Python script that I want to stop executing if a condition is met.</p>
<p>For example:</p>
<pre><code>done = True
if done:
# quit/stop/exit
else:
# do other stuff
</code></pre>
<p>Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a fun... | [
{
"answer_id": 179375,
"author": "Sec",
"author_id": 20555,
"author_profile": "https://Stackoverflow.com/users/20555",
"pm_score": 2,
"selected": false,
"text": "<p>exit() should do the trick</p>\n"
},
{
"answer_id": 179376,
"author": "Dana",
"author_id": 7856,
"autho... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | I have a simple Python script that I want to stop executing if a condition is met.
For example:
```
done = True
if done:
# quit/stop/exit
else:
# do other stuff
```
Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a function which allows the flow of th... | To exit a script you can use,
```
import sys
sys.exit()
```
You can also provide an exit status value, usually an integer.
```
import sys
sys.exit(0)
```
Exits with zero, which is generally interpreted as success. Non-zero codes are usually treated as errors. The default is to exit with zero.
```
import sys
sys.... |
179,405 | <p>Can anyone explain what this mod_rewrite rule is doing?</p>
<p>I'm trying to comment the file, but the code seems to state the opposite of what I think it's doing</p>
<pre><code># Enable rewriting of URLs
RewriteEngine on
# Allow specified file types to be accessed
# Thing to test = URL
# Condition = not startin... | [
{
"answer_id": 179413,
"author": "Sec",
"author_id": 20555,
"author_profile": "https://Stackoverflow.com/users/20555",
"pm_score": 2,
"selected": false,
"text": "<p>If the URL does not start with index.php or images or css or js or robots.txt, the string \"/index.php/\" is prefixed.</p>\... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4196/"
] | Can anyone explain what this mod\_rewrite rule is doing?
I'm trying to comment the file, but the code seems to state the opposite of what I think it's doing
```
# Enable rewriting of URLs
RewriteEngine on
# Allow specified file types to be accessed
# Thing to test = URL
# Condition = not starting with
RewriteCond ... | ```
^ = begin of line
( = begin group
.* = any character, any number of times
) = end group
```
The $1 in the second part is replaced by the group in the first part.
Is this a Symfony rule? The idea is to pass the whole query string to the index.php (the front controller) as a parameter, so that the front controller... |
179,427 | <p>Seems like the subtraction is triggering some kind of issue and the resulting value is wrong.</p>
<pre><code>double tempCommission = targetPremium.doubleValue()*rate.doubleValue()/100d;
</code></pre>
<p>78.75 = 787.5 * 10.0/100d</p>
<pre><code>double netToCompany = targetPremium.doubleValue() - tempCommission;
</... | [
{
"answer_id": 179437,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "<p>See responses to <a href=\"https://stackoverflow.com/questions/178952/adding-floats-with-gmp-gives-correct-result... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25881/"
] | Seems like the subtraction is triggering some kind of issue and the resulting value is wrong.
```
double tempCommission = targetPremium.doubleValue()*rate.doubleValue()/100d;
```
78.75 = 787.5 \* 10.0/100d
```
double netToCompany = targetPremium.doubleValue() - tempCommission;
```
708.75 = 787.5 - 78.75
```
doub... | To control the precision of floating point arithmetic, you should use [java.math.BigDecimal](http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html). Read [The need for BigDecimal](https://blogs.oracle.com/CoreJavaTechTips/entry/the_need_for_bigdecimal) by John Zukowski for more information.
Given your exampl... |
179,439 | <p>I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this into a "Java" project?</p>
<p>I'm using Eclipse version 3.3.2.</p>
| [
{
"answer_id": 179450,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 8,
"selected": true,
"text": "<p>Open the .project file and add java nature and builders.</p>\n\n<pre class=\"lang-xml prettyprint-override\"><code... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5917/"
] | I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this into a "Java" project?
I'm using Eclipse version 3.3.2. | Open the .project file and add java nature and builders.
```xml
<projectDescription>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.c... |
179,448 | <p>on KDE, there's a possibility to execute a command when some event happen.
for example one can execute a script when kmail receives a mail or when a akregator fetches a new feed.</p>
<p>I want to execute the script on a way I can retrieve the mail/feed subject in my script.
is there a possibility to specify the pro... | [
{
"answer_id": 179456,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 5,
"selected": true,
"text": "<p>With my <a href=\"http://pd.acm.org/\" rel=\"noreferrer\">ACM membership</a>, I get access to both Safari and Books24x... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65724/"
] | on KDE, there's a possibility to execute a command when some event happen.
for example one can execute a script when kmail receives a mail or when a akregator fetches a new feed.
I want to execute the script on a way I can retrieve the mail/feed subject in my script.
is there a possibility to specify the program to ex... | With my [ACM membership](http://pd.acm.org/), I get access to both Safari and Books24x7 (this includes Apress).
The selection is reduced from the total offering of those sites (600 in Safari only available to professional members and 500 in Books24x7 available to both student and professional members), but I find it's... |
179,466 | <p>I'm creating a self updating app where I have the majority of the code in a seperate DLL. It's command line and will eventually be run on Mono. I'm just trying to get this code to work in C# on windows at the command line.</p>
<p>How can I create a c# application that I can delete a supporting dll while its running... | [
{
"answer_id": 179477,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 3,
"selected": false,
"text": "<p>The only way I've ever managed something similar is to have the DLL in a separate AppDomain to the assembly that is ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253/"
] | I'm creating a self updating app where I have the majority of the code in a seperate DLL. It's command line and will eventually be run on Mono. I'm just trying to get this code to work in C# on windows at the command line.
How can I create a c# application that I can delete a supporting dll while its running?
```
App... | The only way I've ever managed something similar is to have the DLL in a separate AppDomain to the assembly that is trying to delete it. I unload the other AppDomain and then delete the DLL from disk.
If you're looking for a way to perform the update, off the top of my head I would go for a stub exe that spawns the re... |
179,468 | <p>What I want to do is set the focus to a specific control (specifically a <code>TextBox</code>) on a tab page when that tab page is selected.</p>
<p>I've tried to call <code>Focus</code> during the Selected event of the containing tab control, but that isn't working. After that I tried to call focus during the <code... | [
{
"answer_id": 179499,
"author": "itsmatt",
"author_id": 7862,
"author_profile": "https://Stackoverflow.com/users/7862",
"pm_score": 4,
"selected": true,
"text": "<p>I did this and it seems to work:</p>\n\n<p>Handle the <code>SelectedIndexChanged</code> for the <code>tabControl</code>.\n... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440933/"
] | What I want to do is set the focus to a specific control (specifically a `TextBox`) on a tab page when that tab page is selected.
I've tried to call `Focus` during the Selected event of the containing tab control, but that isn't working. After that I tried to call focus during the `VisibleChanged` event of the control... | I did this and it seems to work:
Handle the `SelectedIndexChanged` for the `tabControl`.
Check if `tabControl1.SelectedIndex` == the one I want and
call `textBox.Focus();`
I'm using VS 2008, BTW.
---
Something like this worked:
```
private void tabControl1_selectedIndexChanged(object sender, EventArgs e)
{
if ... |
179,472 | <p>I need to export a SL DataGrid to HTML so my users can then print it. Can someone put me in the right direction?</p>
<p>Upate: After reading Rob's answer I am changing my question. Instead of Silverlight Grid to HTML, I now just want to export it to PDF. Has anyone used any 3rd party PDF generators with Silverlight... | [
{
"answer_id": 179499,
"author": "itsmatt",
"author_id": 7862,
"author_profile": "https://Stackoverflow.com/users/7862",
"pm_score": 4,
"selected": true,
"text": "<p>I did this and it seems to work:</p>\n\n<p>Handle the <code>SelectedIndexChanged</code> for the <code>tabControl</code>.\n... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23663/"
] | I need to export a SL DataGrid to HTML so my users can then print it. Can someone put me in the right direction?
Upate: After reading Rob's answer I am changing my question. Instead of Silverlight Grid to HTML, I now just want to export it to PDF. Has anyone used any 3rd party PDF generators with Silverlight? | I did this and it seems to work:
Handle the `SelectedIndexChanged` for the `tabControl`.
Check if `tabControl1.SelectedIndex` == the one I want and
call `textBox.Focus();`
I'm using VS 2008, BTW.
---
Something like this worked:
```
private void tabControl1_selectedIndexChanged(object sender, EventArgs e)
{
if ... |
179,480 | <p>Provided I have admin access, I need a way to manage (Create, modify, remove) local accounts in a remote machine from an ASP.NET client.</p>
<p>I'm clueless in how to approach this. Is WMI a possibility (System.Management namespace)?
Any pointers?</p>
| [
{
"answer_id": 179561,
"author": "sebagomez",
"author_id": 23893,
"author_profile": "https://Stackoverflow.com/users/23893",
"pm_score": 0,
"selected": false,
"text": "<p>I used System.DirectoryServices to get data from users in a n ActiveDirectory (LDAP).\nI don't know if that's the kin... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25885/"
] | Provided I have admin access, I need a way to manage (Create, modify, remove) local accounts in a remote machine from an ASP.NET client.
I'm clueless in how to approach this. Is WMI a possibility (System.Management namespace)?
Any pointers? | Give this a try:
```
DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://ComputerName" & ",computer", "AdminUN", "AdminPW");
DirectoryEntry user = directoryEntry.Children.Add("username", "user");
user.Invoke("SetPassword", new object[] { "password"});
ser.CommitChanges();
```
If you do need to go the Active ... |
179,488 | <p>Is there a list somewhere on common Attributes which are used in objects like <code>Serializable</code>?</p>
<p>Thanks</p>
<p>Edit ~ The reason I asked is that I came across an StoredProcedure attribute in ntiers ORMS.</p>
| [
{
"answer_id": 179496,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 5,
"selected": true,
"text": "<p>Yes, look msdn has you covered please look <a href=\"http://msdn.microsoft.com/en-us/library/system.attribute.aspx#in... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | Is there a list somewhere on common Attributes which are used in objects like `Serializable`?
Thanks
Edit ~ The reason I asked is that I came across an StoredProcedure attribute in ntiers ORMS. | Yes, look msdn has you covered please look [here](http://msdn.microsoft.com/en-us/library/system.attribute.aspx#inheritanceContinued).
EDIT: This link only answer sucked. Here is a working extractor for all loadable types (gac) that have Attribute in the name.
```
using System;
using System.Collections.Generic;
usin... |
179,510 | <p>Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?</p>
| [
{
"answer_id": 179525,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 3,
"selected": false,
"text": "<p>Try adding this:</p>\n\n<pre><code>onclick=\"this.blur()\"\n</code></pre>\n\n<p>Discussed here as well</p>\n\n<p><a hr... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] | Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely? | Do you mean the dotted outline of a target?
Try:
```
:focus {
outline: 0;
}
```
This would remove all focus outlines. IT's essentially the same as onclick in JavaScript terms. You might prefer to apply this to `a:focus`. |
179,539 | <p>If I have $var defined in Page1.php and in Page2.php I have</p>
<pre>
//Page2.php
include('Page1.php');
echo $var;
</pre>
<p>For what reasons will it not print the value of $var to the screen? The files are in the same directory so paths shouldn't be the issue. I've checked the php.ini file and nothing really ... | [
{
"answer_id": 179552,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 2,
"selected": false,
"text": "<p>Possible causes:</p>\n\n<ul>\n<li>The current working path isn't always the same as the file's. For example, if Page2.php i... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24059/"
] | If I have $var defined in Page1.php and in Page2.php I have
```
//Page2.php
include('Page1.php');
echo $var;
```
For what reasons will it not print the value of $var to the screen? The files are in the same directory so paths shouldn't be the issue. I've checked the php.ini file and nothing really jumps out at me.... | If it were a path problem you would see a warning in your error log. You could also change to require instead of include and it would become obvious.
```
echo getcwd();
```
You can also print your working directory to figure out what's wrong.
Is $var created in a function? If so, make sure you have
```
global $va... |
179,556 | <p>Like the title says, If I place an <code>app_offline.htm</code> in the application root, will it cut off currently running requests, or just new ones?</p>
| [
{
"answer_id": 179609,
"author": "Brian Kim",
"author_id": 5704,
"author_profile": "https://Stackoverflow.com/users/5704",
"pm_score": 3,
"selected": false,
"text": "<p>From ScottGu's blog:</p>\n\n<blockquote>\n <p>Basically, if you place a file with\n this name in the root of a web\n ... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16172/"
] | Like the title says, If I place an `app_offline.htm` in the application root, will it cut off currently running requests, or just new ones? | Here is my lame experiment; I created an ASPX page with the following code:
```cs
protected void Page_Load(object sender, EventArgs e)
{
Response.BufferOutput = false;
Response.Write("Step 1<br />");
System.Threading.Thread.Sleep(10000);
Response.Write("Step 2<br />");
System.Threading.Thread.Sleep... |
179,565 | <p>If yes, on which operating system, shell or whatever?</p>
<p>Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):</p>
<pre><code>public class ExitCode {
public static void main(String args[]) {
Syst... | [
{
"answer_id": 179652,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://Stackoverflow.com/users/15168",
"pm_score": 6,
"selected": true,
"text": "<h3>Using <code>wait()</code> or <code>waitpid()</code></h3>\n\n<p>It is not possible on Unix and derivatives usin... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25891/"
] | If yes, on which operating system, shell or whatever?
Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):
```
public class ExitCode {
public static void main(String args[]) {
System.exit(Integer.parse... | ### Using `wait()` or `waitpid()`
It is not possible on Unix and derivatives using POSIX functions like [`wait()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html) and [`waitpid()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html). The exit status information returned consist... |
179,582 | <p>I'm primarily interested in pgsql for this, but I was wondering if there is a way in any RDBMS to do an insert operation, <em>without</em> disabling and re-enabling any FOREIGN KEY or NOT NULL constraints, on two tables that refer to each other. (You might think of this as a chicken that was somehow born from its o... | [
{
"answer_id": 179651,
"author": "Neall",
"author_id": 619,
"author_profile": "https://Stackoverflow.com/users/619",
"pm_score": 3,
"selected": true,
"text": "<p>I think that you answered your own question - you have to make a transaction block. In PostgreSQL this should work:</p>\n\n<pr... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16777/"
] | I'm primarily interested in pgsql for this, but I was wondering if there is a way in any RDBMS to do an insert operation, *without* disabling and re-enabling any FOREIGN KEY or NOT NULL constraints, on two tables that refer to each other. (You might think of this as a chicken that was somehow born from its own egg.)
F... | I think that you answered your own question - you have to make a transaction block. In PostgreSQL this should work:
```
BEGIN;
SET CONSTRAINTS ALL DEFERRED;
INSERT INTO questions (questionid, answerid, question)
VALUES (1, 100, 'How long are Abraham Lincoln\'s legs?');
INSERT INTO answers (answerid, questionid, an... |
179,619 | <p>Why is it that there are two kinds of references in xaml.</p>
<p>One looks like this:</p>
<pre><code>xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
</code></pre>
<p>But mine look like this:</p>
<pre><code>xmlns:WPFToolKit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
</code></pre>
<p>W... | [
{
"answer_id": 179632,
"author": "user7116",
"author_id": 7116,
"author_profile": "https://Stackoverflow.com/users/7116",
"pm_score": 4,
"selected": true,
"text": "<p>The second instance is basically an unmapped, but explicit reference to a namespace in an assembly. The first instance is... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] | Why is it that there are two kinds of references in xaml.
One looks like this:
```
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
```
But mine look like this:
```
xmlns:WPFToolKit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
```
Why can't I do this:
```
xmlns:local="http://myschema.my... | The second instance is basically an unmapped, but explicit reference to a namespace in an assembly. The first instance is a mapped reference to a namespace in some assembly referenced by your project. [XAML Namespaces and Namespace Mapping](http://msdn.microsoft.com/en-us/library/ms747086.aspx), over at MSDN explains t... |
179,625 | <p>In SQL Server 2017, you can use this syntax, but not in earlier versions:</p>
<pre><code>SELECT Name = TRIM(Name) FROM dbo.Customer;
</code></pre>
| [
{
"answer_id": 179630,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 9,
"selected": true,
"text": "<pre><code>SELECT LTRIM(RTRIM(Names)) AS Names FROM Customer\n</code></pre>\n"
},
{
"answer_id": 179637,
"a... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6522/"
] | In SQL Server 2017, you can use this syntax, but not in earlier versions:
```
SELECT Name = TRIM(Name) FROM dbo.Customer;
``` | ```
SELECT LTRIM(RTRIM(Names)) AS Names FROM Customer
``` |
179,653 | <p>I want to take the value stored in a 32 bit unsigned int, put it into four chars and then store the integer value of each of these chars in a string.</p>
<p>I think the first part goes like this:</p>
<pre><code>char a = orig << 8;
char b = orig << 8;
char c = orig << 8;
char d = orig << 8;
... | [
{
"answer_id": 179666,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 1,
"selected": false,
"text": "<p>Not quite:</p>\n\n<pre><code>char a = orig & 0xff;\norig >>= 8;\nchar b = orig & 0xff;\norig >>=... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1449/"
] | I want to take the value stored in a 32 bit unsigned int, put it into four chars and then store the integer value of each of these chars in a string.
I think the first part goes like this:
```
char a = orig << 8;
char b = orig << 8;
char c = orig << 8;
char d = orig << 8;
``` | If you really want to extract the individual bytes first:
```
unsigned char a = orig & 0xff;
unsigned char b = (orig >> 8) & 0xff;
unsigned char c = (orig >> 16) & 0xff;
unsigned char d = (orig >> 24) & 0xff;
```
Or:
```
unsigned char *chars = (unsigned char *)(&orig);
unsigned char a = chars[0];
unsigned char b = ... |
179,665 | <p>I have an array <code>NSMutableArray</code> with happy objects. These objects viciously turn on (leak) me whenever I try to clear the array of all the objects and repopulate it.</p>
<p>It's allocated in the init function like so</p>
<pre><code>self.list = [NSMutableArray array];
</code></pre>
<p>The different met... | [
{
"answer_id": 179695,
"author": "Elfred",
"author_id": 12636,
"author_profile": "https://Stackoverflow.com/users/12636",
"pm_score": 2,
"selected": false,
"text": "<p>what does your <code>@property</code> declaration look like? are you synthesizing the accessors? If so, you need <code>@... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25004/"
] | I have an array `NSMutableArray` with happy objects. These objects viciously turn on (leak) me whenever I try to clear the array of all the objects and repopulate it.
It's allocated in the init function like so
```
self.list = [NSMutableArray array];
```
The different methods I have used to clear it out include:
`... | How did you create the objects that are leaking?
If you did something like this:
```
- (void)addObjectsToArray {
[list addObject:[[MyClass alloc] init];
OtherClass *anotherObject = [[OtherClass alloc] init];
[list addObject:anotherObject];
}
```
then you will leak two objects when list is deallocated.
... |
179,668 | <p>I tried doing this:</p>
<pre><code>root.addEventListener("click",
function ()
{
navigateToURL(ClickURLRequest,"_self");
});
</code></pre>
<p>And it does add the event listener. I like using closures because they work well in this situation,</p>
<p>however, removing the event listener requires a... | [
{
"answer_id": 179750,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 2,
"selected": false,
"text": "<p>You can think of the function() keyword as a constructor, creating a new object (a closure) each time. Therefore, if yo... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | I tried doing this:
```
root.addEventListener("click",
function ()
{
navigateToURL(ClickURLRequest,"_self");
});
```
And it does add the event listener. I like using closures because they work well in this situation,
however, removing the event listener requires a reference to the original functi... | Here's a generic way of removing event listeners that i have used on production projects
```
addEventListener
(
Event.ACTIVATE,
function(event:Event):void
{
(event.target as EventDispatcher).removeEventListener(event.type, arguments.callee)
}
)
``` |
179,676 | <p>What is the best way to get a file (in this case, a .PDF, but any file will do) from a WebResponse and put it into a MemoryStream? Using .GetResponseStream() from WebResponse gets a Stream object, but if you want to convert that Stream to a specific type of stream, what do you do?</p>
| [
{
"answer_id": 179990,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Copied this from the web a year or so ago.</p>\n\n<pre><code>//---------- Start HttpResponse\nif(objHttpWebResponse.StatusC... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the best way to get a file (in this case, a .PDF, but any file will do) from a WebResponse and put it into a MemoryStream? Using .GetResponseStream() from WebResponse gets a Stream object, but if you want to convert that Stream to a specific type of stream, what do you do? | There is a serious issue with SoloBold's [answer](https://stackoverflow.com/questions/179676/how-do-i-put-a-webresponse-into-a-memory-stream/179712#179712) that I discovered while testing it. When using it to read a file via an `FtpWebRequest` into a `MemoryStream` it intermittently failed to read the entire stream int... |
179,700 | <p>Is there a way to take a class name and convert it to a string in C#? </p>
<p>As part of the Entity Framework, the .Include method takes in a dot-delimited list of strings to join on when performing a query. I have the class model of what I want to join, and for reasons of refactoring and future code maintenance, I... | [
{
"answer_id": 179711,
"author": "Max Schmeling",
"author_id": 3226,
"author_profile": "https://Stackoverflow.com/users/3226",
"pm_score": 7,
"selected": false,
"text": "<p>You can't use <code>.GetType()</code> without an instance because <code>GetType</code> is a method.</p>\n\n<p>You c... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24841/"
] | Is there a way to take a class name and convert it to a string in C#?
As part of the Entity Framework, the .Include method takes in a dot-delimited list of strings to join on when performing a query. I have the class model of what I want to join, and for reasons of refactoring and future code maintenance, I want to b... | [Include requires a property name](http://msdn.microsoft.com/en-us/library/bb738708.aspx), not a class name. Hence, it's the name of the property you want, not the name of its type. [You can get that with reflection](http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.aspx). |
179,706 | <p>I am writing a site that uses strongly typed datasets. </p>
<p>The DBA who created the table made gave a column a value that represents a negative. The column is 'Do_Not_Estimate_Flag' where the column can contain 'T' or 'F'. I can't change the underlying table or the logic that fills it. What I want to do is to ad... | [
{
"answer_id": 179820,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 2,
"selected": true,
"text": "<p>The DataBinder will see that you're binding to a DataRow and use its fields rather than any property you define. </p>\n\n<p... | 2008/10/07 | [
"https://Stackoverflow.com/questions/179706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] | I am writing a site that uses strongly typed datasets.
The DBA who created the table made gave a column a value that represents a negative. The column is 'Do\_Not\_Estimate\_Flag' where the column can contain 'T' or 'F'. I can't change the underlying table or the logic that fills it. What I want to do is to add a 'ES... | The DataBinder will see that you're binding to a DataRow and use its fields rather than any property you define.
You could create a method to do what you want, e.g.:
```
<%#FormatFlag(DataBinder.Eval(Container.DataItem, "Do_Not_Estimate_Flag" ))%>
```
where you have a method:
```
protected string FormatFlag(objec... |