qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
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 downloaded. In this case it is still displayed correctly but reuses the instance of Excel which is open. When the IFrame is closed, Excel hangs. Excel only becomes unlocked if the user logs out of the web application or if they download a file of a different type.</p>
<p>I've tried turning on the 'Ignore other applications' setting under Tools | Options | General but it didn't solve the problem.</p>
<p>I've also tried following the steps in <a href="https://stackoverflow.com/questions/213110/make-excel-2003-open-spreadsheets-in-new-instances/213187#213187">this answer</a> (as the <a href="http://www.drewery.net/blog/2006/08/29/utilising-dual-monitors-with-microsoft-excel-2003/" rel="nofollow noreferrer">linked reference</a> says 'This issue has been addressed in Excel 2007 beta 2.') with no luck.</p>
<p>Is there some kind of 'disposal' step which I'm not currently doing which would prevent Excel from hanging?</p>
<p>Versions:</p>
<p>Excel 2003 (11.8220.8221) SP3</p>
<p>IE 7.0.5730.11 (Update Versions: 0)</p>
| [
{
"answer_id": 495387,
"author": "Matthew Murdoch",
"author_id": 4023,
"author_profile": "https://Stackoverflow.com/users/4023",
"pm_score": 2,
"selected": true,
"text": "response.setHeader(\"Content-Disposition\", \n \"attachment; filename=\\\"\" + filename + \"\\\"\");\n"
},
{
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4023/"
] |
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 guarantee there aren't more than 2 billion characters in my string!</p>
<p>All the obvious things like reinterpret_cast, static_cast also produce errors or warnings.</p>
<p>EDIT: Argh. a c-style cast: (int) does work. I had been convinced that it did not.</p>
| [
{
"answer_id": 201373,
"author": "John Dibling",
"author_id": 241536,
"author_profile": "https://Stackoverflow.com/users/241536",
"pm_score": 1,
"selected": false,
"text": "int i = (int) strlen(s);\n"
},
{
"answer_id": 201394,
"author": "Igor Semenov",
"author_id": 11401,... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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": "private long GetWebSize(SPWeb web)\n{\n long total = 0;\n\n foreach (SPFolder folder in web.Folders)\n {\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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.aspx")
End Sub
</code></pre>
<p>But it generates a crapload of <em>Response is not available in this context</em> errors. Naturally we don't want to spam our servers error logs.</p>
<p>What is the most efficient way to handle session ending with ASP.NET 2.0?</p>
| [
{
"answer_id": 203951,
"author": "Schalk Versteeg",
"author_id": 15724,
"author_profile": "https://Stackoverflow.com/users/15724",
"pm_score": 2,
"selected": false,
"text": " private void IsAuthenticated()\n {\n string vFileName = Path.GetFileName(HttpContext.Current.Request.Pa... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1291/"
] |
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 600851475143?</p>
<p>Here is my solution in C# and it's been running for I think close to an hour. I'm not looking for an answer because I do actually want to solve this myself. Mainly just looking for some help.</p>
<pre><code> static void Main(string[] args) {
const long n = 600851475143;
//const long n = 13195;
long count, half, largestPrime = 0;
bool IsAPrime;
half = n / 2;
for (long i = half; i > 1 && largestPrime == 0; i--) {
if (n % i == 0) { // these are factors of n
count = 1;
IsAPrime = true;
while (++count < i && IsAPrime) {
if (i % count == 0) { // does a factor of n have a factor? (not prime)
IsAPrime = false;
}
}
if (IsAPrime) {
largestPrime = i;
}
}
}
Console.WriteLine("The largest prime factor is " + largestPrime.ToString() + ".");
Console.ReadLine();
}
</code></pre>
| [
{
"answer_id": 201387,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": true,
"text": "n = 27\nstart at floor(sqrt(27)) = 5\nis 5 a factor? no\nis 4 a factor? no\nis 3 a factor? yes. 27 / 3 = 9. 9 is also a factor.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444511/"
] |
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": "n = 27\nstart at floor(sqrt(27)) = 5\nis 5 a factor? no\nis 4 a factor? no\nis 3 a factor? yes. 27 / 3 = 9. 9 is also a factor.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] |
201,386 | <p>On my reading spree, I stumbled upon something called <a href="http://en.wikipedia.org/wiki/Intentional_programming" rel="noreferrer">Intentional Programming</a>.
I understood it somewhat, but I not fully. If anyone can explain it in better detail, please do. Is it being used in any real application?</p>
| [
{
"answer_id": 4209826,
"author": "Igor Zevaka",
"author_id": 129404,
"author_profile": "https://Stackoverflow.com/users/129404",
"pm_score": 2,
"selected": false,
"text": "//C#, Normal version\nCustomer customer = CustomerService.Get(23);\n\nOrder order = new Order();\n//What is 0.1? Ne... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] |
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 MVCContrib library, but it is deprecated. I can understand this for the other HtmlHelpers, but there does not seem to be a replacement for the <code>CheckBoxList</code> in preview 5.</p>
<p>I would like to create a very simple list like you see below, but what is the best way to do this using ASP.NET MVC preview release 5?</p>
<pre><code><INPUT TYPE="checkbox" NAME="Inhoud" VALUE="goed"> goed
<INPUT TYPE="checkbox" NAME="Inhoud" VALUE="redelijk"> redelijk
<INPUT TYPE="checkbox" NAME="Inhoud" VALUE="matig"> matig
<INPUT TYPE="checkbox" NAME="Inhoud" VALUE="slecht"> slecht
</code></pre>
| [
{
"answer_id": 201423,
"author": "Corin Blaikie",
"author_id": 1736,
"author_profile": "https://Stackoverflow.com/users/1736",
"pm_score": 4,
"selected": false,
"text": "<% foreach(Inhoud i in ViewData[\"InhoudList\"] as List<Inhoud>) { %>\n <input type=\"checkbox\" name=\"Inhoud\" valu... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27857/"
] |
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 receive the message</p>
<pre><code>gunzip: SMS.tar.gz: unexpected end of file
</code></pre>
<p>Is there any way to recover even part of the archive?</p>
| [
{
"answer_id": 222943,
"author": "Liudvikas Bukys",
"author_id": 5845,
"author_profile": "https://Stackoverflow.com/users/5845",
"pm_score": 5,
"selected": false,
"text": "gunzip < SMS.tar.gz > SMS.tar.partial\n"
},
{
"answer_id": 18915270,
"author": "Anthony Palmer",
"au... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11787/"
] |
201,401 | <p>I am looking to improve the performance of my site, not because it is performing badly but just as a general exercise. The usual suggestion for asp.net sites is to remove viewstate wherever possible. I believe this can be done by each control on a page separately or for the whole page.</p>
<p>My question is if I disable the page viewstate will this stop the viewstate of controls on a masterpage (as I understand it the masterpage is actually a control on the page). </p>
| [
{
"answer_id": 204119,
"author": "PhilPursglove",
"author_id": 1738,
"author_profile": "https://Stackoverflow.com/users/1738",
"pm_score": 2,
"selected": false,
"text": "Imports System \nImports System.Web.UI\n\nPublic Class SessionPageStateAdapter\n Inherits System.Web.UI.Adapters.P... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] |
201,413 | <p>Just because I'm curious--is there any C analog to the functionality of the STL in C++? I've seen mention of a <a href="http://www.gtk.org" rel="noreferrer">GTK+</a> library called glib that a few people consider fills the bill but are there other libraries that would provide STL functionality in C?</p>
| [
{
"answer_id": 201483,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 6,
"selected": true,
"text": "glib"
},
{
"answer_id": 63071045,
"author": "msune",
"author_id": 9321563,
"author_profile": "https:... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2820/"
] |
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;
ftpclientRequest.UsePassive = true;
ftpclientRequest.Proxy = null;
ftpclientRequest.Credentials = new NetworkCredential(user, password);
FtpWebResponse response = ftpclientRequest.GetResponse() as FtpWebResponse;
</code></pre>
<p>This normally works, but for 1 particular server this gives an Error 500: Syntax not recognized. The Change Directory command is disabled on the problem server, and the site administrator told me that .NET issues a Change Directory command by default with all FTP connections. Is that true? Is there a way to disable that?
<BR>EDIT: When I login from a command line I am in the correct directory:<BR>
ftp> pwd<BR>
257 "/" is current directory</p>
| [
{
"answer_id": 201847,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 5,
"selected": true,
"text": "if (m_PreviousServerPath != newServerPath) { \n if (!m_IsRootPath\n && m_LoginState == FtpLoginState.LoggedIn\n &&... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20754/"
] |
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 of VS or other languages]</p>
<h3>Keep track of object instances</h3>
<p>Working with multiple instances of a given class? How can you tell them apart?
In pre-garbage collection programming days, it was easy to keep track of references - just look at the memory address. With .NET, you can't do that - objects can get moved around.
Fortunately, the watches view lets you right-click on a watch and select 'Make Object ID'.</p>
<p>This appends a {1#}, {2#} etc. after the instance's value, effectively giving the instance a unique label.</p>
<p>The label is persisted for the lifetime of that object.</p>
<h3>Meaningful values for watched variables</h3>
<p>By default, a watched variable's value is it's type. If you want to see its fields, you have to expand it, and this could take a long time (or even timeout!) if there are many fields or they do something complicated.</p>
<p>However, some predefined types show more meaningful information :</p>
<ul>
<li>strings show their actual contents</li>
<li>lists and dictionaries show their elements count etc.</li>
</ul>
<p>Wouldn't it be nice to have that for my own types?</p>
<p>Hmm...</p>
<p>...some quality time with .NET Reflector shows how easily this can be accomplished with the <code>DebuggerDisplay</code> attribute on my custom type:</p>
<pre><code>[System.Diagnostics.DebuggerDisplay("Employee: '{Name}'")]
public class Employee {
public string Name { get { ... } }
...
}
</code></pre>
<p>... re-run, and it works.</p>
<p>There's a lot more info on the subject here: <a href="http://msdn.microsoft.com/en-us/magazine/cc163974.aspx" rel="nofollow noreferrer">MSDN</a></p>
<h3>Break on all exceptions</h3>
<p>... even the ones that are handled in code!
I know, I'm such a n00b for not knowing about this ever since I was born, but here it goes anyway - maybe this will help someone someday:</p>
<p>You can force a debugged process to break into debug mode each time an exception is thrown. Ever went on a bug hunt for hours only to come across a piece of code like this?</p>
<pre><code>try {
runStrangeContraption();
} catch(Exception ex) {
/* TODO: Will handle this error later */
}
</code></pre>
<p>Catching all exceptions is really handy in these cases.
This can be enabled from <em>Debug > Exceptions... (Ctrl-Alt-E)</em>. Tick the boxes in the 'Thrown' column for each type of exception you need.</p>
<hr />
<p>Those were a few forehead-slapping moments for me.
Would you care to share yours?</p>
| [
{
"answer_id": 204458,
"author": "Cristian Diaconescu",
"author_id": 11545,
"author_profile": "https://Stackoverflow.com/users/11545",
"pm_score": 4,
"selected": false,
"text": "System.Diagnostics.Debugger.Break()\n"
},
{
"answer_id": 204591,
"author": "leppie",
"author_i... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11545/"
] |
201,457 | <p>What's the best way to implement a URL interpreter / dispatcher, such as found in <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/?from=olddocs" rel="nofollow noreferrer">Django</a> and RoR, in PHP?</p>
<p>It should be able to interpret a query string as follows:</p>
<ul>
<li><code>/users/show/4</code> maps to
<ul>
<li><em>area</em> = <strong>Users</strong></li>
<li><em>action</em> = <strong>show</strong></li>
<li><em>Id</em> = <strong>4</strong></li>
</ul></li>
<li><code>/contents/list/20/10</code> maps to
<ul>
<li><em>area</em> = <strong>Contents</strong></li>
<li><em>action</em> = <strong>list</strong></li>
<li><em>Start</em> = <strong>20</strong></li>
<li><em>Count</em> = <strong>10</strong></li>
</ul></li>
<li><code>/toggle/projects/10/active</code> maps to
<ul>
<li><em>action</em> = <strong>toggle</strong></li>
<li>area = <strong>Projects</strong></li>
<li><em>id</em> = <strong>10</strong></li>
<li><em>field</em> = <strong>active</strong></li>
</ul></li>
</ul>
<p>Where the query string can be a specified GET / POST variable, or a string passed to the interpreter.</p>
<p>Edit: I'd prefer an implementation that does not use mod_rewrite.</p>
<p>Edit: This question is not about clean urls, but about interpreting a URL. Drupal uses mod_rewrite to redirect requests such as <a href="http://host/node/5" rel="nofollow noreferrer">http://host/node/5</a> to <a href="http://host/?q=node/5" rel="nofollow noreferrer">http://host/?q=node/5</a>. It then interprets the value of $_REQUEST['q']. I'm interested in the interpreting part.</p>
| [
{
"answer_id": 201659,
"author": "adnam",
"author_id": 27886,
"author_profile": "https://Stackoverflow.com/users/27886",
"pm_score": 2,
"selected": false,
"text": "<IfModule mod_rewrite.c>\n RewriteEngine On\n RewriteCond %{REQUEST_FILENAME} -f\n RewriteRule ^(.*)$ $1 [L]\n R... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6681/"
] |
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(argv[1])
</code></pre>
<p>My own implementation solves Sudokus the same way I solve them in my head but how does this cryptic algorithm work?</p>
<p><a href="http://scottkirkwood.blogspot.com/2006/07/shortest-sudoku-solver-in-python.html" rel="noreferrer">http://scottkirkwood.blogspot.com/2006/07/shortest-sudoku-solver-in-python.html</a></p>
| [
{
"answer_id": 201550,
"author": "Tetha",
"author_id": 17663,
"author_profile": "https://Stackoverflow.com/users/17663",
"pm_score": 3,
"selected": false,
"text": "def r(a):\n i = a.find('0') # returns -1 on fail, index otherwise\n ~i or exit(a) # ~(-1) == 0, anthing else is not 0\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27736/"
] |
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 this problem. But I get the feeling this is a bad idea. Here's example code of what I mean</p>
<pre><code>// array of WHERE conditions
$param = array('customer_id'=>1, 'qty'=>'2');
$stmt = $mysqli->stmt_init();
$types = ''; $bindParam = array(); $where = ''; $count = 0;
// build the dynamic sql and param bind conditions
foreach($param as $key=>$val)
{
$types .= 'i';
$bindParam[] = '$p'.$count.'=$param["'.$key.'"]';
$where .= "$key = ? AND ";
$count++;
}
// prepare the query -- SELECT * FROM t1 WHERE customer_id = ? AND qty = ?
$sql = "SELECT * FROM t1 WHERE ".substr($where, 0, strlen($where)-4);
$stmt->prepare($sql);
// assemble the bind_param command
$command = '$stmt->bind_param($types, '.implode(', ', $bindParam).');';
// evaluate the command -- $stmt->bind_param($types,$p0=$param["customer_id"],$p1=$param["qty"]);
eval($command);
</code></pre>
<p>Is that last eval() statement a bad idea? I tried to avoid code injection by encapsulating values behind the variable name $param.</p>
<p>Does anyone have an opinion or other suggestions? Are there issues I need to be aware of?</p>
| [
{
"answer_id": 201639,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 5,
"selected": true,
"text": "eval()"
},
{
"answer_id": 205145,
"author": "rix0rrr",
"author_id": 2474,
"author_profile": "https://St... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27305/"
] |
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 information about it.</p>
<p>My client code is below:</p>
<pre><code>import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestClient {
public static void main(String [] args)
{
try{
String endpoint = "http://localhost:8080/TestWebService/services/DoesMagic";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName( new QName("http://testPackage.fc.com/, doBasicStuff") );
String ret = (String) call.invoke( new Object[] {"some kind of message"} );
System.out.println(ret);
}catch(Exception e){
System.err.println(e.toString());
}
}
}
</code></pre>
<p>My web serivce code is really basic - just a simple class that returns your input string with a bit of concat text:</p>
<pre><code>public String doBasicStuff(String message)
{
return "This is your message: " + message;
}
</code></pre>
| [
{
"answer_id": 201497,
"author": "Rich Kroll",
"author_id": 58733,
"author_profile": "https://Stackoverflow.com/users/58733",
"pm_score": 3,
"selected": false,
"text": "new QName(\"http://testPackage.fc.com/\", \"doBasicStuff\")\n"
},
{
"answer_id": 201508,
"author": "Martin ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175/"
] |
201,479 | <p>I've heard people talking about "base 64 encoding" here and there. What is it used for?</p>
| [
{
"answer_id": 201495,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "+"
},
{
"answer_id": 201823,
"author": "Andrew Cox",
"author_id": 27907,
"author_profile": "https... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22471/"
] |
201,501 | <p>I have a strange issue: I am using SPContext.Current.Web in a .aspx page, but at the end, I get a "Trying to use an SPWeb object that has been closed or disposed and is no longer valid." error message.</p>
<p>From what I see, SPContext.Current.Web is Disposed by someone, <strong>but I have no idea where</strong>. I just wonder: With Visual Studio 2005's Debugger, can I somehow see where/who disposed an Object? As I neither create nor have the source code, setting breakpoints is a problem.</p>
<p>What would be a good approach for finding out who disposes a given object where, without just randomly commenting out lines?</p>
<p>(Note: The Issue has been resolve, but the question itself also applies outside of Sharepoint)</p>
| [
{
"answer_id": 201645,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 4,
"selected": true,
"text": "System.IO.StreamReader.Dispose"
},
{
"answer_id": 202132,
"author": "Nico",
"author_id": 22970,
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91/"
] |
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 actual script and not a simplification of a different test script):</p>
<pre><code>import urllib, urllib2
print urllib.urlopen("http://127.0.0.1").read() # prints "running"
print urllib2.urlopen("http://127.0.0.1").read() # throws an exception
</code></pre>
<p>Here's the stack trace:</p>
<pre><code>Traceback (most recent call last):
File "urltest.py", line 5, in <module>
print urllib2.urlopen("http://127.0.0.1").read()
File "C:\Python25\lib\urllib2.py", line 121, in urlopen
return _opener.open(url, data)
File "C:\Python25\lib\urllib2.py", line 380, in open
response = meth(req, response)
File "C:\Python25\lib\urllib2.py", line 491, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python25\lib\urllib2.py", line 412, in error
result = self._call_chain(*args)
File "C:\Python25\lib\urllib2.py", line 353, in _call_chain
result = func(*args)
File "C:\Python25\lib\urllib2.py", line 575, in http_error_302
return self.parent.open(new)
File "C:\Python25\lib\urllib2.py", line 380, in open
response = meth(req, response)
File "C:\Python25\lib\urllib2.py", line 491, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python25\lib\urllib2.py", line 418, in error
return self._call_chain(*args)
File "C:\Python25\lib\urllib2.py", line 353, in _call_chain
result = func(*args)
File "C:\Python25\lib\urllib2.py", line 499, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 504: Gateway Timeout
</code></pre>
<p>Any ideas? I might end up needing some of the more advanced features of <code>urllib2</code>, so I don't want to just resort to using <code>urllib</code>, plus I want to understand this problem.</p>
| [
{
"answer_id": 201737,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 5,
"selected": true,
"text": "proxy_support = urllib2.ProxyHandler({})\nopener = urllib2.build_opener(proxy_support)\nprint opener.open(\"http://127.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] |
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 extraneous "class" attribute in the INPUT tag):</p>
<pre><code><span class="btnOrange">
<input type="submit" class="btnOrange" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/>
</span>
</code></pre>
<p>My custom button class looks like this:</p>
<pre><code>[ToolboxData(@"<{0}:MyButton runat=server></{0}:MyButton>")]
public class MyButton : Button
{
public override void RenderBeginTag(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
writer.RenderBeginTag("span");
base.RenderBeginTag(writer);
}
public override void RenderEndTag(HtmlTextWriter writer)
{
writer.RenderEndTag();
base.RenderEndTag(writer);
}
}
</code></pre>
<p>Since I only need to set the class attribute for the SPAN tag, is it possible to not include or "blank out" the class attribute for the INPUT tag?</p>
| [
{
"answer_id": 201526,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 0,
"selected": false,
"text": "class"
},
{
"answer_id": 203613,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] |
201,524 | <p>Our Test DB is suddenly missing rows. We want them back.</p>
<p>Is there a way to sift through everything that has happened to the database today? Each SQL statement? I presume this kind of stuff is in the transaction log, but am not sure how to view it.</p>
<p>Is there a way to undo delete operations?</p>
<p>BTW: Yes, we do have a backup, but would prefer to find the cause of the deletion as well...</p>
| [
{
"answer_id": 35519886,
"author": "Jason Clark",
"author_id": 5218011,
"author_profile": "https://Stackoverflow.com/users/5218011",
"pm_score": -1,
"selected": false,
"text": "Rollback"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] |
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>event description</li>
<li>timestamp of the event</li>
</ul>
<p>Am I missing something here? Obviously, I can keep improving the design, although I don't plan on making it complicated (creating other tables for event types or stuff like that is out of the question since it's a complication for my need).</p>
| [
{
"answer_id": 201561,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": 2,
"selected": false,
"text": "mod_user"
},
{
"answer_id": 211540,
"author": "WW.",
"author_id": 14663,
"author_profile": "https://S... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9114/"
] |
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:</p>
<pre><code>$('#container').html(divstr);
</code></pre>
<p>Is there a more elegant way to insert multiple, identical elements?</p>
<p>I'm hoping to find something that wouldn't break chaining but wouldn't bring the browser to its knees. A chainable <code>.repeat()</code> plugin?</p>
| [
{
"answer_id": 201564,
"author": "Wayne",
"author_id": 8236,
"author_profile": "https://Stackoverflow.com/users/8236",
"pm_score": 1,
"selected": false,
"text": "for(i=0;i<10; i++){\n $('#container').append(\"<div></div>\");\n}\n"
},
{
"answer_id": 201661,
"author": "Remy ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20074/"
] |
201,532 | <p>I use the ASP.NET Development Web server (also known as the Visual Studio Development Web server) to do local web site debugging and testing.</p>
<p>I've pretty much found exact functionality with IIS with the dev web server. However - where can you manage the settings of the dev web server - specifically regarding never caching any content - ever?</p>
<p>This of course is useful in a development scenario where I dont want to have to clear my cache...</p>
| [
{
"answer_id": 13547959,
"author": "Ahmad Firdaus",
"author_id": 990579,
"author_profile": "https://Stackoverflow.com/users/990579",
"pm_score": 0,
"selected": false,
"text": "[WebMethod(CacheDuration=0)]\npublic string mymethod(string s)\n{\n\n}\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341/"
] |
201,589 | <p>I know that the JBoss Application Server has the JMX-Console as a GUI for administration. My question is, is there a similar admin tool using the command line? Does this tool come with the application server, and can it report on the status of various services under the control of the server?</p>
| [
{
"answer_id": 410591,
"author": "Nicholas",
"author_id": 43786,
"author_profile": "https://Stackoverflow.com/users/43786",
"pm_score": 1,
"selected": false,
"text": "import javax.management.*;\nimport javax.naming.*;\nProperties p = new Properties();\np.put(Context.PROVIDER_URL, url);\n... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27778/"
] |
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 valid CLR header, but this approach seems clumsy and difficult to automate.</p>
| [
{
"answer_id": 201781,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 0,
"selected": false,
"text": "System.Reflection.Assembly.ReflectionOnlyLoadFrom(\"mydll.dll\")\n"
},
{
"answer_id": 202633,
"author": "Tim Farle... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5985/"
] |
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>And a implementation with something like this:</p>
<pre><code>char* enum_to_string(MyEnum t){
switch(t){
case FOO:
return "FOO";
case BAR:
return "BAR";
default:
return "INVALID ENUM";
}
}
</code></pre>
<p>The gotcha is really with typedefed enums, and unnamed C style enums. Does anybody know something for this?</p>
<p>EDIT: The solution should not modify my source, except for the generated functions. The enums are in an API, so using the solutions proposed until now is just not an option.</p>
| [
{
"answer_id": 201665,
"author": "gbjbaanb",
"author_id": 13744,
"author_profile": "https://Stackoverflow.com/users/13744",
"pm_score": 5,
"selected": false,
"text": "enum colours { red, green, blue };\nconst char *colour_names[] = { \"red\", \"green\", \"blue\" };\n"
},
{
"answe... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21648/"
] |
201,602 | <p>I am using wordpress and use custom permalink structure: /%category%/%postname%/</p>
<p>My problem is that a decent number of people link to the site without including the trailing slash in the URL, so users get a 404 page.</p>
<p>I'm using the default .htaccess file that comes with wordpress because no solution I've tried has worked. I've tried using the Redirection plugin, with no success. </p>
<p>I'd gladly link to the site, but I don't want it to be construed as self-promotion. If you ask, I'll provide a link.</p>
<p>Could anyone help me find a plugin or provide some .htaccess entries to help resolve this?</p>
<p>Thanks very much!</p>
| [
{
"answer_id": 201618,
"author": "Dominic Rodger",
"author_id": 20972,
"author_profile": "https://Stackoverflow.com/users/20972",
"pm_score": 2,
"selected": false,
"text": "/%category%/%postname%(/?)\n"
},
{
"answer_id": 214564,
"author": "eyelidlessness",
"author_id": 17... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25066/"
] |
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 through the array to turn it into a generic <code>List</code>?</p>
| [
{
"answer_id": 201622,
"author": "IAmCodeMonkey",
"author_id": 27613,
"author_profile": "https://Stackoverflow.com/users/27613",
"pm_score": 0,
"selected": false,
"text": "Dim strings As List<string> = string_variable.Split().ToList<string>();\n"
},
{
"answer_id": 201627,
"au... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
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><a href="http://angrez.blogspot.com/2006/12/log4r-usage-and-examples.html" rel="nofollow noreferrer">Angrez's blog: Log4r - Usage and Examples</a></p>
<p><a href="http://programmingstuff.wikidot.com/log4r" rel="nofollow noreferrer">ProgrammingStuff: Log4r</a></p>
| [
{
"answer_id": 203848,
"author": "Rajkumar S",
"author_id": 25453,
"author_profile": "https://Stackoverflow.com/users/25453",
"pm_score": 4,
"selected": true,
"text": "require 'rubygems'\nrequire 'log4r'\nrequire 'log4r/outputter/syslogoutputter'\nmylog = Logger.new 'mylog'\nmylog.output... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25453/"
] |
201,616 | <p>We have a C# service that is deployed to a remote customer system. The application writes a substantial amount of "diagnostic" information to the console (i.e. Console.WriteLine()). The service isn't "doing what it should." How can we capture the console output from the service in another application?</p>
<p>A WinForm version the application can be loaded at the customer location. It, unfortunately, functions correctly.</p>
<p>Update:</p>
<p>We are able to change the change the service, but would prefer not to make major changes at this time.</p>
<p>We are also logging to MSMQ, but only for "important" events. This service does interact with MSMQ for its normal operations. Or, at least, it should. The service doesn't seem to be pulling items from MSMQ when the WinForm version does. So, writing the messages that are going to the console could be problematic.</p>
| [
{
"answer_id": 201810,
"author": "Michael Petrotta",
"author_id": 23897,
"author_profile": "https://Stackoverflow.com/users/23897",
"pm_score": 3,
"selected": false,
"text": "EventLog log;\nstring logsource = \"MyService\";\n\n// execute once per invocation\nif (!System.Diagnostics.Event... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27887/"
] |
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": "SELECT * FROM information_schema.TABLE_CONSTRAINTS \nWHERE information_schema.TABLE_CONSTRAINTS.CONSTRAINT_TYPE = 'FOREIGN KEY'... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3757/"
] |
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 this in Linq To Sql?</p>
<p><strong>NOTE: We have hundreds of databases and do not want to put views in each db. The return should come back as just another property on each row of the return result set.</strong></p>
| [
{
"answer_id": 231477,
"author": "gfrizzle",
"author_id": 23935,
"author_profile": "https://Stackoverflow.com/users/23935",
"pm_score": 0,
"selected": false,
"text": "Dim results = _\n From x In myContext.MyTables _\n Select x, info = myContext.Connection.ConnectionString\n"
},
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] |
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>
<XMLContent>Here is some content</XMLContnet>
</XMLNode>
</code></pre>
<p>if I get the InnerXML for <code><XmlNode></code> the HTML tags are returned as XML entities.</p>
<p>I cannot use InnerText because I need to be able to get the XML contents. So all I really need is a way to un-escape the HTML tags, because I can detect if it's XML or not and act accordingly.</p>
<p>I guess I could use HTMLDecode, but will this decode all the XML encoded entities?</p>
<p><strong>Update:</strong> I guess I'm rambling a bit above so here is a clarified scenario:</p>
<p>I have a XML document that looks like this:</p>
<pre><code><content id="1">
<data>&lt;p&gt;A Test&lt;/p&gt;</data>
</content id="2">
<content>
<data>
<dataitem>A test</dataitem>
</data>
</content>
</code></pre>
<p>If I do:</p>
<pre><code>XmlNode xn1 = document.SelectSingleNode("/content[@id=1]/data");
XmlNode xn2 = document.SelectSingleNode("/content[@id=2]/data");
Console.WriteLine(xn1.InnerXml);
Console.WriteLine(xn2.InnerXml);
</code></pre>
<p>xn1 will return </p>
<pre><code> &lt;p&gt;A Test&lt;/p&gt;
</code></pre>
<p>xn2 will return <code><dataitem>A test</dataitem></code></p>
<p>I am already checking to see if what is returned is XML (in the case of xn2) so all I need to do is un-escape the <code>&lt;</code> etc in xn1.</p>
<p>HTMLDecode does this, but I'm not sure it would work for everything. So the question remains would HTMLDecode handle all the possible entities or is there a class somewhere that will do it for me.</p>
| [
{
"answer_id": 201790,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "\"<p>A Test</p>\""
},
{
"answer_id": 205962,
"author": "Robert Rossney",
"author_id": 19403,
"author_p... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1970/"
] |
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 nested set model is optimized for reads instead of writes, I decided to use that. Unfortunately during my research and testing of nested sets, I ran into the problem of how do I display the hierarchical tree with sorted nodes. For example if I have the hierarchy:</p>
<pre><code>root
finances
budgeting
fy08
projects
research
fabrication
release
trash
</code></pre>
<p>I want that to be sorted so that it displays as:</p>
<pre><code>root
finances
budgeting
fy08
projects
fabrication
release
research
trash
</code></pre>
<p>Notice that the fabrication appears before research.</p>
<p>Anyway, after a long search I saw answer such as "store the tree in a multi-dimensional array and sort it" and "resort the tree and serialized back into your nested set model" (I'm paraphrazing...). Either way, the first solution is a horrible waste of RAM and CPU, which are both very finite resources... The second solution just looks like a lot of painful code.</p>
<p>Regardless, I was able to figure out how to (using the nested set model):</p>
<ol>
<li>Start a new tree in SQL</li>
<li>Insert a node as a child of another node in tree</li>
<li>Insert a node after a sibling node in the tree</li>
<li>Pull the entire tree with the hierarchy structure from SQL</li>
<li>Pull a subtree from a specific node (including root) in the hierarchy with or without a depth limit</li>
<li>Find the parent of any node in the tree</li>
</ol>
<p>So I figured #5 and #6 could be used to do the sorting I wanted, and it could also be used to rebuild the tree in sorted order as well.</p>
<p>However, now that I've looked at all of these things I've learned to do I see that #3, #5, and #6 could be used together to perform sorted inserts. If I did sorted inserts it always be sorted. However, if I ever change the sort criteria or I want a different sort order I'm back to square one.</p>
<p>Could this just be the limitation of the nested set model? Does its use inhibit in query sorting of the output?</p>
| [
{
"answer_id": 202735,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 3,
"selected": false,
"text": "ORDER BY node.rgt DESC"
},
{
"answer_id": 457424,
"author": "Justin Wignall",
"author_id": 42774,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
201,680 | <p>Does Geronimo provides a standalone transaction manager?
And if it does, is it possible to use it in Tomcat?</p>
| [
{
"answer_id": 1991439,
"author": "skaffman",
"author_id": 21234,
"author_profile": "https://Stackoverflow.com/users/21234",
"pm_score": 2,
"selected": false,
"text": "DataSource"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27762/"
] |
201,696 | <p>In ASP.NET, I'm looking for a way to audit a user leaving my application. To be specific, I'd like to insert a 'logout' record in an audit table in SQL Server when the user's session is abandoned/destroyed for any reason (not necessarily because of a call to session.abandon)</p>
<p>I have a 'SessionHelper' class that manages the session setters/getters.</p>
<p>I've tried posting back in Session_End in Global.asax, but it never fired this event even after the timeout expired.</p>
<p>I've tried overriding 'finalize' in the SessionHelper class and doing it there when the class is destroyed, but it did not fire that event either.</p>
<p>I'd try implementing IDisposable in the SessionHelper, but I don't know where to call it so that it always gets called.</p>
<p>What is the proper way to audit a user leaving your ASP.NET application?</p>
<p>Thank you!</p>
| [
{
"answer_id": 201755,
"author": "Jason Jackson",
"author_id": 13103,
"author_profile": "https://Stackoverflow.com/users/13103",
"pm_score": 1,
"selected": false,
"text": "[Id] [Uid] [LoginInOn] [ExpiresOn] \n 1 johndoe 10/14/2008 10:47 10/14/2008 11:07 \n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6624/"
] |
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 that 2.0 sets cookies to HttpOnly by default, but the solutions given haven't worked for me so far. I also read somewhere that 2.0 may be discriminating based on user-agent.</p>
<p>Does anyone have any experience or insight into this?</p>
| [
{
"answer_id": 656465,
"author": "Aidan Black",
"author_id": 8211,
"author_profile": "https://Stackoverflow.com/users/8211",
"pm_score": 0,
"selected": false,
"text": "<httpCookies httpOnlyCookies=\"false\" />"
},
{
"answer_id": 7314616,
"author": "Trevor Lohrbeer",
"auth... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8211/"
] |
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 necessary. But I would like to name my log file. Rather than "localhost".YYYY-MM-DD.log, is there a way to have it write to "myAppName".YYYY-MM-DD.log. I know I could create my own mechanism, but again, I looking for simplicity here.</p>
<p>I'm hoping to stay away from a complete framework like Log4j.</p>
| [
{
"answer_id": 656465,
"author": "Aidan Black",
"author_id": 8211,
"author_profile": "https://Stackoverflow.com/users/8211",
"pm_score": 0,
"selected": false,
"text": "<httpCookies httpOnlyCookies=\"false\" />"
},
{
"answer_id": 7314616,
"author": "Trevor Lohrbeer",
"auth... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13930/"
] |
201,705 | <p>I've got an image library on Amazon S3. For each image, I md5 the source URL on my server plus a timestamp to get a unique filename. Since S3 can't have subdirectories, I need to store all of these images in a single flat folder.</p>
<p>Do I need to worry about collisions in the MD5 hash value that gets produced?</p>
<p>Bonus: How many files could I have before I'd start seeing collisions in the hash value that MD5 produces?</p>
| [
{
"answer_id": 201725,
"author": "Ryan",
"author_id": 17917,
"author_profile": "https://Stackoverflow.com/users/17917",
"pm_score": 4,
"selected": false,
"text": "md5(filename) + timestamp\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27899/"
] |
201,706 | <p>I have an SQL Server DB with a table with these fields:</p>
<ol>
<li>A <code>bit</code> with the default value 1, <code>NOT NULL</code>.</li>
<li>A <code>smalldatetime</code> with the default value <code>gettime()</code>, <code>NOT NULL</code>.</li>
<li>An <code>int</code> with no default value, <code>IDENTITY</code>, <code>NOT NULL</code>.</li>
</ol>
<p>When I generate Linq to SQL for this table, the following happens:</p>
<ol>
<li>The <code>bit</code> is given no special treatment.</li>
<li>The <code>smalldatetime</code> is given no special treatment.</li>
<li>The <code>int</code> is marked as <code>IsDbGenerated</code>.</li>
</ol>
<p>This means that when I make inserts using Linq to SQL, the following will happen:</p>
<ol>
<li>The <code>bit</code> will be sent as 0, overriding the default value. <strong>Right?</strong></li>
<li>The <code>smalldatetime</code> will be sent as an uninitialized <code>System.DateTime</code>, producing an error in SQL server since it doesn't fall with the SQL Server smalldatetime range. <strong>Right?</strong></li>
<li>The <code>IsDbGenerated</code> <code>int</code> will not be sent; the DB will generate a value which Linq to SQL will then read back.</li>
</ol>
<p><strong>What changes do I have to make to make this scenario work?</strong> </p>
<p>To summarize: I want non-nullable fields with DB-assigned default values, but I don't want them <code>IsDbGenerated</code> if it means I cannot provide values for them when making updates or inserts using Linq to SQL. I also do not want them <code>IsDbGenerated</code> if it means I have to hand-modify the code generated by Linq to SQL.</p>
<p><em>EDIT: The answer seems to be this is a limitation in the current Linq to SQL.</em></p>
| [
{
"answer_id": 206710,
"author": "Robert Paulson",
"author_id": 14033,
"author_profile": "https://Stackoverflow.com/users/14033",
"pm_score": 4,
"selected": true,
"text": "GetDate()"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7724/"
] |
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": "vector<int> a, b;\n//fill with data\nb.insert(b.end(), a.begin(), a.end());\n"
},
{
"answer_id": 201729,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 way.)</p>
| [
{
"answer_id": 201733,
"author": "Wayne",
"author_id": 8236,
"author_profile": "https://Stackoverflow.com/users/8236",
"pm_score": 11,
"selected": true,
"text": "var arr = [\"Zero\", \"One\", \"Two\"];\n\ndocument.write(arr.join(\", \"));"
},
{
"answer_id": 202247,
"author": ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
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 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, and that I can specify my own timeout.</p>
<ul>
<li>Thanks!</li>
</ul>
| [
{
"answer_id": 201759,
"author": "Andrew Cox",
"author_id": 27907,
"author_profile": "https://Stackoverflow.com/users/27907",
"pm_score": 2,
"selected": true,
"text": "using System.Net;\n\nusing System.IO;\n\nHttpWebRequest req = (HttpWebRequest) WebRequest.Create(WebPageUrl);\n\nWebResp... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14101/"
] |
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 work so well if the page has a master page. I've tried setting the default button in code with <em>control</em>.ID, <em>control</em>.ClientID, and <em>control</em>.UniqueID, and in each case I get:</p>
<blockquote>
<p>The DefaultButton of panelName must be the ID of a control of type IButtonControl.</p>
</blockquote>
<p>I'm sure there's a way to do this with JavaScript, but I'd really like to do it with plain old C# code if possible. Is it possible?</p>
| [
{
"answer_id": 201822,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "txtPassword.Attributes.Add(\"onKeyPress\", \"javascript:if (event.keyCode == 13) __doPostBack('\" + lnkSubmit.UniqueID ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5486/"
] |
201,778 | <p>I have a user interface that requires placing some round buttons in a C# project with some data behind them. The buttons are System.Windows.Forms.buttons and I have used a GIF image with transparency to create them. However, the transparent areas aren't transparent. I've looked for references online but haven't found any suggestions for how to do this properly. There's some mention of doing it in Visual Studio 2008 but I need to keep this project in 2005. Any help or suggestion is appreciated.</p>
| [
{
"answer_id": 825833,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": " protected override CreateParams CreateParams\n {\n get\n {\n const int WS_EX_TRANSPARENT = 0x2... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27906/"
] |
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\",", i);
}
s.append("]");
</code></pre>
<p>giving you a string like</p>
<pre><code>[0,1,2,3,4,5,]
</code></pre>
<p>Is this allowed?</p>
| [
{
"answer_id": 201856,
"author": "brianb",
"author_id": 27892,
"author_profile": "https://Stackoverflow.com/users/27892",
"pm_score": 9,
"selected": true,
"text": "s.append(\"[\");\nfor (i = 0; i < 5; ++i) {\n if (i) s.append(\",\"); // add the comma only if this isn't the first entry\n... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1323/"
] |
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<User> GetAllUsers() // non C# users: that means List of User :)
</code></pre>
<p>Do you know why (google didn't help)? What do you usually expose for that kind of stuff? IList? IEnumerable?</p>
| [
{
"answer_id": 201805,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": true,
"text": "IEnumerable<User>"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5789/"
] |
201,796 | <p>We are using standard asp.net forms authentication. Certain pages require a user to be logged in; and least some of these pages are delivered by https. There is a search control at the top of each page. When this is used, we don't care whether the user's session has expired, even if the current page requires a log in. </p>
<p>However, currently, when performing the search, the built-in forms authentication sees that the page being posted to requires authentication and redirects the user to the login page, with the previous page, <em>not the search results page</em> as the referrer.</p>
<p>What is the best way of bypassing the security here? I have considered posting to a different page using the PostBackUrl property, but if this is not https you get the "you are posting data to an unsecure connection" message, which users don't like.</p>
<p>Thanks for any help.</p>
<p>Edit: thanks Nick for your suggestion of using a GET on the search page. We are doing this already, but the query string is constructed by the search input control then redirects. How can we build up the query string without using a postback? (Obviously javascript is an option but I was hoping to find an alternative mechanism.)</p>
| [
{
"answer_id": 201820,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": false,
"text": "<form method=\"post\" ...>\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/201796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3856/"
] |
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;....
...
C:\apps\jdk1.6.0_07\bin\java.exe -client oracle.jdevimpl.junit.runner.TestRunner com.myco.myClass.MyTest testMethod
</code></pre>
<p>(Other variations are setting the classpath all on one line, setting the classpath via -classpath as an argument to java"). It always comes down to the console throwing up it's hands with this error:</p>
<pre><code>The input line is too long.
The syntax of the command is incorrect.
</code></pre>
<p>This is a JUnit test testing a rather large existing legacy project, so no suggestions about rearranging my directory structure to something more reasonable, those types of solutions are out for now. I was just trying to gen up a quick test against this project and run it on the command line, and the console is stonewalling me. Help!</p>
| [
{
"answer_id": 201857,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": -1,
"selected": false,
"text": "set CLASS_PATH = c:\\path\nset ALT_A = %CLASS_PATH%\\a\\b\\c;\nset ALT_B = %CLASS_PATH%\\e\\f\\g;\n...\n\nset ALL_PATHS = ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13140/"
] |
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 to support the user being able to name their clients however they want. I'm wondering if this is possible. I tried using brackets, but that didn't appear to work. My file looks like:</p>
<pre>
8.0
1
1 SQLCHAR 0 0 "\r\n" 1 [group] SQL_Latin1_General_CP1_CI_AS
</pre>
| [
{
"answer_id": 203931,
"author": "Ed Harper",
"author_id": 27825,
"author_profile": "https://Stackoverflow.com/users/27825",
"pm_score": 1,
"selected": false,
"text": "Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'group'.\n"
},
{
"answe... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] |
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 query:</p>
<pre><code>var person = (from p in [DataContextObject].Persons
where p.PersonsID == 1
select new p).FirstOrDefault();
if (person == null)
{
// handle 0 "rows" returned.
}
</code></pre>
<p>But I can't use <code>FirstOrDefault()</code> when I do:</p>
<pre><code>var person = from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZipcode };
// Under the hood, this pattern generates a query which selects specific
// columns which will be faster than selecting all columns as the above
// snippet of code does. This results in a performance-boost on large tables.
</code></pre>
<p>How do I check for 0 "rows" returned by the query, using the second pattern?
<br />
<br />
<br />
<br />
<strong>UPDATE:</strong></p>
<p>I think my build fails because I am trying to assign the result of the query to a variable (<code>this._user</code>) declared with the type of <code>[DataContext].User</code>.</p>
<pre><code>this._user = (from u in [DataContextObject].Users
where u.UsersID == [Int32]
select new { u.UsersID }).FirstOrDefault();
</code></pre>
<p><em>Compilation error: Cannot implicitly convert type "AnonymousType#1" to "[DataContext].User".</em></p>
<p>Any thoughts on how I can get around this? Would I have to make my own object?</p>
| [
{
"answer_id": 201853,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "if (person.Any()) /* ... */;\n"
},
{
"answer_id": 201871,
"author": "Peter",
"author_id": 5189,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] |
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;});
$.get("content.py?pageName=instores", function(data)
{instores = data;});
$.get("content.py?pageName=specs", function(data)
{specs = data;});
$.get("content.py?pageName=about", function(data)
{about = data;});
</code></pre>
<p>As you can see, we have a huge violation of the DRY principle, but... I don't really see a way to fix it... any ideas?</p>
<p>maybe an array?</p>
| [
{
"answer_id": 201855,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "var names = ['viewer', 'artists', 'instores', 'specs', 'about'];\nfor (var i = 0; i < names.length; i++)\n $.get(\"content.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] |
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_migrations" ("version")
</code></pre>
<p>The relevant part of <code>db/schema.rb</code> is as follows:</p>
<pre><code>create_table "ts_schema_migrations", :id => false, :force => true do |t|
t.string "version", :null => false
end
add_index "ts_schema_migrations", ["version"], :name => "unique_schema_migrations", :unique => true
</code></pre>
<p>I'm not manually changing this index anywhere, and I'm using Rails' default SQLite3 adapter with a brand new database. (That is, running <code>rm db/*sqlite3</code> before <code>rake db:migrate</code> doesn't help.)</p>
<p>Is the <code>test:units</code> task perhaps trying to re-load the schema? If so, why? Shouldn't it recognize the schema is already up to date?</p>
| [
{
"answer_id": 201900,
"author": "Vitalie",
"author_id": 27913,
"author_profile": "https://Stackoverflow.com/users/27913",
"pm_score": 0,
"selected": false,
"text": "unique_schema_migrations"
},
{
"answer_id": 206848,
"author": "Tilendor",
"author_id": 1470,
"author_p... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] |
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 filename but specify on import that i want the standard python lib and not this file? </p>
<p>Solution based on Vinko's answer:</p>
<pre><code>import sys
sys.path.reverse()
from getopt import getopt
opts, args = getopt(sys.argv[1:], "h:s")
for key,value in opts:
print key, "=>", value
</code></pre>
| [
{
"answer_id": 201862,
"author": "axblount",
"author_id": 1729005,
"author_profile": "https://Stackoverflow.com/users/1729005",
"pm_score": -1,
"selected": false,
"text": "import getopt as bettername\n"
},
{
"answer_id": 201891,
"author": "Vinko Vrsalovic",
"author_id": 5... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] |
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 that doesn't really matter.</p>
| [
{
"answer_id": 201862,
"author": "axblount",
"author_id": 1729005,
"author_profile": "https://Stackoverflow.com/users/1729005",
"pm_score": -1,
"selected": false,
"text": "import getopt as bettername\n"
},
{
"answer_id": 201891,
"author": "Vinko Vrsalovic",
"author_id": 5... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008/"
] |
201,863 | <p>I was wondering if anyone had successfully used DPAPI with a user store in a web farm enviroment?</p>
<p>Because our application is a recently converted from 1.1 to 2.0 ASP.NET app, we're using a custom wrapper which directly calls the <code>CryptUnprotect</code> methods. But this should be the same as the <code>ProtectedData</code> method available in the 2.0 framework.</p>
<p>Because we are operating in a web farm environment, we can't guarantee that the machine that did the encryption is going to be the one decrypting it. (Also because machine failures shouldn't destroy our encrypted data).</p>
<p>So what we have is a serviced component that runs in a service under a particular user account on each one of our web boxes. This user is a set up to have a roaming profile, as per the recomendation.</p>
<p>The problem we have is that info encrypted on one machine can not be decrypted on another, this fails with the win32 error: </p>
<blockquote>
<p>'Key not valid for use in specified state'.</p>
</blockquote>
<p>I suspect that this is because I've made a mistake by having the encryption service running as the user on multiple machines, hence keeping the user logged in on more than one machine at the same time. </p>
<p>If this is the problem, how are other using DPAPI with the User Store in a web farm environment?</p>
| [
{
"answer_id": 63183019,
"author": "codeMonkey",
"author_id": 4009972,
"author_profile": "https://Stackoverflow.com/users/4009972",
"pm_score": 0,
"selected": false,
"text": "public void ConfigureServices(IServiceCollection services)\n{\n services.AddDataProtection()\n .Protect... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
201,875 | <p>How to hide the default toolbar and to disallow the default context menu of the <code>DocumentViewer</code> control?</p>
| [
{
"answer_id": 201911,
"author": "Andy",
"author_id": 3857,
"author_profile": "https://Stackoverflow.com/users/3857",
"pm_score": 2,
"selected": true,
"text": "ContextMenuOpening"
},
{
"answer_id": 6098488,
"author": "Mo0gles",
"author_id": 283512,
"author_profile": "... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23372/"
] |
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/ShowPost.aspx?PostID=659716&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=659716&SiteID=1</a><br>
<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2909173&SiteID=1&pageid=0" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2909173&SiteID=1&pageid=0</a><br>
<a href="http://bytes.com/forum/thread548399.html" rel="nofollow noreferrer">http://bytes.com/forum/thread548399.html</a></p>
<p>I've tried a lot of things so far. My latest failure was based on the theory that maybe the DataGridView was using WIN32 API wndproc subclassing to intercept messages, so I wrote logic to save the old wndproc and restore it after adding it to the DataGridView's control collection. That didn't work.</p>
<p>Messina - thanks for reminding me about Spy++. For the letter "A", the edit window sends an EN_UPDATE to its combobox parent. But, not for the "Q". That's so strange.</p>
<p>I have convinced myself that the DataGridView is not subclassing the combo and the edit, because I check the address of the wndprocs just after creation and before adding them to the grid's collection, and then later when I paint. Unless the grid installs some sort of global hooks..</p>
<p>I'm thinkin, maybe I can subclass the edit control, and then send the notification to the combobox the way I see the edit control doing here?</p>
<p>EDIT: More info here. Windows messages from grid, combobox, and edit control, from Spy++:</p>
<p>HWNDs:
122064e < grid
010d0674 < combobox
01360696 < combox's edit control</p>
<pre><code><01402> 01360696 P WM_KEYDOWN nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<01403> 010D0674 S WM_GETDLGCODE
<01404> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01405> 010D0674 S WM_GETDLGCODE
<01406> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01407> 010D0674 S WM_GETDLGCODE
<01408> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01409> 010D0674 S WM_GETDLGCODE
<01410> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01411> 01360696 P WM_CHAR chCharCode:'0061' (97) cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<01412> 010D0674 S WM_GETDLGCODE
<01413> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01414> 010D0674 S WM_GETDLGCODE
<01415> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01416> 010D0674 S WM_COMMAND wNotifyCode:EN_UPDATE wID:1001 hwndCtl:01360696 <<< edit control sends to combobox
<01417> 010D0674 S message:0x2111 [User-defined:WM_USER+7441] wParam:00060674 lParam:010D0674 What do these do?
<01418> 010D0674 R message:0x2111 [User-defined:WM_USER+7441] lResult:00000000
<01419> 010D0674 R WM_COMMAND
<01420> 010D0674 S WM_CTLCOLOREDIT hdcEdit:C7011AA6 hwndEdit:01360696
<01421> 010D0674 R WM_CTLCOLOREDIT hBrush:F0103EB0
<01422> 010D0674 S WM_COMMAND wNotifyCode:EN_CHANGE wID:1001 hwndCtl:01360696 << edit control sends to combobox
<01423> 010D0674 S message:0x2111 [User-defined:WM_USER+7441] wParam:00050674 lParam:010D0674
<01424> 0122064E S WM_PAINT hdc:00000000 <<< grid is told to paint
<01425> 0122064E S WM_ERASEBKGND hdc:94011D4E
<01426> 0122064E R WM_ERASEBKGND fErased:True
<01427> 0122064E S WM_GETTEXTLENGTH
<01428> 0122064E R WM_GETTEXTLENGTH cch:0
<01429> 0122064E S WM_GETTEXT cchTextMax:2 lpszText:0012D0C0
<01430> 0122064E R WM_GETTEXT cchCopied:0 lpszText:0012D0C0 ("")
<01431> 0122064E S WM_GETTEXTLENGTH
<01432> 0122064E R WM_GETTEXTLENGTH cch:0
<01433> 0122064E S WM_GETTEXT cchTextMax:2 lpszText:0012D0C0
<01434> 0122064E R WM_GETTEXT cchCopied:0 lpszText:0012D0C0 ("")
<01435> 010D0674 S WM_WINDOWPOSCHANGING lpwp:0012D4B0
<01436> 010D0674 R WM_WINDOWPOSCHANGING
<01437> 010D0674 S CB_GETCURSEL
<01438> 010D0674 R CB_GETCURSEL index:CB_ERR
<01439> 010D0674 S WM_GETTEXTLENGTH
<01440> 01360696 S WM_GETTEXTLENGTH
<01441> 01360696 R WM_GETTEXTLENGTH cch:2
<01442> 010D0674 R WM_GETTEXTLENGTH cch:2
<01443> 010D0674 S WM_GETTEXT cchTextMax:6 lpszText:0012CC44
<01444> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012BE64
<01445> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012BE64 ("a")
<01446> 010D0674 R WM_GETTEXT cchCopied:2 lpszText:0012CC44 ("a")
<01447> 010D0674 S CB_GETCURSEL
<01448> 010D0674 R CB_GETCURSEL index:CB_ERR
<01449> 010D0674 S WM_GETTEXTLENGTH
<01450> 01360696 S WM_GETTEXTLENGTH
<01451> 01360696 R WM_GETTEXTLENGTH cch:2
<01452> 010D0674 R WM_GETTEXTLENGTH cch:2
<01453> 010D0674 S WM_GETTEXT cchTextMax:6 lpszText:0012CC44
<01454> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012BE64
<01455> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012BE64 ("a")
<01456> 010D0674 R WM_GETTEXT cchCopied:2 lpszText:0012CC44 ("a")
<01457> 010D0674 S CB_GETCURSEL
<01458> 010D0674 R CB_GETCURSEL index:CB_ERR
<01531> 0122064E R WM_PAINT
<01532> 010D0674 S WM_PAINT hdc:00000000
<01533> 010D0674 S WM_NCPAINT hrgn:00000001
<01534> 010D0674 R WM_NCPAINT
<01535> 010D0674 S WM_ERASEBKGND hdc:0F0141ED
<01536> 010D0674 R WM_ERASEBKGND fErased:True
<01537> 0122064E S WM_CTLCOLOREDIT hdcEdit:840137F1 hwndEdit:010D0674
<01538> 0122064E R WM_CTLCOLOREDIT hBrush:F0103EB0
<01539> 010D0674 R WM_PAINT
<01540> 01360696 S WM_PAINT hdc:00000000
<01541> 01360696 S WM_NCPAINT hrgn:00000001
<01542> 01360696 R WM_NCPAINT
<01543> 01360696 S WM_ERASEBKGND hdc:C7011AA6
<01544> 01360696 R WM_ERASEBKGND fErased:True
<01545> 010D0674 S WM_CTLCOLOREDIT hdcEdit:870137F1 hwndEdit:01360696
<01546> 010D0674 R WM_CTLCOLOREDIT hBrush:F0103EB0
<01547> 010D0674 S WM_CTLCOLOREDIT hdcEdit:870137F1 hwndEdit:01360696
<01548> 010D0674 R WM_CTLCOLOREDIT hBrush:F0103EB0
<01549> 01360696 R WM_PAINT
<01555> 0122064E S WM_CTLCOLOREDIT hdcEdit:8A0137F1 hwndEdit:010306AC
<01556> 0122064E R WM_CTLCOLOREDIT hBrush:78103C5B
<01568> 010D0674 S CB_GETCURSEL
<01569> 010D0674 R CB_GETCURSEL index:CB_ERR
<01570> 010D0674 S WM_GETTEXTLENGTH
<01571> 01360696 S WM_GETTEXTLENGTH
<01572> 01360696 R WM_GETTEXTLENGTH cch:2
<01573> 010D0674 R WM_GETTEXTLENGTH cch:2
<01574> 010D0674 S WM_GETTEXT cchTextMax:6 lpszText:0012D7A4
<01575> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012C9C4
<01576> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012C9C4 ("a")
<01577> 010D0674 R WM_GETTEXT cchCopied:2 lpszText:0012D7A4 ("a")
<01578> 010D0674 S CB_GETCURSEL
<01579> 010D0674 R CB_GETCURSEL index:CB_ERR
<01580> 010D0674 S WM_GETTEXTLENGTH
<01581> 01360696 S WM_GETTEXTLENGTH
<01582> 01360696 R WM_GETTEXTLENGTH cch:2
<01583> 010D0674 R WM_GETTEXTLENGTH cch:2
<01584> 010D0674 S WM_GETTEXT cchTextMax:6 lpszText:0012D6E0
<01585> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012C900
<01586> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012C900 ("a")
<01587> 010D0674 R WM_GETTEXT cchCopied:2 lpszText:0012D6E0 ("a")
<01588> 010D0674 S CB_GETCURSEL
<01589> 010D0674 R CB_GETCURSEL index:CB_ERR
<01590> 010D0674 S WM_GETTEXTLENGTH
<01591> 01360696 S WM_GETTEXTLENGTH
<01592> 01360696 R WM_GETTEXTLENGTH cch:2
<01593> 010D0674 R WM_GETTEXTLENGTH cch:2
<01594> 010D0674 S WM_GETTEXT cchTextMax:6 lpszText:0012D6E0
<01595> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012C900
<01596> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012C900 ("a")
<01597> 010D0674 R WM_GETTEXT cchCopied:2 lpszText:0012D6E0 ("a")
<01598> 010D0674 R message:0x2111 [User-defined:WM_USER+7441] lResult:00000000
<01599> 01360696 S WM_GETTEXTLENGTH
<01600> 01360696 R WM_GETTEXTLENGTH cch:2
<01601> 01360696 S WM_GETTEXT cchTextMax:6 lpszText:0012DF8C
<01602> 01360696 R WM_GETTEXT cchCopied:2 lpszText:0012DF8C ("a")
<01603> 010D0674 R WM_COMMAND
<01604> 01360696 P WM_KEYUP nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:1 fUp:1
</code></pre>
<p>Letter q</p>
<pre><code><01625> 01360696 P WM_KEYDOWN nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<01626> 010D0674 S WM_GETDLGCODE
<01627> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01628> 010D0674 S WM_GETDLGCODE
<01629> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01630> 010D0674 S WM_GETDLGCODE
<01631> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01632> 010D0674 S WM_GETDLGCODE
<01633> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01634> 01360696 P WM_CHAR chCharCode:'0071' (113) cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<01635> 010D0674 S WM_GETDLGCODE
<01636> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01637> 010D0674 S WM_GETDLGCODE
<01638> 010D0674 R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS
<01640> 01360696 P WM_KEYUP nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:1 fUp:1
</code></pre>
| [
{
"answer_id": 454773,
"author": "Michael Buen",
"author_id": 11432,
"author_profile": "https://Stackoverflow.com/users/11432",
"pm_score": 2,
"selected": true,
"text": "public bool EditingControlWantsInputKey(\n Keys key, bool dataGridViewWantsInputKey)\n{\n // Let the DateTimePic... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] |
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()</code> and I think that you can call <code>SELECT @@IDENTITY AS 'Identity';</code> is there a common way to do this accross databases in jdbc?</p>
<p>If not how would you suggest I implement this for a piece of code that could access any of SQL Server, MySQL and Oracle?</p>
| [
{
"answer_id": 202533,
"author": "extraneon",
"author_id": 24582,
"author_profile": "https://Stackoverflow.com/users/24582",
"pm_score": 7,
"selected": true,
"text": "pInsertOid = connection.prepareStatement(INSERT_OID_SQL, Statement.RETURN_GENERATED_KEYS);\n"
},
{
"answer_id": 1... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
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">Getting Started with Panda</a></p>
<p>I'm getting the following error:</p>
<pre><code>@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
Permissions 0644 for '~/.ec2/id_rsa-gsg-keypair' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
</code></pre>
<p>I've chmoded my keypair to 600 in order to get into my personal instance last night, and experimented at length setting the permissions to 0 and even generating new key strings, but nothing seems to be working.</p>
<p>Any help at all would be a great help!</p>
<hr>
<p>Hm, it seems as though unless permissions are set to 777 on the directory, the ec2-run-instances script is unable to find my keyfiles.
I'm new to SSH so I might be overlooking something.</p>
| [
{
"answer_id": 201898,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 6,
"selected": false,
"text": "chmod 700 ~/.ec2\n"
},
{
"answer_id": 25681412,
"author": "Alena",
"author_id": 989896,
"author_profile"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2293/"
] |
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": 201902,
"author": "Steve B.",
"author_id": 19479,
"author_profile": "https://Stackoverflow.com/users/19479",
"pm_score": 3,
"selected": true,
"text": " HashSet<String> sqlKeywords =\n new HashSet<String>(Arrays.asList(\n new String[] { ... cut and paste a ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] |
201,940 | <p>This was an job placement interview I faced. They asked whether we can realloc Array, I told yes. Then They asked - then why we need pointers as most of the people give reason that it wastes memory space. I could not able to give satisfactory answer. If any body can give any satisfactory answer, I'll be obliged. Please mention any situation where the above statement can contradict.</p>
<p>Thank you.</p>
| [
{
"answer_id": 202019,
"author": "Tarski",
"author_id": 27653,
"author_profile": "https://Stackoverflow.com/users/27653",
"pm_score": 1,
"selected": false,
"text": "void *realloc(void *ptr, size_t size);\n"
},
{
"answer_id": 202023,
"author": "Greg Rogers",
"author_id": 5... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24813/"
] |
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 this a serious enough problem to avoid using the int as the key? What would a preferable alternative be? (maybe int.ToString()?)</p>
<p>I've done this before without any major problems, but recently I hit a nasty snag where XML serialization against a KeyedCollection does <em>not</em> work if the key is an int, due to <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=120461" rel="noreferrer">a bug in .NET</a>.</p>
| [
{
"answer_id": 201968,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": false,
"text": "GetById(int)"
},
{
"answer_id": 201983,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profi... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27414/"
] |
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 first before I add it to the list.</p>
<p>I attempted to use Binary serialization (see below) to create a deep copy but since <code>System.Windows.Forms.DataObject</code> is not marked as serializable the serialization step fails. Any ideas?</p>
<pre><code>public IDataObject GetClipboardData()
{
MemoryStream memoryStream = new MemoryStream();
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, Clipboard.GetDataObject());
memoryStream.Position = 0;
return (IDataObject) binaryFormatter.Deserialize(memoryStream);
}
</code></pre>
| [
{
"answer_id": 202020,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https://Stackoverflow.com/users/5645",
"pm_score": 2,
"selected": false,
"text": " public static class GhettoSerializer\n {\n // you could make this a factory method if your type\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2690646/"
] |
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 = [NSNumber numberWithBool:NO];
[fMovie setAttribute:val forKey:QTMovieIsLinearAttribute];
</code></pre>
<p>If I then get the value of these attributes, they come up as NO and YES, respectively. The movie is editable, so I can't understand what I'm doing wrong here. How can I ensure that the attributes will actually change?</p>
| [
{
"answer_id": 513584,
"author": "Daniel",
"author_id": 6852,
"author_profile": "https://Stackoverflow.com/users/6852",
"pm_score": 1,
"selected": false,
"text": "NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:\n [NSNumber numberWithBool:YES], QTMo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3830/"
] |
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 know how to do this?</p>
<p>Thank you,
Rohit</p>
| [
{
"answer_id": 513584,
"author": "Daniel",
"author_id": 6852,
"author_profile": "https://Stackoverflow.com/users/6852",
"pm_score": 1,
"selected": false,
"text": "NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:\n [NSNumber numberWithBool:YES], QTMo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27928/"
] |
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>, whichever comes first.</p>
<p>Or is using loops the only way to do it? If so, what is the best way?</p>
| [
{
"answer_id": 202043,
"author": "trotterdylan",
"author_id": 17695,
"author_profile": "https://Stackoverflow.com/users/17695",
"pm_score": 7,
"selected": false,
"text": "stdin"
},
{
"answer_id": 202097,
"author": "KeithB",
"author_id": 2298,
"author_profile": "https:... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14759/"
] |
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": 202880,
"author": "AR.",
"author_id": 1354,
"author_profile": "https://Stackoverflow.com/users/1354",
"pm_score": 4,
"selected": true,
"text": "Private Sub ProcessOfficeDocument(ByVal fileName As String)\n Dim docDSO As New DSOFile.OleDocumentPropertiesClass\n Dim do... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5653/"
] |
202,009 | <p>Required is the true language version of the OS, not the user interface language or the current locale settings.</p>
<p>Use case: software installation which has to apply security settings and user account creation. The scripts have to know certain system properties like user group names in the original language of the OS.</p>
<p>(Should work with Windows XP, Windows Server 2003, Vista, ...)</p>
| [
{
"answer_id": 204590,
"author": "Rômulo Ceccon",
"author_id": 23193,
"author_profile": "https://Stackoverflow.com/users/23193",
"pm_score": 3,
"selected": true,
"text": "WellKnownSidType = 27 (WinBuiltinUsersSid)"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23772/"
] |
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": "KeySize - MinimumPadding"
},
{
"answer_id": 2791259,
"author": "Brett",
"author_id": 188474,
"auth... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] |
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 each version.</p>
<p>Is there a way to freeze the isolation for the whole application instead of the version?</p>
| [
{
"answer_id": 227218,
"author": "codeConcussion",
"author_id": 1321,
"author_profile": "https://Stackoverflow.com/users/1321",
"pm_score": 5,
"selected": true,
"text": "using System.IO;\nusing System.IO.IsolatedStorage;\n...\n\nIsolatedStorageFile appScope = IsolatedStorageFile.GetUserS... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
202,031 | <p>It's possible, but is it appropriate to use SHFileOperation within a Windows service? All those SHxxx API functions in shell32.dll seem to have been written with user level programs in mind. Can I be certain SHFileOperation won't display GUI ever?</p>
| [
{
"answer_id": 202519,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 3,
"selected": false,
"text": "FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR\n"
},
{
"answer_id": 13196069,
"author": "Da... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24898/"
] |
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').bind("keyup", update);
});
update = function(e) {
// Get text from search box
// Pass to web method and bind to concessions grid
$.ajax({
...
success: function(msg) {
displayResults(msg, filterParams);
},
});
}
displayResults = function(msg, filterParams) {
// Databind results grid using jTemplates
// Show results on map: Pass parameters to KML generator and overlay on map
}
</code></pre>
<p>Depending on the search, there may be hundreds of results; and so the work that happens in <code>displayResults</code> is processor-intensive both on the server (querying the database, building and simplifying the KML on the fly) and on the client (databinding the results grid, overlaying big KML files on the map). </p>
<p>I like the immediacy of getting progressively narrower results as I type, but I'd like to minimize the number of times this refreshes. What's the simplest way to introduce an N-second delay after the user stops typing, before running the <code>update</code> function?</p>
| [
{
"answer_id": 202077,
"author": "Guido",
"author_id": 12388,
"author_profile": "https://Stackoverflow.com/users/12388",
"pm_score": 0,
"selected": false,
"text": "$('input.Search').bind(\"keyup\", function() { setTimeout(update, 5) } );\n"
},
{
"answer_id": 202093,
"author":... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
202,067 | <p>Is there a way to get an ASP.NET textbox to accept only currency values, and when the control is validated, insert a $ sign beforehand?</p>
<p>Examples: </p>
<p>10.23 becomes $10.23<br>
$1.45 stays $1.45<br>
10.a raises error due to not being a valid number </p>
<p>I have a RegularExpressionValidator that is verifying the number is valid, but I don't know how to force the $ sign into the text. I suspect JavaScript might work, but was wondering if there was another way to do this.</p>
| [
{
"answer_id": 202128,
"author": "Anjisan",
"author_id": 25304,
"author_profile": "https://Stackoverflow.com/users/25304",
"pm_score": 0,
"selected": false,
"text": "string value = text_box_to_validate.Text;\n\nstring myPattern = @\"^\\$(\\d{1,3},?(\\d{3},?)*\\d{3}(\\.\\d{0,2})|\\d{1,3}(... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] |
202,068 | <p>I'm looking at setting up a small company that hosts flash-based websites for artist portfolios. The customer control panel would be django-powered, and would provide the interface for uploading their images, managing galleries, selling prints, etc.</p>
<p>Seeing as the majority of traffic to the hosted sites would end up at their top level domain, this would result in only static media hits (the HTML page with the embedded flash movie), I could set up lighttpd or nginx to handle those requests, and pass the django stuff back to apache/mod_whatever.</p>
<p>Seems as if I could set this all up on one box, with the django sites framework keeping each site's admin separate.</p>
<p>I'm not much of a server admin. Are there any gotchas I'm not seeing?</p>
| [
{
"answer_id": 220711,
"author": "Justin Voss",
"author_id": 5616,
"author_profile": "https://Stackoverflow.com/users/5616",
"pm_score": 2,
"selected": false,
"text": "sites"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3912/"
] |
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></pre>
<p>In my project structure I have a default resource file and a psuedo-translation resource file. If I set try something like this:</p>
<pre><code>Display(BasePage page) {
ResourceManager manager = new ResourceManager(typeof(Login));
}
</code></pre>
<p>it returns the translated page. After some research I found that page.GetType().ToString() returned something to the effect of "ASP_login.aspx" How can I get the actual code behind class type, such that I get an object of type "Login" that is derived from "BasePage"? </p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 202099,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 4,
"selected": true,
"text": "public partial class _Login : BasePage \n { /* ... */ \n }\n"
},
{
"answer_id": 202228,
"author": "Guvante",
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13688/"
] |
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 column in DataGridView with dropdown where user can type?</p>
| [
{
"answer_id": 202478,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 3,
"selected": false,
"text": "void dataGridView1_EditingControlShowing(object sender, \n DataGridViewEditingControlShowingEventArgs e)\n{\n if (e.C... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14727/"
] |
202,107 | <p>This question is to seek out good examples of Hungarian Notation, so we can bring together a collection of these. </p>
<p><strong>Edit:</strong> I agree that Hungarian for types isn't that necessary, I'm hoping for more specific examples where it increases readability and maintainability, like Joel gives in his article (as per my answer).</p>
| [
{
"answer_id": 202135,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 5,
"selected": false,
"text": "ix"
},
{
"answer_id": 202179,
"author": "Mark Ingram",
"author_id": 986,
"author_profile": "https://... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13295/"
] |
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 machine gets power-cycled before one of these automatic syncs, the time will be incorrect when the machine restarts.</p>
<p>How do you ensure that the hardware clock gets updated when you set the system time?</p>
| [
{
"answer_id": 202118,
"author": "Kristopher Johnson",
"author_id": 1175,
"author_profile": "https://Stackoverflow.com/users/1175",
"pm_score": 3,
"selected": false,
"text": "system(\"/sbin/hwclock --systohc\");\n"
},
{
"answer_id": 202170,
"author": "Zan Lynx",
"author_i... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] |
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 <code>getXXX()</code> rather than/additionally to the <code>isXXX()</code> Method.</p>
<p>I need to generate this methods cause when i start the service i get the message:</p>
<pre><code><WS data binding error>could not find getter for property 'IsXXX' on com.foo.MyClass
</code></pre>
<p>Tried a customization:</p>
<pre><code><jaxb:globalBindings generateIsSetMethod="false" enableJavaNamingConventions="false">
</code></pre>
<p>without effect. :(</p>
<p>Any help?</p>
| [
{
"answer_id": 1009590,
"author": "AlanG",
"author_id": 11645,
"author_profile": "https://Stackoverflow.com/users/11645",
"pm_score": 2,
"selected": true,
"text": " <taskdef name=\"xjc\" classname=\"com.sun.tools.xjc.XJCTask\" classpathref=\"development.classpath\"/>\n\n <xjc schem... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21370/"
] |
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 string "kov" would for example match the key "stackoverflow". </p>
<p>Currently I am using a Ternary Search Tree (TST), which usually will find the items within 100 milliseconds. This is however too slow for my requirements. The TST implementation could be improved with some minor optimizations and I could try to balance the tree. But i figured that these things would not give me the 5x - 10x speed improvement I am aiming at. I am assuming that the reason for being so slow is that i basically have to visit most nodes in the tree.</p>
<p>Any ideas on how to improve the speed of the algorithm? Are there any other algorithms that I should be looking at?</p>
<p>Thanks in advance,
Oskar</p>
| [
{
"answer_id": 202195,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "SubString"
},
{
"answer_id": 202250,
"author": "Community",
"author_id": -1,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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></p>
</blockquote>
<p>Setting LDAP_OPT_ENCRYPT to 1 didn't work either. The port I'm using is 389.</p>
| [
{
"answer_id": 202195,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "SubString"
},
{
"answer_id": 202250,
"author": "Community",
"author_id": -1,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1533/"
] |
202,144 | <p>We have a few developers working on the same VS2005 solution, but our source control is very bad. (Our company uses Harvest, which we give a vote of no confidence).</p>
<p>Right now, we're all just working off of the files on a shared lan drive. Obviously, this causes some problems. But we think it's better than working locally, and tracking the files we touched in a spreadsheet and merging everything manually. Does anybody have a strategy for merging our changes?</p>
<p>Some of the problems exist because of corporate beaurocracy (like mandating Harvest). Those same policies prevent introducing new tools into our environment. So, strategies that avoid buying/downloading new software would work best for us.</p>
| [
{
"answer_id": 202182,
"author": "Frank Schmitt",
"author_id": 27951,
"author_profile": "https://Stackoverflow.com/users/27951",
"pm_score": 2,
"selected": false,
"text": "merge mine older yours\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] |
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": 202182,
"author": "Frank Schmitt",
"author_id": 27951,
"author_profile": "https://Stackoverflow.com/users/27951",
"pm_score": 2,
"selected": false,
"text": "merge mine older yours\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18169/"
] |
202,148 | <p>I have a text file where I want to change only the first line of the file. The file could be millions of rows long, so I'd rather not have to loop over everything, so I'm wondering if there is another way to do this.</p>
<p>I'd also like to apply some rules to the first line so that I replace instances of certain words with other words.</p>
<p>Is this possible?</p>
| [
{
"answer_id": 202185,
"author": "David Schmitt",
"author_id": 4918,
"author_profile": "https://Stackoverflow.com/users/4918",
"pm_score": 2,
"selected": false,
"text": "String.replaceFirst(String regex, String replacement)"
},
{
"answer_id": 202192,
"author": "volley",
"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] |
202,166 | <p>I'm writing a lightweight game engine and while doing some research for it I've come across a number of compelling articles advocating the implementation of Game Objects through a "collection of components" model rather than an "inheiritance from concrete classes" model. There are lots of advantages:</p>
<ul>
<li>objects can be composed using data
driven design techniques, allowing
designers to come up with new
objects without involving a
programmer;</li>
<li>there tend to be fewer source file
dependencies, allowing code to be
compiled faster;</li>
<li>the engine as a whole becomes more
general;</li>
<li>unforseen consequences of having to
change concrete classes high up the
inheiritance hierarchy can be
avoided;</li>
<li>and so on.</li>
</ul>
<p>But there are parts of the system that remain opaque. Primarily among these is how components of the same object communicate with each other. For example, let's say an object that models a bullet in game is implemented in terms of these components:</p>
<ul>
<li>a bit of geometry for visual
representation</li>
<li>a position in the world</li>
<li>a volume used for collision with
other objects</li>
<li>other things</li>
</ul>
<p>At render time the geometry has to know its position in the world in order to display correctly, but how does it find that position among all its sibling components in the object? And at update time, how does the collision volume find the object's position in the world in order to test for its intersection with other objects?</p>
<p>I guess my question can be boiled down to this: Okay, we have objects that are composed of a number of components that each implement a bit of functionality. What is the best way for this to work at runtime?</p>
| [
{
"answer_id": 205284,
"author": "Iain",
"author_id": 11911,
"author_profile": "https://Stackoverflow.com/users/11911",
"pm_score": 1,
"selected": false,
"text": "object.burnable = new Burnable(object);\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13149/"
] |
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 mechanism (for example a form with a button) to easily transfer the file to a remote server, using sftp. Does anyone have an idea of how to accomplish this?</p>
| [
{
"answer_id": 202316,
"author": "Mat Nadrofsky",
"author_id": 26853,
"author_profile": "https://Stackoverflow.com/users/26853",
"pm_score": 4,
"selected": true,
"text": "mySFTPCall = \"sftp <insert your options here!>\"\nCall Shell(mySFTPCall, 1)\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3734/"
] |
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>
<li>1-n users involved in different roles ("User x replied to User y's comment on User's Z post")</li>
<li>Different views of the same activity item ("you commented .." vs. "your friend x commented" vs. "user x commented .." => 3 representations of a "comment" activity)</li>
</ul>
<p>.. and some more, especially if you take it to a high level of sophistication, as Facebook does, for example, combining several activity items into one ("users x, y and z commented on that photo"</p>
<p>Any thoughts or pointers on patterns, papers, etc on the most flexible, efficient and powerful approaches to implementing such a system, data model, etc. would be appreciated.</p>
<p>Although most of the issues are platform-agnostic, chances are I end up implementing such a system on Ruby on Rails</p>
| [
{
"answer_id": 205477,
"author": "heyman",
"author_id": 27406,
"author_profile": "https://Stackoverflow.com/users/27406",
"pm_score": 7,
"selected": false,
"text": "{id:1, userId:1, type:PHOTO, time:2008-10-15 12:00:00, data:{photoId:2089, photoName:A trip to the beach}}\n"
},
{
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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": "utf8mb4"
},
{
"answer_id": 202248,
"author": "Claudio",
"author_id": 27958,
"author_profile": "https://Stack... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] |
202,206 | <p>I am building an enterprise application with .Net 1.1 and SQL Server 2000. I use the read committed isolation level . However changes in non-functional requirements have made it necessary to take measures against non-repeatable reads and phantoms. I see two options: </p>
<ol>
<li><p>Introduce row-versioning to check if a row has been modified since it was read within a transaction. This is done by adding a VersionId column to tables abd incrementing the value whenever the row is changed. This would solve the problem but require us to rewrite all stored procedures and the data access layer of our applications. </p></li>
<li><p>Migrate to SQL Server 2005 and use the snapshot isolation level. This would save us the trouble of rewriting code, but there are a few challenges:
a. The snapshot isolation level is not known in .Net 1.1, so we must take an extra round trip to the server to set it manually.
b. We cannot make use of temporary tables in our stored procedures because the snapshot isolation level does not allow changes to the schema of the tempdb. I'm not sure how to around this. </p></li>
</ol>
<p>Any ideas or suggestions are more than wellcome </p>
| [
{
"answer_id": 243609,
"author": "GilaMonster",
"author_id": 9342,
"author_profile": "https://Stackoverflow.com/users/9342",
"pm_score": 1,
"selected": false,
"text": "ALLOW_SNAPSHOT_ISOLATION"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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": 202582,
"author": "Scott Kramer",
"author_id": 3522,
"author_profile": "https://Stackoverflow.com/users/3522",
"pm_score": 2,
"selected": false,
"text": " Dim screensize As System.Drawing.Rectangle = Screen.PrimaryScreen.Bounds\n Public gDeviceRes As String = screensize.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3522/"
] |
202,234 | <p>I have an app that executes commands on a Linux server via SSH just fine. When I connect to a Solaris server, things don't work. It seems that the Solaris command line is limited to 267 characters.</p>
<p>Is there a way to change this?</p>
<p>Update: As was pointed out before, this is a limit to the default shell for Solaris (sh) vs Linux (bash). So, now the question is, is there a way to change the limit for sh?</p>
| [
{
"answer_id": 202396,
"author": "Craig Trader",
"author_id": 12895,
"author_profile": "https://Stackoverflow.com/users/12895",
"pm_score": 1,
"selected": false,
"text": "/usr/bin/foo with a very long list of options and parameters\n"
},
{
"answer_id": 2056784,
"author": "bri... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5389/"
] |
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 additional fields which should be in the following format:</p>
<ol>
<li>DDMMM</li>
<li>HHMMT, where T is 'A' for a.m. and 'P' for p.m.</li>
</ol>
<p>Example: If the data in the field was '2008-10-12 13:19:12.0' then the extracted fields should contain:</p>
<ol>
<li>12OCT</li>
<li>0119P</li>
</ol>
<p>I have tried using CONVERT string formats, but none of the formats match the output I want to get. I am thinking along the lines of extracting the field data via CONVERT and then using REPLACE, but I surely need some help here, as I am no sure.</p>
<p>Could anyone well versed in stored procedures help me out here?
Thanks!</p>
| [
{
"answer_id": 202284,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 4,
"selected": true,
"text": "SUBSTRING(CONVERT(varchar, dt, 13), 1, 2)\n + UPPER(SUBSTRING(CONVERT(varchar, dt, 13), 4, 3))\n"
},
{
"answer... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311/"
] |
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>). What I need is another column in the result set which contains these auto-numberings. I'm willing to use a SQL function if I have to, but I would rather do it without using extensions on the ANSI spec.</p>
<p>Platform is MySQL, but the technique should be cross-platform if at all possible (hence the desire to avoid non-standard extensions).</p>
| [
{
"answer_id": 202265,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": true,
"text": "SELECT id, name\n , (SELECT COUNT(*) FROM people p2 WHERE name='Spiewak' AND p2.id <= p1.id) AS RowNumber\nFROM peop... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9815/"
] |
202,252 | <p>Anybody know of a plugin, or a built in function to make the columns in a table sortable? i.e. I click on the column header and it sorts the rows by that column?</p>
| [
{
"answer_id": 36380772,
"author": "João Paulo",
"author_id": 1455108,
"author_profile": "https://Stackoverflow.com/users/1455108",
"pm_score": 0,
"selected": false,
"text": "var data = {\n people: [\n {name: 'a', address: 'c', salesperson: 'b'},\n {name: 'b', address: '... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26121/"
] |
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 "share". This folder comes from CVS so I'd like to use it with its given name instead of renaming it. How can this be done?</p>
| [
{
"answer_id": 202391,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 4,
"selected": true,
"text": ".settings"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27736/"
] |
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 do something like this:</p>
<pre><code>string foo = "bar";
Object o = foo == null ? DBNull.Value : (Object)foo;
</code></pre>
<p>This cast seems pointless as this is certainly legal:</p>
<pre><code>string foo = "bar";
Object o = foo == null ? "gork" : foo;
</code></pre>
<p>It seems to me that when the ternary branches are of different types, the compiler will not autobox the values to the type object...but when they are of the same type then the autoboxing is automatic.</p>
<p>In my mind the first statement should be legal...</p>
<p>Can anyone describe why the compiler does not allow this and why the designers of C# chose to do this? I believe this is legal in Java...Though I have not verified this.</p>
<p>Thanks.</p>
<p><strong>EDIT:</strong> I am asking for an understanding of why Java and C# handle this differently, what is going on underneath the scenes in C# that make this invalid. I know how to use ternary, and am not looking for a "better way" to code the examples. I understand the rules of ternary in C#, but I want to know WHY...</p>
<p><strong>EDIT</strong> (Jon Skeet): Removed "autoboxing" tag as no boxing is involved in this question.</p>
| [
{
"answer_id": 202281,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 4,
"selected": false,
"text": "DBNull.Value"
},
{
"answer_id": 202382,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "ht... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] |
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 '.__CLASS__;
}
}
</code></pre>
<p>I would like to do something similar with the filenames (<code>__FILE__</code>, but dynamically evaluated); I would like to know what file the subclass resides in, from the superclass. Is it possible in any elegant way?</p>
<p>I know you could do something with <a href="http://fi.php.net/get_included_files" rel="nofollow noreferrer"><code>get_included_files()</code></a>, but that's not very efficient, especially if I have numerous instances.</p>
| [
{
"answer_id": 202308,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "__FILE__"
},
{
"answer_id": 202687,
"author": "user27987",
"author_id": 27987,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2238/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.