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 |
|---|---|---|---|---|---|---|
201,233 | <p>I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys?</p>
<p>For example, I have some ListViews in my application in which I want to save / load the column widths; Instead of ... | [
{
"answer_id": 201500,
"author": "James Osborn",
"author_id": 6686,
"author_profile": "https://Stackoverflow.com/users/6686",
"pm_score": 0,
"selected": false,
"text": "<p>I think the error</p>\n\n<blockquote>\n <p>The settings property\n 'key' was not found.</p>\n</blockquote>\n\n<p>o... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27847/"
] | I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys?
For example, I have some ListViews in my application in which I want to save / load the column widths; Instead of creating a... | Store your column width settings in an Xml Serializable object. Ie, something that implements [IXmlSerializable](http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx) then create a single setting entry of that type in Settings.settings.
A good option would probably be an Xml Serializa... |
201,235 | <p>I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL server or do it directly in SQL server.</p>
<p>Suggestions on the best way to approach this?</p... | [
{
"answer_id": 201253,
"author": "Matthias Meid",
"author_id": 17713,
"author_profile": "https://Stackoverflow.com/users/17713",
"pm_score": 3,
"selected": false,
"text": "<p>Add a Linked Server to your SQL Server and query the Active Directory via LDAP queries. This here described this ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26792/"
] | I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL server or do it directly in SQL server.
Suggestions on the best way to approach this? | Arry,
I don't know exactly, but found some links that may help you. I think the hottest track is this expression:
```
"(&(objectCategory=Person)(memberOf=DN=GroupName, OU=Org, DC=domain,
DC=com))"
```
I found it in [LDAP Query for group members](http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55298)... |
201,255 | <p>Using C#, does anyone know how to get the MarshalAsAttribute's Sizeconst value in runtime ?</p>
<p>Eg. I would like to retrieve the value of 10.</p>
<pre><code>[StructLayout[LayoutKind.Sequential, Pack=1]
Class StructureToMarshalFrom
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public byte[] _va... | [
{
"answer_id": 201266,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>Yup, with reflection:</p>\n\n<pre><code>FieldInfo field = typeof(StructureToMarshalFrom).GetField(\"_value1\");\nobjec... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/279238/"
] | Using C#, does anyone know how to get the MarshalAsAttribute's Sizeconst value in runtime ?
Eg. I would like to retrieve the value of 10.
```
[StructLayout[LayoutKind.Sequential, Pack=1]
Class StructureToMarshalFrom
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public byte[] _value1;
}
``` | Yup, with reflection:
```
FieldInfo field = typeof(StructureToMarshalFrom).GetField("_value1");
object[] attributes = field.GetCustomAttributes(typeof(MarshalAsAttribute), false);
MarshalAsAttribute marshal = (MarshalAsAttribute) attributes[0];
int sizeConst = marshal.SizeConst;
```
(Untested, and obviously lacking ... |
201,282 | <p>Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database.</p>
<p>Is there an equivalent I can use?</p>
| [
{
"answer_id": 201297,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 1,
"selected": false,
"text": "<p>Getting a list of tables:</p>\n\n<pre><code>SELECT \n Table_Name = Name, \nFROM \n MSysObjects \nWHERE \n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5978/"
] | Microsoft SQL Server and MySQL have an INFORMATION\_SCHEMA table that I can query. However it does not exist in an MS Access database.
Is there an equivalent I can use? | To build on Ilya's answer try the following query:
```
SELECT MSysObjects.Name AS table_name
FROM MSysObjects
WHERE (((Left([Name],1))<>"~")
AND ((Left([Name],4))<>"MSys")
AND ((MSysObjects.Type) In (1,4,6)))
order by MSysObjects.Name
```
(this one works without modification with an MDB)
ACCDB us... |
201,314 | <p>In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)".
Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-to-top?
For the moment I us... | [
{
"answer_id": 201330,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": true,
"text": "<p><strong>Edit</strong>: Since jQuery 1.3, this has been built in as the <a href=\"http://api.jquery.com/closest\" rel=\"noref... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27789/"
] | In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)".
Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-to-top?
For the moment I use t... | **Edit**: Since jQuery 1.3, this has been built in as the [`closest()`](http://api.jquery.com/closest) function. eg: `$('#foo').closest('.bar');`
---
yep - parents() traverses up the tree.
```
<div id="a">
<div id="b">
<p id="c">
<a id="d"></a>
</p>
</div>
</div>
```
`$('#d').pa... |
201,323 | <p>Over the years I have slowly developed a <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expression</a> that validates <em>most</em> email addresses correctly, assuming they don't use an IP address as the server part.</p>
<p>I use it in several PHP programs, and it works most of th... | [
{
"answer_id": 201336,
"author": "Per Hornshøj-Schierbeck",
"author_id": 11619,
"author_profile": "https://Stackoverflow.com/users/11619",
"pm_score": 8,
"selected": false,
"text": "<p>I use</p>\n\n<pre class=\"lang-none prettyprint-override\"><code>^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24215/"
] | Over the years I have slowly developed a [regular expression](http://en.wikipedia.org/wiki/Regular_expression) that validates *most* email addresses correctly, assuming they don't use an IP address as the server part.
I use it in several PHP programs, and it works most of the time. However, from time to time I get con... | The [fully RFC 822 compliant regex](http://ex-parrot.com/%7Epdw/Mail-RFC822-Address.html) is inefficient and obscure because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322). RFC 5322 leads to a regex ... |
201,355 | <p>I have a web application which provides Excel files via IE 7. It requests the files with an HTTP GET from a URL which returns the data with a content type of 'application/vnd.ms-excel'. It then opens the spreadsheets in an IFrame.</p>
<p>This all works fine unless Excel is already open when a spreadsheet is downloa... | [
{
"answer_id": 201372,
"author": "NotMe",
"author_id": 2424,
"author_profile": "https://Stackoverflow.com/users/2424",
"pm_score": 0,
"selected": false,
"text": "<p>Unfortunately, this is completely out of your hands. It really depends on what version of excel they have and what updates... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4023/"
] | I have a web application which provides Excel files via IE 7. It requests the files with an HTTP GET from a URL which returns the data with a content type of 'application/vnd.ms-excel'. It then opens the spreadsheets in an IFrame.
This all works fine unless Excel is already open when a spreadsheet is downloaded. In th... | Further to [Robert's answer](https://stackoverflow.com/questions/201355/how-can-i-stop-excel-2003-from-hanging-after-opening-a-spreadsheet-in-ie/497100#497100), the following line of (Java) code fixes this problem, in that it prevents Excel from hanging:
```
response.setHeader("Content-Disposition",
"attachment; ... |
201,359 | <p>int l = strlen(s);</p>
<p>warning C4244: '=' : conversion from '__w64 int' to 'int', possible loss of data</p>
<p>I need to replace strlen with an inline function
int l = new_strlen(s);</p>
<p>But how do I portably get the result of the strlen into the int without a warning, and without using pragmas? I can guar... | [
{
"answer_id": 201373,
"author": "John Dibling",
"author_id": 241536,
"author_profile": "https://Stackoverflow.com/users/241536",
"pm_score": 1,
"selected": false,
"text": "<p>Cast it:</p>\n\n<pre><code>int i = (int) strlen(s);\n</code></pre>\n"
},
{
"answer_id": 201383,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | int l = strlen(s);
warning C4244: '=' : conversion from '\_\_w64 int' to 'int', possible loss of data
I need to replace strlen with an inline function
int l = new\_strlen(s);
But how do I portably get the result of the strlen into the int without a warning, and without using pragmas? I can guarantee there aren't mor... | ```
const char * str = "Hello";
int len = static_cast< int >( strlen( str ) );
return len;
```
This code doesn't produce any error or warning even on Warning Level 4 (VS2005).
What compiler do you use? |
201,368 | <p>Not of the site collection itself, but the individual SPWeb's.</p>
| [
{
"answer_id": 201393,
"author": "Pascal Paradis",
"author_id": 1291,
"author_profile": "https://Stackoverflow.com/users/1291",
"pm_score": 3,
"selected": false,
"text": "<p>You should take a look at this blog entry by Alexander Meijers : <a href=\"http://www.bloggix.com/blogs/microsoft/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Not of the site collection itself, but the individual SPWeb's. | You should take a look at this blog entry by Alexander Meijers : [Size of SPWeb based on its Folders and Files](http://www.bloggix.com/blogs/microsoft/archive/2008/04/03/size-of-spweb-based-on-its-folders-and-files.aspx)
It provides a clever way of finding the size of an SPWeb or SPFolder by iterating through his cont... |
201,370 | <p>On the site we are building. We need to be able to redirect the user to a default page when his session has ended.</p>
<p>At first sight we used the Session_End with a Response.Redirect to do this job.</p>
<pre><code>Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("~/global/exit... | [
{
"answer_id": 201402,
"author": "Sijin",
"author_id": 8884,
"author_profile": "https://Stackoverflow.com/users/8884",
"pm_score": 2,
"selected": false,
"text": "<p>We handled it by checking if the session data existed in Application.Begin_Request for the pages that were user specific an... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1291/"
] | On the site we are building. We need to be able to redirect the user to a default page when his session has ended.
At first sight we used the Session\_End with a Response.Redirect to do this job.
```
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("~/global/exit.aspx")
End Sub
```... | We handled it by checking if the session data existed in Application.Begin\_Request for the pages that were user specific and if it didn't then redirecting the user to login or homepage. |
201,374 | <p>I'm trying to work through Project Euler and I'm hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very large number.</p>
<p><strong>Problem 03:</strong>
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 60085... | [
{
"answer_id": 201387,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": true,
"text": "<p>For starters, instead of beginning your search at n / 2, start it at the square root of n. You'll get half of the factors, t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444511/"
] | I'm trying to work through Project Euler and I'm hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very large number.
**Problem 03:**
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?
Here is my so... | For starters, instead of beginning your search at n / 2, start it at the square root of n. You'll get half of the factors, the other half being their complement.
eg:
```
n = 27
start at floor(sqrt(27)) = 5
is 5 a factor? no
is 4 a factor? no
is 3 a factor? yes. 27 / 3 = 9. 9 is also a factor.
is 2 a factor? no.
facto... |
201,377 | <p>For example, I am trying to get a min date, a max date, and a sum in different instances. I am trying to avoid hard coding a SQL string or looping through an IList to get these values.</p>
| [
{
"answer_id": 201387,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": true,
"text": "<p>For starters, instead of beginning your search at n / 2, start it at the square root of n. You'll get half of the factors, t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | For example, I am trying to get a min date, a max date, and a sum in different instances. I am trying to avoid hard coding a SQL string or looping through an IList to get these values. | For starters, instead of beginning your search at n / 2, start it at the square root of n. You'll get half of the factors, the other half being their complement.
eg:
```
n = 27
start at floor(sqrt(27)) = 5
is 5 a factor? no
is 4 a factor? no
is 3 a factor? yes. 27 / 3 = 9. 9 is also a factor.
is 2 a factor? no.
facto... |
201,391 | <p>Why is the <em>CheckBoxList</em> removed from ASP.NET MVC preview release 5? </p>
<p>Currently I don't see any way in which I can create a list of checkboxes (with similar names but different id's) so people can select 0-1-more options from the list.</p>
<p>There is an <code>CheckBoxList</code> list present in the... | [
{
"answer_id": 201423,
"author": "Corin Blaikie",
"author_id": 1736,
"author_profile": "https://Stackoverflow.com/users/1736",
"pm_score": 4,
"selected": false,
"text": "<p>A for loop in the view to generate the checkboxes</p>\n\n<pre><code><% foreach(Inhoud i in ViewData[\"InhoudList... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27857/"
] | Why is the *CheckBoxList* removed from ASP.NET MVC preview release 5?
Currently I don't see any way in which I can create a list of checkboxes (with similar names but different id's) so people can select 0-1-more options from the list.
There is an `CheckBoxList` list present in the MVCContrib library, but it is depr... | A for loop in the view to generate the checkboxes
```
<% foreach(Inhoud i in ViewData["InhoudList"] as List<Inhoud>) { %>
<input type="checkbox" name="Inhoud" value="<%= i.name %>" checked="checked" /> <%= i.name %>
<% } %>
```
Don't use `Html.Checkbox`, as that will generate two values for each item in the lis... |
201,392 | <p>I have a large number of files in a .tar.gz archive. Checking the file type with the command</p>
<pre><code>file SMS.tar.gz
</code></pre>
<p>gives the response</p>
<pre><code>gzip compressed data - deflate method , max compression
</code></pre>
<p>When I try to extract the archive with gunzip, after a delay I r... | [
{
"answer_id": 201409,
"author": "David Segonds",
"author_id": 13673,
"author_profile": "https://Stackoverflow.com/users/13673",
"pm_score": 5,
"selected": true,
"text": "<p>Are you sure that it is a gzip file? I would first run 'file SMS.tar.gz' to validate that.</p>\n\n<p>Then I would ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11787/"
] | I have a large number of files in a .tar.gz archive. Checking the file type with the command
```
file SMS.tar.gz
```
gives the response
```
gzip compressed data - deflate method , max compression
```
When I try to extract the archive with gunzip, after a delay I receive the message
```
gunzip: SMS.tar.gz: unexpe... | Are you sure that it is a gzip file? I would first run 'file SMS.tar.gz' to validate that.
Then I would read the [The gzip Recovery Toolkit](http://www.urbanophile.com/arenn/coding/gzrt/gzrt.html) page. |
201,436 | <p>I'm trying to get the following code working: </p>
<pre><code> string url = String.Format(@"SOMEURL");
string user = "SOMEUSER";
string password = "SOMEPASSWORD";
FtpWebRequest ftpclientRequest = (FtpWebRequest)WebRequest.Create(new Uri(url));
ftpclientRequest.Method = WebRequestMethods.Ftp.ListDirectory;... | [
{
"answer_id": 201493,
"author": "Sijin",
"author_id": 8884,
"author_profile": "https://Stackoverflow.com/users/8884",
"pm_score": 0,
"selected": false,
"text": "<p>I think we had a similar issue a while back, I don't remember the exact details though.</p>\n\n<p>To prevent .net from issu... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20754/"
] | I'm trying to get the following code working:
```
string url = String.Format(@"SOMEURL");
string user = "SOMEUSER";
string password = "SOMEPASSWORD";
FtpWebRequest ftpclientRequest = (FtpWebRequest)WebRequest.Create(new Uri(url));
ftpclientRequest.Method = WebRequestMethods.Ftp.ListDirectory;
ftpclientRe... | I just tested this on one of our dev servers and indeed there is a CWD issued by the .NET FtpWebRequest:
```
new connection from 172.16.3.210 on 172.16.3.210:21 (Explicit SSL)
hostname resolved : devpc
sending welcome message.
220 Gene6 FTP Server v3.10.0 (Build 2) ready...
USER testuser
testuser, 331 Password requir... |
201,450 | <p>I've been working for years with VS's debugger, but every now and then I come across a feature I have never noticed before, and think "Damn! How could I have missed that? It's <strong>so</strong> useful!"</p>
<p>[Disclaimer: These tips work in VS 2005 on a C# project, no guarantees for older incarnations o... | [
{
"answer_id": 201570,
"author": "Brian",
"author_id": 19299,
"author_profile": "https://Stackoverflow.com/users/19299",
"pm_score": 3,
"selected": false,
"text": "<p>Of course, check out the VS tip of the day:</p>\n\n<p><a href=\"http://blogs.msdn.com/SaraFord/\" rel=\"nofollow noreferr... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11545/"
] | I've been working for years with VS's debugger, but every now and then I come across a feature I have never noticed before, and think "Damn! How could I have missed that? It's **so** useful!"
[Disclaimer: These tips work in VS 2005 on a C# project, no guarantees for older incarnations of VS or other languages]
### Ke... | Two in-code tricks:
I really like the [System.Diagnostics.DebuggerStepThrough](http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx) attribute; you can attach it to a class, method or property to make VS not enter the code by default when debugging. I prefer it over the [Debugge... |
201,461 | <p>I was playing around with my own Sudoku solver and was looking for some pointers to good and fast design when I came across this:</p>
<pre><code>def r(a):i=a.find('0');~i or exit(a);[m
in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for
j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18]
from sys import*;r(a... | [
{
"answer_id": 201496,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 3,
"selected": false,
"text": "<p>A lot of the short sudoku solvers just recursively try every possible legal number left until they have successfully f... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27736/"
] | I was playing around with my own Sudoku solver and was looking for some pointers to good and fast design when I came across this:
```
def r(a):i=a.find('0');~i or exit(a);[m
in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for
j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18]
from sys import*;r(argv[1])
```
... | Well, you can make things a little easier by fixing up the syntax:
```
def r(a):
i = a.find('0')
~i or exit(a)
[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)] or r(a[:i]+m+a[i+1:])for m in'%d'%5**18]
from sys import *
r(argv[1])
```
Cleaning up a little:
```
from sys import exit, arg... |
201,468 | <p>I like the flexibility of Dynamic SQL and I like the security + improved performance of Prepared Statements. So what I really want is Dynamic Prepared Statements, which is troublesome to make because bind_param and bind_result accept "fixed" number of arguments. So I made use of an eval() statement to get around t... | [
{
"answer_id": 201639,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 5,
"selected": true,
"text": "<p>I think it is dangerous to use <code>eval()</code> here.</p>\n\n<p>Try this:</p>\n\n<ul>\n<li>iterate the params array t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27305/"
] | I like the flexibility of Dynamic SQL and I like the security + improved performance of Prepared Statements. So what I really want is Dynamic Prepared Statements, which is troublesome to make because bind\_param and bind\_result accept "fixed" number of arguments. So I made use of an eval() statement to get around this... | I think it is dangerous to use `eval()` here.
Try this:
* iterate the params array to build the SQL string with question marks `"SELECT * FROM t1 WHERE p1 = ? AND p2 = ?"`
* call `prepare()` on that
* use `call_user_func_array()` to make the call to `bind_param()`, passing in the dynamic params array.
The code:
```... |
201,476 | <p>I am getting the following error when I get to the line that invokes a REALLY BASIC web service I have running on Tomcat/Axis.</p>
<pre><code>Element or attribute do not match QName production: QName::=(NCName':')?NCName
</code></pre>
<p>Have I got something wrong with QName?- I can't even find any useful informat... | [
{
"answer_id": 201497,
"author": "Rich Kroll",
"author_id": 58733,
"author_profile": "https://Stackoverflow.com/users/58733",
"pm_score": 3,
"selected": false,
"text": "<p>Could it be a typo in your QName?:</p>\n\n<pre><code>new QName(\"http://testPackage.fc.com/\", \"doBasicStuff\")\n</... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175/"
] | I am getting the following error when I get to the line that invokes a REALLY BASIC web service I have running on Tomcat/Axis.
```
Element or attribute do not match QName production: QName::=(NCName':')?NCName
```
Have I got something wrong with QName?- I can't even find any useful information about it.
My client c... | As the exception says, you call the QName constructor incorrectly:
```
new QName("http://testPackage.fc.com/, doBasicStuff")
```
is incorrect. I think you have to pass two strings, one containing the namespace, one the localname. The documentation will typically contain a description on how to use that class. |
201,515 | <p>I have a simple website I'm testing. It's running on localhost and I can access it in my web browser. The index page is simply the word "running". <code>urllib.urlopen</code> will successfully read the page but <code>urllib2.urlopen</code> will not. Here's a script which demonstrates the problem (this is the act... | [
{
"answer_id": 201556,
"author": "Sijin",
"author_id": 8884,
"author_profile": "https://Stackoverflow.com/users/8884",
"pm_score": 1,
"selected": false,
"text": "<p>Does calling urlib2.open first followed by urllib.open have the same results? Just wondering if the first call to open is c... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] | I have a simple website I'm testing. It's running on localhost and I can access it in my web browser. The index page is simply the word "running". `urllib.urlopen` will successfully read the page but `urllib2.urlopen` will not. Here's a script which demonstrates the problem (this is the actual script and not a simplifi... | Sounds like you have proxy settings defined that urllib2 is picking up on. When it tries to proxy "127.0.0.01/", the proxy gives up and returns a 504 error.
From [Obscure python urllib2 proxy gotcha](http://kember.net/articles/obscure-python-urllib2-proxy-gotcha):
```
proxy_support = urllib2.ProxyHandler({})
opener =... |
201,518 | <p>Greetings!</p>
<p>I've created a custom button class to render the following:</p>
<pre><code><span class="btnOrange">
<input type="submit" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/>
</span>
</code></pre>
<p>However, it renders like this instead (note the... | [
{
"answer_id": 201526,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 0,
"selected": false,
"text": "<p>How about removing the <code>class</code> attribute from the <code>writer</code> object after rendering the <code>... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] | Greetings!
I've created a custom button class to render the following:
```
<span class="btnOrange">
<input type="submit" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/>
</span>
```
However, it renders like this instead (note the extraneous "class" attribute in the INPUT tag):
`... | You can do this:
```
private string _heldCssClass = null;
public override void RenderBeginTag(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
writer.RenderBeginTag("span");
_heldCssClass = this.CssClass;
this.CssClass = String.Empty;
base.RenderBeginTag(wri... |
201,527 | <p>I need to create a database table to store different changelog/auditing
(when something was added, deleted, modified, etc). I don't need to store particularly detailed info, so I was thinking something along the lines of:</p>
<ul>
<li>id (for the event)</li>
<li>user that triggered it</li>
<li>event name</li>
<li>ev... | [
{
"answer_id": 201561,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": 2,
"selected": false,
"text": "<p>There are many ways to do this. My favorite way is:</p>\n\n<ol>\n<li><p>Add a <code>mod_user</code> field to your sou... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9114/"
] | I need to create a database table to store different changelog/auditing
(when something was added, deleted, modified, etc). I don't need to store particularly detailed info, so I was thinking something along the lines of:
* id (for the event)
* user that triggered it
* event name
* event description
* timestamp of the... | In the project I'm working on, audit log also started from the very minimalistic design, like the one you described:
```
event ID
event date/time
event type
user ID
description
```
The idea was the same: to keep things simple.
However, it quickly became obvious that this minimalistic design was not sufficient. The... |
201,530 | <p>I need to add multiple empty divs to a container element using jQuery.</p>
<p>At the moment I am generating a string containing the empty html using a loop</p>
<pre><code>divstr = '<div></div><div></div>...<div></div>';
</code></pre>
<p>and then injecting that into my container... | [
{
"answer_id": 201564,
"author": "Wayne",
"author_id": 8236,
"author_profile": "https://Stackoverflow.com/users/8236",
"pm_score": 1,
"selected": false,
"text": "<p>You can use a regular loop with the Jquery <a href=\"http://docs.jquery.com/Manipulation/append#content\" rel=\"nofollow no... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20074/"
] | I need to add multiple empty divs to a container element using jQuery.
At the moment I am generating a string containing the empty html using a loop
```
divstr = '<div></div><div></div>...<div></div>';
```
and then injecting that into my container:
```
$('#container').html(divstr);
```
Is there a more elegant wa... | If you want IE to be fast - or generally consider speed, then you'll want to build up a DOM fragment first before inserting it.
John Resig explains the technique and includes a performance benchmark:
<http://ejohn.org/blog/dom-documentfragments/>
```
var i = 10,
fragment = document.createDocumentFragment(),
... |
201,590 | <p>I've inherited a .NET application that pulls together about 100 dlls built by two teams or purchased from vendors. I would like to quickly identify whether a given dll is a .NET assembly or a COM component. I realize that I could just invoke ildasm on each dll individually and make a note if the dll does not have a ... | [
{
"answer_id": 201603,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 2,
"selected": false,
"text": "<p>You can always try to add the \"Assembly Version\" column to the Explorer Window, and note which ones are blank to find ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5985/"
] | I've inherited a .NET application that pulls together about 100 dlls built by two teams or purchased from vendors. I would like to quickly identify whether a given dll is a .NET assembly or a COM component. I realize that I could just invoke ildasm on each dll individually and make a note if the dll does not have a val... | If you want to approach from the COM side, testing for COM objects in a DLL boils down to looking for an export named "DllGetClassObject". This is because an in-proc COM object is accessed by the COM runtime by calling [DllGetClassObject()](http://msdn.microsoft.com/en-us/library/ms680760(VS.85).aspx) on that DLL.
You... |
201,593 | <p>Suppose we have some named enums:</p>
<pre><code>enum MyEnum {
FOO,
BAR = 0x50
};
</code></pre>
<p>What I googled for is a script (any language) that scans all the headers in my project and generates a header with one function per enum.</p>
<pre><code>char* enum_to_string(MyEnum t);
</code></pre>
<p>... | [
{
"answer_id": 201610,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 0,
"selected": false,
"text": "<p>That's pretty much the only way it can be done (an array of string could work also).</p>\n\n<p>The problem is, onc... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21648/"
] | Suppose we have some named enums:
```
enum MyEnum {
FOO,
BAR = 0x50
};
```
What I googled for is a script (any language) that scans all the headers in my project and generates a header with one function per enum.
```
char* enum_to_string(MyEnum t);
```
And a implementation with something like this:
`... | You may want to check out [GCCXML](http://www.gccxml.org/HTML/Index.html).
Running GCCXML on your sample code produces:
```
<GCC_XML>
<Namespace id="_1" name="::" members="_3 " mangled="_Z2::"/>
<Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std"/>
<Enumeration id="_3" name="MyEnum" context="... |
201,606 | <p>For the past 2 years-(ish) I've been using <a href="http://maven.apache.org" rel="nofollow noreferrer">Maven2</a> for my build/continuous integration solution. I used <a href="http://ant.apache.org" rel="nofollow noreferrer">Ant</a> a bit before that but really didn't get a lot of experience with it. Now I've take... | [
{
"answer_id": 201623,
"author": "Chris R",
"author_id": 23309,
"author_profile": "https://Stackoverflow.com/users/23309",
"pm_score": 4,
"selected": true,
"text": "<p>My experience with ant -- which is our primary build tool for Java source, so make of this what you will -- is that ther... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3030/"
] | For the past 2 years-(ish) I've been using [Maven2](http://maven.apache.org) for my build/continuous integration solution. I used [Ant](http://ant.apache.org) a bit before that but really didn't get a lot of experience with it. Now I've taken a new job and the team I'm on now uses Ant.
What I'm wondering about is thi... | My experience with ant -- which is our primary build tool for Java source, so make of this what you will -- is that there are no such *formal* conventions. Many source projects I've seen organize things in a similar manner; JBoss uses <module>/src/main for sources, etc... Ant just uses whatever conventions you want, wh... |
201,607 | <p>I'd like to do something like this:</p>
<pre><code>Dim Foo as String = "a,b,c,d,e"
Dim Boo as List(of String) = Foo.Split(","c)
</code></pre>
<p>Of course <code>Foo.Split</code> returns a one-dimensional array of <code>String</code>, not a generic <code>List</code>. Is there a way to do this without iterating thro... | [
{
"answer_id": 201622,
"author": "IAmCodeMonkey",
"author_id": 27613,
"author_profile": "https://Stackoverflow.com/users/27613",
"pm_score": 0,
"selected": false,
"text": "<p>If you use Linq, you can use the ToList() extension method</p>\n\n<pre><code>Dim strings As List<string> = ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] | I'd like to do something like this:
```
Dim Foo as String = "a,b,c,d,e"
Dim Boo as List(of String) = Foo.Split(","c)
```
Of course `Foo.Split` returns a one-dimensional array of `String`, not a generic `List`. Is there a way to do this without iterating through the array to turn it into a generic `List`? | If you don't want to use LINQ, you can do:
```
Dim foo As String = "a,b,c,d,e"
Dim boo As New List(Of String)(foo.Split(","c))
``` |
201,615 | <p>Can some one post an example of using syslog outputter for log4r, I am currently using stdout but want to log to syslog.</p>
<pre><code>mylog = Logger.new 'mylog'
mylog.outputters = Outputter.stdout
mylog.info "Starting up."
</code></pre>
<p>raj</p>
<hr>
<p>Thanks also to the following blog posts.<br> </p>
<p><... | [
{
"answer_id": 203848,
"author": "Rajkumar S",
"author_id": 25453,
"author_profile": "https://Stackoverflow.com/users/25453",
"pm_score": 4,
"selected": true,
"text": "<p>Kind of lame answering my own question, but I found answer to this and adding it for later searches.</p>\n\n<p>For so... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25453/"
] | Can some one post an example of using syslog outputter for log4r, I am currently using stdout but want to log to syslog.
```
mylog = Logger.new 'mylog'
mylog.outputters = Outputter.stdout
mylog.info "Starting up."
```
raj
---
Thanks also to the following blog posts.
[Angrez's blog: Log4r - Usage and Examples](h... | Kind of lame answering my own question, but I found answer to this and adding it for later searches.
For some reason I need to require log4r/outputter/syslogoutputter explicitly other wise SyslogOutputter would cause "uninitialized constant SyslogOutputter (NameError)" error. Other outputters do not seem to have this ... |
201,621 | <p>In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular column? This is the same thing as <a href="https://stackoverflow.com/questions/85978/query-a-tables-foreign-key-relationships">this Oracle question</a>, but for MySQL.</p>
| [
{
"answer_id": 201647,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 7,
"selected": false,
"text": "<p>If you use InnoDB and defined FK's you could query the information_schema database e.g.:</p>\n\n<pre><code>SELECT * FROM inf... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3757/"
] | In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular column? This is the same thing as [this Oracle question](https://stackoverflow.com/questions/85978/query-a-tables-foreign-key-relationships), but for MySQL. | **For a Table:**
```
SELECT
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
FROM
INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_SCHEMA = '<database>' AND
REFERENCED_TABLE_NAME = '<table>';
```
**For a Column:**
```
SELECT
TABLE_NAME,COLUMN_NAME,CONSTRAINT... |
201,636 | <p>We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So...</p>
<p>I want to have a property on my class that will return the database name (SQL Server, so DB_NAME()). How can I do... | [
{
"answer_id": 231477,
"author": "gfrizzle",
"author_id": 23935,
"author_profile": "https://Stackoverflow.com/users/23935",
"pm_score": 0,
"selected": false,
"text": "<p>How are you iterating through the different databases? Could you just include information from the context in the quer... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] | We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So...
I want to have a property on my class that will return the database name (SQL Server, so DB\_NAME()). How can I do this in ... | In the DBML XML file, you can set the Expression attribute of a Column element to this:
```
<Column Name="Table1.DBName"
DbType="nvarahcar(128)"
Type="System.String"
Expression="DB_NAME()" />
``` |
201,660 | <p>I have some code which returns InnerXML for a XMLNode.</p>
<p>The node can contain just some text (with HTML) or XML.</p>
<p>For example:</p>
<pre><code><XMLNode>
Here is some &lt;strong&gt;HTML&lt;/strong&gt;
<XMLNode>
</code></pre>
<p>or</p>
<pre><code><XMLNode>
<X... | [
{
"answer_id": 201672,
"author": "Joachim Kerschbaumer",
"author_id": 20227,
"author_profile": "https://Stackoverflow.com/users/20227",
"pm_score": 2,
"selected": false,
"text": "<p>why not inserting them as &lt; and &gt; ? you avoid mixing xml and custom markup stuff with this..... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1970/"
] | I have some code which returns InnerXML for a XMLNode.
The node can contain just some text (with HTML) or XML.
For example:
```
<XMLNode>
Here is some <strong>HTML</strong>
<XMLNode>
```
or
```
<XMLNode>
<XMLContent>Here is some content</XMLContnet>
</XMLNode>
```
if I get the InnerXML for `... | I think Tomalak is on the right track, but I'd write the code a little differently:
```
XmlNode xn = document.SelectSingleNode("/content[@id=1]/data");
if (xn.ChildNodes.Count != 1)
{
throw new InvalidOperationException("I don't know what to do if there's not exactly one child node.... |
201,671 | <p>When I refer to nested set model I mean what is described <a href="http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/" rel="nofollow noreferrer">here.</a></p>
<p>I need to build a new system for storing "categories" (I can't think of better word for it) in a user defined hierarchy. Since the nest... | [
{
"answer_id": 202735,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 3,
"selected": false,
"text": "<p>I think this is indeed a limitation of the nested set model. You can not easily sort the child nodes within their... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I refer to nested set model I mean what is described [here.](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/)
I need to build a new system for storing "categories" (I can't think of better word for it) in a user defined hierarchy. Since the nested set model is optimized for reads instead of w... | I think this is indeed a limitation of the nested set model. You can not easily sort the child nodes within their respective parent node, because the ordering of the result set is essential to reconstruct the tree structure.
I think it is probably the best approach to keep the tree sorted when inserting, updating or d... |
201,686 | <p>On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?</p>
<p>Would this:</p>
<pre><code>var person = from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZ... | [
{
"answer_id": 201691,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 2,
"selected": false,
"text": "<p>If you are limiting the size of the result set by only selecting a few specific columns, then YES it will have ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] | On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?
Would this:
```
var person = from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZipcode };
```
be fa... | I highly recommend [LinqPad](http://linqpad.net/). It is free and lets you run LINQ queries dynamically. When you can also look at the SQL that is generated.
What you will see is that the LINQ query will translate the first query into selecting only those columns. So it is faster. |
201,699 | <p>I have a Java applet that runs inside a forms-authenticated aspx page. In the .NET 1.1 version of my site, the applet has access to the session cookie and is able to retrieve a file from the server, but in the .NET 2.0 version it fails to authenticate.</p>
<p>I have seen a couple of forum posts elsewhere that state... | [
{
"answer_id": 656465,
"author": "Aidan Black",
"author_id": 8211,
"author_profile": "https://Stackoverflow.com/users/8211",
"pm_score": 0,
"selected": false,
"text": "<p>Filip's answer isn't entirely correct. I ran a program to sniff the HTTP headers on my workstation, and the Java appl... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8211/"
] | I have a Java applet that runs inside a forms-authenticated aspx page. In the .NET 1.1 version of my site, the applet has access to the session cookie and is able to retrieve a file from the server, but in the .NET 2.0 version it fails to authenticate.
I have seen a couple of forum posts elsewhere that state that 2.0 ... | This question is old, but I figured it was valuable to have the correct answer here.
Filip is confusing server-side Java with client-side Java. He is correct that you cannot share sessions between two server-side platforms, such as Java (J2EE) and ASP.Net without using a custom approach.
However, applets are client-s... |
201,700 | <p>I'm currently logging via the simplest of methods within my servlet using Tomcat. I use the ServletConfig.getServletContext().log to record activity. This writes to the localhost.YYYY-MM-DD.log in $TOMCAT_HOME/logs.</p>
<p>I don't want to get away from the simplicity of this logging mechanism unless absolutely ne... | [
{
"answer_id": 656465,
"author": "Aidan Black",
"author_id": 8211,
"author_profile": "https://Stackoverflow.com/users/8211",
"pm_score": 0,
"selected": false,
"text": "<p>Filip's answer isn't entirely correct. I ran a program to sniff the HTTP headers on my workstation, and the Java appl... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13930/"
] | I'm currently logging via the simplest of methods within my servlet using Tomcat. I use the ServletConfig.getServletContext().log to record activity. This writes to the localhost.YYYY-MM-DD.log in $TOMCAT\_HOME/logs.
I don't want to get away from the simplicity of this logging mechanism unless absolutely necessary. Bu... | This question is old, but I figured it was valuable to have the correct answer here.
Filip is confusing server-side Java with client-side Java. He is correct that you cannot share sessions between two server-side platforms, such as Java (J2EE) and ASP.Net without using a custom approach.
However, applets are client-s... |
201,718 | <p>How do I concatenate two <code>std::vector</code>s?</p>
| [
{
"answer_id": 201727,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 8,
"selected": false,
"text": "<p>I would use the <a href=\"http://cppreference.com/wiki/stl/vector/insert\" rel=\"noreferrer\">insert function</a>, som... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I concatenate two `std::vector`s? | ```
vector1.insert( vector1.end(), vector2.begin(), vector2.end() );
``` |
201,724 | <p>I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only ... | [
{
"answer_id": 201733,
"author": "Wayne",
"author_id": 8236,
"author_profile": "https://Stackoverflow.com/users/8236",
"pm_score": 11,
"selected": true,
"text": "<p>The <a href=\"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/join\" rel=\"noreferrer\"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] | I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only way... | The [Array.prototype.join()](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/join) method:
```js
var arr = ["Zero", "One", "Two"];
document.write(arr.join(", "));
``` |
201,734 | <p>I have an HttpHandler on my webserver that takes a URL in the form of "<a href="https://servername/myhandler?op=get&k=Internal&m=jdahug1" rel="nofollow noreferrer">https://servername/myhandler?op=get&k=Internal&m=jdahug1</a>". I need to call this URL from my .NET app and capture whatever the output ... | [
{
"answer_id": 201740,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "<p>Try the System.Net.WebClient class.</p>\n\n<p>You can use the .DownloadStringAsync() method to enforce a timeout.</... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14101/"
] | I have an HttpHandler on my webserver that takes a URL in the form of "<https://servername/myhandler?op=get&k=Internal&m=jdahug1>". I need to call this URL from my .NET app and capture whatever the output is. Does anyone know how I can do that? I want it to be simple so that I just get back a string with the output, an... | we have used the following in the backend of our product (this is just the core code, not with timeout errorhandling etc.)
```
using System.Net;
using System.IO;
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(WebPageUrl);
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
Str... |
201,776 | <p>I have an ASP.NET web page with a Login control on it. When I hit Enter, the Login button doesn't fire; instead the page submits, doing nothing.</p>
<p>The standard solution to this that I've found online is to enclose the Login control in a Panel, then set the Panel default button. But apparently that doesn't wo... | [
{
"answer_id": 201822,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "<p>you have to add something like this in page load...</p>\n\n<pre><code>txtPassword.Attributes.Add(\"onKeyPress\", \"j... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5486/"
] | I have an ASP.NET web page with a Login control on it. When I hit Enter, the Login button doesn't fire; instead the page submits, doing nothing.
The standard solution to this that I've found online is to enclose the Login control in a Panel, then set the Panel default button. But apparently that doesn't work so well i... | This should be helpful: <http://weblogs.asp.net/jgalloway/archive/2007/10/03/asp-net-setting-the-defaultbutton-for-a-login-control.aspx>
You can use the following to reference the button within the Login control template:
```
DefaultButton="Login$LoginButton"
```
Basically, you can define a DefaultButton not just o... |
201,782 | <p>When manually generating a JSON object or array, it's often easier to leave a trailing comma on the last item in the object or array. For example, code to output from an array of strings might look like (in a C++ like pseudocode):</p>
<pre><code>s.append("[");
for (i = 0; i < 5; ++i) {
s.appendF("\"%d\",", ... | [
{
"answer_id": 201784,
"author": "Ben Combee",
"author_id": 1323,
"author_profile": "https://Stackoverflow.com/users/1323",
"pm_score": 7,
"selected": false,
"text": "<p>No. The JSON spec, as maintained at <a href=\"http://json.org\" rel=\"noreferrer\">http://json.org</a>, does not allo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1323/"
] | When manually generating a JSON object or array, it's often easier to leave a trailing comma on the last item in the object or array. For example, code to output from an array of strings might look like (in a C++ like pseudocode):
```
s.append("[");
for (i = 0; i < 5; ++i) {
s.appendF("\"%d\",", i);
}
s.append("]"... | Unfortunately [the JSON specification](http://www.json.org/) does not allow a trailing comma. There are a few browsers that will allow it, but generally you need to worry about all browsers.
In general I try turn the problem around, and add the comma before the actual value, so you end up with code that looks like thi... |
201,791 | <p>I am currently coding a simple Data Access Layer, and I was wondering which type I should expose to the other layers.</p>
<p>I am going to internally implement the Data as a List<>, but I remember reading something about not exposing the List type to the consumers if not needed.</p>
<pre><code>public List<Us... | [
{
"answer_id": 201803,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>Definitely an ISomething. Using an interface will reduce coupling and make it easier to change details of your dat... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5789/"
] | I am currently coding a simple Data Access Layer, and I was wondering which type I should expose to the other layers.
I am going to internally implement the Data as a List<>, but I remember reading something about not exposing the List type to the consumers if not needed.
```
public List<User> GetAllUsers() // non C#... | Usually it's best to expose the least powerful interface that the user can still meaningfully work with. If the user just needs some enumerable data, return `IEnumerable<User>`. If that's not enough because the user needs to be able to modify the list (attention! shouldn't often be the case), return an `IList<User>`.
... |
201,816 | <p>I'm trying to run a particular JUnit test by hand on a Windows XP command line, which has an unusually high number of elements in the class path. I've tried several variations, such as:</p>
<pre><code>set CLASS_PATH=C:\path\a\b\c;C:\path\e\f\g;....
set CLASS_PATH=%CLASS_PATH%;C:\path2\a\b\c;C:\path2\e\f\g;....
...... | [
{
"answer_id": 201857,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": -1,
"selected": false,
"text": "<p>Have you tried stacking them?</p>\n\n<pre><code>set CLASS_PATH = c:\\path\nset ALT_A = %CLASS_PATH%\\a\\b\\c;\nset ALT_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13140/"
] | I'm trying to run a particular JUnit test by hand on a Windows XP command line, which has an unusually high number of elements in the class path. I've tried several variations, such as:
```
set CLASS_PATH=C:\path\a\b\c;C:\path\e\f\g;....
set CLASS_PATH=%CLASS_PATH%;C:\path2\a\b\c;C:\path2\e\f\g;....
...
C:\apps\jdk1.6... | The Windows command line is very limiting in this regard. A workaround is to create a "pathing jar". This is a jar containing only a `Manifest.mf` file, whose `Class-Path` specifies the disk paths of your long list of jars, etc. Now just add this *pathing jar* to your command line classpath. This is usually more conven... |
201,826 | <p><strong>ASPX Code</strong></p>
<pre>
<asp:RadioButtonList ID="rbServer" runat="server" >
<asp:ListItem Value=<%=ServerDeveloper%>> Developer </asp:ListItemv
<asp:ListItem Value="dev.ahsvendor.com"> dev.test.com</asp:ListItem>
<asp:ListItem Value="staging.ahsvendor.com"&g... | [
{
"answer_id": 201842,
"author": "Cory Foy",
"author_id": 4083,
"author_profile": "https://Stackoverflow.com/users/4083",
"pm_score": 3,
"selected": true,
"text": "<p>Would it be:</p>\n\n<pre>rbServer.Items.Add(ServerDeveloper)</pre>\n\n<p>Ok, so since you want to do it from presentation... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27912/"
] | **ASPX Code**
```
<asp:RadioButtonList ID="rbServer" runat="server" >
<asp:ListItem Value=<%=ServerDeveloper%>> Developer </asp:ListItemv
<asp:ListItem Value="dev.ahsvendor.com"> dev.test.com</asp:ListItem>
<asp:ListItem Value="staging.ahsvendor.com"> staging.test.com</asp:ListItem>
</asp:RadioButtonList>
`... | Would it be:
```
rbServer.Items.Add(ServerDeveloper)
```
Ok, so since you want to do it from presentation...It is possible, but horribly ugly:
```
<div>
<% rbServer.Items.Add(new ListItem("Dev", ServerDeveloper)); %>
<asp:RadioButtonList ID="rbServer" runat="server">
<asp:ListItem Value="Blah">Blah</asp:ListIte... |
201,827 | <p>Ok, strange setup, strange question. We've got a Client and an Admin web application for our SaaS app, running on asp.net-2.0/iis-6. The Admin application can change options displayed on the Client application. When those options are saved in the Admin we call a Webservice on the Client, from the Admin, to flush our... | [
{
"answer_id": 201842,
"author": "Cory Foy",
"author_id": 4083,
"author_profile": "https://Stackoverflow.com/users/4083",
"pm_score": 3,
"selected": true,
"text": "<p>Would it be:</p>\n\n<pre>rbServer.Items.Add(ServerDeveloper)</pre>\n\n<p>Ok, so since you want to do it from presentation... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27915/"
] | Ok, strange setup, strange question. We've got a Client and an Admin web application for our SaaS app, running on asp.net-2.0/iis-6. The Admin application can change options displayed on the Client application. When those options are saved in the Admin we call a Webservice on the Client, from the Admin, to flush our ca... | Would it be:
```
rbServer.Items.Add(ServerDeveloper)
```
Ok, so since you want to do it from presentation...It is possible, but horribly ugly:
```
<div>
<% rbServer.Items.Add(new ListItem("Dev", ServerDeveloper)); %>
<asp:RadioButtonList ID="rbServer" runat="server">
<asp:ListItem Value="Blah">Blah</asp:ListIte... |
201,829 | <p>I have a format file where I want one of the columns to be "group". I'm auto-generating the format file and a client wants to upload a file with "group" as one of the columns. I could restrict it so they can't use SQL keywords, but then I need a function to determine if a column name is a SQL keyword, so I'd like ... | [
{
"answer_id": 203931,
"author": "Ed Harper",
"author_id": 27825,
"author_profile": "https://Stackoverflow.com/users/27825",
"pm_score": 1,
"selected": false,
"text": "<p>I tested this out several different ways on SQL 2005 SP2 (target databases in both compatibility modes 80 and 90) and... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] | I have a format file where I want one of the columns to be "group". I'm auto-generating the format file and a client wants to upload a file with "group" as one of the columns. I could restrict it so they can't use SQL keywords, but then I need a function to determine if a column name is a SQL keyword, so I'd like to su... | I tested this out several different ways on SQL 2005 SP2 (target databases in both compatibility modes 80 and 90) and it works OK for me using the SQL 2005 version of bcp.
However, I also tested it with the SQL 2000 version of bcp, and that failed with
```
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incor... |
201,830 | <p>I just asked <a href="https://stackoverflow.com/questions/201686/linq-to-sql-select-optimization">this question</a>. Which lead me to a new question :)</p>
<p>Up until this point, I have used the following pattern of selecting stuff with Linq to SQL, with the purpose of being able to handle 0 "rows" returned by the... | [
{
"answer_id": 201853,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "<pre><code>if (person.Any()) /* ... */;\n</code></pre>\n\n<p>OR</p>\n\n<pre><code>if (person.Count() == 0) /* ... */;\n<... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] | I just asked [this question](https://stackoverflow.com/questions/201686/linq-to-sql-select-optimization). Which lead me to a new question :)
Up until this point, I have used the following pattern of selecting stuff with Linq to SQL, with the purpose of being able to handle 0 "rows" returned by the query:
```
var pers... | Regarding your UPDATE: you have to either create your own type, change this.\_user to be *int*, or select the whole object, not only specific columns. |
201,832 | <p>Hey right now I'm using jQuery and I have some global variables to hold a bit of preloaded ajax stuff (preloaded to make pages come up nice and fast):</p>
<pre><code>
$.get("content.py?pageName=viewer", function(data)
{viewer = data;});
$.get("content.py?pageName=artists", function(data)
{artists = data;});... | [
{
"answer_id": 201855,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<p>You can avoid eval using new Function:</p>\n\n<pre><code>var names = ['viewer', 'artists', 'instores', 'specs', 'about'];\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] | Hey right now I'm using jQuery and I have some global variables to hold a bit of preloaded ajax stuff (preloaded to make pages come up nice and fast):
```
$.get("content.py?pageName=viewer", function(data)
{viewer = data;});
$.get("content.py?pageName=artists", function(data)
{artists = data;});
$.get("conten... | You don't need `eval()` or `Function()` for this. An array, as you suspected, will do the job nicely:
```
(function() // keep outer scope clean
{
// pages to load. Each name is used both for the request and the name
// of the property to store the result in (so keep them valid identifiers
// unless you want t... |
201,840 | <p>Running <code>rake db:migrate</code> followed by <code>rake test:units</code> yields the following:</p>
<pre><code>rake test:functionals
(in /projects/my_project)
rake aborted!
SQLite3::SQLException: index unique_schema_migrations already exists: CREATE UNIQUE INDEX "unique_schema_migrations" ON "ts_schema_migratio... | [
{
"answer_id": 201900,
"author": "Vitalie",
"author_id": 27913,
"author_profile": "https://Stackoverflow.com/users/27913",
"pm_score": 0,
"selected": false,
"text": "<p>Try to search if your schema.rb file does not contain other declarations that create an index with the same name: <code... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] | Running `rake db:migrate` followed by `rake test:units` yields the following:
```
rake test:functionals
(in /projects/my_project)
rake aborted!
SQLite3::SQLException: index unique_schema_migrations already exists: CREATE UNIQUE INDEX "unique_schema_migrations" ON "ts_schema_migrations" ("version")
```
The relevant p... | In SQLite, index name uniqueness is enforced at the database level. In MySQL, uniqueness is enforced only at the table level. That's why your migrations work in the latter and not the former: you have two indexes with the same name on different tables.
Rename the index, or find and rename the other `unique_schema_migr... |
201,846 | <p>i have the following script</p>
<pre><code>import getopt, sys
opts, args = getopt.getopt(sys.argv[1:], "h:s")
for key,value in opts:
print key, "=>", value
</code></pre>
<p>if i name this getopt.py and run it doesn't work as it tries to import itself</p>
<p>is there a way around this, so i can keep this fi... | [
{
"answer_id": 201862,
"author": "axblount",
"author_id": 1729005,
"author_profile": "https://Stackoverflow.com/users/1729005",
"pm_score": -1,
"selected": false,
"text": "<pre><code>import getopt as bettername\n</code></pre>\n\n<p>This should allow you to call getopt as bettername.</p>\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] | i have the following script
```
import getopt, sys
opts, args = getopt.getopt(sys.argv[1:], "h:s")
for key,value in opts:
print key, "=>", value
```
if i name this getopt.py and run it doesn't work as it tries to import itself
is there a way around this, so i can keep this filename but specify on import that i ... | You shouldn't name your scripts like existing modules. Especially if standard.
That said, you can touch sys.path to modify the library loading order
```
~# cat getopt.py
print "HI"
~# python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "cred... |
201,848 | <p>I'm automating Outlook and I need to control who the email appears to be from. The users will have two or more Accounts set up in Outlook and I need to be able to select which account to send the email from. Any ideas?</p>
<p>Needs to be supported on Outlook 2003 and above. I'm using Delphi 2006 to code this, but t... | [
{
"answer_id": 201862,
"author": "axblount",
"author_id": 1729005,
"author_profile": "https://Stackoverflow.com/users/1729005",
"pm_score": -1,
"selected": false,
"text": "<pre><code>import getopt as bettername\n</code></pre>\n\n<p>This should allow you to call getopt as bettername.</p>\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008/"
] | I'm automating Outlook and I need to control who the email appears to be from. The users will have two or more Accounts set up in Outlook and I need to be able to select which account to send the email from. Any ideas?
Needs to be supported on Outlook 2003 and above. I'm using Delphi 2006 to code this, but that doesn'... | You shouldn't name your scripts like existing modules. Especially if standard.
That said, you can touch sys.path to modify the library loading order
```
~# cat getopt.py
print "HI"
~# python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "cred... |
201,883 | <p>I have the same problem as described in the posts listed below. That is, certain keys don't work at all when I type them into my combobox until I first hit the spacebar. One of the keys is ".", but another is the letter "Q", and there are others: "$", "%". </p>
<p><a href="http://forums.microsoft.com/msdn/Show... | [
{
"answer_id": 203033,
"author": "Corey Trager",
"author_id": 9328,
"author_profile": "https://Stackoverflow.com/users/9328",
"pm_score": 0,
"selected": false,
"text": "<p>Partial answer to my question. In the Combobox I handle the KeyDown, TextChanged, and KeyUp events, which fire in ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | I have the same problem as described in the posts listed below. That is, certain keys don't work at all when I type them into my combobox until I first hit the spacebar. One of the keys is ".", but another is the letter "Q", and there are others: "$", "%".
<http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=659716... | By any chance, have you already solved your problem?
I have the same problem as yours, my custom control for DataGridView cannot receive letter Q, period, dollar, single quote, percent, etc.
I was able to solve the problem by changing the "switch .. default: return false" to "switch .. default: return !dataGridViewWa... |
201,887 | <p>Is there a cross database platform way to get the primary key of the record you have just inserted?</p>
<p>I noted that <a href="https://stackoverflow.com/questions/165156/easy-mysql-question-regarding-primary-keys-and-an-insert">this answer</a> says that you can get it by Calling <code>SELECT LAST_INSERT_ID()</cod... | [
{
"answer_id": 202533,
"author": "extraneon",
"author_id": 24582,
"author_profile": "https://Stackoverflow.com/users/24582",
"pm_score": 7,
"selected": true,
"text": "<p>Copied from my code:</p>\n\n<pre><code>pInsertOid = connection.prepareStatement(INSERT_OID_SQL, Statement.RETURN_GENER... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | Is there a cross database platform way to get the primary key of the record you have just inserted?
I noted that [this answer](https://stackoverflow.com/questions/165156/easy-mysql-question-regarding-primary-keys-and-an-insert) says that you can get it by Calling `SELECT LAST_INSERT_ID()` and I think that you can call... | Copied from my code:
```
pInsertOid = connection.prepareStatement(INSERT_OID_SQL, Statement.RETURN_GENERATED_KEYS);
```
where pInsertOid is a prepared statement.
you can then obtain the key:
```
// fill in the prepared statement and
pInsertOid.executeUpdate();
ResultSet rs = pInsertOid.getGeneratedKeys();
if (rs.n... |
201,888 | <p>Suppose I have a couple of spring beans: </p>
<pre><code><beans>
<bean name="A" ... />
<bean name="B" ... />
</beans>
</code></pre>
<p>"B" exposes a remote service that doesn't need "A". Assume that "A" takes a non-negligble time to load. What this means is that during a restart cycle... | [
{
"answer_id": 202565,
"author": "Arne Burmeister",
"author_id": 12890,
"author_profile": "https://Stackoverflow.com/users/12890",
"pm_score": 0,
"selected": false,
"text": "<p>I do not understand, why \"A takes a non-negligble time to load\", but maybe you could to a lazy initialize you... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19479/"
] | Suppose I have a couple of spring beans:
```
<beans>
<bean name="A" ... />
<bean name="B" ... />
</beans>
```
"B" exposes a remote service that doesn't need "A". Assume that "A" takes a non-negligble time to load. What this means is that during a restart cycle, the application hangs the remote client, which c... | Don't refer to bean "A" directly. Instead, refer to a bean which is a FACTORY for bean "A"; in this way, the Factory bean can be created without taking the initialization hit for instantiating "A". You'll need to refactor your classes which refer to an "A" to retrieve an "A" first, of course.
Or, you could create a be... |
201,893 | <p>I'm working to set up Panda on an Amazon EC2 instance.
I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but right now I'm not being allowed permission into Panda's EC2 instance.
<a href="http://pandastream.com/docs/getting_started" rel="noreferrer">Gett... | [
{
"answer_id": 201898,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 6,
"selected": false,
"text": "<p>Make sure that the directory containing the private key files is set to <strong>700</strong></p>\n\n<pre><code>chmod 700 ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2293/"
] | I'm working to set up Panda on an Amazon EC2 instance.
I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but right now I'm not being allowed permission into Panda's EC2 instance.
[Getting Started with Panda](http://pandastream.com/docs/getting_started)
I'm... | >
> I've chmoded my keypair to 600 in order to get into my personal instance last night,
>
>
>
And this is the way it is supposed to be.
From the [EC2 documentation](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html) we have *"If you're using OpenSSH (or any reasonably paranoid SSH ... |
201,896 | <p>I want something that can check if a string is <code>"SELECT"</code>, <code>"INSERT"</code>, etc. I'm just curious if this exists.</p>
| [
{
"answer_id": 201901,
"author": "Richard Harrison",
"author_id": 19624,
"author_profile": "https://Stackoverflow.com/users/19624",
"pm_score": 1,
"selected": false,
"text": "<p>why not start with <a href=\"http://www.novicksoftware.com/UDFofWeek/Vol2/T-SQL-UDF-Vol-2-Num-29-udf_SQL2K_IsK... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] | I want something that can check if a string is `"SELECT"`, `"INSERT"`, etc. I'm just curious if this exists. | Easy enough to add :
```
HashSet<String> sqlKeywords =
new HashSet<String>(Arrays.asList(
new String[] { ... cut and paste a list of sql keywords here .. }));
``` |
201,919 | <p>I'm living in nightmares because of this situation, I have a HttpWebRequest.GetResponse that keeps on giving me a ThreadAbortException, that causes the whole app to go down.</p>
<p>How can I avoid that, or at least handle it, would using Thread.ResetAbort() be useful in such a case?</p>
<p>To explain more here is ... | [
{
"answer_id": 201945,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "<p>I had this problem with using Response. Check out this article for some workarounds. <a href=\"http://support.micros... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20006/"
] | I'm living in nightmares because of this situation, I have a HttpWebRequest.GetResponse that keeps on giving me a ThreadAbortException, that causes the whole app to go down.
How can I avoid that, or at least handle it, would using Thread.ResetAbort() be useful in such a case?
To explain more here is a rough code samp... | From what you say it seems you are making an outgoing WebRequest to an external resource from within the processing of an incoming request to an ASP.NET application. There are (at least) two timeouts that are relevant here:
* WebRequest.Timeout (default 100000ms = 100s) specifies the timeout for execution of the outgo... |
201,933 | <p>We have a DLL used as the middle layer between our website front end and our back end ticketing system. The method of insertion into the ticketing system is a bit complicated to explain, but the short version is that it's slow. The best case scenario I've gotten is a 9 second submission time.</p>
<p>The real prob... | [
{
"answer_id": 201987,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Pepper your application on both sides with logs - that will show you where the time is going. If that doesn't help, u... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17145/"
] | We have a DLL used as the middle layer between our website front end and our back end ticketing system. The method of insertion into the ticketing system is a bit complicated to explain, but the short version is that it's slow. The best case scenario I've gotten is a 9 second submission time.
The real problem though, ... | Are you running both on the same machine? Is the middle-layer that you are calling located on a remote machine? The time durations you mentioned vaguely feels like a DNS timeout issue, when opening a connection incurs the penalty for the first (down/misaddressed) DNS response to timeout. Are you sure that whatever conf... |
201,956 | <p>Often times I need a collection of non-sequential objects with numeric identifiers. I like using the KeyedCollection for this, but I think there's a serious drawback. If you use an int for the key, you can no longer access members of the collection by their index (collection[index] is now really collection[key]). Is... | [
{
"answer_id": 201968,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": false,
"text": "<p>It might be best to add a <strong><code>GetById(int)</code></strong> method to a collection type. <code>Collection<... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27414/"
] | Often times I need a collection of non-sequential objects with numeric identifiers. I like using the KeyedCollection for this, but I think there's a serious drawback. If you use an int for the key, you can no longer access members of the collection by their index (collection[index] is now really collection[key]). Is th... | Basically you need to decide if users of the class are likely to be confused by the fact that they can't, for example, do:
```
for(int i=0; i=< myCollection.Count; i++)
{
... myCollection[i] ...
}
```
though they can of course use foreach, or use a cast:
```
for(int i=0; i=< myCollection.Count; i++)
{
... (... |
201,957 | <p>I am attempting to create a Clipboard stack in C#. Clipboard data is stored in <code>System.Windows.Forms.DataObject</code> objects. I wanted to store each clipboard entry (<code>IDataObject</code>) directly in a Generic list. Due to the way Bitmaps (seem to be) stored I am thinking I need to perform a deep copy fi... | [
{
"answer_id": 202020,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https://Stackoverflow.com/users/5645",
"pm_score": 2,
"selected": false,
"text": "<p>I wrote the code below for another question and maybe it could come in useful for you in this scenario:</p>\n\n<pre><code... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2690646/"
] | I am attempting to create a Clipboard stack in C#. Clipboard data is stored in `System.Windows.Forms.DataObject` objects. I wanted to store each clipboard entry (`IDataObject`) directly in a Generic list. Due to the way Bitmaps (seem to be) stored I am thinking I need to perform a deep copy first before I add it to the... | I wrote the code below for another question and maybe it could come in useful for you in this scenario:
```
public static class GhettoSerializer
{
// you could make this a factory method if your type
// has a constructor that appeals to you (i.e. default
// parameterless co... |
201,966 | <p>I'm trying to create a QTVR movie via QTKit, and I've got all the frames in the movie. However, setting the attributes necessary doesn't seem to be having any effect. For example:</p>
<pre><code>NSNumber *val = [NSNumber numberWithBool:YES];
[fMovie setAttribute:val forKey:QTMovieIsInteractiveAttribute];
val = [... | [
{
"answer_id": 513584,
"author": "Daniel",
"author_id": 6852,
"author_profile": "https://Stackoverflow.com/users/6852",
"pm_score": 1,
"selected": false,
"text": "<p>What I do when I want to export a Quicktime movie is something like the following:</p>\n\n<pre><code>NSMutableDictionary *... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3830/"
] | I'm trying to create a QTVR movie via QTKit, and I've got all the frames in the movie. However, setting the attributes necessary doesn't seem to be having any effect. For example:
```
NSNumber *val = [NSNumber numberWithBool:YES];
[fMovie setAttribute:val forKey:QTMovieIsInteractiveAttribute];
val = [NSNumber numberW... | What I do when I want to export a Quicktime movie is something like the following:
```
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], QTMovieExport,
[exportSettings objectForKey: @"subtype"], QTMovieExportType,
[exportSettings objectForKe... |
201,978 | <p>I use Visual Studio to do a lot of my coding. I find the open containing folder feature quite helpful. But I don't want the folder to be "opened" by the windows explorer, instead I want to "explore" the folder -- you know, get the nice little frame showing me all the other folders on the left hand side. Does anyone ... | [
{
"answer_id": 513584,
"author": "Daniel",
"author_id": 6852,
"author_profile": "https://Stackoverflow.com/users/6852",
"pm_score": 1,
"selected": false,
"text": "<p>What I do when I want to export a Quicktime movie is something like the following:</p>\n\n<pre><code>NSMutableDictionary *... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27928/"
] | I use Visual Studio to do a lot of my coding. I find the open containing folder feature quite helpful. But I don't want the folder to be "opened" by the windows explorer, instead I want to "explore" the folder -- you know, get the nice little frame showing me all the other folders on the left hand side. Does anyone kno... | What I do when I want to export a Quicktime movie is something like the following:
```
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], QTMovieExport,
[exportSettings objectForKey: @"subtype"], QTMovieExportType,
[exportSettings objectForKe... |
201,992 | <p>I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using <code>cin.get( input, '\0' )</code> but <code>'\0'</code> is not really the EOF character, that just reads until EOF or <code>'\0'</code>, ... | [
{
"answer_id": 202033,
"author": "luke",
"author_id": 16434,
"author_profile": "https://Stackoverflow.com/users/16434",
"pm_score": 2,
"selected": false,
"text": "<p>You can use the <a href=\"http://www.cplusplus.com/reference/iostream/istream/getline.html\" rel=\"nofollow noreferrer\">s... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14759/"
] | I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using `cin.get( input, '\0' )` but `'\0'` is not really the EOF character, that just reads until EOF or `'\0'`, whichever comes first.
Or is using ... | The only way you can read a variable amount of data from `stdin` is using loops. I've always found that the [`std::getline()`](http://en.cppreference.com/w/cpp/string/basic_string/getline) function works very well:
```
std::string line;
while (std::getline(std::cin, line))
{
std::cout << line << std::endl;
}
```
... |
202,002 | <p>I need to open a Microsoft Word 2003 file and change its file properties. Such as changing the Subject in the Summary Tab. <br/>
<img src="https://i.stack.imgur.com/FEpJY.gif" alt="alt text"></p>
| [
{
"answer_id": 202010,
"author": "ine",
"author_id": 4965,
"author_profile": "https://Stackoverflow.com/users/4965",
"pm_score": 3,
"selected": false,
"text": "<p>I can think of 2 ways to do this:</p>\n\n<ul>\n<li>Use the Microsoft Office APIs. You\nwill have to reference them in your\np... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5653/"
] | I need to open a Microsoft Word 2003 file and change its file properties. Such as changing the Subject in the Summary Tab.
 | Microsoft provides a very useful little assembly called DSOFile. With a reference to it in your project, you can modify Office document properties. It won't necessarily let you open the actual Office file's properties dialog, but you could certainly simulate it.
According to Microsoft:
>
> The Dsofile.dll files lets... |
202,011 | <p>How can I encrypt and decrypt a string in C#?</p>
| [
{
"answer_id": 202075,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 7,
"selected": false,
"text": "<p>Here is an example using RSA. </p>\n\n<p><strong>Important:</strong> There is a limit to the size of data you can e... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] | How can I encrypt and decrypt a string in C#? | **EDIT 2013-Oct**: Although I've edited this answer over time to address shortcomings, please see [jbtule's answer](https://stackoverflow.com/a/10366194/157247) for a more robust, informed solution.
<https://stackoverflow.com/a/10366194/188474>
**Original Answer:**
Here's a working example derived from the ["Rijndae... |
202,013 | <p>The Winform application is release with ClickOnce in our Intranet. We store personal preference for the GUI in the Isolated Storage. All works pretty fine :)</p>
<p>The problem is when we have a new version of the application, we publish... all preferences are lost! User need to setup their preference over and over... | [
{
"answer_id": 202028,
"author": "Gulzar Nazim",
"author_id": 4337,
"author_profile": "https://Stackoverflow.com/users/4337",
"pm_score": 1,
"selected": false,
"text": "<p>You have to store a permanent version of user settings in a more durable store like database. Your application can d... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] | The Winform application is release with ClickOnce in our Intranet. We store personal preference for the GUI in the Isolated Storage. All works pretty fine :)
The problem is when we have a new version of the application, we publish... all preferences are lost! User need to setup their preference over and over each vers... | You need to use *application* scoped, rather than *domain* scoped, isolated storage. This can be done by using one of **IsolatedStorageFileStream's** overloaded constructors.
Example:
```
using System.IO;
using System.IO.IsolatedStorage;
...
IsolatedStorageFile appScope = IsolatedStorageFile.GetUserStoreForApplicati... |
202,060 | <p>I have a page where search resuts are shown both in a grid and on a map (using KML generated on the fly, overlaid on an embedded Google map). I've wired this up to work as the user types; here's the skeleton of my code, which works:</p>
<pre><code>$(function() {
// Wire up search textbox
$('input.Search').b... | [
{
"answer_id": 202077,
"author": "Guido",
"author_id": 12388,
"author_profile": "https://Stackoverflow.com/users/12388",
"pm_score": 0,
"selected": false,
"text": "<p>As a first approach, what about something like :</p>\n\n<pre><code>$('input.Search').bind(\"keyup\", function() { setTime... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] | I have a page where search resuts are shown both in a grid and on a map (using KML generated on the fly, overlaid on an embedded Google map). I've wired this up to work as the user types; here's the skeleton of my code, which works:
```
$(function() {
// Wire up search textbox
$('input.Search').bind("keyup", u... | Instead of calling `update()` directly, call a wrapper that checks to see if there are any pending delayed updates:
```
$('input.Search').bind("keyup", delayedUpdate);
function delayedUpdate() {
if (updatePending) {
clearTimeout(updatePending);
}
updatePending = setTimeout(update, 250);
}
functi... |
202,073 | <p>I want to get a type of a "BasePage" object that I am creating. Every Page object is based off BasePage. For instance, I have a Login.aspx and in my code-behind and a class that has a method Display:</p>
<pre><code>Display(BasePage page) {
ResourceManager manager = new ResourceManager(page.GetType());
}
</code>... | [
{
"answer_id": 202095,
"author": "chadmyers",
"author_id": 10862,
"author_profile": "https://Stackoverflow.com/users/10862",
"pm_score": 0,
"selected": false,
"text": "<p>It depends where you're calling Display() from. If you're calling it from the ASPX, then you'llse \"ASP_login.aspx\".... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13688/"
] | I want to get a type of a "BasePage" object that I am creating. Every Page object is based off BasePage. For instance, I have a Login.aspx and in my code-behind and a class that has a method Display:
```
Display(BasePage page) {
ResourceManager manager = new ResourceManager(page.GetType());
}
```
In my project s... | If your code-beside looks like this:
```
public partial class _Login : BasePage
{ /* ... */
}
```
Then you would get the `Type` object for it with *`typeof(_Login)`*. To get the type dynamically, you can find it recursively:
```
Type GetCodeBehindType()
{ return getCodeBehindTypeRecursive(this.GetType());
}
... |
202,084 | <p>Cells in DataGridViewComboBoxColumn have ComboBoxStyle DropDownList. It means the user can only select values from the dropdown. The underlying control is ComboBox, so it can have style DropDown. How do I change the style of the underlying combo box in DataGridViewComboBoxColumn. Or, more general, can I have a colum... | [
{
"answer_id": 202478,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 3,
"selected": false,
"text": "<pre><code>void dataGridView1_EditingControlShowing(object sender, \n DataGridViewEditingControlShowingEventArgs e)\n{\n... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14727/"
] | Cells in DataGridViewComboBoxColumn have ComboBoxStyle DropDownList. It means the user can only select values from the dropdown. The underlying control is ComboBox, so it can have style DropDown. How do I change the style of the underlying combo box in DataGridViewComboBoxColumn. Or, more general, can I have a column i... | ```
void dataGridView1_EditingControlShowing(object sender,
DataGridViewEditingControlShowingEventArgs e)
{
if (e.Control.GetType() == typeof(DataGridViewComboBoxEditingControl))
{
DataGridViewComboBoxEditingControl cbo =
e.Control as DataGridViewComboBoxEditingControl;
cbo.Dro... |
202,116 | <p>Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time.</p>
<p>Linux systems typically sync the hardware clock with the system time at shutdown and at periodic intervals. However, if the machi... | [
{
"answer_id": 202118,
"author": "Kristopher Johnson",
"author_id": 1175,
"author_profile": "https://Stackoverflow.com/users/1175",
"pm_score": 3,
"selected": false,
"text": "<p>After calling stime(), do this:</p>\n\n<pre><code>system(\"/sbin/hwclock --systohc\");\n</code></pre>\n\n<p>Se... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] | Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time.
Linux systems typically sync the hardware clock with the system time at shutdown and at periodic intervals. However, if the machine gets powe... | Check out the rtc man-page for details, but if you are logged in as root, something like this:
```
#include <linux/rtc.h>
#include <sys/ioctl.h>
struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
... |
202,124 | <p>I´m trying to expose services using jax-ws but the first surprise i got was that Weblogic does not support inner classes for request/response objects. After get over this situation <a href="https://stackoverflow.com/questions/144118/jaxb-binding-customization">here</a>, i´m facing another challenge:</p>
<p>Generate ... | [
{
"answer_id": 1009590,
"author": "AlanG",
"author_id": 11645,
"author_profile": "https://Stackoverflow.com/users/11645",
"pm_score": 2,
"selected": true,
"text": "<p>BooleanGetter XJC plugin for JAXB is available at <a href=\"http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/ww... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21370/"
] | I´m trying to expose services using jax-ws but the first surprise i got was that Weblogic does not support inner classes for request/response objects. After get over this situation [here](https://stackoverflow.com/questions/144118/jaxb-binding-customization), i´m facing another challenge:
Generate `getXXX()` rather th... | BooleanGetter XJC plugin for JAXB is available at <http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/www/boolean-getter/index.html>
If you are working with JavaSE 6 then it needs to be re-packaged - see <http://forums.java.net/jive/message.jspa?messageID=319434>
Use in ant build like below:
```
<taskdef... |
202,136 | <p>Hello fellow stackoverflowers!</p>
<p>I have a word list of 200.000 string entries, average string length is around 30 characters. This list of words are the key and to each key i have a domain object. I would like to find the domain objects in this collection by only knowing a part of the key. I.E. the search stri... | [
{
"answer_id": 202164,
"author": "Superpolock",
"author_id": 16496,
"author_profile": "https://Stackoverflow.com/users/16496",
"pm_score": 0,
"selected": false,
"text": "<p>Would you get any advantage having your trie keys comparable to the size of the machine register? So if you are on... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hello fellow stackoverflowers!
I have a word list of 200.000 string entries, average string length is around 30 characters. This list of words are the key and to each key i have a domain object. I would like to find the domain objects in this collection by only knowing a part of the key. I.E. the search string "kov" w... | Suffix Array and *q*-gram index
-------------------------------
If your strings have a strict upper bound on the size you might consider the use of a [**suffix array**](http://en.wikipedia.org/wiki/Suffix_array): Simply pad all your strings to the same maximum length using a special character (e.g. the null char). The... |
202,142 | <p>I can connect with a user who has permissions to set passwords. I'm able to change attributes, but I can't set the password.</p>
<p>Found some instructions to set the attribute <code>unicodePwd</code> to <code>\UNC:"*password*"</code>, but it says:</p>
<blockquote>
<p>Error: Modify: Unwilling To Perform. <53>... | [
{
"answer_id": 202164,
"author": "Superpolock",
"author_id": 16496,
"author_profile": "https://Stackoverflow.com/users/16496",
"pm_score": 0,
"selected": false,
"text": "<p>Would you get any advantage having your trie keys comparable to the size of the machine register? So if you are on... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1533/"
] | I can connect with a user who has permissions to set passwords. I'm able to change attributes, but I can't set the password.
Found some instructions to set the attribute `unicodePwd` to `\UNC:"*password*"`, but it says:
>
> Error: Modify: Unwilling To Perform. <53>
>
>
>
Setting LDAP\_OPT\_ENCRYPT to 1 didn't wo... | Suffix Array and *q*-gram index
-------------------------------
If your strings have a strict upper bound on the size you might consider the use of a [**suffix array**](http://en.wikipedia.org/wiki/Suffix_array): Simply pad all your strings to the same maximum length using a special character (e.g. the null char). The... |
202,147 | <p>Is there a way to start another application from within Compact .Net framework 1.0 similar to </p>
<pre><code>System.Diagnostics.Process.Start
</code></pre>
<p>on the Windows side?</p>
<p>I need to start a CAB file for installation.</p>
| [
{
"answer_id": 202160,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 4,
"selected": true,
"text": "<p>Treat the share as if it were your source control system. Make the share read-only, which will force developers to ge... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18169/"
] | Is there a way to start another application from within Compact .Net framework 1.0 similar to
```
System.Diagnostics.Process.Start
```
on the Windows side?
I need to start a CAB file for installation. | Treat the share as if it were your source control system. Make the share read-only, which will force developers to get local copies in order to make changes. You then have a somewhat stable version to compare against. This would help facilitate being able to do "merges". "Checking" code in would have to consist of some... |
202,197 | <p>I have a requirement to create a simple database in Access to collect some user data that will be loaded into another database for further reporting. There will be a module in the Access db that when invoked by the user (probably by clicking a button) will output a query to a delimited file. The user also needs a ... | [
{
"answer_id": 202269,
"author": "jmatthias",
"author_id": 2768,
"author_profile": "https://Stackoverflow.com/users/2768",
"pm_score": 0,
"selected": false,
"text": "<p>I would imagine you just need to find an FTP COM object. You should then be able to instantiate this in the Access modu... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3734/"
] | I have a requirement to create a simple database in Access to collect some user data that will be loaded into another database for further reporting. There will be a module in the Access db that when invoked by the user (probably by clicking a button) will output a query to a delimited file. The user also needs a mecha... | You can simply write a call to the sftp command line client via a batch file if you want to accomplish that.
Check out the Shell() function in VBA.
Under the click event of the button on your form add in the code:
```
mySFTPCall = "sftp <insert your options here!>"
Call Shell(mySFTPCall, 1)
```
I've used this befo... |
202,198 | <p>I'm interested in hearing your opinions in which is the best way of implementing a social activity stream (Facebook is the most famous example). Problems/challenges involved are:</p>
<ul>
<li>Different types of activities (posting, commenting ..)</li>
<li>Different types of objects (post, comment, photo ..)</li>
<l... | [
{
"answer_id": 202227,
"author": "warren",
"author_id": 4418,
"author_profile": "https://Stackoverflow.com/users/4418",
"pm_score": 2,
"selected": false,
"text": "<p>I think <a href=\"http://plurk.com\" rel=\"nofollow noreferrer\">Plurk's</a> approach is interesting: they supply your ent... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm interested in hearing your opinions in which is the best way of implementing a social activity stream (Facebook is the most famous example). Problems/challenges involved are:
* Different types of activities (posting, commenting ..)
* Different types of objects (post, comment, photo ..)
* 1-n users involved in diff... | I have created such system and I took this approach:
Database table with the following columns: id, userId, type, data, time.
* **userId** is the user who generated the activity
* **type** is the type of the activity (i.e. Wrote blog post, added photo, commented on user's photo)
* **data** is a serialized object with... |
202,205 | <p>One of the responses to <a href="https://stackoverflow.com/questions/198721/converting-a-word-document-into-usable-html-in-php">a question I asked yesterday</a> suggested that I should make sure my database can handle UTF-8 characters correctly. How I can do this with MySQL?</p>
| [
{
"answer_id": 202246,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 8,
"selected": true,
"text": "<p><strong>Update:</strong> </p>\n\n<p>Short answer - You should almost always be using the <code>utf8mb4</code> charset and <co... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] | One of the responses to [a question I asked yesterday](https://stackoverflow.com/questions/198721/converting-a-word-document-into-usable-html-in-php) suggested that I should make sure my database can handle UTF-8 characters correctly. How I can do this with MySQL? | **Update:**
Short answer - You should almost always be using the `utf8mb4` charset and `utf8mb4_unicode_ci` collation.
To alter database:
```
ALTER DATABASE dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
```
See:
* Aaron's comment on this answer [How to make MySQL handle UTF-8 properly](https://stacko... |
202,231 | <p>I need to detect the device resolution automatically, right now I have a global var & hardwire the resolution:</p>
<pre><code>Public gDeviceRes As String = "640"
'Public gDeviceRes As String = "320"
</code></pre>
<p>then recompile for each device, does anyone have a quick snippit of code for this??</p>
| [
{
"answer_id": 202512,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 4,
"selected": true,
"text": "<p>Depending on your exact needs, you can check the current screen dimensions with <a href=\"http://msdn.microsoft.com/en-us... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3522/"
] | I need to detect the device resolution automatically, right now I have a global var & hardwire the resolution:
```
Public gDeviceRes As String = "640"
'Public gDeviceRes As String = "320"
```
then recompile for each device, does anyone have a quick snippit of code for this?? | Depending on your exact needs, you can check the current screen dimensions with [Screen.PrimaryScreen](http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.primaryscreen.aspx) or you can P/Invoke [GetSystemMetrics](http://msdn.microsoft.com/en-us/library/ms929469.aspx) with SM\_CXSCREEN or [GetDeviceCaps... |
202,243 | <p>I am trying to write a stored procedure which selects columns from a table and adds 2 extra columns to the ResultSet. These 2 extra columns are the result of conversions on a field in the table which is a Datetime field.</p>
<p>The Datetime format field has the following format 'YYYY-MM-DD HH:MM:SS.S'</p>
<p>The 2... | [
{
"answer_id": 202284,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 4,
"selected": true,
"text": "<p>If dt is your datetime column, then </p>\n\n<p>For 1:</p>\n\n<pre><code>SUBSTRING(CONVERT(varchar, dt, 13), 1, 2)\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311/"
] | I am trying to write a stored procedure which selects columns from a table and adds 2 extra columns to the ResultSet. These 2 extra columns are the result of conversions on a field in the table which is a Datetime field.
The Datetime format field has the following format 'YYYY-MM-DD HH:MM:SS.S'
The 2 additional field... | If dt is your datetime column, then
For 1:
```
SUBSTRING(CONVERT(varchar, dt, 13), 1, 2)
+ UPPER(SUBSTRING(CONVERT(varchar, dt, 13), 4, 3))
```
For 2:
```
SUBSTRING(CONVERT(varchar, dt, 100), 13, 2)
+ SUBSTRING(CONVERT(varchar, dt, 100), 16, 3)
``` |
202,245 | <p>I'm looking for a way to sequentially number rows in a <em>result set</em> (not a table). In essence, I'm starting with a query like the following:</p>
<pre><code>SELECT id, name FROM people WHERE name = 'Spiewak'
</code></pre>
<p>The <code>id</code>s are obviously not a true sequence (e.g. <code>1, 2, 3, 4</code... | [
{
"answer_id": 202261,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 2,
"selected": false,
"text": "<p>There is no ANSI-standard way to do this of which I am aware.</p>\n\n<p>In SQL Server you have a ROW_NUMBER() functio... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9815/"
] | I'm looking for a way to sequentially number rows in a *result set* (not a table). In essence, I'm starting with a query like the following:
```
SELECT id, name FROM people WHERE name = 'Spiewak'
```
The `id`s are obviously not a true sequence (e.g. `1, 2, 3, 4`). What I need is another column in the result set whic... | To have a meaningful row number you need to order your results. Then you can do something like this:
```
SELECT id, name
, (SELECT COUNT(*) FROM people p2 WHERE name='Spiewak' AND p2.id <= p1.id) AS RowNumber
FROM people p1
WHERE name = 'Spiewak'
ORDER BY id
```
Note that the WHERE clause of the sub query needs ... |
202,253 | <p>I'm using Eclipse 3.4 and Tomcat 5.5 and I have a Dynamic Web Project set up. I can access it from <a href="http://127.0.0.1:8080/project/" rel="noreferrer">http://127.0.0.1:8080/project/</a> but by default it serves files from WebContent folder. The real files, that I want to serve, can be found under folder named ... | [
{
"answer_id": 202303,
"author": "anjanb",
"author_id": 11142,
"author_profile": "https://Stackoverflow.com/users/11142",
"pm_score": 2,
"selected": false,
"text": "<p>if you're running windows, use the junction utility from MS : <a href=\"http://technet.microsoft.com/en-us/sysinternals/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27736/"
] | I'm using Eclipse 3.4 and Tomcat 5.5 and I have a Dynamic Web Project set up. I can access it from <http://127.0.0.1:8080/project/> but by default it serves files from WebContent folder. The real files, that I want to serve, can be found under folder named "share". This folder comes from CVS so I'd like to use it with ... | In the project folder, there should be a file under the `.settings` folder named `org.eclipse.wst.common.component` that contains an XML fragment like this:
```
<wb-module deploy-name="WebProjectName">
<wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-p... |
202,271 | <p>The following code will not compile:</p>
<pre><code>string foo = "bar";
Object o = foo == null ? DBNull.Value : foo;
</code></pre>
<p>I get: <em>Error 1 Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DBNull' and 'string'</em></p>
<p>To fix this, I must ... | [
{
"answer_id": 202281,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 4,
"selected": false,
"text": "<p><code>DBNull.Value</code> returns type <code>DBNull</code>.</p>\n\n<p>You want the type to be <code>string</code>.</p>\n\n<p>... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] | The following code will not compile:
```
string foo = "bar";
Object o = foo == null ? DBNull.Value : foo;
```
I get: *Error 1 Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DBNull' and 'string'*
To fix this, I must do something like this:
```
string foo ... | The compiler requires that either the types of second and third operands are the same, or that one is implicitly convertible to the other. In your case, the types are DBNull and string, neither of which is implicitly convertible to the other. Casting either of them to object solves that.
EDIT: Looks like it is indeed ... |
202,273 | <p>I can currently to the following:</p>
<pre><code>class SubClass extends SuperClass {
function __construct() {
parent::__construct();
}
}
class SuperClass {
function __construct() {
// this echoes "I'm SubClass and I'm extending SuperClass"
echo 'I\'m '.get_class($this).' and I\'m extending '.__CL... | [
{
"answer_id": 202308,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "<p>Uh, not really, that I can think of. Each subclass would need to have an explicitly implemented method that returne... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2238/"
] | I can currently to the following:
```
class SubClass extends SuperClass {
function __construct() {
parent::__construct();
}
}
class SuperClass {
function __construct() {
// this echoes "I'm SubClass and I'm extending SuperClass"
echo 'I\'m '.get_class($this).' and I\'m extending '.__CLASS__;
}
}
... | You can use Reflection.
```
$ref = new ReflectionObject($this);
$ref->getFileName(); // return the file where the object's class was declared
``` |
202,302 | <p>How can you round <em>any</em> number (not just integers > 0) to N significant digits?</p>
<p>For example, if I want to round to three significant digits, I'm looking for a formula that could take:</p>
<p>1,239,451 and return 1,240,000</p>
<p>12.1257 and return 12.1</p>
<p>.0681 and return .0681</p>
<p>5 and re... | [
{
"answer_id": 202336,
"author": "Claudiu",
"author_id": 15055,
"author_profile": "https://Stackoverflow.com/users/15055",
"pm_score": 4,
"selected": false,
"text": "<p>SUMMARY:</p>\n\n<pre><code>double roundit(double num, double N)\n{\n double d = log10(num);\n double power;\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7442/"
] | How can you round *any* number (not just integers > 0) to N significant digits?
For example, if I want to round to three significant digits, I'm looking for a formula that could take:
1,239,451 and return 1,240,000
12.1257 and return 12.1
.0681 and return .0681
5 and return 5
Naturally the algorithm should not be... | Here's the same code in Java without the 12.100000000000001 bug other answers have
I also removed repeated code, changed `power` to a type integer to prevent floating issues when `n - d` is done, and made the long intermediate more clear
The bug was caused by multiplying a large number with a small number. Instead I ... |
202,305 | <p>I've created a PHP DOM xml piece and saved it to a string like this:</p>
<pre><code><?php
// create a new XML document
$doc = new DomDocument('1.0');
...
...
...
$xmldata = $doc->saveXML();
?>
</code></pre>
<p>Now I can't use the headers to send a file download prompt and I can't write the ... | [
{
"answer_id": 202866,
"author": "Daniel Rucci",
"author_id": 27604,
"author_profile": "https://Stackoverflow.com/users/27604",
"pm_score": 1,
"selected": false,
"text": "<p>You could enable output_buffering in your php.ini, then you might have some options with sending headers.</p>\n\n<... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27943/"
] | I've created a PHP DOM xml piece and saved it to a string like this:
```
<?php
// create a new XML document
$doc = new DomDocument('1.0');
...
...
...
$xmldata = $doc->saveXML();
?>
```
Now I can't use the headers to send a file download prompt and I can't write the file to the server, or rather I don... | I see from the comments that you're working from within a CMS framework and are unable to stop content from being output prior to where your code will be.
If the script in which you're working has already output content (beyond your control), then you can't do what you're trying to achieve in just one script.
Your sc... |
202,306 | <p>How can I AutoIncrement the assembly (build) number in Visual Studio?</p>
<h3>Duplicate:</h3>
<p><a href="https://stackoverflow.com/questions/650/">/questions/650/automatically-update-version-number</a></p>
| [
{
"answer_id": 202315,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 3,
"selected": false,
"text": "<p>You can just use a wildcard in the <a href=\"http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversio... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I AutoIncrement the assembly (build) number in Visual Studio?
### Duplicate:
[/questions/650/automatically-update-version-number](https://stackoverflow.com/questions/650/) | You can just use a wildcard in the [AssemblyVersionAttribute](http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.assemblyversionattribute.aspx):
```
[assembly: AssemblyVersion("1.0.*")]
```
This will cause build to be equal to the number of days since January 1, 2000 local time. |
202,340 | <p>Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.</p>
<p>Often times I should really be rolling my own class instead of just using std::pair. It's pretty easy to see when things start breaking ... | [
{
"answer_id": 202350,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 3,
"selected": false,
"text": "<p>This is what <a href=\"http://www.boost.org/doc/libs/1_36_0/libs/tuple/doc/tuple_users_guide.html\" rel=\"nofollow nore... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5963/"
] | Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.
Often times I should really be rolling my own class instead of just using std::pair. It's pretty easy to see when things start breaking down - whe... | This is what [Boost.Tuple](http://www.boost.org/doc/libs/1_36_0/libs/tuple/doc/tuple_users_guide.html) was made for.
But you should probably be using [std::tuple](http://en.cppreference.com/w/cpp/utility/tuple) now... |
202,368 | <p>I'm writing an ASP.NET application. I have a textbox on a webform, and I want to force whatever the user types to upper case. I'd like to do this on the front end. You should also note that there is a validation control on this textbox, so I want to make sure the solution doesn't interfere with the ASP.NET validatio... | [
{
"answer_id": 202386,
"author": "billb",
"author_id": 26805,
"author_profile": "https://Stackoverflow.com/users/26805",
"pm_score": 5,
"selected": false,
"text": "<p>Use a CSS style on the text box. Your CSS should be something like this:</p>\n\n<pre><code>.uppercase\n{\n text-transf... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21155/"
] | I'm writing an ASP.NET application. I have a textbox on a webform, and I want to force whatever the user types to upper case. I'd like to do this on the front end. You should also note that there is a validation control on this textbox, so I want to make sure the solution doesn't interfere with the ASP.NET validation.
... | Why not use a combination of the CSS and backend? Use:
```
style='text-transform:uppercase'
```
on the TextBox, and in your codebehind use:
```
Textbox.Value.ToUpper();
```
You can also easily change your regex on the validator to use lowercase and uppercase letters. That's probably the easier solution than forc... |
202,378 | <p>I am trying to make this feature available, maybe in an apache .htaccess file.</p>
| [
{
"answer_id": 202385,
"author": "Thomas Owens",
"author_id": 572,
"author_profile": "https://Stackoverflow.com/users/572",
"pm_score": 0,
"selected": false,
"text": "<p>My understanding is that everything in PHP 4 is in PHP 5, so if you install PHP 5 and configure it, you will be able t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to make this feature available, maybe in an apache .htaccess file. | I used the virtual server config to setup several folders with PHP5 and some with PHP4 on my PC to test code. I also set them up with different hostnames (also in the windows host file). (I dont have access to that machine anymore, but here is what I remember.)
Just include one of the following (for linux)
```
AddHan... |
202,406 | <p>In my user model, I have an attribute called "nickname" and validates as such:</p>
<blockquote>
<p>validates_format_of :nickname, :with => /[a-zA-Z0-9]$/, :allow_nil => true</p>
</blockquote>
<p>However, it is currently letting this string pass as valid:</p>
<p>a?c</p>
<p>I only want to accept alphanumeric str... | [
{
"answer_id": 202411,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 4,
"selected": true,
"text": "<p>You need to anchor the pattern on both sides:</p>\n\n<pre><code>/^[a-zA-Z0-9]+$/\n</code></pre>\n"
},
{
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19527/"
] | In my user model, I have an attribute called "nickname" and validates as such:
>
> validates\_format\_of :nickname, :with => /[a-zA-Z0-9]$/, :allow\_nil => true
>
>
>
However, it is currently letting this string pass as valid:
a?c
I only want to accept alphanumeric strings - does anyone know why my regular expr... | You need to anchor the pattern on both sides:
```
/^[a-zA-Z0-9]+$/
``` |
202,417 | <p>When I shrink a sql server database using the GUI (All Tasks->Shrink Database->Accept all defaults, click OK), it finishes quickly.</p>
<p>But if I run this command, it takes a very very long time.</p>
<pre><code>DBCC SHRINKDATABASE('my_database')
</code></pre>
<p>What am I missing?</p>
<p>This is in SQL Server ... | [
{
"answer_id": 202427,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>If I recall correctly the interface will leave about 20% grown space, running DBCC SHRINKDATABASE without any p... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] | When I shrink a sql server database using the GUI (All Tasks->Shrink Database->Accept all defaults, click OK), it finishes quickly.
But if I run this command, it takes a very very long time.
```
DBCC SHRINKDATABASE('my_database')
```
What am I missing?
This is in SQL Server 2000. | If I recall correctly the interface will leave about 20% grown space, running DBCC SHRINKDATABASE without any parameters shrinks it to as small as possible.
I don't have Enterprise Manager handy to check the defaults. But you should notice a smaller database file with the manual run than the GUI run, thus the time dif... |
202,430 | <p>Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.</p>
<p>The <a href="http://www.mono-project.com/Roadmap" rel="nofollow n... | [
{
"answer_id": 202568,
"author": "MichaelGG",
"author_id": 27012,
"author_profile": "https://Stackoverflow.com/users/27012",
"pm_score": 5,
"selected": true,
"text": "<p>Well a potential is that RewritePath to / has some sort of bug, so just avoid that. Changing the RewritePath(Request.A... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27012/"
] | Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.
The [Mono Project Roadmap](http://www.mono-project.com/Roadmap) indicates A... | Well a potential is that RewritePath to / has some sort of bug, so just avoid that. Changing the RewritePath(Request.ApplicationPath) to:
```
HttpContext.Current.RewritePath("/Home/Index");
```
Seems to fix the problem, and at least the demo works so far. |
202,432 | <p>I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar. </p>
<p>screen output:</p>
<blockquote>
<p>Copying
/user2/cdb/builds/tmp/uat/myfiles/* to
server /users/myfiles as cdb</p>
<p>cdb@se... | [
{
"answer_id": 202477,
"author": "ayaz",
"author_id": 23191,
"author_profile": "https://Stackoverflow.com/users/23191",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe you can use '<a href=\"http://ayaz.wordpress.com/2006/11/19/script1-logging-terminal-sessions-to-files/\" rel=\"nofo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807/"
] | I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar.
screen output:
>
> Copying
> /user2/cdb/builds/tmp/uat/myfiles/\* to
> server /users/myfiles as cdb
>
>
> cdb@server's password:
> myfile 10... | It looks like your just missing whether the scp was succesful or not from the log.
I'm guessing the scroll bar doesn't print to stdout and uses ncurses or some other kind of TUI?
You could just look at the return value of scp to see whether it was successful. Like
```
scp myfile user@host.com:. && echo success!
`... |
202,434 | <p>How can I detect the current text formatting at the cursor position in a WPF RichTextBox?</p>
| [
{
"answer_id": 202737,
"author": "Artur Carvalho",
"author_id": 1013,
"author_profile": "https://Stackoverflow.com/users/1013",
"pm_score": 2,
"selected": true,
"text": "<p>Try the code below where rtb is the RichTextBox:</p>\n\n<pre><code>TextRange tr = new TextRange(rtb.Selection.Start... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807/"
] | How can I detect the current text formatting at the cursor position in a WPF RichTextBox? | Try the code below where rtb is the RichTextBox:
```
TextRange tr = new TextRange(rtb.Selection.Start, rtb.Selection.End);
object oFont = tr.GetPropertyValue(Run.FontFamilyProperty);
``` |
202,440 | <p>I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to narrow a result set by certain factors and column values. </p>
... | [
{
"answer_id": 202457,
"author": "Dónal",
"author_id": 2648,
"author_profile": "https://Stackoverflow.com/users/2648",
"pm_score": 0,
"selected": false,
"text": "<p>\"How hard is it\" is a tough question to answer. For example, someone who's already done it 10 times will probably reckon ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] | I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to narrow a result set by certain factors and column values.
Being t... | First off, you need to enabled Full text Searching indexing on the production servers, so if thats not in scope, your not going to want to go with this.
However, if that's already ready to go, full text searching is relatively simple.
T-SQL has 4 predicates used for full text search:
* FREETEXT
* FREETEXTTABLE
* CON... |
202,442 | <p>What tricks can be used to stop javascript callouts to various online services from slowing down page loading?</p>
<p>The obvious solution is to do all the javascript calls at the bottom of the page, but some calls need to happen at the top and in the middle. Another idea that comes to mind is using iframes. </p>
... | [
{
"answer_id": 202482,
"author": "Guido",
"author_id": 12388,
"author_profile": "https://Stackoverflow.com/users/12388",
"pm_score": 1,
"selected": false,
"text": "<p>Not easy solution. In some cases it is possible to merge the external files into a single unit and compress it in order ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/556/"
] | What tricks can be used to stop javascript callouts to various online services from slowing down page loading?
The obvious solution is to do all the javascript calls at the bottom of the page, but some calls need to happen at the top and in the middle. Another idea that comes to mind is using iframes.
Have you ever ... | window onload is a good concept, but the better option is to use jQuery and put your code in a 'document ready' block. This has the same effect, but you don't have to worry about the onload function already having a subscriber.
<http://docs.jquery.com/Core/jQuery#callback>
```
$(function(){
// Document is ready
});... |
202,459 | <p>I stumbled across this code and am too proud to go and ask the author what it means.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What is <code>gcnew</code> and how important is it to use that instead of simply... | [
{
"answer_id": 202464,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 7,
"selected": true,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/te3ecsc8.aspx\" rel=\"noreferrer\">gcnew</a> is for .NET referenc... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4790/"
] | I stumbled across this code and am too proud to go and ask the author what it means.
```
Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
```
What is `gcnew` and how important is it to use that instead of simply `new`? (I'm also stumped by the caret; ... | [gcnew](http://msdn.microsoft.com/en-us/library/te3ecsc8.aspx) is for .NET reference objects; objects created with gcnew are automatically garbage-collected; it is important to use gcnew with CLR types |
202,463 | <p>I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What the heck does the caret mean? (The <code>gcnew<... | [
{
"answer_id": 202472,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 2,
"selected": false,
"text": "<p>It means that it is a reference to a managed object.</p>\n"
},
{
"answer_id": 202473,
"author": "Rob... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4790/"
] | I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax.
```
Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
```
What the heck does the caret mean? (The `gcnew` is also new to me, and I asked ab... | This is [C++/CLI](http://en.wikipedia.org/wiki/C%2B%2B/CLI) and the caret is the managed equivalent of a \* (pointer) which in C++/CLI terminology is called a ['handle'](https://learn.microsoft.com/en-us/cpp/extensions/handle-to-object-operator-hat-cpp-component-extensions) to a 'reference type' (since you can still ha... |
202,481 | <p>How can I use HttpWebRequest (.NET, C#) asynchronously?</p>
| [
{
"answer_id": 202896,
"author": "Jon B",
"author_id": 27414,
"author_profile": "https://Stackoverflow.com/users/27414",
"pm_score": 8,
"selected": true,
"text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx\" rel=\"noreferrer\"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16794/"
] | How can I use HttpWebRequest (.NET, C#) asynchronously? | Use [`HttpWebRequest.BeginGetResponse()`](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx)
```
HttpWebRequest webRequest;
void StartWebRequest()
{
webRequest.BeginGetResponse(new AsyncCallback(FinishWebRequest), null);
}
void FinishWebRequest(IAsyncResult result)
{
web... |
202,491 | <p>Is there a way to automatically increment the "minimum required version" fields in a ClickOnce deployment to always equal the current build number? Basically, I always want my deployment to be automatically updated at launch.</p>
<p>I suspect I'm going to need a some pre-/post-build events, but I hope there's an ea... | [
{
"answer_id": 213920,
"author": "Jared Updike",
"author_id": 2543,
"author_profile": "https://Stackoverflow.com/users/2543",
"pm_score": -1,
"selected": false,
"text": "<p>Are you looking for Application Updates?</p>\n\n<p>Right clicking on the project in the Solution Explorer and then ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6897/"
] | Is there a way to automatically increment the "minimum required version" fields in a ClickOnce deployment to always equal the current build number? Basically, I always want my deployment to be automatically updated at launch.
I suspect I'm going to need a some pre-/post-build events, but I hope there's an easier way. | I may be a little late with answering this one but I found it difficult to find the solution on google but eventually figured it out so thought I would share.
With MSBuild version 4 (VS2010 and VS2012) this can be achieved by inserting the following target:
```
<Target Name="AutoSetMinimumRequiredVersion" BeforeTar... |
202,540 | <p>We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter.</p>
<p>This call works fine for other customers calling from C# or Java but this customer is getting an error back from the call. I haven't debugged their specific call but I am gue... | [
{
"answer_id": 202601,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 2,
"selected": true,
"text": "<p>Most PHP installations won't support 64 bit integers - 32 is the max. You can check this by reading the PHP_INT_SIZE... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27989/"
] | We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter.
This call works fine for other customers calling from C# or Java but this customer is getting an error back from the call. I haven't debugged their specific call but I am guessing that... | Most PHP installations won't support 64 bit integers - 32 is the max. You can check this by reading the PHP\_INT\_SIZE constant (4 = 32bit, 8 = 64bit) or read the PHP\_INT\_MAX value.
```
<?php
echo PHP_INT_SIZE, "\n", PHP_INT_MAX;
?>
```
If the web service class he is using is trying to type-convert a string repr... |