qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
139,670 | <p>In SQL SERVER Is it possible to store data with carriage return in a table and then retrieve it back again with carriage return.</p>
<p>Eg:</p>
<pre><code>insert into table values ('test1
test2
test3
test4');
</code></pre>
<p>When I retrieve it, I get the message in a line </p>
<p>test1 test2 test3 test4</p>
<p>The carriage return is treated as a single character.</p>
<p>Is there way to get the carriage returns or its just the way its going to be stored?</p>
<p>Thanks for the help guys!!!</p>
<p>Edit: I should have explained this before. I get the data from the web development (asp .net) and I just insert it into the table. I might not be doing any data manipulation.. just insert.</p>
<p>I return the data to the app development (C++) and may be some data or report viewer.</p>
<p>I don't want to manipulate on the data.</p>
| [
{
"answer_id": 139701,
"author": "Axeman",
"author_id": 22108,
"author_profile": "https://Stackoverflow.com/users/22108",
"pm_score": 2,
"selected": false,
"text": "insert into table values ('test1' + chr(13) + chr(10) + 'test2' );\n"
},
{
"answer_id": 139706,
"author": "Ciri... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21968/"
] |
139,683 | <p>I'm dealing with huge glassfish log files (in windows, eek!) and well ... Wordpad isn't cutting it. </p>
<p>Are there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome:</p>
<ul>
<li>View all lines of a certain log level (info, warning, severe)</li>
<li>Show logs between two timestamps</li>
<li>Occurency counter (this exception was thrown 99 times between time x and time y)</li>
</ul>
| [
{
"answer_id": 655675,
"author": "fredarin",
"author_id": 25038,
"author_profile": "https://Stackoverflow.com/users/25038",
"pm_score": 2,
"selected": false,
"text": "getline"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/139683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18673/"
] |
139,686 | <p>The maintenance problems that uninitialised locals cause (particularly pointers) will be obvious to anyone who has done a bit of c/c++ maintenance or enhancement, but I still see them and occasionally hear performance implications given as their justification.</p>
<p>It's easy to demonstrate in c that redundant initialisation is optimised out:</p>
<pre><code>$ less test.c
#include <stdio.h>
main()
{
#ifdef INIT_LOC
int a = 33;
int b;
memset(&b,66,sizeof(b));
#else
int a;
int b;
#endif
a = 0;
b = 0;
printf ("a = %i, b = %i\n", a, b);
}
$ gcc --version
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
</code></pre>
<p>[Not Optimised:]</p>
<pre><code>$ gcc test.c -S -o no_init.s; gcc test.c -S -D INIT_LOC=1 -o init.s; diff no_in
it.s init.s
22a23,28
> movl $33, -4(%ebp)
> movl $4, 8(%esp)
> movl $66, 4(%esp)
> leal -8(%ebp), %eax
> movl %eax, (%esp)
> call _memset
33a40
> .def _memset; .scl 3; .type 32; .endef
</code></pre>
<p>[Optimised:]</p>
<pre><code>$ gcc test.c -O -S -o no_init.s; gcc test.c -O -S -D INIT_LOC=1 -o init.s; diff
no_init.s init.s
$
</code></pre>
<p>So WRT performance under what circumstances is mandatory variable initialisation NOT a good idea?</p>
<p>IF applicable, no need to restrict answers to c/c++ but please be clear about the language/environment (and reproducible evidence much preferred over speculation!)</p>
| [
{
"answer_id": 139731,
"author": "xtofl",
"author_id": 6610,
"author_profile": "https://Stackoverflow.com/users/6610",
"pm_score": 2,
"selected": false,
"text": "ftime"
},
{
"answer_id": 139766,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "http... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22640/"
] |
139,739 | <p>I've been doing a massive code review and one pattern I notice all over the place is this:</p>
<pre><code>public bool MethodName()
{
bool returnValue = false;
if (expression)
{
// do something
returnValue = MethodCall();
}
else
{
// do something else
returnValue = Expression;
}
return returnValue;
}
</code></pre>
<p>This is not how I would have done this I would have just returned the value when I knew what it was. which of these two patterns is more correct?</p>
<p>I stress that the logic always seems to be structured such that the return value is assigned in one plave only and no code is executed after it's assigned.</p>
| [
{
"answer_id": 139754,
"author": "mmattax",
"author_id": 1638,
"author_profile": "https://Stackoverflow.com/users/1638",
"pm_score": 2,
"selected": false,
"text": "\nreturn expression ? MethodCall() : Expression;\n"
},
{
"answer_id": 139788,
"author": "Nenad Dobrilovic",
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
139,752 | <p>I'm starting to get comfortable with the idea of fakes, stubs, mocks, and dynamic mocks. But I am still a little iffy in my understanding of when to use partial mocks. </p>
<p>It would seem that if you're planning on mocking a service and need to resort to a partial mock then it is a sign of bad design. Is it that partial mocks are mostly for getting legacy code under test coverage?</p>
<p>On the flip side of this, say I am testing a class which has a Reset() method. If I have already confirmed in a separate test that the Reset() method works, and I have some functionality of the class that should end with a call to this method, is it poor test design to do a partial mock of the object and run tests against the partial mock, defining an Expectation on the Reset() method. </p>
<p>I currently have several tests set up in this manner, is this sort of thing going to get me in trouble later on?</p>
| [
{
"answer_id": 378720,
"author": "James Mead",
"author_id": 2025138,
"author_profile": "https://Stackoverflow.com/users/2025138",
"pm_score": 2,
"selected": false,
"text": "Reset"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/139752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] |
139,759 | <p>Is there any way to list all the files that have changed between two tags in CVS?</p>
<p>Every time we do a release we apply a tag to all the files in that release. I want to find all the files that changed between releases.</p>
<p>It would also work if I could find all files that had changed between two dates.</p>
| [
{
"answer_id": 139871,
"author": "Decio Lira",
"author_id": 12423,
"author_profile": "https://Stackoverflow.com/users/12423",
"pm_score": 6,
"selected": true,
"text": "cvs diff -N -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs\n"
},
{
"answer_id": 139923,
"author": "roomaroo",
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3464/"
] |
139,794 | <p>Let's say we have <code>index.php</code> and it is stored in <code>/home/user/public/www</code> and <code>index.php</code> calls the class <code>Foo->bar()</code> from the file <code>inc/app/Foo.class.php</code>. </p>
<p>I'd like the bar function in the <code>Foo</code> class to get a hold of the path <code>/home/user/public/www</code> in this instance — I don't want to use a global variable, pass a variable, etc.</p>
| [
{
"answer_id": 139830,
"author": "Devon",
"author_id": 13850,
"author_profile": "https://Stackoverflow.com/users/13850",
"pm_score": 4,
"selected": false,
"text": "class Foo {\n function bar() { \n $trace = debug_backtrace();\n echo \"calling file was \".$trace[0]['file'].\"\\n\"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6752/"
] |
139,809 | <p>I have a Console application hosting a WCF service. I would like to be able to fire an event from a method in the WCF service and handle the event in the hosting process of the WCF service. Is this possible? How would I do this? Could I derive a custom class from ServiceHost?</p>
| [
{
"answer_id": 139886,
"author": "Franci Penov",
"author_id": 17028,
"author_profile": "https://Stackoverflow.com/users/17028",
"pm_score": 5,
"selected": true,
"text": "ServiceHost"
},
{
"answer_id": 4295649,
"author": "Pankaj Awasthi",
"author_id": 522781,
"author_p... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8033/"
] |
139,811 | <p>What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"?</p>
<p>One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a day that had similar weather.</p>
<p>The similarity of two sets is a bit subjective, so the algorithm really just needs to diferentiate between good matches and bad matches. We have a lot of historical data, so I would like to try to narrow down the amount of days the users need to look through by automatically throwing out sets that aren't close and trying to put the "best" matches at the top of the list.</p>
<p><strong>Edit</strong>:
Ideally the result of the algorithm would be comparable to results using different data sets. For example using the mean square error as suggested by <a href="https://stackoverflow.com/questions/139811/algorithm-to-score-similarness-of-sets-of-numbers#139842">Niles</a> produces pretty good results, but the numbers generated when comparing the temperature can not be compared to numbers generated with other data such as Wind Speed or Precipitation because the scale of the data is different. Some of the non-weather data being is very large, so the mean square error algorithm generates numbers in the hundreds of thousands compared to the tens or hundreds that is generated by using temperature.</p>
| [
{
"answer_id": 140244,
"author": "Adam Hughes",
"author_id": 3863,
"author_profile": "https://Stackoverflow.com/users/3863",
"pm_score": 0,
"selected": false,
"text": "function calculate_score(historical_set, forecast_set)\n{\n double c = correlation(historical_set, forecast_set);\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3863/"
] |
139,819 | <p>The following test fails:</p>
<pre><code>#!/usr/bin/env python
def f(*args):
"""
>>> t = 1, -1
>>> f(*map(lambda i: lambda: i, t))
[1, -1]
>>> f(*(lambda: i for i in t)) # -> [-1, -1]
[1, -1]
>>> f(*[lambda: i for i in t]) # -> [-1, -1]
[1, -1]
"""
alist = [a() for a in args]
print(alist)
if __name__ == '__main__':
import doctest; doctest.testmod()
</code></pre>
<p>In other words:</p>
<pre><code>>>> t = 1, -1
>>> args = []
>>> for i in t:
... args.append(lambda: i)
...
>>> map(lambda a: a(), args)
[-1, -1]
>>> args = []
>>> for i in t:
... args.append((lambda i: lambda: i)(i))
...
>>> map(lambda a: a(), args)
[1, -1]
>>> args = []
>>> for i in t:
... args.append(lambda i=i: i)
...
>>> map(lambda a: a(), args)
[1, -1]
</code></pre>
| [
{
"answer_id": 139880,
"author": "Brian",
"author_id": 9493,
"author_profile": "https://Stackoverflow.com/users/9493",
"pm_score": 3,
"selected": false,
"text": "lambda : i\n"
},
{
"answer_id": 139899,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4279/"
] |
139,821 | <p>What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.</p>
| [
{
"answer_id": 139965,
"author": "willem",
"author_id": 22702,
"author_profile": "https://Stackoverflow.com/users/22702",
"pm_score": 2,
"selected": false,
"text": " <endpoint address=\"\" binding=\"webHttpBinding\" bindingConfiguration=\"\"\n contract=\"WcfCore.ICustomer\">\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21784/"
] |
139,833 | <p>I am using StringReplace to replace &gt and &lt by the char itself in a generated XML like this:</p>
<pre><code>StringReplace(xml.Text,'&gt;','>',[rfReplaceAll]) ;
StringReplace(xml.Text,'&lt;','<',[rfReplaceAll]) ;
</code></pre>
<p>The thing is it takes way tooo long to replace every occurence of &gt.</p>
<p>Do you purpose any better idea to make it faster?</p>
| [
{
"answer_id": 139876,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 2,
"selected": false,
"text": "String s = \"<xml>test</xml>\";\nchar[] input = s.ToCharArray();\nchar[] res = new char[s.Length];\nint j... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19224/"
] |
139,835 | <p>I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does not show the window's system menu, nor does it show up when right-clicking the window's name in the taskbar.</p>
<p>This form uses these styles:</p>
<pre><code>this.SetStyle( ControlStyles.AllPaintingInWmPaint, true );
this.SetStyle( ControlStyles.UserPaint, true );
this.SetStyle( ControlStyles.OptimizedDoubleBuffer, true );
this.SetStyle( ControlStyles.ResizeRedraw, true );
</code></pre>
<p>And has these non-default property values:</p>
<pre><code>this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
</code></pre>
<p>I've tried handling WM_NCRBUTTONDOWN and WM_NCRBUTTONUP, and send the WM_GETSYSMENU message, but it didn't work.</p>
| [
{
"answer_id": 159897,
"author": "Bill",
"author_id": 14547,
"author_profile": "https://Stackoverflow.com/users/14547",
"pm_score": 4,
"selected": true,
"text": "GetWindowLong"
},
{
"answer_id": 450149,
"author": "Community",
"author_id": -1,
"author_profile": "https:... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] |
139,837 | <p>I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? </p>
<p>I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage?</p>
<p>I'm not interested in seeing a textbook example, mind you. There are plenty of those out there. I want to see an actual reason why it solved a particular problem for you.</p>
<p>EDIT: Let's place aside the discussion about whether or not to use attributes in the first place. I understand some people don't like them because they "dirty" their code. That's for a different discussion!</p>
| [
{
"answer_id": 140890,
"author": "Kevin Dostalek",
"author_id": 22732,
"author_profile": "https://Stackoverflow.com/users/22732",
"pm_score": 2,
"selected": false,
"text": " public class ShellController : ControllerBase, IShellController\n {\n public ShellController([StateDe... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5469/"
] |
139,859 | <p>On <strong>Linux/NPTL</strong>, threads are created as some kind of process.</p>
<p>I can see some of my process have a weird cmdline:</p>
<pre><code>cat /proc/5590/cmdline
hald-addon-storage: polling /dev/scd0 (every 2 sec)
</code></pre>
<p>Do you have an idea how I could do that for each thread of my process? That would be very helpful for debugging.</p>
<p><em>/me now investigating in HAL source</em></p>
| [
{
"answer_id": 139935,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": false,
"text": "argv"
},
{
"answer_id": 139963,
"author": "elmarco",
"author_id": 1277510,
"author_profile": "https://St... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1277510/"
] |
139,867 | <p>Does anyone know of a freely available java 1.5 package that provides a list of ISO 3166-1 country codes as a enum or EnumMap? Specifically I need the "ISO 3166-1-alpha-2 code elements", i.e. the 2 character country code like "us", "uk", "de", etc. Creating one is simple enough (although tedious), but if there's a standard one already out there in apache land or the like it would save a little time.</p>
| [
{
"answer_id": 140235,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 6,
"selected": false,
"text": "String[] countryCodes = Locale.getISOCountries();\n"
},
{
"answer_id": 2298525,
"author": "Christophe Desguez",
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12531/"
] |
139,884 | <p>Google results on this one are a bit thin, but suggest that it is not easily possible.</p>
<p>My specific problem is that I need to renumber the IDs in two tables that are related to each other such that table B has an "table_a_id" column in it. I can't renumber table A first because then its children in B point to the old IDs. I can't renumber table B first because then they would point to the new IDs before they were created. Now repeat for three or four tables.</p>
<p>I don't really want to have to fiddle around with individual relationships when I could just "start transaction; disable ref integrity; sort IDs out; re-enable ref integrity; commit transaction". Mysql and MSSQL both provide this functionality IIRC so I would be surprised if Postgres didn't.</p>
<p>Thanks!</p>
| [
{
"answer_id": 139943,
"author": "Joel B Fant",
"author_id": 22211,
"author_profile": "https://Stackoverflow.com/users/22211",
"pm_score": 5,
"selected": true,
"text": "DEFERRABLE"
},
{
"answer_id": 139960,
"author": "Liam",
"author_id": 18333,
"author_profile": "http... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22715/"
] |
139,889 | <p>I'm setting up a number sites right now and many of them have multiple domains. The question is: do I alias the domain (with <a href="http://httpd.apache.org/docs/2.0/mod/core.html#serveralias" rel="noreferrer">ServerAlias</a>) or do I <a href="http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect" rel="noreferrer">Redirect</a> the request? </p>
<p>Obviously ServerAlias is better/easier from a readability or scripting perspective. I have heard however that Google likes it better if everything redirects to one domain. Is this true? If so, what redirect code should be used?</p>
<p>Common vhost examples will have:</p>
<pre><code>ServerName example.net
ServerAlias www.example.net
</code></pre>
<p>Is this wrong and should the www also be a redirect in addition to example2.net and www.example2.net? Or is Google smart enough to that all these sites (or at least the www) are the same site?</p>
<p>UPDATE: Part of the reasoning for wanting aliases is that they are much faster. A redirect for a dialup user just because they did (or didn't) use the www adds significantly to initial page load.</p>
<p>UPDATE and ANSWER: Thanks Paul for finding the <a href="http://googlewebmastercentral.blogspot.com/2008/09/demystifying-duplicate-content-penalty.html" rel="noreferrer">Google link</a> which instructs us to "help your fellow webmasters by <strong>not</strong> perpetuating the myth of duplicate content penalties". Note, however, this only applies to content ON THE SAME SITE, exemplified in the article with "www.example.com/skates.asp?color=black&brand=riedell or www.example.com/skates.asp?brand=riedell&color=black". In fact, the article explicitly says "Don't create multiple pages, subdomains, or domains with substantially duplicate content."</p>
| [
{
"answer_id": 139911,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 6,
"selected": true,
"text": "RewriteCond %{HTTP_HOST} !^www\\.foobar\\.com [NC]\nRewriteCond %{HTTP_HOST} !^$\nRewriteRule ^/(.*) http://ww... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15948/"
] |
139,891 | <p>This question is not so much programming related as it is deployment related.</p>
<p>I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code on them. For legal and compliance reasons, I do not have direct visibility or any control over the servers so the only way I can tell which version(s) of .NET are installed on any of them is through directions I give to that group. </p>
<p>So far, all of the methods I can think of to tell which version(s) are installed (check for Administrative Tools matching 1.1 or 2.0, check for the entries in the "Add/Remove Programs" list, check for the existence of the directories under c:\Windows\Microsoft.NET) are flawed (I've seen at least one machine with 2.0 but no 2.0 entries under Administrative Tools - and that method tells you nothing about 3.0+, the "Add/Remove Programs" list can get out of sync with reality, and the existence of the directories doesn't necessarily mean anything).</p>
<p>Given that I generally need to know these things are in place in advance (discovering that "oops, this one doesn't have all the versions and service packs you need" doesn't really work well with short maintenance windows) and I have to do the checking "by proxy" since I can't get on the servers directly, what's the foolproof way to tell which version(s) of .NET are installed on a production Windows Server? Preferably some intrinsic way to do so using what the framework installs since it will be quicker and not need some sort of utility to be loaded and also a method which will definitely fail if the frameworks are not properly installed but still have files in place (i.e., there's a directory and gacutil.exe is inded there but that version of the framework is not really "installed")</p>
<p><strong>EDIT:</strong> In the absence of a good foolproof intrinsic way to do this built into the Framework(s), does anyone know of a good, lightweight, no-install-required program that can find this out? I can imagine someone could easily write one but if one already exists, that would be even better.</p>
| [
{
"answer_id": 139912,
"author": "Dean",
"author_id": 11802,
"author_profile": "https://Stackoverflow.com/users/11802",
"pm_score": 0,
"selected": false,
"text": "<root>:\\WINDOWS\\Microsoft.NET\\Framework"
},
{
"answer_id": 139916,
"author": "Ed Guiness",
"author_id": 42... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2577/"
] |
139,909 | <p>I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0</p>
| [
{
"answer_id": 139917,
"author": "pfranza",
"author_id": 22221,
"author_profile": "https://Stackoverflow.com/users/22221",
"pm_score": 4,
"selected": true,
"text": "-Djava.net.preferIPv4Stack=true\n"
},
{
"answer_id": 20336403,
"author": "Mark Harrison",
"author_id": 116,... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
139,921 | <p>I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've typed. When I try this the page reloads (the action is #) but any new text typed in the fields is not passed in the REQUEST, so I don't get to put it in the DB. Is there some fundamental reason why this happens or is my code just not playing nice together (I'm using the EXTJS grid view to show the form and a library for tracking idle time)?
Thanks,
Robert</p>
| [
{
"answer_id": 140035,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "<form action=\"/page.cgi\">\n ...\n <input name=\"Fieldx\" value=\"\"/>\n</form>\n"
},
{
"answer_id": 140065,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22719/"
] |
139,926 | <p>I was writing some Unit tests last week for a piece of code that generated some SQL statements.</p>
<p>I was trying to figure out a regex to match <code>SELECT</code>, <code>INSERT</code> and <code>UPDATE</code> syntax so I could verify that my methods were generating valid SQL, and after 3-4 hours of searching and messing around with various regex editors I gave up.</p>
<p>I managed to get partial matches but because a section in quotes can contain any characters it quickly expands to match the whole statement.</p>
<p>Any help would be appreciated, I'm not very good with regular expressions but I'd like to learn more about them.</p>
<p>By the way it's C# RegEx that I'm after.</p>
<p><strong>Clarification</strong></p>
<p>I don't want to need access to a database as this is part of a Unit test and I don't wan't to have to maintain a database to test my code. which may live longer than the project.</p>
| [
{
"answer_id": 139959,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": -1,
"selected": false,
"text": ".\\*"
},
{
"answer_id": 140094,
"author": "David Aldridge",
"author_id": 6742,
"author_profile": "https:... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
139,927 | <p>I have several projects where I need to append strings to a BSTR/CComBSTR/_bstr_t object (e.g. building a dynamic SQL statement). Is there an out-of-the-box type in the WinAPI to buffer the concatenation (like StringBuilder in .NET), or do I have to write my own? From what I know about the append methods, they perform re-allocation.</p>
| [
{
"answer_id": 139959,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": -1,
"selected": false,
"text": ".\\*"
},
{
"answer_id": 140094,
"author": "David Aldridge",
"author_id": 6742,
"author_profile": "https:... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20133/"
] |
139,948 | <p>I have a page using .NETs server-side input validation controls. This page also has a javascript confirm box that fires when the form is submitted. Currently when the Submit button is selected, the javascript confirm box appears, and once confirmed the ASP.NET server-side validation controls are fired. I would like to fire the server-side validation controls BEFORE the javascript confirm box is displayed.</p>
<p>How can this be accomplished? Ive included a sample of my current code below.</p>
<p>sample.aspx</p>
<pre><code><asp:textbox id=foo runat=server />
<asp:requiredfieldvalidator id=val runat=server controltovalidate=foo />
<asp:button id=submit runat=server onClientClick=return confirm('Confirm this submission?') />
</code></pre>
<p>sample.aspx.vb</p>
<pre><code>Sub Page_Load()
If Page.IsPostback() Then
Page.Validate()
If Page.IsValid Then
'process page here'
End If
End If
End Sub
</code></pre>
<p>Thanks for any help.</p>
| [
{
"answer_id": 490584,
"author": "cofiem",
"author_id": 31567,
"author_profile": "https://Stackoverflow.com/users/31567",
"pm_score": 3,
"selected": false,
"text": "confirm"
},
{
"answer_id": 10314013,
"author": "Aniruddha Ghosh",
"author_id": 1355916,
"author_profile... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
139,954 | <p>I've started with ASP.NET MVC recently, reading blogs, tutorials, trying some routes, etc. Now, i've stumbled on a issue where i need some help.</p>
<p>Basically, i have an URL like /products.aspx?categoryid=foo&productid=bar</p>
<p>Most tutorials/examples propose to map this to something like: /products/category/foo/bar where "products" is the controller, "category" is the action, etc.</p>
<p>But i need to map it to /products/foo/bar. (without "category")</p>
<p>Is it possible? Am i missing something? Help will be highly appreciated. Thank you advance :)</p>
<p>P.S. Sorry for my bad English.</p>
| [
{
"answer_id": 139986,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 4,
"selected": true,
"text": "routes.MapRoute(\"productsByCategory\", \"products/{category}/{productid}\",\n new { controller=\"products\", action=\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19610/"
] |
139,964 | <p>Does anyone have a method to overcome the 260 character limit of the MSBuild tool for building Visual Studio projects and solutions from the command line? I'm trying to get the build automated using CruiseControl (CruiseControl.NET isn't an option, so I'm trying to tie it into normal ant scripts) and I keep on running into problems with the length of the paths. To clarify, the problem is in the length of paths of projects referenced in the solution file, as the tool doesn't collapse paths down properly :(</p>
<p>I've also tried using DevEnv which sometimes works and sometimes throws an exception, which isn't good for an automated build on a separate machine. So please don't suggest using this as a replacement.</p>
<p>And to top it all, the project builds fine when using Visual Studio through the normal IDE.</p>
| [
{
"answer_id": 9635709,
"author": "doomer",
"author_id": 423665,
"author_profile": "https://Stackoverflow.com/users/423665",
"pm_score": 3,
"selected": false,
"text": "<BaseIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\\..\\..\\..\\Intermediate\\$(Ass... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16035/"
] |
139,972 | <p>Kind of a newbie question, but I am having problems using SNVKit. </p>
<p>I am using SVNKit in an application to commit changes to files. I have it successfully adding the files and folders to the working copy, but I am having problems committing it to the respository.</p>
<p>The command I am trying to run is 'commit -m "Test Add" /svnroot/project1/' but I keep getting "svn: '/home/user' is not a working copy"</p>
<p>I have a structure similar to this:</p>
<ul>
<li>/svnroot/</li>
<li>/svnroot/project1/</li>
<li>/svnroot/project1/grouping1/</li>
<li>/svnroot/project1/grouping1/myfilesarehere</li>
</ul>
<p>If I try to commit the file, I get the following message: "'/svnroot/project1/grouping1' is not under version control and is not part of the commit, yet its child is part of the commit."</p>
<p>What might I be doing wrong?</p>
<p>EDIT: Fixed the directories.</p>
| [
{
"answer_id": 140116,
"author": "Sean",
"author_id": 4919,
"author_profile": "https://Stackoverflow.com/users/4919",
"pm_score": 1,
"selected": false,
"text": "import"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/139972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2535/"
] |
139,979 | <p>I have a C# interface with certain method parameters declared as <code>object</code> types. However, the actual type passed around can differ depending on the class implementing the interface:</p>
<pre><code>public interface IMyInterface
{
void MyMethod(object arg);
}
public class MyClass1 : IMyInterface
{
public void MyMethod(object arg)
{
MyObject obj = (MyObject) arg;
// do something with obj...
}
}
public class MyClass2 : IMyInterface
{
public void MyMethod(object arg)
{
byte[] obj = (byte[]) arg;
// do something with obj...
}
}
</code></pre>
<p>The problem with MyClass2 is that the conversion of <code>byte[]</code> to and from <code>object</code> is <a href="http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx" rel="noreferrer">boxing and unboxing</a>, which are computationally expensive operations affecting performance.</p>
<p>Would solving this problem with a <a href="http://msdn.microsoft.com/en-us/library/kwtft8ak.aspx" rel="noreferrer">generic interface</a> avoid boxing/unboxing?</p>
<pre><code>public interface IMyInterface<T>
{
void MyMethod(T arg);
}
public class MyClass1 : IMyInterface<MyObject>
{
public void MyMethod(MyObject arg)
{
// typecast no longer necessary
//MyObject obj = (MyObject) arg;
// do something with arg...
}
}
public class MyClass2 : IMyInterface<byte[]>
{
public void MyMethod(byte[] arg)
{
// typecast no longer necessary
//byte[] obj = (byte[]) arg;
// do something with arg...
}
}
</code></pre>
<p>How is this implemented in .NET vs Mono? Will there be any performance implications on either platform?</p>
<p>Thank you!</p>
| [
{
"answer_id": 176441,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": " void Bla<T> (T a, T b);\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/139979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2576/"
] |
139,991 | <p>I have two functions, <code>f</code> and <code>g</code>, which call each other recursively. Unfortunately, when <code>f</code> calls <code>g</code>, it has not yet been declared, so I get an "unbound variable" error. How can I prototype (or whatever the equivalent vocabulary is) this function in SML/NJ?</p>
| [
{
"answer_id": 140386,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 2,
"selected": false,
"text": "and"
},
{
"answer_id": 140405,
"author": "Chris Conway",
"author_id": 1412,
"author_profile": "https://S... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10307/"
] |
140,002 | <p>I'm trying to return a dictionary from a function. I believe the function is working correctly, but I'm not sure how to utilize the returned dictionary.</p>
<p>Here is the relevant part of my function:</p>
<pre><code>Function GetSomeStuff()
'
' Get a recordset...
'
Dim stuff
Set stuff = CreateObject("Scripting.Dictionary")
rs.MoveFirst
Do Until rs.EOF
stuff.Add rs.Fields("FieldA").Value, rs.Fields("FieldB").Value
rs.MoveNext
Loop
GetSomeStuff = stuff
End Function
</code></pre>
<p>How do I call this function and use the returned dictionary?</p>
<p>EDIT: I've tried this:</p>
<pre><code>Dim someStuff
someStuff = GetSomeStuff
</code></pre>
<p>and</p>
<pre><code>Dim someStuff
Set someStuff = GetSomeStuff
</code></pre>
<p>When I try to access someStuff, I get an error:</p>
<pre><code>Microsoft VBScript runtime error: Object required: 'GetSomeStuff'
</code></pre>
<p>EDIT 2: Trying this in the function:</p>
<pre><code>Set GetSomeStuff = stuff
</code></pre>
<p>Results in this error:</p>
<pre><code>Microsoft VBScript runtime error: Wrong number of arguments or invalid property assignment.
</code></pre>
| [
{
"answer_id": 140064,
"author": "Rob",
"author_id": 7872,
"author_profile": "https://Stackoverflow.com/users/7872",
"pm_score": 0,
"selected": false,
"text": "Dim returnedStuff\nSet returnedStuff = GetSomeStuff()\n"
},
{
"answer_id": 140141,
"author": "tloach",
"author_i... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2441/"
] |
140,012 | <p>I am currently creating an overnight job that calls a Unix script which in turn creates and transfers a file using <code>ftp</code>. I would like to check all possible return codes. The man page for <code>ftp</code> doesn't list return codes. Does anyone know where to find a list? Anyone with experience with this? We have other scripts that grep for certain return strings in the log, and they send an email when in error. However, they often miss unanticipated codes.
I am then putting the reason into the log and the email.</p>
| [
{
"answer_id": 140071,
"author": "ColinYounger",
"author_id": 1223,
"author_profile": "https://Stackoverflow.com/users/1223",
"pm_score": 4,
"selected": true,
"text": "ftp"
},
{
"answer_id": 140390,
"author": "jk.",
"author_id": 21284,
"author_profile": "https://Stack... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12646/"
] |
140,026 | <p>I'm writing a server that I expect to be run by many different people, not all of whom I will have direct contact with. The servers will communicate with each other in a cluster. Part of the server's functionality involves selecting a small subset of rows from a potentially very large table. The exact choice of what rows are selected will need some tuning, and it's important that it's possible for the person running the cluster (eg, myself) to update the selection criteria without getting each and every server administrator to deploy a new version of the server.</p>
<p>Simply writing the function in Python isn't really an option, since nobody is going to want to install a server that downloads and executes arbitrary Python code at runtime.</p>
<p>What I need are suggestions on the simplest way to implement a Domain Specific Language to achieve this goal. The language needs to be capable of simple expression evaluation, as well as querying table indexes and iterating through the returned rows. Ease of writing and reading the language is secondary to ease of implementing it. I'd also prefer not to have to write an entire query optimiser, so something that explicitly specifies what indexes to query would be ideal.</p>
<p>The interface that this will have to compile against will be similar in capabilities to what the App Engine datastore exports: You can query for sequential ranges on any index on the table (eg, less-than, greater-than, range and equality queries), then filter the returned row by any boolean expression. You can also concatenate multiple independent result sets together.</p>
<p>I realise this question sounds a lot like I'm asking for SQL. However, I don't want to require that the datastore backing this data be a relational database, and I don't want the overhead of trying to reimplement SQL myself. I'm also dealing with only a single table with a known schema. Finally, no joins will be required. Something much simpler would be far preferable.</p>
<p>Edit: Expanded description to clear up some misconceptions.</p>
| [
{
"answer_id": 46762714,
"author": "Vikas",
"author_id": 137228,
"author_profile": "https://Stackoverflow.com/users/137228",
"pm_score": 0,
"selected": false,
"text": "SQLite3"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12030/"
] |
140,033 | <p>Assume I have a class foo, and wish to use a std::map to store some boost::shared_ptrs, e.g.:</p>
<pre><code>class foo;
typedef boost::shared_ptr<foo> foo_sp;
typeded std::map<int, foo_sp> foo_sp_map;
foo_sp_map m;
</code></pre>
<p>If I add a new foo_sp to the map but the key used already exists, will the existing entry be deleted? For example:</p>
<pre><code>foo_sp_map m;
void func1()
{
foo_sp p(new foo);
m[0] = p;
}
void func2()
{
foo_sp p2(new foo);
m[0] = p2;
}
</code></pre>
<p>Will the original pointer (p) be freed when it is replaced by p2? I'm pretty sure it will be, but I thought it was worth asking/sharing.</p>
| [
{
"answer_id": 140112,
"author": "Harald Scheirich",
"author_id": 22080,
"author_profile": "https://Stackoverflow.com/users/22080",
"pm_score": 1,
"selected": false,
"text": "m[0] = p2;"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] |
140,043 | <p>How do I loop into all the resources in the resourcemanager?</p>
<p>Ie:
foreach (string resource in ResourceManager)
//Do something with the recource.</p>
<p>Thanks</p>
| [
{
"answer_id": 140060,
"author": "VVS",
"author_id": 21038,
"author_profile": "https://Stackoverflow.com/users/21038",
"pm_score": 6,
"selected": true,
"text": "IEnumerable"
},
{
"answer_id": 140257,
"author": "Leandro López",
"author_id": 22695,
"author_profile": "ht... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17766/"
] |
140,044 | <p>I need to create a user control in either vb.net or c# to search a RightNow CRM database. I have the documentation on their XML API, but I'm not sure how to post to their parser and then catch the return data and display it on the page.</p>
<p>Any sample code would be greatly appreciated!</p>
<p>Link to API: <a href="http://community.rightnow.com/customer/documentation/integration/82_crm_integration.pdf" rel="nofollow noreferrer">http://community.rightnow.com/customer/documentation/integration/82_crm_integration.pdf</a></p>
| [
{
"answer_id": 148494,
"author": "csgero",
"author_id": 21764,
"author_profile": "https://Stackoverflow.com/users/21764",
"pm_score": 1,
"selected": false,
"text": "using System.Net;\nusing System.Text;\nusing System;\n\nnamespace RightNowSample\n{\n class Program\n {\n stat... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20483/"
] |
140,054 | <p>I need to use InstallUtil to install a C# windows service. I need to set the service logon credentials (username and password). All of this needs to be done silently.</p>
<p>Is there are way to do something like this:</p>
<pre><code>installutil.exe myservice.exe /customarg1=username /customarg2=password
</code></pre>
| [
{
"answer_id": 140285,
"author": "Dean Hill",
"author_id": 3106,
"author_profile": "https://Stackoverflow.com/users/3106",
"pm_score": 7,
"selected": true,
"text": "installutil.exe /user=uname /password=pw myservice.exe\n"
},
{
"answer_id": 1613862,
"author": "william",
"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3106/"
] |
140,061 | <p>When creating a class library in C++, you can choose between dynamic (<code>.dll</code>, <code>.so</code>) and static (<code>.lib</code>, <code>.a</code>) libraries. What is the difference between them and when is it appropriate to use which?</p>
| [
{
"answer_id": 140444,
"author": "bk1e",
"author_id": 8090,
"author_profile": "https://Stackoverflow.com/users/8090",
"pm_score": 8,
"selected": false,
"text": "mylib.lib"
},
{
"answer_id": 1900692,
"author": "Vijay",
"author_id": 134713,
"author_profile": "https://St... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4055/"
] |
140,104 | <p>If something goes wrong in a WCF REST call, such as the requested resource is not found, how can I play with the HTTP response code (setting it to something like HTTP 404, for example) in my OperationContract method?</p>
| [
{
"answer_id": 140154,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 8,
"selected": true,
"text": "WebOperationContext"
},
{
"answer_id": 4266353,
"author": "Graeme Bradbury",
"author_id": 5889,
"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21784/"
] |
140,111 | <p>Linux supports sending an arbitrary Posix-Signal such as <code>SIGINT</code> or <code>SIGTERM</code> to a process using the <code>kill</code>-Command. While <code>SIGINT</code> and <code>SIGTERM</code> are just boring old ways to end a process in a friendly or not-so-friendly kind of way, <code>SIGQUIT</code> is meant to trigger a core dump. This can be used to trigger a running Java VM to print out a thread dump, including the stacktraces of all running threads -- neat! After printing the debugging info, the Java VM will continue doing whatever it was doing before; in fact the thread dump just happens in another spawned thread of maximum priority. (You can try this out yourself by using <code>kill -3 <VM-PID></code>.)</p>
<p>Note that you can also register your own signal handlers using the (unsupported!) <code>Signal</code> and <code>SignalHandler</code> classes in the <code>sun.misc</code>-package, so you can have all kinds of fun with it.</p>
<p><em>However, I have yet to find a way to send a signal to a Windows process.</em> Signals are created by certain user inputs: <code>Ctrl-C</code> triggers a <code>SIGINT</code> on both platforms, for instance. But there does not seem to be any utility to manually send a signal to a running, but non-interactive process on Windows. The obvious solution is to use the Cygwin <code>kill</code> executable, but while it can end Windows processes using the appropriate Windows API, I could not send a <code>SIGBREAK</code> (the Windows equivalent to <code>SIGQUIT</code>) with it; in fact I think the only signal it is able to send to Windows processes is <code>SIGTERM</code>.</p>
<p>So, to make a long story short and to repeat the headline: How to I send an arbitrary signal to a process in Windows?</p>
| [
{
"answer_id": 140174,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 3,
"selected": false,
"text": "SetConsoleCtrlHandler"
},
{
"answer_id": 140229,
"author": "Bob Nadler",
"author_id": 2514,
"author... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19256/"
] |
140,113 | <p>I want to consume a web service over https from a java client.
What steps will i need to take in order to do this?</p>
| [
{
"answer_id": 163759,
"author": "Ian McLaird",
"author_id": 18796,
"author_profile": "https://Stackoverflow.com/users/18796",
"pm_score": 2,
"selected": false,
"text": "keytool -importcert -v -trustcacerts -alias ServerName -file server_cert_file.crt -keystore client_keystore_file\n"
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11612/"
] |
140,115 | <p>So I have a small C# app that needs to periodically check the contents of directories on multiple machines on the network. I thought I could just read \hostname\C$ as a directory path, but with the normal Directory class there doesn't seem to be a way to authenticate against the other servers so you can access the hidden share.
I'm sure there's an easy way to do this that I've overlooked, but at the moment I'm a bit stumpted.</p>
| [
{
"answer_id": 140156,
"author": "Austin Salonen",
"author_id": 4068,
"author_profile": "https://Stackoverflow.com/users/4068",
"pm_score": 0,
"selected": false,
"text": "DirectoryInfo di = new DirectoryInfo(@\"\\\\machineName\\c$\\temp\");\n\nFileInfo[] files = di.GetFiles();\n\nforeach... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/634/"
] |
140,131 | <p>I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.</p>
<p>I couldn't have phrased it better than the person that posted <a href="http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21062554.html" rel="noreferrer">the same question here</a>.</p>
<p>But to keep it original, I'll phrase it my own way: suppose I have a string <code>"00A0BF"</code> that I would like interpreted as the</p>
<pre><code>byte[] {0x00,0xA0,0xBf}
</code></pre>
<p>what should I do?</p>
<p>I am a Java novice and ended up using <code>BigInteger</code> and watching out for leading hex zeros. But I think it is ugly and I am sure I am missing something simple. </p>
| [
{
"answer_id": 140147,
"author": "skaffman",
"author_id": 21234,
"author_profile": "https://Stackoverflow.com/users/21234",
"pm_score": 7,
"selected": false,
"text": "import org.apache.commons.codec.binary.Hex;\n...\nbyte[] decoded = Hex.decodeHex(\"00A0BF\");\n// 0x00 0xA0 0xBF\n"
},
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11798/"
] |
140,133 | <p>I want to raise an event when a popup window is closed, or preferably, just before closing. I'm storing the popup window object as an object, but I don't know of any way to bind to the close event, or an event just before the window is closed.</p>
<pre><code>var popupWindow = window.open("/popup.aspx", "popupWindow", "height=550,width=780");
</code></pre>
<p>Is there any way to subscribe to the close event using jQuery, or just raw javascript? I'm using jQuery and can't add another library, so if it can't be done in jQuery I'll have to roll my own event system somehow so that it will work across all browsers.</p>
<p><strong>UPDATE:</strong><br>
I've tried using the unload event in jQuery and for some reason the event is raised as soon as my popup opens instead of when it is closed. If I use Firebug to set a breakpoint to delay the unload event from being subscribed to, the unload event works the way it is supposed to, but for whatever reason, it doesn't work correctly when the javascript is allowed to execute naturally. </p>
<pre><code>var popupWindow = window.open("/popup.aspx", "popupWindow", "height=550,width=780");
$(popupWindow.window).unload(function() { alert('hello'); });
</code></pre>
<p>Does anybody have any idea as to why the unload event could be raised when the window is loading?</p>
<p>One other catch is that I've noticed that jQuery's "unload" event does not stay subscribed to the window like it normally does if I just do:</p>
<pre><code>popupWindow.onunload = function(){alert('hello')};
</code></pre>
<p>It seems to unsubscribe from the event every time it is raised. Is this supposed to happen? If it weren't for this bug (or feature?) in jQuery, it would by fine to have the event get raised on load since I can check the <code>popupWindow.closed</code> property inside of the event to ensure the window was really closed.</p>
| [
{
"answer_id": 140318,
"author": "Philip Tinney",
"author_id": 14930,
"author_profile": "https://Stackoverflow.com/users/14930",
"pm_score": 2,
"selected": false,
"text": "$(window).unload( function () { alert(\"Bye now!\"); } );"
},
{
"answer_id": 1164449,
"author": "Elzo Va... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
140,137 | <p>I'm working on a client site who is using Umbraco as a CMS. I need to create a custom 404 error page. I've tried doing it in the IIS config but umbraco overrides that. </p>
<p>Does anyone know how to create a custom 404 error page in Umbraco?
Is there a way to create a custom error page for runtime errors?</p>
| [
{
"answer_id": 140169,
"author": "Swati",
"author_id": 12682,
"author_profile": "https://Stackoverflow.com/users/12682",
"pm_score": 4,
"selected": false,
"text": "/config/umbracoSettings.config"
},
{
"answer_id": 1129888,
"author": "Dirk De Grave",
"author_id": 137107,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20483/"
] |
140,149 | <p>I have a custom performance counter category. Visual Studio Server Explorer refuses to delete it, claiming it is 'not registered or a system category'. Short of doing it programmatically, how can I delete the category? Is there a registry key I can delete?</p>
| [
{
"answer_id": 140185,
"author": "Jaykul",
"author_id": 8718,
"author_profile": "https://Stackoverflow.com/users/8718",
"pm_score": 6,
"selected": true,
"text": "[Diagnostics.PerformanceCounterCategory]::Delete( \"Your Category Name\" )\n"
},
{
"answer_id": 1017515,
"author":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16881/"
] |
140,161 | <p>How can I find out which column and value is violating the constraint? The exception message isn't helpful at all:</p>
<blockquote>
<p>Failed to enable constraints. One or
more rows contain values violating
non-null, unique, or foreign-key
constraints.</p>
</blockquote>
| [
{
"answer_id": 140679,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 5,
"selected": false,
"text": "...\ntry\n{\n adapter.Fill(dataTable); // or dataSet\n}\ncatch (ConstraintException)\n{\n LogErrors(dataTable);\n thr... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11547/"
] |
140,162 | <p>In a servlet I do the following:</p>
<pre><code> Context context = new InitialContext();
value = (String) context.lookup("java:comp/env/propertyName");
</code></pre>
<p>On an Apache Geronimo instance (WAS CE 2.1) how do i associate a value with the key <em>propertyName</em>?</p>
<p>In Websphere AS 6 i can configure these properties for JNDI lookup under the "Name Space Bindings" page in the management console, but for the life of me I can find no way to do this in community edition on the web.</p>
| [
{
"answer_id": 143749,
"author": "Mike Spross",
"author_id": 17862,
"author_profile": "https://Stackoverflow.com/users/17862",
"pm_score": 1,
"selected": false,
"text": "<env-entry>"
},
{
"answer_id": 5325475,
"author": "boes",
"author_id": 17746,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2985/"
] |
140,182 | <p>When using regular expressions we generally, if not always use them to extract some kind of information. What I need is to replace the match value with some other value... </p>
<p>Right now I'm doing this...</p>
<pre><code>def getExpandedText(pattern, text, replaceValue):
"""
One liner... really ugly but it's only used in here.
"""
return text.replace(text[text.find(re.findall(pattern, text)[0]):], replaceValue) + \
text[text.find(re.findall(pattern, text)[0]) + len(replaceValue):]
</code></pre>
<p>so if I do sth like</p>
<pre><code>>>> getExpandedText("aaa(...)bbb", "hola aaaiiibbb como estas?", "ooo")
'hola aaaooobbb como estas?'
</code></pre>
<p>It changes the (...) with 'ooo'.</p>
<p>Do you guys know whether with python regular expressions we can do this?</p>
<p>thanks a lot guys!!</p>
| [
{
"answer_id": 140209,
"author": "Swati",
"author_id": 12682,
"author_profile": "https://Stackoverflow.com/users/12682",
"pm_score": 4,
"selected": true,
"text": "sub (replacement, string[, count = 0])\n"
},
{
"answer_id": 140218,
"author": "David Schmitt",
"author_id": 4... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293/"
] |
140,204 | <p>Given a typical class:</p>
<pre>
struct Whatever
{
void Doit();
};
Whatever w;
</pre>
<p>what is the best way to get the member function to be called by a C void* based callback such as pthread_create() or a signal handler ?</p>
<pre>
pthread_t pid;
pthread_create(&pid, 0, ... &w.Doit() ... );
</pre>
| [
{
"answer_id": 140232,
"author": "Ian G",
"author_id": 5764,
"author_profile": "https://Stackoverflow.com/users/5764",
"pm_score": 3,
"selected": false,
"text": "int pthread_create(pthread_t *thread, const pthread_attr_t *attr,\n void *(*start_routine)(void*), void *arg... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22725/"
] |
140,205 | <p>I'm working on a query that needs to have some data rows combined based on date ranges. These rows are duplicated in all the data values, except the date ranges are split. For example the table data may look like</p>
<pre><code>StudentID StartDate EndDate Field1 Field2
1 9/3/2007 10/20/2007 3 True
1 10/21/2007 6/12/2008 3 True
2 10/10/2007 3/20/2008 4 False
3 9/3/2007 11/3/2007 8 True
3 12/15/2007 6/12/2008 8 True
</code></pre>
<p>The result of the query should have the split date ranges combined. The query should combine date ranges with a gap of only one day. If there is more than a one day gap, then the rows shouldn't be combined. The rows that don't have a split date range should come through unchanged. The result would look like</p>
<pre><code>StudentID StartDate EndDate Field1 Field2
1 9/3/2007 6/12/2008 3 True
2 10/10/2007 3/20/2008 4 False
3 9/3/2007 11/3/2007 8 True
3 12/15/2007 6/12/2008 8 True
</code></pre>
<p>What would be the SELECT statement for this query?</p>
| [
{
"answer_id": 140226,
"author": "Scott Bevington",
"author_id": 9544,
"author_profile": "https://Stackoverflow.com/users/9544",
"pm_score": 0,
"selected": false,
"text": "SELECT StudentID, MIN(startdate) AS startdate, MAX(enddate), field1, field2\nFROM tablex\nGROUP BY StudentID, field1... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18891/"
] |
140,217 | <p>As a developer, how do you use gdb to track down bugs within your code? What techniques tricks do you use to make your life easier?</p>
| [
{
"answer_id": 140316,
"author": "Andrew Johnson",
"author_id": 5109,
"author_profile": "https://Stackoverflow.com/users/5109",
"pm_score": 2,
"selected": false,
"text": "gdb> p show_my_struct(struct)\n\nMy custom display of Foo:\n ...\n"
},
{
"answer_id": 270911,
"author":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16044/"
] |
140,303 | <p>What is the cause of this exception in ASP.NET? Obviously it is a viewstate exception, but I can't reproduce the error on the page that is throwing the exception (a simple two TextBox form with a button and navigation links).</p>
<p>FWIW, I'm not running a web farm.</p>
<h2>Exception</h2>
<blockquote>
<p>Error Message: Unable to validate
data.</p>
<p>Error Source: System.Web</p>
<p>Error Target Site: Byte[]
GetDecodedData(Byte[], Byte[], Int32,
Int32, Int32 ByRef)</p>
</blockquote>
<h2>Post Data</h2>
<blockquote>
<p><em>VIEWSTATE:</em></p>
<p>/wEPDwULLTE4NTUyODcyMTFkZF96FHxDUAHIY3NOAMRJYZ+CKsnB</p>
<p><em>EVENTVALIDATION:</em></p>
<p>/wEWBAK+8ZzHAgKOhZRcApDF79ECAoLch4YMeQ2ayv/Gi76znHooiRyBFrWtwyg=</p>
</blockquote>
<h2>Exception Stack Trace</h2>
<pre><code> at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
</code></pre>
<p>~ William Riley-Land</p>
| [
{
"answer_id": 141419,
"author": "Raelshark",
"author_id": 19678,
"author_profile": "https://Stackoverflow.com/users/19678",
"pm_score": 2,
"selected": false,
"text": "enableViewStateMac=\"false\""
},
{
"answer_id": 254581,
"author": "Jeffrey Harrington",
"author_id": 430... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17847/"
] |
140,329 | <p>I am currently working on an web application that uses ASP.NET 2.0 framework. I need to redirect to a certain page, say SessionExpired.aspx, when the user session expires. There are lot of pages in the project, so adding code to every page of the site is not really a good solution. I have MasterPages though, which I think might help.</p>
<p>Thanks!</p>
| [
{
"answer_id": 140425,
"author": "wprl",
"author_id": 17847,
"author_profile": "https://Stackoverflow.com/users/17847",
"pm_score": 0,
"selected": false,
"text": "<customErrors defaultRedirect=\"url\" mode=\"RemoteOnly\">\n <error statusCode=\"408\" redirect=\"~/SessionExpired.aspx\"/... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14710/"
] |
140,331 | <p>I have a following SQL Server 2005 database schema:</p>
<pre><code>CREATE TABLE Messages (
MessageID int,
Subject varchar(500),
Text varchar(max) NULL,
UserID NULL
)
</code></pre>
<p>The column "UserID" - which can be null - is a foreign key and links to the table</p>
<pre><code>CREATE TABLE Users (
UserID int,
...
)
</code></pre>
<p>Now I have several POCO classes with names Message, User etc. that I use in the following query:</p>
<pre><code>public IList<Message> GetMessages(...) {
var q = (from m in dataContext.Messages.Include("User")
where ...
select m); // could call ToList(), but...
return (from m in q
select new Message {
ID = m.MessageID,
User = new User {
ID = m.User.UserID,
FirstName = m.User.FirstName,
...
}
}).ToList();
}
</code></pre>
<p>Now note that I advise the entity framework - using Include("Users") - to load a user associated with a message, if any. Also note that I don't call ToList() after the first LINQ statement. By doing so only specified columns in the projection list - in this case MessageID, UserID, FirstName - will be returned from the database. </p>
<p>Here lies the problem - as soon as Entity Framework encounters a message with UserID == NULL, it throws an exception, saying that it could not convert to Int32 because the DB value is NULL.</p>
<p>If I change the last couple of lines to</p>
<pre><code>return (from m in q
select new Message {
ID = m.MessageID,
User = m.User == null ? null : new User {
ID = m.User.UserID,
...
}
}).ToList()
</code></pre>
<p>then a run-time NotSupportedException is thrown telling that it can't create a constant User type and only primitives like int, string, guid are supported.</p>
<p>Anybody has any idea how to handle it besides materializing the results just right after the first statement and using in-memory projection afterwards? Thanks.</p>
| [
{
"answer_id": 140424,
"author": "Orion Adrian",
"author_id": 7756,
"author_profile": "https://Stackoverflow.com/users/7756",
"pm_score": 0,
"selected": false,
"text": ".Include(\"Users\")"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
140,347 | <p>I know there is a function somewhere that will accept a client rect and it will convert it into a window rect for you. I just can't find / remember it!</p>
<p>Does anyone know what it is?</p>
<p>It will do something similar to:</p>
<pre><code>const CRect client(0, 0, 200, 200);
const CRect window = ClientRectToWindowRect(client);
SetWindowPos(...)
</code></pre>
| [
{
"answer_id": 140373,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 4,
"selected": true,
"text": "AdjustWindowRectEx()"
},
{
"answer_id": 21004956,
"author": "aMarCruz",
"author_id": 3174665,
"author_profile... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] |
140,406 | <p>Does anyone know of existing software or algorithms to calculate a package size for shipping multiple items?</p>
<p>I have a bunch of items in our inventory database with length, width and height dimesions defined. Given these dimensions I need to calculate how many of the purchased items will fit into predefined box sizes.</p>
| [
{
"answer_id": 46173005,
"author": "Ammar",
"author_id": 3427844,
"author_profile": "https://Stackoverflow.com/users/3427844",
"pm_score": 0,
"selected": false,
"text": "PackingService.Pack()"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8754/"
] |
140,422 | <p>I'm looking for pseudocode, or sample code, to convert higher bit ascii characters (like, Ü which is extended ascii 154) into U (which is ascii 85).</p>
<p>My initial guess is that since there are only about 25 ascii characters that are similar to 7bit ascii characters, a translation array would have to be used.</p>
<p>Let me know if you can think of anything else.</p>
| [
{
"answer_id": 140531,
"author": "Derek Clegg",
"author_id": 19783,
"author_profile": "https://Stackoverflow.com/users/19783",
"pm_score": 1,
"selected": false,
"text": "static const char xlate[256] = { ..., ['é'] = 'e', ..., ['Ü'] = 'U', ... }\n...\nnew_c = xlate[old_c];\n"
},
{
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245/"
] |
140,439 | <p>How do I authenticate against AD using Python + LDAP. I'm currently using the python-ldap library and all it is producing is tears.</p>
<p>I can't even bind to perform a simple query:</p>
<pre><code>import sys
import ldap
Server = "ldap://my-ldap-server"
DN, Secret, un = sys.argv[1:4]
Base = "dc=mydomain,dc=co,dc=uk"
Scope = ldap.SCOPE_SUBTREE
Filter = "(&(objectClass=user)(sAMAccountName="+un+"))"
Attrs = ["displayName"]
l = ldap.initialize(Server)
l.protocol_version = 3
print l.simple_bind_s(DN, Secret)
r = l.search(Base, Scope, Filter, Attrs)
Type,user = l.result(r,60)
Name,Attrs = user[0]
if hasattr(Attrs, 'has_key') and Attrs.has_key('displayName'):
displayName = Attrs['displayName'][0]
print displayName
sys.exit()
</code></pre>
<p>Running this with <code>myusername@mydomain.co.uk password username</code> gives me one of two errors:</p>
<p><code>Invalid Credentials</code> - When I mistype or intentionally use wrong credentials it fails to authenticate.</p>
<blockquote>
<p>ldap.INVALID_CREDENTIALS: {'info': '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 52e, vece', 'desc': 'Invalid credentials'}</p>
</blockquote>
<p>Or </p>
<blockquote>
<p>ldap.OPERATIONS_ERROR: {'info': '00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece', 'desc': 'Operations error'}</p>
</blockquote>
<p>What am I missing out to bind properly?</p>
<p>I am getting the same errors on fedora and windows.</p>
| [
{
"answer_id": 140495,
"author": "1729",
"author_id": 4319,
"author_profile": "https://Stackoverflow.com/users/4319",
"pm_score": 7,
"selected": true,
"text": "l.set_option(ldap.OPT_REFERRALS, 0)\n"
},
{
"answer_id": 140737,
"author": "Johan Buret",
"author_id": 15366,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4319/"
] |
140,453 | <p>My company is considering changing continuous integration servers (I won't say which one we have now, so I won't skew your responses in anyway :) ) I wondering if anybody has any recommendations? Best user experience, level of difficulty to maintain, etc...</p>
<p>Our code is all in java, and we use ANT as a build tool.</p>
| [
{
"answer_id": 4008659,
"author": "yegor256",
"author_id": 187141,
"author_profile": "https://Stackoverflow.com/users/187141",
"pm_score": 0,
"selected": false,
"text": "ant"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22221/"
] |
140,460 | <p>We have a typical web application that is essentially a data entry application with lots of screens some of which have some degree of complexity. We need to provide that standard capability on making sure if the user forgets to click the "Save" button before navigating away or closing their browser they get a warning and can cancel (but only when there is unsaved or dirty data).</p>
<p>I know the basics of what I've got to do-- in fact I'm sure I've done it all before over the years (tie in to onbeforeunload, track the "dirty" state of the page, etc...) but before I embark on coding this YET AGAIN, does anyone have some suggestions for libraries already out there (free or otherwise) that will help out?</p>
| [
{
"answer_id": 140508,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https://Stackoverflow.com/users/6760",
"pm_score": 4,
"selected": false,
"text": "/**\n * Determines if a form is dirty by comparing the current value of each element\n * with its default value.\n *\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22732/"
] |
140,462 | <p>Is it possible to tell if the user of a website is using multiple monitors? I need to find the position of a popup but it's quite likely the user will have a multiple monitor setup. Whilst <code>window.screenX</code> etc. will give the position of the browser window it's useless for multiple monitors.</p>
| [
{
"answer_id": 140523,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 0,
"selected": false,
"text": "screen.width"
},
{
"answer_id": 21305365,
"author": "Algy Taylor",
"author_id": 1842033,
"author_profile": ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21030/"
] |
140,468 | <p>What is the longest string that can be created in .NET? The docs for the <code>String</code> class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of internals. Would the maximum change on a 64-bit system?</p>
<p>[This is asked more for curiosity than for practical use - I don't intend to create any code that uses gigantic strings!]</p>
| [
{
"answer_id": 140492,
"author": "Ryan Farley",
"author_id": 1627,
"author_profile": "https://Stackoverflow.com/users/1627",
"pm_score": 6,
"selected": false,
"text": "Length"
},
{
"answer_id": 140506,
"author": "VVS",
"author_id": 21038,
"author_profile": "https://St... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3776/"
] |
140,490 | <p>Which gets called first - the base constructor or "other stuff here"?</p>
<pre><code>public class MyExceptionClass : Exception
{
public MyExceptionClass(string message, string extrainfo) : base(message)
{
//other stuff here
}
}
</code></pre>
| [
{
"answer_id": 140497,
"author": "Mastermind",
"author_id": 22213,
"author_profile": "https://Stackoverflow.com/users/22213",
"pm_score": 3,
"selected": false,
"text": "using System;\nclass Base\n{\n\npublic Base()\n{\n Console.WriteLine(\"BASE 1\");\n}\npublic Base(int x)\n{\n Con... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16872/"
] |
140,550 | <p>What is the best way to store a large amount of text in a table in SQL server?</p>
<p>Is varchar(max) reliable?</p>
| [
{
"answer_id": 140652,
"author": "Mark Stock",
"author_id": 19737,
"author_profile": "https://Stackoverflow.com/users/19737",
"pm_score": 2,
"selected": false,
"text": "id"
},
{
"answer_id": 47523879,
"author": "user9018039",
"author_id": 9018039,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] |
140,579 | <p>How do I detect if my program runs in an Active Directory environment?</p>
<p>I'm using C# and .Net 2.0</p>
| [
{
"answer_id": 140603,
"author": "Kevin Fairchild",
"author_id": 3743,
"author_profile": "https://Stackoverflow.com/users/3743",
"pm_score": 2,
"selected": false,
"text": "string ADServer = Environment.GetEnvironmentVariable(\"LOGONSERVER\"); \n"
},
{
"answer_id": 140823,
"au... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17766/"
] |
140,614 | <p>My Ubuntu server has Apache and Subversion installed. I use this server as a staging server, purely for testing purposes. I use Apache to host the web application, and Subversion to keep versioned copies of the source code.</p>
<p>My current workflow:</p>
<ul>
<li>Make changes to a file</li>
<li>Commit the file to the Subversion repository</li>
<li>Upload the file new over SFTP to the Apache public directory</li>
<li>View the changes in my web browser</li>
</ul>
<p>I would be much happier if my workflow was like this:</p>
<ul>
<li>Make changes to a file</li>
<li>Commit the file to the Subversion repository</li>
<li><em>In the background, Subversion puts a copy of the committed file into the Apache public directory</em></li>
<li>View the changes in my web browser</li>
</ul>
<p>I have very little server admin experience, and any help or pointers are appreciated. I heard that post-commit hooks are what I need, and that I can write bash scripts to do this, but I'm not sure where to start and didn't really find anything after quite a lot of Googling.</p>
<p>Thank you!</p>
| [
{
"answer_id": 908042,
"author": "Jonas Kölker",
"author_id": 58668,
"author_profile": "https://Stackoverflow.com/users/58668",
"pm_score": 0,
"selected": false,
"text": "/home/richardhenry/src/mywebsite"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326176/"
] |
140,616 | <p>Is there a NAnt task that will echo out all property names and values that are currently set during a build? Something equivalent to the Ant <a href="http://ant.apache.org/manual/Tasks/echoproperties.html" rel="noreferrer">echoproperties</a> task maybe?</p>
| [
{
"answer_id": 141174,
"author": "craigb",
"author_id": 18590,
"author_profile": "https://Stackoverflow.com/users/18590",
"pm_score": 6,
"selected": true,
"text": "<project>\n <property name=\"foo\" value=\"bar\"/>\n <property name=\"fiz\" value=\"buz\"/>\n\n <script language=\"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] |
140,627 | <p>I just wrote my first web service so lets make the assumption that my web service knowlege is non existant. I want to try to call a dbClass function from the web service. However I need some params that are in the session. Is there any way I can get these call these session variables from the webservice??</p>
| [
{
"answer_id": 140656,
"author": "Metro",
"author_id": 18978,
"author_profile": "https://Stackoverflow.com/users/18978",
"pm_score": 5,
"selected": true,
"text": "[WebMethod(EnableSession = true)]\npublic void MyWebService()\n{\n Foo foo;\n Session[\"MyObjectName\"] = new Foo();\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16820/"
] |
140,640 | <p>Is there an NSIS var to get the path of the currently running installer?</p>
| [
{
"answer_id": 43888176,
"author": "Maxim Suslov",
"author_id": 3364871,
"author_profile": "https://Stackoverflow.com/users/3364871",
"pm_score": 4,
"selected": false,
"text": "$EXEPATH"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
140,643 | <p>When I try to execute a view that includes tables from different schemas an ORA-001031 Insufficient privileges is thrown. These tables have execute permission for the schema where the view was created. If I execute the view's SQL Statement it works. What am I missing?</p>
| [
{
"answer_id": 140665,
"author": "Steve K",
"author_id": 739,
"author_profile": "https://Stackoverflow.com/users/739",
"pm_score": 5,
"selected": true,
"text": "grant SELECT on TABLE_NAME to READ_USERNAME;\n"
},
{
"answer_id": 141219,
"author": "Igor Zelaya",
"author_id":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22769/"
] |
140,677 | <p>I had a discussion a few weeks back with some co-workers on refactoring, and I seem to be in a minority that believes "Refactor early, refactor often" is a good approach that keeps code from getting messy and unmaintainable. A number of other people thought that it just belongs in the maintenance phases of a project.</p>
<p>If you have an opinion, please defend it.</p>
| [
{
"answer_id": 140766,
"author": "Chris Cudmore",
"author_id": 18907,
"author_profile": "https://Stackoverflow.com/users/18907",
"pm_score": 2,
"selected": false,
"text": "temp = array[i];\narray[i] = array[j];\narray[j] = temp;\n"
},
{
"answer_id": 150433,
"author": "Craig P... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6897/"
] |
140,696 | <p>I'm wondering which languages support (or don't support) native multithreading, and perhaps get some details about the implementation. Hopefully we can produce a complete overview of this specific functionality.</p>
| [
{
"answer_id": 59979349,
"author": "Umair Riaz",
"author_id": 10570437,
"author_profile": "https://Stackoverflow.com/users/10570437",
"pm_score": 1,
"selected": false,
"text": "Go"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14032/"
] |
140,728 | <p>It often happens that characters such as <em>é</em> gets transformed to <em>é</em>, even though the collation for the MySQL DB, table and field is set to utf8_general_ci. The encoding in the <em>Content-Type</em> for the page is also set to UTF8.</p>
<p>I know about utf8_encode/decode, but I'm not quite sure about where and how to use it.</p>
<p>I have read the "<a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow noreferrer">The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)</a>" article, but I need some MySQL / PHP specific pointers.</p>
<p>How do I ensure that user entered data containing international characters doesn't get corrupted?</p>
| [
{
"answer_id": 141011,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 5,
"selected": true,
"text": "SET NAMES utf8\n"
},
{
"answer_id": 143565,
"author": "Vegard Larsen",
"author_id": 1606,
"author... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6681/"
] |
140,734 | <p>What would be the best practice way to handle the caching of images using PHP.</p>
<p>The filename is currently stored in a MySQL database which is renamed to a GUID on upload, along with the original filename and alt tag.</p>
<p>When the image is put into the HTML pages it is done so using a url such as '/images/get/200x200/{guid}.jpg which is rewritten to a php script. This allows my designers to specify (roughly - the source image maybe smaller) the file size. </p>
<p>The php script then creates a hash of the size (200x200 in the url) and the GUID filename and if the file has been generated before (file with the name of the hash exists in TMP directory) sends the file from the application TMP directory. If the hashed filename does not exist, then it is created, written to disk and served up in the same manner,</p>
<p>Is this efficient as it could be? (It also supports watermarking the images and the watermarking settings are stored in the hash as well, but thats out of scope for this.)</p>
| [
{
"answer_id": 141164,
"author": "user18334",
"author_id": 18334,
"author_profile": "https://Stackoverflow.com/users/18334",
"pm_score": 0,
"selected": false,
"text": "<img src=\"/phpThumb.php?src=/path/to/image.jpg&w=200&h=200\" alt=\"thumbnail\"/>\n"
},
{
"answer_id": 14122... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22776/"
] |
140,758 | <p>In Java you can do <code>File.listFiles()</code> and receive all of the files in a directory. You can then easily recurse through directory trees.</p>
<p>Is there an analogous way to do this in Python?</p>
| [
{
"answer_id": 140778,
"author": "florin",
"author_id": 18308,
"author_profile": "https://Stackoverflow.com/users/18308",
"pm_score": 2,
"selected": false,
"text": ">>> import glob\n>>> glob.glob('./[0-9].*')\n['./1.gif', './2.txt']\n>>> glob.glob('*.gif')\n['1.gif', 'card.gif']\n>>> glo... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2598/"
] |
140,765 | <p>I am writing a web server in Java and I want it to support HTTP 1.1 Keep-Alive connections. But how can I tell when the client is done sending requests for a given connection? (like a double end-of-line or something). </p>
<p>Lets see how stackoverflow handles this very obscure question -- answers for which, on Google, are mired in technical specifications and obscure language. I want a plain-english answer for a non-C programmer :)</p>
<hr>
<p>I see. that confirms my suspicion of having to rely on the SocketTimeoutException. But i wasn't sure if there was something i could rely on from the client that indicates it is done with the connection--which would allow me to close the connections sooner in most cases--instead of waiting for the timeout. Thanks</p>
| [
{
"answer_id": 140889,
"author": "Alexander",
"author_id": 16724,
"author_profile": "https://Stackoverflow.com/users/16724",
"pm_score": 1,
"selected": false,
"text": "Connection: close"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/140765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/982630/"
] |
140,786 | <p>The code is</p>
<pre><code>return min + static_cast<int>(static_cast<double>(max - min + 1.0) *
(number / (UINT_MAX + 1.0)));
</code></pre>
<p>number is a random number obtained by rand_s. min and max are ints and represent minimum and maximum values (inclusive).</p>
<p>If you provide a solution not using unsigned int as a number, please also explain how to make it be random.</p>
<p>Please do not submit solutions using rand().</p>
| [
{
"answer_id": 140826,
"author": "Andrew Stein",
"author_id": 13029,
"author_profile": "https://Stackoverflow.com/users/13029",
"pm_score": -1,
"selected": false,
"text": "min + number % (max - min + 1)\n"
},
{
"answer_id": 140848,
"author": "jk.",
"author_id": 21284,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9403/"
] |
140,820 | <p>Assuming I'm trying to automate the installation of something on windows and I want to try to test whether another installation is in progress before attempting install. I don't have control over the installer and have to do this in the automation framework. Is there a better way to do this, some win32 api?, than just testing if msiexec is running?</p>
<p>[Update 2]</p>
<p>Improved the previous code I had been using to just access the mutex directly, this is a lot more reliable:</p>
<pre><code>using System.Threading;
[...]
/// <summary>
/// Wait (up to a timeout) for the MSI installer service to become free.
/// </summary>
/// <returns>
/// Returns true for a successful wait, when the installer service has become free.
/// Returns false when waiting for the installer service has exceeded the timeout.
/// </returns>
public static bool WaitForInstallerServiceToBeFree(TimeSpan maxWaitTime)
{
// The _MSIExecute mutex is used by the MSI installer service to serialize installations
// and prevent multiple MSI based installations happening at the same time.
// For more info: http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx
const string installerServiceMutexName = "Global\\_MSIExecute";
try
{
Mutex MSIExecuteMutex = Mutex.OpenExisting(installerServiceMutexName,
System.Security.AccessControl.MutexRights.Synchronize | System.Security.AccessControl.MutexRights.Modify);
bool waitSuccess = MSIExecuteMutex.WaitOne(maxWaitTime, false);
MSIExecuteMutex.ReleaseMutex();
return waitSuccess;
}
catch (WaitHandleCannotBeOpenedException)
{
// Mutex doesn't exist, do nothing
}
catch (ObjectDisposedException)
{
// Mutex was disposed between opening it and attempting to wait on it, do nothing
}
return true;
}
</code></pre>
| [
{
"answer_id": 22026461,
"author": "NBPC77",
"author_id": 235100,
"author_profile": "https://Stackoverflow.com/users/235100",
"pm_score": 2,
"selected": false,
"text": " /// <summary>\n/// Wait (up to a timeout) for the MSI installer service to become free.\n/// </summary>\n/// <returns... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332/"
] |
140,825 | <p>Can you define a macro that accesses a normal variable, but in a read-only fashion (other than defining it as a call to a function)? For example, can the VALUE macro in the following code be defined in such a way that the dostuff() function causes a compile error?</p>
<pre><code>struct myobj {
int value;
}
/* This macro does not satisfy the read-only requirement */
#define VALUE(o) (o)->value
/* This macro uses a function, unfortunately */
int getvalue(struct myobj *o) { return o->value; }
#define VALUE(o) getvalue(o)
void dostuff(struct myobj *foo) {
printf("The value of foo is %d.\n", VALUE(foo)); /* OK */
VALUE(foo) = 1; /* We want a compile error here */
foo->value = 1; /* This is ok. */
}
</code></pre>
| [
{
"answer_id": 140853,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 4,
"selected": true,
"text": "#define VALUE(x) (x+0)\n"
},
{
"answer_id": 140870,
"author": "Andrew Stein",
"author_id": 13029,
"au... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14732/"
] |
140,850 | <p>I'm using SQL Server 2005, and creating ftp tasks within SSIS. </p>
<p>Sometimes there will be files to ftp over, sometimes not. If there are no files, I don't want the task nor the package to fail. I've changed the arrow going from the ftp task to the next to "completion", so the package runs through. I've changed the allowed number of errors to 4 (because there are 4 ftp tasks, and any of the 4 directories may or may not have files). </p>
<p>But, when I run the package from a job in agent, it marks the job as failing. Since this will be running every 15 minutes, I don't want a bunch of red x's in my job history, which will cause us to not see a problem when it really does occur. </p>
<p>How do I set the properties in the ftp task so that not finding files to ftp is not a failure? The operation I am using is "Send files".</p>
<p>Here is some more information: the files are on a server that I don't have any access through except ftp. And, I don't know the filenames ahead of time. The user can call them whatever they want. So I can't check for specific files, nor, I think, can I check at all. Except through using the ftp connection and tasks based upon that connection. The files are on a remote server, and I want to copy them over to my server, to get them from that remote server.</p>
<p>I can shell a command level ftp in a script task. Perhaps that is what I need to use instead of a ftp task. (I have changed to use the ftp command line, with a parameter file, called from a script task. It gives no errors when there are no files to get. I think this solution is going to work for me. I'm creating the parameter file dynamically, which means I don't need to have connection information in the plain text file, but rather can be stored in my configuration file, which is in a more secure location.)</p>
| [
{
"answer_id": 165000,
"author": "thursdaysgeek",
"author_id": 22523,
"author_profile": "https://Stackoverflow.com/users/22523",
"pm_score": 2,
"selected": false,
"text": " Dim ftpStream As StreamWriter = ftpFile.CreateText()\n ftpStream.WriteLine(ftpUser)\n ftpStream.WriteLine(... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22523/"
] |
140,852 | <p>I have a nested class. I want to access the outer and nested classes in other class.
How to access both class properties and methods and my condition is i want to create object for only one class
plz provide the code snippet</p>
| [
{
"answer_id": 140881,
"author": "Craig Eddy",
"author_id": 5557,
"author_profile": "https://Stackoverflow.com/users/5557",
"pm_score": 0,
"selected": false,
"text": "public class Foo() {\n public Foo() { }\n\n private Bar m_Bar = new Bar(); \n\n public Bar TheBar { get { retur... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
140,869 | <p>I'm on a team maintaining a .Net web app with a SQL Server 2005 back end. The system's been running a little slow in places lately, so after doing all the tuning kind of stuff we could think of (adding indexes, cleaning up really badly written stored procedures, etc.) I ran a typical workload through the Tuning Advisor - and it spit out a huge list of additional Indexes and Statistics to create. My initial reaction was to say "sure, you got it, SQL Server," but is there ever any reason NOT to just do what the Advisor says?</p>
| [
{
"answer_id": 142668,
"author": "Nicholas Head",
"author_id": 22505,
"author_profile": "https://Stackoverflow.com/users/22505",
"pm_score": 2,
"selected": false,
"text": "SELECT\n migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) AS improve... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
140,908 | <p>Is there any framework for querying XML SQL Syntax, I seriously tire of iterating through node lists.
<hr>
Or is this just wishful thinking (if not idiotic) and certainly not possible since XML isn't a relational database?</p>
| [
{
"answer_id": 140914,
"author": "Craig Eddy",
"author_id": 5557,
"author_profile": "https://Stackoverflow.com/users/5557",
"pm_score": 2,
"selected": false,
"text": "ReadXml()"
},
{
"answer_id": 142491,
"author": "Constantin",
"author_id": 20310,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765/"
] |
140,926 | <p>I have a data stream that may contain \r, \n, \r\n, \n\r or any combination of them. Is there a simple way to normalize the data to make all of them simply become \r\n pairs to make display more consistent?</p>
<p>So something that would yield this kind of translation table:</p>
<pre><code>\r --> \r\n
\n --> \r\n
\n\n --> \r\n\r\n
\n\r --> \r\n
\r\n --> \r\n
\r\n\n --> \r\n\r\n
</code></pre>
| [
{
"answer_id": 140952,
"author": "Quintin Robinson",
"author_id": 12707,
"author_profile": "https://Stackoverflow.com/users/12707",
"pm_score": 2,
"selected": false,
"text": "\\r => \\r \n\\n => \\n \n\\n\\n => \\n\\n \n\\n\\r => \\n\\r \n\\r\\n => \\r\\n \n\\r\\n => \\r\\n \n\\n =... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13154/"
] |
140,935 | <p>Anyone knows if is possible to have partial class definition on C++ ?</p>
<p>Something like:</p>
<p>file1.h:</p>
<pre>
class Test {
public:
int test1();
};
</pre>
<p>file2.h: </p>
<pre>
class Test {
public:
int test2();
};
</pre>
<p>For me it seems quite useful for definining multi-platform classes that have common functions between them that are platform-independent because inheritance is a cost to pay that is non-useful for multi-platform classes.</p>
<p>I mean you will never have two multi-platform specialization instances at runtime, only at compile time. Inheritance could be useful to fulfill your public interface needs but after that it won't add anything useful at runtime, just costs. </p>
<p>Also you will have to use an ugly #ifdef to use the class because you can't make an instance from an abstract class:</p>
<pre>
class genericTest {
public:
int genericMethod();
};
</pre>
<p>Then let's say for win32:</p>
<pre>
class win32Test: public genericTest {
public:
int win32Method();
};
</pre>
<p>And maybe:</p>
<pre>
class macTest: public genericTest {
public:
int macMethod();
};
</pre>
<p>Let's think that both win32Method() and macMethod() calls genericMethod(), and you will have to use the class like this:</p>
<pre>
#ifdef _WIN32
genericTest *test = new win32Test();
#elif MAC
genericTest *test = new macTest();
#endif
test->genericMethod();
</pre>
<p>Now thinking a while the inheritance was only useful for giving them both a genericMethod() that is dependent on the platform-specific one, but you have the cost of calling two constructors because of that. Also you have ugly #ifdef scattered around the code.</p>
<p>That's why I was looking for partial classes. I could at compile-time define the specific platform dependent partial end, of course that on this silly example I still need an ugly #ifdef inside genericMethod() but there is another ways to avoid that.</p>
| [
{
"answer_id": 140942,
"author": "Jamie",
"author_id": 22748,
"author_profile": "https://Stackoverflow.com/users/22748",
"pm_score": 4,
"selected": false,
"text": "class AllPlatforms {\npublic:\n int common();\n};\n"
},
{
"answer_id": 141085,
"author": "PiNoYBoY82",
"a... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18623/"
] |
140,996 | <p>In WPF, I want to create a hyperlink that navigates to the details of an object, and I want the text of the hyperlink to be the name of the object. Right now, I have this:</p>
<pre><code><TextBlock><Hyperlink Command="local:MyCommands.ViewDetails" CommandParameter="{Binding}">Object Name</Hyperlink></TextBlock>
</code></pre>
<p>But I want "Object Name" to be bound to the actual name of the object. I would like to do something like this:</p>
<pre><code><TextBlock><Hyperlink Command="local:MyCommands.ViewDetails" CommandParameter="{Binding}" Text="{Binding Path=Name}"/></TextBlock>
</code></pre>
<p>However, the Hyperlink class does not have a text or content property that is suitable for data binding (that is, a dependency property).</p>
<p>Any ideas?</p>
| [
{
"answer_id": 141008,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 9,
"selected": true,
"text": "Hyperlink"
},
{
"answer_id": 1801586,
"author": "Jamie Clayton",
"author_id": 219119,
"author_profile": ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/140996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22789/"
] |
141,002 | <p>I'm doing some maintenance coding on a webapp and I am getting a javascript error of the form: "[elementname] has no properties"</p>
<p>Part of the code is being generated on the fly with an AJAX call that changes innerHTML for part of the page, after this is finished I need to copy a piece of data from a hidden input field to a visible input field.
So we have the destination field: <code><input id="dest" name="dest" value="0"></code>
<br>And the source field: <code><input id="source" name="source" value="1"></code>
<br>Now when the ajax runs it overwrites the innerHTML of the div that source is in, so the source field now reads: <code><input id="source" name="source" value="2"></code></p>
<p>Ok after the javascript line that copies the ajax data to innerHTML the next line is:
<code>document.getElementById('dest').value = document.getElementById('source').value;</code></p>
<p>I get the following error: <code>Error: document.getElementById("source") has no properties</code></p>
<p>(I also tried <code>document.formname.source</code> and <code>document.formname.dest</code> and same problem)</p>
<p>What am I missing?</p>
<p>Note1: The page is fully loaded and the element exists. The ajax call only happens after a user action and replaces the html section that the element is in.</p>
<p>Note2: As for not using innerHTML, this is how the codebase was given to me, and in order to remove it I would need to rewrite all the ajax calls, which is not in the scope of the current maintenance cycle.</p>
<p>Note3: the innerHTML is updated with the new data, a whole table with data and formatting is being copied, I am trying to add a boolean to the end of this big chunk, instead of creating a whole new ajax call for one boolean. It looks like that is what I will have to do... as my hack on the end then copy method is not working.</p>
<p>Extra pair of eyes FTW.</p>
<p>Yeah I had a couple guys take a look here at work and they found my simple typing mistake... I swear I had those right to begin with, but hey we live and learn...</p>
<p>Thanks for the help guys.</p>
| [
{
"answer_id": 141075,
"author": "user19264",
"author_id": 19264,
"author_profile": "https://Stackoverflow.com/users/19264",
"pm_score": 2,
"selected": false,
"text": "<div id=\"test2\">\n <input id=\"source\" value=\"0\" />\n</div>\n<input id=\"dest\" value=\"1\" />\n\n<script type=\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6153/"
] |
141,007 | <p>Is there a way to add a resource to a ResourceDictionary from code without giving it a resource key?</p>
<p>For instance, I have this resource in XAML:</p>
<pre><code><TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type xbap:FieldPropertyInfo}"
ItemsSource="{Binding Path=Value.Values}">
<TextBlock Text="{Binding Path=Name}" />
<HierarchicalDataTemplate>
</TreeView.Resources>
</code></pre>
<p>I need to create this resource dynamically from code and add it to the TreeView ResourceDictionary. However, in XAML having no Key means that it's used, by default, for all FieldPropertyInfo types. Is there a way to add it to the resource in code without having a key or is there a way I can use a key and still have it used on all FieldPropertyInfo types?</p>
<p>Here's what I've done in C# so far:</p>
<pre><code>HierarchicalDataTemplate fieldPropertyTemplate = new HierarchicalDataTemplate("FieldProperyInfo");
fieldPropertyTemplate.ItemsSource = new Binding("Value.Values");
this.Resources.Add(null, fieldPropertyTemplate);
</code></pre>
<p>Obviously, adding a resource to the ResourceDictionary the key null doesn't work.</p>
| [
{
"answer_id": 141018,
"author": "Orion Adrian",
"author_id": 7756,
"author_profile": "https://Stackoverflow.com/users/7756",
"pm_score": 0,
"selected": false,
"text": "this.Resources.Add(FieldPropertyInfo.GetType(), fieldPropertyTemplate);\n"
},
{
"answer_id": 141032,
"autho... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12999/"
] |
141,045 | <p>I want to replace the first occurrence in a given string. </p>
<p>How can I accomplish this in .NET?</p>
| [
{
"answer_id": 141076,
"author": "VVS",
"author_id": 21038,
"author_profile": "https://Stackoverflow.com/users/21038",
"pm_score": 7,
"selected": false,
"text": "string ReplaceFirst(string text, string search, string replace)\n{\n int pos = text.IndexOf(search);\n if (pos < 0)\n {\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
141,052 | <p>I have been looking for documentation related to interacting with MSPaint from the command line. I have only found references to /p, /pt and /wia, but no guidance as to how to use them and their limitations.</p>
<p>I am trying to send some graphics files to the printer and when I drop the file on my printer driver I get a different print output than if I call paint from the command line. I am using the UDC print driver to convert graphics, and I am using paint to send my graphics file to the printer driver in order for my file to convert. </p>
<p>Any ideas? </p>
| [
{
"answer_id": 141087,
"author": "Vincent McNabb",
"author_id": 16299,
"author_profile": "https://Stackoverflow.com/users/16299",
"pm_score": 3,
"selected": true,
"text": "mspaint /p filename"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/141052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178/"
] |
141,068 | <p>I have an Image column (Allow Null = true) in SQL Server 2005. I am using Crystal Reports designer (ver 10.5) that comes with Visual Studio 2008. Crystal sees the column as blob field and puts an image object for the column.
When I am trying to limit the record selection by using </p>
<pre><code> NOT ISNULL({Employee.Picture})
</code></pre>
<p>as Selection Formula, I get the following error:</p>
<blockquote>
<p>Error in formula .<br>
'NOT (ISNULL({Employee.Picture}))'<br>
This function cannot be used because it must be evaluated later.</p>
</blockquote>
<p>Is there a way to filter out rows with out pictures?</p>
<p>Thanks,<br>
Kishore A</p>
| [
{
"answer_id": 268068,
"author": "David T. Macknet",
"author_id": 6850,
"author_profile": "https://Stackoverflow.com/users/6850",
"pm_score": 1,
"selected": false,
"text": "ISNULL"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/141068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18169/"
] |
141,088 | <p>I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?</p>
| [
{
"answer_id": 141098,
"author": "Pablo Fernandez",
"author_id": 7595,
"author_profile": "https://Stackoverflow.com/users/7595",
"pm_score": 13,
"selected": true,
"text": "foreach(KeyValuePair<string, string> entry in myDictionary)\n{\n // do something with entry.Value or entry.Key\n}... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9311/"
] |
141,108 | <p>Is it possible to find the <code>foreach</code> index?</p>
<p>in a <code>for</code> loop as follows:</p>
<pre><code>for ($i = 0; $i < 10; ++$i) {
echo $i . ' ';
}
</code></pre>
<p><code>$i</code> will give you the index.</p>
<p>Do I have to use the <code>for</code> loop or is there some way to get the index in the <code>foreach</code> loop?</p>
| [
{
"answer_id": 141114,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 11,
"selected": true,
"text": "foreach($array as $key=>$value) {\n // do stuff\n}\n"
},
{
"answer_id": 141117,
"author": "Ólafur Waage",
"a... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18334/"
] |
141,126 | <p>What is important to keep in mind when designing a database?</p>
<p>I don't want to limit your answer to my needs as I am sure that others can benefit from your insights as well. But I am planning a content management system for a multi-client community driven site.</p>
| [
{
"answer_id": 141226,
"author": "jalbert",
"author_id": 1360388,
"author_profile": "https://Stackoverflow.com/users/1360388",
"pm_score": 4,
"selected": false,
"text": "CHECK"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/141126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19226/"
] |
141,128 | <p>Does TCP/IP prevent multiple copies of the same packet from reaching the destination? Or is it up to the endpoint to layer idempotency logic above it?</p>
<p>Please reference specific paragraphs from the TCP/IP specification if possible.</p>
| [
{
"answer_id": 863227,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "/// <summary>\n/// Combination of a double-linked-list and a hashset with a max bound; \n/// Works like a bounded queue where ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14731/"
] |
141,136 | <p>I have a .net 2.0 ascx control with a start time and end time textboxes. The data is as follows: </p>
<p>txtStart.Text = 09/19/2008 07:00:00</p>
<p>txtEnd.Text = 09/19/2008 05:00:00</p>
<p>I would like to calculate the total time (hours and minutes) in JavaScript then display it in a textbox on the page. </p>
| [
{
"answer_id": 141159,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 4,
"selected": true,
"text": "stringToDate"
},
{
"answer_id": 141387,
"author": "Dale Ragan",
"author_id": 1117,
"author_profile": "htt... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4096/"
] |
141,140 | <p>The following method does not work because the inner block declares a variable of the same name as one in the outer block. Apparently variables belong to the method or class in which they are declared, not to the block in which they are declared, so I therefore can't write a short little temporary block for debugging that happens to push a variable in the outer scope off into shadow just for a moment:</p>
<pre><code>void methodName() {
int i = 7;
for (int j = 0; j < 10; j++) {
int i = j * 2;
}
}
</code></pre>
<p>Almost every block-scoped language I've ever used supported this, including trivial little languages that I wrote interpreters and compilers for in school. Perl can do this, as can Scheme, and even C. Even PL/SQL supports this!</p>
<p>What's the rationale for this design decision for Java?</p>
<p>Edit: as somebody pointed out, Java does have block-scoping. What's the name for the concept I'm asking about? I wish I could remember more from those language-design classes. :)</p>
| [
{
"answer_id": 141289,
"author": "Ricardo Massaro",
"author_id": 98102,
"author_profile": "https://Stackoverflow.com/users/98102",
"pm_score": 5,
"selected": false,
"text": "void methodName() {\n for (int j = 0; j < 10; j++) {\n int i = j * 2;\n }\n System.out.println(i); // error\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18103/"
] |
141,146 | <p>I want to know if my server is running Subversion 1.5.</p>
<p>How can I find that out?</p>
<p>Also would be nice to know my SVN client version number. <code>svn help</code> hasn't been helpful.</p>
<p><strong>Note:</strong> I don't want my <em>project's</em> revision number, etc. This question is about the <em>Subversion software</em> itself.</p>
| [
{
"answer_id": 141479,
"author": "PiedPiper",
"author_id": 19315,
"author_profile": "https://Stackoverflow.com/users/19315",
"pm_score": 5,
"selected": false,
"text": "`svn --version`\n"
},
{
"answer_id": 142061,
"author": "Milen A. Radev",
"author_id": 15785,
"author... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
141,154 | <p>I'm trying to determine what instances of sql server/sql express I have installed (either manually or programmatically) but all of the examples are telling me to run a SQL query to determine this which assumes I'm already connected to a particular instance.</p>
| [
{
"answer_id": 141166,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 6,
"selected": false,
"text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\90\\Tools\\ClientSetup\\CurrentVersion\n"
},
{
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/327/"
] |
141,162 | <p>I need to see if a given process id is running, and it must work in either Java or JRuby (preferably a Ruby solution). It can be system dependent for Linux (specifically Debian and/or Ubuntu).</p>
<p>I already have the PID I am looking for, just need to see if it is currently running.</p>
<hr>
<p>UPDATE:</p>
<p>Thanks for all the responses everyone! I appreciate it, however it's not QUITE what I'm looking for... I am hoping for something in a standard Ruby library (or Java, but preferably Ruby)... if no such library call exists, I will probably stick with the procfs solution I already have.</p>
| [
{
"answer_id": 141663,
"author": "Bribles",
"author_id": 5916,
"author_profile": "https://Stackoverflow.com/users/5916",
"pm_score": 0,
"selected": false,
"text": "def pid_exists? (pid)\n system \"ps -p #{pid} > /dev/null\"\n return $? == 0\nend\n"
},
{
"answer_id": 141731,... | 2008/09/26 | [
"https://Stackoverflow.com/questions/141162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.