qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
121,722
<pre><code>string percentage = e.Row.Cells[7].Text; </code></pre> <p>I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty str...
[ { "answer_id": 121740, "author": "Orion Adrian", "author_id": 7756, "author_profile": "https://Stackoverflow.com/users/7756", "pm_score": 5, "selected": true, "text": "<p>First you need to wrap your code in a <code>Label</code> or <code>Literal</code> control so that you can reference it...
2008/09/23
[ "https://Stackoverflow.com/questions/121722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
``` string percentage = e.Row.Cells[7].Text; ``` I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty string. Any ideas? ...
First you need to wrap your code in a `Label` or `Literal` control so that you can reference it properly. What's happening is that there's no way for the system to keep track of it, because there's no control associated with the text. It's the control's responsibility to add its contents to viewstate. You need to use ...
121,762
<p>I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method.</p> <p>How i can do this? is there any wait for the signal or something?</p>
[ { "answer_id": 121853, "author": "Paul Brinkley", "author_id": 18160, "author_profile": "https://Stackoverflow.com/users/18160", "pm_score": 6, "selected": true, "text": "<p>Share a java.lang.Object between the two threads, whose sole purpose is to tell the worker thread when it can cont...
2008/09/23
[ "https://Stackoverflow.com/questions/121762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7363/" ]
I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method. How i can do this? is there any wait for the signal or something?
Share a java.lang.Object between the two threads, whose sole purpose is to tell the worker thread when it can continue its work. Whenever the worker thread reaches a point where it should sleep, it does this: ``` stick.wait(); ``` When the view thread finishes its onDraw work, it calls this: ``` stick.notify(); ``...
121,810
<p><strong>Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA?</strong></p> <p>I am forever right-clicking to reply to an email, only to accidentally click <code>Print</code> and have Outlook send it directly to the printer quicker than I can stop it.</p> ...
[ { "answer_id": 121899, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 3, "selected": false, "text": "<p>Thera is sample how to programaticly working with Outlook:\n<a href=\"http://msdn.microsoft.com/en-us/library/bb176426.asp...
2008/09/23
[ "https://Stackoverflow.com/questions/121810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
**Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA?** I am forever right-clicking to reply to an email, only to accidentally click `Print` and have Outlook send it directly to the printer quicker than I can stop it. ![alt text](https://farm4.static.flic...
Based on the link TcKs provide, that was pretty simple. In the example below I check the type of the item so that it only affects e-mails and not calendar items. To enter the code in outlook, Type Alt + F11, then expand the Microsoft Office Outlook Objects in the Project pane. Then double click the ThisOutlookSession. ...
121,813
<p>We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page.</p> <p>IE: <br /> was www.example.com/abc <br /> now www.example.com/default.aspx?article=abc <br /></p> <p>I have tried to use Global.asax to do this, and it works properly when I debug th...
[ { "answer_id": 121834, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 0, "selected": false, "text": "<p>Have you made sure the web.config files are the same for each website (assuming :1234 is different to :80)</p>\n\n<p>Als...
2008/09/23
[ "https://Stackoverflow.com/questions/121813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18821/" ]
We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do this, and it works properly when I debug through it. ``` if (...
Well, if the port indicates you are using the built-in web server (the one that comes with VS), this probably works because that *always* routes requests through the ASP.NET framework. Requests ending with /abc will not automatically route through the ASP.NET framework because IIS may not "know" you want them to. You ...
121,817
<p>I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available.</p> <pre><code>&lt;div id="panel"&gt; &lt;div id="field_name"&gt;TEXT GOES HERE&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here's what the function will look like:</p> ...
[ { "answer_id": 121822, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 4, "selected": false, "text": "<pre><code>$('field_name').innerHTML = 'Your text.';\n</code></pre>\n\n<p>One of the nifty features of Prototype is t...
2008/09/23
[ "https://Stackoverflow.com/questions/121817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. ``` <div id="panel"> <div id="field_name">TEXT GOES HERE</div> </div> ``` Here's what the function will look like: ``` function showPanel(fieldName) { var fieldNameEl...
I would use Prototype's `update` method which supports plain text, an HTML snippet or any JavaScript object that defines a `toString` method. ``` $("field_name").update("New text"); ``` * [Element.update documentation](http://www.prototypejs.org/api/element/update)
121,864
<p>As compared to say:</p> <pre><code>REPLICATE(@padchar, @len - LEN(@str)) + @str </code></pre>
[ { "answer_id": 121890, "author": "AlexCuse", "author_id": 794, "author_profile": "https://Stackoverflow.com/users/794", "pm_score": 9, "selected": true, "text": "<p>This is simply an inefficient use of SQL, no matter how you do it. </p>\n\n<p>perhaps something like </p>\n\n<pre><code>rig...
2008/09/23
[ "https://Stackoverflow.com/questions/121864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18255/" ]
As compared to say: ``` REPLICATE(@padchar, @len - LEN(@str)) + @str ```
This is simply an inefficient use of SQL, no matter how you do it. perhaps something like ``` right('XXXXXXXXXXXX'+ rtrim(@str), @n) ``` where X is your padding character and @n is the number of characters in the resulting string (assuming you need the padding because you are dealing with a fixed length). But a...
121,866
<p>I'm preparing to deploy my Django app and I noticed that when I change the "DEBUG" setting to False, all references to static files (i.e., JavaScript, CSS, etc..) result in <code>HTTP 500</code> errors.</p> <p>Any idea what's causing that issue (and how to fix it)?</p>
[ { "answer_id": 122052, "author": "Peter Shinners", "author_id": 17209, "author_profile": "https://Stackoverflow.com/users/17209", "pm_score": 5, "selected": true, "text": "<p>I would highly recommend letting your web server handle the static requests, without getting to Django. In my <co...
2008/09/23
[ "https://Stackoverflow.com/questions/121866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10040/" ]
I'm preparing to deploy my Django app and I noticed that when I change the "DEBUG" setting to False, all references to static files (i.e., JavaScript, CSS, etc..) result in `HTTP 500` errors. Any idea what's causing that issue (and how to fix it)?
I would highly recommend letting your web server handle the static requests, without getting to Django. In my `urls.py`, I only add the static request handler when debug is set to True. Technically, Django serving the static works fine though. Definitely read the short docs page, <http://docs.djangoproject.com/en/dev/...
121,922
<p>I am currently suffering a brain fart. I've done this before but I can't remember the exact syntax and I can't look at the code I wrote because I was working at another company at the time. I have this arrangement:</p> <pre><code>class P { // stuff }; class PW : public P { // more stuff }; class PR : public P { /...
[ { "answer_id": 121944, "author": "Carl Seleborg", "author_id": 2095, "author_profile": "https://Stackoverflow.com/users/2095", "pm_score": 2, "selected": false, "text": "<p>In the code above, you have the opposite of the <strong>slicing</strong> problem.</p>\n\n<p>What you're trying to d...
2008/09/23
[ "https://Stackoverflow.com/questions/121922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342/" ]
I am currently suffering a brain fart. I've done this before but I can't remember the exact syntax and I can't look at the code I wrote because I was working at another company at the time. I have this arrangement: ``` class P { // stuff }; class PW : public P { // more stuff }; class PR : public P { // more stuff }...
If you want to get this part to compile: ``` // ... P p = c.GetP( ); // valid PW p = c.GetP( ); // invalid PR p = c.GetP( ); // invalid // ... ``` You need to be able to construct/convert a P into a PW or a PR. You need to do something like this: ``` class PW : public P { PW(const P &); // more st...
121,946
<p>Ok, so I just ran into the following problem that raised an eyebrow.</p> <p>For various reasons I have a testing setup where Testing classes in a TestingAssembly.dll depend on the TestingBase class in a BaseTestingAssembly.dll. One of the things the TestBase does in the meantime is look for a certain embedded resou...
[ { "answer_id": 122049, "author": "Harper Shelby", "author_id": 21196, "author_profile": "https://Stackoverflow.com/users/21196", "pm_score": 1, "selected": false, "text": "<p>I think the answer is here in the discussion of <a href=\"http://msdn.microsoft.com/en-us/library/k9x6w0hc(VS.80)...
2008/09/23
[ "https://Stackoverflow.com/questions/121946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
Ok, so I just ran into the following problem that raised an eyebrow. For various reasons I have a testing setup where Testing classes in a TestingAssembly.dll depend on the TestingBase class in a BaseTestingAssembly.dll. One of the things the TestBase does in the meantime is look for a certain embedded resource in its...
The static constructor is called by the runtime and not directly by user code. You can see this by setting a breakpoint in the constructor and then running in the debugger. The function immediately above it in the call chain is native code. **Edit:** There are a lot of ways in which static initializers run in a differ...
121,962
<p>How can I consistently get the absolute, fully-qualified root or base url of the site regardless of whether the site is in a virtual directory and regardless of where my code is in the directory structure? I've tried every variable and function I can think of and haven't found a good way.</p> <p>I want to be able t...
[ { "answer_id": 121970, "author": "Dave Neeley", "author_id": 9660, "author_profile": "https://Stackoverflow.com/users/9660", "pm_score": 3, "selected": false, "text": "<p>There is some excellent discussion and ideas on <a href=\"http://www.west-wind.com/Weblog/posts/154812.aspx\" rel=\"n...
2008/09/23
[ "https://Stackoverflow.com/questions/121962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4318/" ]
How can I consistently get the absolute, fully-qualified root or base url of the site regardless of whether the site is in a virtual directory and regardless of where my code is in the directory structure? I've tried every variable and function I can think of and haven't found a good way. I want to be able to get the ...
In reading through the answer provided in Rick Strahl's Blog I found what I really needed was quite simple. First you need to determine the relative path (which for me was the easy part), and pass that into the function defined below: VB.NET ``` Public Shared Function GetFullyQualifiedURL(ByVal s as string) As String...
122,033
<p>Yesterday, I asked <a href="https://stackoverflow.com/questions/119107/how-do-i-generate-a-list-of-n-unique-random-numbers-in-ruby">this</a> question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such ...
[ { "answer_id": 122047, "author": "Dan Lenski", "author_id": 20789, "author_profile": "https://Stackoverflow.com/users/20789", "pm_score": 0, "selected": false, "text": "<p>Python with Numeric Python:</p>\n\n<pre><code>from numpy import *\na = random.random_integers(0, 100, 5)\nb = unique...
2008/09/23
[ "https://Stackoverflow.com/questions/122033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/781/" ]
Yesterday, I asked [this](https://stackoverflow.com/questions/119107/how-do-i-generate-a-list-of-n-unique-random-numbers-in-ruby) question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby withou...
In Ruby: ``` a = (0..100).entries.sort_by {rand}.slice! 0, 5 ``` **Update**: Here is a slightly different way: a = (0...100).entries.sort\_by{rand}[0...5] **EDIT:** and In Ruby 1.9 you can do this: ``` Array(0..100).sample(5) ```
122,067
<p>I have a site using a custom favicon.ico. The favicon displays as expected in all browsers except IE. When trying to display the favicon in IE, I get the big red x; when displaying the favicon in another browser, it displays just fine. The page source includes and it does work in other browsers. Thanks for your th...
[ { "answer_id": 122111, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 7, "selected": true, "text": "<p>Right you've not been that helpful (providing source would be have been really useful!) but here you go... Some things to ch...
2008/09/23
[ "https://Stackoverflow.com/questions/122067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13465/" ]
I have a site using a custom favicon.ico. The favicon displays as expected in all browsers except IE. When trying to display the favicon in IE, I get the big red x; when displaying the favicon in another browser, it displays just fine. The page source includes and it does work in other browsers. Thanks for your thoug...
Right you've not been that helpful (providing source would be have been really useful!) but here you go... Some things to check: Is the code like this: ``` <link rel="icon" href="http://www.example.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://www.example.com/favicon.ico" type="image/...
122,088
<p>I have a table in a MSSQL database that looks like this:</p> <pre><code>Timestamp (datetime) Message (varchar(20)) </code></pre> <p>Once a day, a particular process inserts the current time and the message 'Started' when it starts. When it is finished it inserts the current time and the message 'Finished'.</p> <p...
[ { "answer_id": 122129, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": 3, "selected": true, "text": "<pre><code>Select Count(Message) As Status\nFrom Process_monitor\nWhere TimeStamp &gt;= '20080923'\n An...
2008/09/23
[ "https://Stackoverflow.com/questions/122088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16881/" ]
I have a table in a MSSQL database that looks like this: ``` Timestamp (datetime) Message (varchar(20)) ``` Once a day, a particular process inserts the current time and the message 'Started' when it starts. When it is finished it inserts the current time and the message 'Finished'. What is a good query or set of s...
``` Select Count(Message) As Status From Process_monitor Where TimeStamp >= '20080923' And TimeStamp < '20080924' And (Message = 'Started' or Message = 'Finished') ``` You could modify this slightly to detect invalid conditions, like multiple starts, finishes, starts without a finish, etc... ``` Sel...
122,089
<p>A brief search shows that all available (uUnix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort.</p> <p>First, if I use rngconv:</p> <pre><code>$ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip $ unzip rngconv.20...
[ { "answer_id": 122434, "author": "Adrian Mouat", "author_id": 4332, "author_profile": "https://Stackoverflow.com/users/4332", "pm_score": 2, "selected": false, "text": "<p>Converting XSD is a very hard task; the XSD specification is a bit of a nightmare and extremely complex. From some q...
2008/09/23
[ "https://Stackoverflow.com/questions/122089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21205/" ]
A brief search shows that all available (uUnix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort. First, if I use rngconv: ``` $ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip $ unzip rngconv.20060319.zip $ cd rngco...
Converting XSD is a very hard task; the XSD specification is a bit of a nightmare and extremely complex. From some quick [research,](http://www.tbray.org/ongoing/When/200x/2006/11/27/Choose-Relax) it seems that it is easy to go from RelaxNG to XSD, but that the reverse may not be true or even possible (which explains y...
122,098
<p>I have a Google Web Toolkit (GWT) application and when I link to it, I want to pass some arguments/parameters that it can use to dynamically retrieve data. E.g. if it were a stock chart application, I would want my link to contain the symbol and then have the GWT app read that and make a request to some stock servi...
[ { "answer_id": 122833, "author": "Drejc", "author_id": 6482, "author_profile": "https://Stackoverflow.com/users/6482", "pm_score": 4, "selected": true, "text": "<p>If you want to read query string parameters from the request you can use the <strong>com.google.gwt.user.client.Window</stro...
2008/09/23
[ "https://Stackoverflow.com/questions/122098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9910/" ]
I have a Google Web Toolkit (GWT) application and when I link to it, I want to pass some arguments/parameters that it can use to dynamically retrieve data. E.g. if it were a stock chart application, I would want my link to contain the symbol and then have the GWT app read that and make a request to some stock service. ...
If you want to read query string parameters from the request you can use the **com.google.gwt.user.client.Window** class: ``` // returns whole query string public static String getQueryString() { return Window.Location.getQueryString(); } // returns specific parameter public static String getQueryString(String ...
122,102
<p>What is the most efficient way to clone a JavaScript object? I've seen <code>obj = eval(uneval(o));</code> being used, but <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval" rel="noreferrer">that's non-standard and only supported by Firefox</a>.<br/><br/> I've done thin...
[ { "answer_id": 122190, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 9, "selected": false, "text": "<p>If there wasn't any builtin one, you could try:</p>\n\n<pre><code>function clone(obj) {\n if (obj === null || typeof (...
2008/09/23
[ "https://Stackoverflow.com/questions/122102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12694/" ]
What is the most efficient way to clone a JavaScript object? I've seen `obj = eval(uneval(o));` being used, but [that's non-standard and only supported by Firefox](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval). I've done things like `obj = JSON.parse(JSON.stringify(o));` b...
Native deep cloning =================== There's now a JS standard called ["structured cloning"](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone), that works experimentally in Node 11 and later, will land in browsers, and which has [polyfills for existing systems](https://www.npmjs.com/package/@ungap/s...
122,104
<p>Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I find myself doing this when building links on that page:</p> <pre><code>&lt;%=Html.ActionLink("Page 1", "Search", new { query=ViewData["query"], page etc..%&gt; &lt;%=Html.ActionLink("Page 2", "...
[ { "answer_id": 122439, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 1, "selected": false, "text": "<p>Whenever you find yourself writing redundant code in your Views, <a href=\"http://blog.wekeroad.com/blog/asp-net-mvc...
2008/09/23
[ "https://Stackoverflow.com/questions/122104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I find myself doing this when building links on that page: ``` <%=Html.ActionLink("Page 1", "Search", new { query=ViewData["query"], page etc..%> <%=Html.ActionLink("Page 2", "Search", new { query=Vi...
I had a similar problem inside an HtmlHelper; I wanted to generate links that linked backed to the current page, with a small adjustment in parameters (think incrementing the page number). So if I had URL /Item/?sort=Name&page=0, I wanted to be able to create links to the same page, but just change the page parameter, ...
122,105
<p>I want to filter a <code>java.util.Collection</code> based on a predicate.</p>
[ { "answer_id": 122128, "author": "Kevin Wong", "author_id": 4792, "author_profile": "https://Stackoverflow.com/users/4792", "pm_score": 7, "selected": false, "text": "<p>Use <a href=\"https://commons.apache.org/proper/commons-collections/javadocs/api-release/org/apache/commons/collection...
2008/09/23
[ "https://Stackoverflow.com/questions/122105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4792/" ]
I want to filter a `java.util.Collection` based on a predicate.
Java 8 ([2014](https://www.oracle.com/java/technologies/javase/8-whats-new.html "What's New in JDK 8")) solves this problem using streams and lambdas in one line of code: ``` List<Person> beerDrinkers = persons.stream() .filter(p -> p.getAge() > 16).collect(Collectors.toList()); ``` Here's a [tutorial](http://ze...
122,107
<p><strong>"It is not possible to check out a single file. The finest level of checkouts you can do is at the directory level."</strong></p> <p>How do I get around this issue when using Subversion?</p> <p>We have this folder in Subversion where we keep all our images. I just want to check out one file (image) from th...
[ { "answer_id": 122126, "author": "Milan Babuškov", "author_id": 14690, "author_profile": "https://Stackoverflow.com/users/14690", "pm_score": 6, "selected": false, "text": "<p>Use <code>svn cat</code> or <code>svn export</code>.</p>\n\n<p>For that, you don't need to fetch the working dir...
2008/09/23
[ "https://Stackoverflow.com/questions/122107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1175964/" ]
**"It is not possible to check out a single file. The finest level of checkouts you can do is at the directory level."** How do I get around this issue when using Subversion? We have this folder in Subversion where we keep all our images. I just want to check out one file (image) from that. This folder is really big ...
The simple answer is that you `svn export` the file instead of checking it out. But that might not be what you want. You might want to work on the file and check it back in, without having to download GB of junk you don't need. If you have Subversion 1.5+, then do a sparse checkout: ``` svn checkout <url_of_big_dir>...
122,108
<p>I have implemented the WMD control that Stack Overflow uses into a project of mine, it <strong>almost</strong> works like a charm, but when I save the changes to the database it is saving the HTML version and not the Markdown version.</p> <p>So where I have this in my text box:</p> <pre><code>**boldtext** </code><...
[ { "answer_id": 122572, "author": "Clinton Dreisbach", "author_id": 6262, "author_profile": "https://Stackoverflow.com/users/6262", "pm_score": 4, "selected": true, "text": "<p>Before you include <code>wmd.js</code>, or whatever you've named the WMD editor JavaScript code locally, add one...
2008/09/23
[ "https://Stackoverflow.com/questions/122108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
I have implemented the WMD control that Stack Overflow uses into a project of mine, it **almost** works like a charm, but when I save the changes to the database it is saving the HTML version and not the Markdown version. So where I have this in my text box: ``` **boldtext** ``` It is really saving this: ``` <b>bo...
Before you include `wmd.js`, or whatever you've named the WMD editor JavaScript code locally, add one line of JavaScript code: ``` wmd_options = {"output": "Markdown"}; ``` This will force the output of the editor to Markdown.
122,115
<p>Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement that allows for separating stdin, stdout, and stderr?</p>
[ { "answer_id": 122222, "author": "Max Caceres", "author_id": 4842, "author_profile": "https://Stackoverflow.com/users/4842", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://popen4.rubyforge.org/\" rel=\"nofollow noreferrer\">POpen4</a> gem has a common interface between uni...
2008/09/23
[ "https://Stackoverflow.com/questions/122115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4842/" ]
Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement that allows for separating stdin, stdout, and stderr?
[POpen4](http://popen4.rubyforge.org/) gem has a common interface between unix and Windows. The following example (from their website) works like a charm. ``` require 'rubygems' require 'popen4' status = POpen4::popen4("cmd") do |stdout, stderr, stdin, pid| stdin.puts "echo hello world!" stdin.puts "echo ER...
122,127
<p>In order to create the proper queries I need to be able to run a query against the same datasource that the report is using. How do I get that information <strong>programatically</strong>? Preferably the connection string or pieces of data used to build the connection string.</p>
[ { "answer_id": 122171, "author": "Erikk Ross", "author_id": 18772, "author_profile": "https://Stackoverflow.com/users/18772", "pm_score": 0, "selected": false, "text": "<p>If you have the right privileges you can can go to <a href=\"http://servername/reports/\" rel=\"nofollow noreferrer\...
2008/09/23
[ "https://Stackoverflow.com/questions/122127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7756/" ]
In order to create the proper queries I need to be able to run a query against the same datasource that the report is using. How do I get that information **programatically**? Preferably the connection string or pieces of data used to build the connection string.
``` DataSourceDefinition dataSourceDefinition = reportingService.GetDataSourceContents("DataSourceName"); string connectionString = dataSourceDefinition.ConnectString; ```
122,144
<p>Im calling a locally hosted wcf service from silverlight and I get the exception below.</p> <p>Iv created a clientaccesspolicy.xml, which is situated in the route of my host.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;access-policy&gt; &lt;cross-domain-access&gt; &lt;policy&gt; &lt...
[ { "answer_id": 122165, "author": "C. Dragon 76", "author_id": 5682, "author_profile": "https://Stackoverflow.com/users/5682", "pm_score": 0, "selected": false, "text": "<p>I'd start by making sure Silverlight is actually finding your client access policy file by inspecting the network ca...
2008/09/23
[ "https://Stackoverflow.com/questions/122144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
Im calling a locally hosted wcf service from silverlight and I get the exception below. Iv created a clientaccesspolicy.xml, which is situated in the route of my host. ``` <?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <d...
there are some debugging techniques [listed here](http://timheuer.com/blog/archive/2008/06/10/silverlight-services-cross-domain-404-not-found.aspx)..one more [useful post](http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx)..
122,154
<p>I'm using Team Foundation Build but we aren't yet using TFS for problem tracking, so I would like to disable the work item creation on a failed build. Is there any way to do this? I tried commenting out the work item info in the TFSBuild.proj file for the build type but that didn't do the trick.</p>
[ { "answer_id": 122660, "author": "Tim Booker", "author_id": 10046, "author_profile": "https://Stackoverflow.com/users/10046", "pm_score": 6, "selected": true, "text": "<p>Try adding this inside the PropertyGroup in your TFSBuild.proj:</p>\n\n<pre><code>&lt;SkipWorkItemCreation&gt;true&lt...
2008/09/23
[ "https://Stackoverflow.com/questions/122154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327/" ]
I'm using Team Foundation Build but we aren't yet using TFS for problem tracking, so I would like to disable the work item creation on a failed build. Is there any way to do this? I tried commenting out the work item info in the TFSBuild.proj file for the build type but that didn't do the trick.
Try adding this inside the PropertyGroup in your TFSBuild.proj: ``` <SkipWorkItemCreation>true</SkipWorkItemCreation> ``` --- If you are curious as to how this works, Microsoft.TeamFoundation.Build.targets contians the following: ``` <Target Name="CoreCreateWorkItem" Condition=" '$(SkipWorkItemCreation...
122,160
<p>I'm a big fan of the way Visual Studio will give you the comment documentation / parameter names when completing code that you have written and ALSO code that you are referencing (various libraries/assemblies).</p> <p>Is there an easy way to get inline javadoc/parameter names in Eclipse when doing code complete or ...
[ { "answer_id": 122182, "author": "Henry B", "author_id": 6414, "author_profile": "https://Stackoverflow.com/users/6414", "pm_score": 7, "selected": false, "text": "<p>Short answer would be yes.</p>\n\n<p>You can attach source using the properties for a project.</p>\n\n<p>Go to Properties...
2008/09/23
[ "https://Stackoverflow.com/questions/122160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5885/" ]
I'm a big fan of the way Visual Studio will give you the comment documentation / parameter names when completing code that you have written and ALSO code that you are referencing (various libraries/assemblies). Is there an easy way to get inline javadoc/parameter names in Eclipse when doing code complete or hovering o...
Short answer would be yes. You can attach source using the properties for a project. Go to Properties (for the Project) -> Java Build Path -> Libraries Select the Library you want to attach source/javadoc for and then expand it, you'll see a list like so: ``` Source Attachment: (none) Javadoc location: (none) Nativ...
122,175
<p>I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net 2.0 friendly URLs using RewritePath, but I was wondering if it was possible to make use of the System.Web.Routing that comes with ASP.NET 3.5 SP1. </p> <p>I think I've figured out how to get my route table loaded, but I...
[ { "answer_id": 127897, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>It should be as easy as the below.</p>\n\n<pre><code>var route = new Route(\"blah/{*path}\", new MyRouteHandler());\nRouteT...
2008/09/23
[ "https://Stackoverflow.com/questions/122175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10893/" ]
I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net 2.0 friendly URLs using RewritePath, but I was wondering if it was possible to make use of the System.Web.Routing that comes with ASP.NET 3.5 SP1. I think I've figured out how to get my route table loaded, but I'm not cle...
I ended up taking what Ryan had: ``` var route = new Route("blah/{*path}", new MyRouteHandler()); RouteTable.Routes.Add(route); public class MyRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext requestContext) { //rewrite to some know sharepoint path HttpContext....
122,208
<p>In C++, what's the easiest way to get the local computer's IP address and subnet mask?</p> <p>I want to be able to detect the local machine's IP address in my local network. In my particular case, I have a network with a subnet mask of 255.255.255.0 and my computer's IP address is 192.168.0.5. I need to get these ha...
[ { "answer_id": 122225, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 4, "selected": false, "text": "<p>You can use gethostname followed by gethostbyname to get your local interface internal IP. </p>\n\n<p>This return...
2008/09/23
[ "https://Stackoverflow.com/questions/122208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4880/" ]
In C++, what's the easiest way to get the local computer's IP address and subnet mask? I want to be able to detect the local machine's IP address in my local network. In my particular case, I have a network with a subnet mask of 255.255.255.0 and my computer's IP address is 192.168.0.5. I need to get these had two val...
The question is trickier than it appears, because in many cases there isn't "an IP address for the local computer" so much as a number of different IP addresses. For example, the Mac I'm typing on right now (which is a pretty basic, standard Mac setup) has the following IP addresses associated with it: ``` fe80::1%lo0...
122,215
<p>In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to </p> <pre><code>Expect.Call(....).Throw(new OracleException()); </code></pre> <p>For whatever reason however, OracleException seems to be sealed with no public constru...
[ { "answer_id": 122224, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": -1, "selected": false, "text": "<p>Can you write a trivial stored procedure that fails/errors each time, then use that to test?</p>\n" }, { "an...
2008/09/23
[ "https://Stackoverflow.com/questions/122215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to ``` Expect.Call(....).Throw(new OracleException()); ``` For whatever reason however, OracleException seems to be sealed with no public constructor. What can I do to test...
It seems that Oracle changed their constructors in later versions, therefore the solution above will not work. If you only want to set the error code, the following will do the trick for 2.111.7.20: ``` ConstructorInfo ci = typeof(OracleException) .GetConstructor( BindingFlags.NonPublic | ...
122,216
<p>So I have a large 2d array that i serialize, but when I attempt to unserialize the array it just throws the same error to the point of nearly crashing Firefox.</p> <p>The error is:</p> <pre><code>Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/dev/wc_paul/inc/analyzerTester.php on ...
[ { "answer_id": 122241, "author": "JimmyJ", "author_id": 2083, "author_profile": "https://Stackoverflow.com/users/2083", "pm_score": 0, "selected": false, "text": "<p>to answer your second question about how else you could save the data</p>\n\n<p>why not output the xml responce directly t...
2008/09/23
[ "https://Stackoverflow.com/questions/122216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20895/" ]
So I have a large 2d array that i serialize, but when I attempt to unserialize the array it just throws the same error to the point of nearly crashing Firefox. The error is: ``` Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/dev/wc_paul/inc/analyzerTester.php on line 24 ``` I would...
Usually, when you get an error message, you can figure out a great deal by simply searching the web for that very message. For example, when you put [Node no longer exists](http://www.google.co.uk/search?q=Node+no+longer+exists) into Google, you end up with [a concise explanation of why this is happening, along with a ...
122,229
<p>I'm the only developer supporting a website that's a mix of classic asp and .NET. I had to add some .net pages to a classic asp application. This application requires users to login. The login page, written in classic asp, creates a cookie that .net pages use to identify the logged in user and stores information in ...
[ { "answer_id": 122252, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 2, "selected": false, "text": "<p>Using <a href=\"http://www.fiddlertool.com/fiddler/\" rel=\"nofollow noreferrer\">Fiddler</a> is a good way to try to ...
2008/09/23
[ "https://Stackoverflow.com/questions/122229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9809/" ]
I'm the only developer supporting a website that's a mix of classic asp and .NET. I had to add some .net pages to a classic asp application. This application requires users to login. The login page, written in classic asp, creates a cookie that .net pages use to identify the logged in user and stores information in ses...
Using [Fiddler](http://www.fiddlertool.com/fiddler/) is a good way to try to figure out what's going on. You can see the exact Set-Cookie that the browser is getting.
122,238
<p>JSF is setting the ID of an input field to <code>search_form:expression</code>. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something?</p> <pre><code>input#sea...
[ { "answer_id": 122266, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 8, "selected": true, "text": "<p>Backslash: </p>\n\n<pre><code>input#search_form\\:expression { ///...}\n</code></pre>\n\n<ul>\n<li>See also <em><a hr...
2008/09/23
[ "https://Stackoverflow.com/questions/122238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
JSF is setting the ID of an input field to `search_form:expression`. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something? ``` input#search_form:expression { /...
Backslash: ``` input#search_form\:expression { ///...} ``` * See also *[Using Namespaces with CSS](http://msdn.microsoft.com/en-us/library/ms762307(VS.85).aspx)* (MSDN)
122,239
<p>Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right.<br> Supposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good).<br> However, when I have two floated divs in the cell, they align themselves to the same top line.<br> I...
[ { "answer_id": 122263, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 0, "selected": false, "text": "<p>Add <code>clear: both</code> to the second element. If you want to @ to be below the yellow box, put it last in HTML cod...
2008/09/23
[ "https://Stackoverflow.com/questions/122239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right. Supposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good). However, when I have two floated divs in the cell, they align themselves to the same top line. I want t...
I never answered the first two questions, so feel free to give your answers below. But I *did* solve the last problem, of how to make it work. I added a containing div to the two divs inside the table cells like so: > > > ``` > <table> > <tr> > <td> > <div class="t"> > <div class="h">Title Text...
122,253
<p>After installing a third-party SDK, it very discourteously makes one if its templates the default item in "Add New Item..." dialog in Visual Studio 2005. This is also the case for all other similar dialogs - "Add Class...", "Add User Control..." etc.</p> <p>Is there a way to change this behavior?</p>
[ { "answer_id": 122270, "author": "Asaf R", "author_id": 6827, "author_profile": "https://Stackoverflow.com/users/6827", "pm_score": -1, "selected": false, "text": "<p>Try looking at the registry under </p>\n\n<pre><code>HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\\n</code></pre...
2008/09/23
[ "https://Stackoverflow.com/questions/122253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15497/" ]
After installing a third-party SDK, it very discourteously makes one if its templates the default item in "Add New Item..." dialog in Visual Studio 2005. This is also the case for all other similar dialogs - "Add Class...", "Add User Control..." etc. Is there a way to change this behavior?
You may have to manually modify the SortOrder on the Item templates yourself. You can do this by following these directions: 1) Find the Item Template(s) Item Templates for VS2005 are stored in the following locations: ``` (Installed Templates) <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\ (C...
122,254
<p>I have a class that defines the names of various session attributes, e.g.</p> <pre><code>class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } </code></pre> <p>I would like to use these constants within a JSP to test for the presence of these attributes, something like:</p> <pre><...
[ { "answer_id": 122863, "author": "Matt N", "author_id": 20605, "author_profile": "https://Stackoverflow.com/users/20605", "pm_score": -1, "selected": false, "text": "<p>First, your syntax had an extra \"]\" which was causing an error. </p>\n\n<p>To fix that, and to set a variable you wo...
2008/09/23
[ "https://Stackoverflow.com/questions/122254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I have a class that defines the names of various session attributes, e.g. ``` class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } ``` I would like to use these constants within a JSP to test for the presence of these attributes, something like: ``` <%@ taglib prefix="c" uri="http:...
It's not working in your example because the `ATTR_CURRENT_USER` constant is not visible to the JSTL tags, which expect properties to be exposed by getter functions. I haven't tried it, but the cleanest way to expose your constants appears to be the [unstandard tag library](http://jakarta.apache.org/taglibs/sandbox/doc...
122,267
<p>(using the IMAP commands, not with the assistance of any other mail package)</p>
[ { "answer_id": 122289, "author": "jkramer", "author_id": 12523, "author_profile": "https://Stackoverflow.com/users/12523", "pm_score": 2, "selected": false, "text": "<p>I guess you COPY the message to the new folder and then delete (EXPUNGE) it in the old one.</p>\n\n<p><a href=\"http://...
2008/09/23
[ "https://Stackoverflow.com/questions/122267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
(using the IMAP commands, not with the assistance of any other mail package)
I'm not sure how well-versed you are in imap-speak, but basically after login, "SELECT" the source mailbox, "COPY" the messages, and "EXPUNGE" the messages (or "DELETE" the old mailbox if it is empty now :-). ``` a login a s b select source c copy 1 othermbox d store 1 +flags (\Deleted) e expunge ``` would be an exa...
122,273
<p>Does anyone have any code examples on how to create controllers that have parameters other than using a Dependency Injection Container? </p> <p>I see plenty of samples with using containers like StructureMap, but nothing if you wanted to pass in the dependency class yourself.</p>
[ { "answer_id": 122361, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 5, "selected": true, "text": "<p>You can use poor-man's dependency injection:</p>\n\n<pre><code>public ProductController() : this( new Foo() )\n{\n ...
2008/09/23
[ "https://Stackoverflow.com/questions/122273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17902/" ]
Does anyone have any code examples on how to create controllers that have parameters other than using a Dependency Injection Container? I see plenty of samples with using containers like StructureMap, but nothing if you wanted to pass in the dependency class yourself.
You can use poor-man's dependency injection: ``` public ProductController() : this( new Foo() ) { //the framework calls this } public ProductController(IFoo foo) { _foo = foo; } ```
122,276
<p>I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus.</p> <p>Specifically what I'm trying to use this for is a script that I want to be...
[ { "answer_id": 122300, "author": "dirtside", "author_id": 20903, "author_profile": "https://Stackoverflow.com/users/20903", "pm_score": 1, "selected": false, "text": "<p>I don't know what the ultimate reason is for needing to do this, but I think maybe you might need to rethink whatever ...
2008/09/23
[ "https://Stackoverflow.com/questions/122276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14528/" ]
I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus. Specifically what I'm trying to use this for is a script that I want to be runnable ...
With newer versions of [`sudo`](http://www.sudo.ws/sudo/sudo.man.html) there's an option for this purpose: ``` sudo -n true ``` I use `true` here for a no-op, but you could use any command.
122,277
<p>I switched from Perl to Python about a year ago and haven't looked back. There is only <i>one</i> idiom that I've ever found I can do more easily in Perl than in Python:</p> <pre><code>if ($var =~ /foo(.+)/) { # do something with $1 } elsif ($var =~ /bar(.+)/) { # do something with $1 } elsif ($var =~ /baz(.+)...
[ { "answer_id": 122294, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 4, "selected": false, "text": "<p>Using named groups and a dispatch table:</p>\n\n<pre><code>r = re.compile(r'(?P&lt;cmd&gt;foo|bar|baz)(?P&lt;dat...
2008/09/23
[ "https://Stackoverflow.com/questions/122277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20789/" ]
I switched from Perl to Python about a year ago and haven't looked back. There is only *one* idiom that I've ever found I can do more easily in Perl than in Python: ``` if ($var =~ /foo(.+)/) { # do something with $1 } elsif ($var =~ /bar(.+)/) { # do something with $1 } elsif ($var =~ /baz(.+)/) { # do somethin...
Starting `Python 3.8`, and the introduction of [assignment expressions (PEP 572)](https://www.python.org/dev/peps/pep-0572/) (`:=` operator), we can now capture the condition value `re.search(pattern, text)` in a variable `match` in order to both check if it's not `None` and then re-use it within the body of the condit...
122,301
<p>Is there an easy way to get a conflict summary after running a <code>cvs update</code>? </p> <p>I work on a large project and after doing some work I need to do an update. The list of changes coming back from the cvs update command is several pages long and I'd like to see only the list of conflicts (starts with ...
[ { "answer_id": 122337, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 1, "selected": false, "text": "<p>I don't have cvs handy what is the exact format of the output of cvs update</p>\n\n<p>I seem to remember C &lt;file...
2008/09/23
[ "https://Stackoverflow.com/questions/122301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
Is there an easy way to get a conflict summary after running a `cvs update`? I work on a large project and after doing some work I need to do an update. The list of changes coming back from the cvs update command is several pages long and I'd like to see only the list of conflicts (starts with 'C') repeated at the en...
Given the specification, it seems that you need a minor adaptation of Martin York's solution (because that only shows the conflicts and not the normal log information). Something like this - which might be called 'cvsupd': ``` tmp=${TMPDIR:-/tmp}/cvsupd.$$ trap "rm -f $tmp; exit 1" 0 1 2 3 13 15 cvs update "$@" | tee ...
122,302
<p>According to select name from system_privilege_map System has been granted:</p> <pre><code>SELECT ANY TABLE </code></pre> <p>...and lots of other * ANY TABLES.</p> <p>Plainly running</p> <pre><code>select * from the_table; select * from the_table; </code></pre> <p>...nets the given response:</p> <blockquote> ...
[ { "answer_id": 122309, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 4, "selected": true, "text": "<p>If the_table is owned by user \"some_user\" then:</p>\n\n<pre><code>select * from some_user.the_table;\n</code></pr...
2008/09/23
[ "https://Stackoverflow.com/questions/122302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
According to select name from system\_privilege\_map System has been granted: ``` SELECT ANY TABLE ``` ...and lots of other \* ANY TABLES. Plainly running ``` select * from the_table; select * from the_table; ``` ...nets the given response: > > ERROR at line 1: > ORA-00942: table or view does not exist > > ...
If the\_table is owned by user "some\_user" then: ``` select * from some_user.the_table; ```
122,313
<p>I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control.</p> <p>Let's say for example I've added the entire Visual Studio folder, with its solutions, proje...
[ { "answer_id": 122328, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "<p>At the lowest level, SVN allows you to ignore certain files or patterns with <a href=\"http://www.petefreitag.com/i...
2008/09/23
[ "https://Stackoverflow.com/questions/122313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control. Let's say for example I've added the entire Visual Studio folder, with its solutions, projects, debug...
You're probably safest excluding particular filetypes, rather than picking those you want to include, as you could then add a new type and not realize it wasn't versioned. On a per-directory basis, you can edit the [svn:ignore](http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.3) property. Run ``` sv...
122,316
<p>In C# we can define a generic type that imposes constraints on the types that can be used as the generic parameter. The following example illustrates the usage of generic constraints:</p> <pre><code>interface IFoo { } class Foo&lt;T&gt; where T : IFoo { } class Bar : IFoo { } class Simpson { } class Program { ...
[ { "answer_id": 122347, "author": "shoosh", "author_id": 9611, "author_profile": "https://Stackoverflow.com/users/9611", "pm_score": 1, "selected": false, "text": "<p>Only implicitly.<br>\nAny method you use in a method that is actually called is imposed on the template parameter. </p>\n...
2008/09/23
[ "https://Stackoverflow.com/questions/122316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6508/" ]
In C# we can define a generic type that imposes constraints on the types that can be used as the generic parameter. The following example illustrates the usage of generic constraints: ``` interface IFoo { } class Foo<T> where T : IFoo { } class Bar : IFoo { } class Simpson { } class Program { static void Main(...
As someone else has mentioned, C++0x is getting this built into the language. Until then, I'd recommend [Bjarne Stroustrup](http://en.wikipedia.org/wiki/Bjarne_Stroustrup)'s [suggestions for template constraints](http://www.stroustrup.com/bs_faq2.html#constraints). Edit: [Boost](http://boost.org) also has an [alternat...
122,324
<p>Would having a nice little feature that makes it quicker to write code like Automatic Properties fit very nicely with the mantra of VB.NET?</p> <p>Something like this would work perfect:</p> <pre><code>Public Property FirstName() As String Get Set End Property </code></pre> <p><strong>UPDATE:</strong> VB.NET...
[ { "answer_id": 122339, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 1, "selected": false, "text": "<p>C# and VB.NET don't exactly line up on new features in their first versions. Usually, by the next version C# catches ...
2008/09/23
[ "https://Stackoverflow.com/questions/122324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7831/" ]
Would having a nice little feature that makes it quicker to write code like Automatic Properties fit very nicely with the mantra of VB.NET? Something like this would work perfect: ``` Public Property FirstName() As String Get Set End Property ``` **UPDATE:** VB.NET 10 (coming with Visual Studio 2010 and .NE...
One reason many features get delayed in VB is that the development structure is much different than in C# and additionally, that often more thought goes into details. The same seems to be true in this case, as suggested by [Paul Vick's post](http://www.panopticoncentral.net/archive/2008/03/27/23050.aspx) on the matter....
122,327
<p>How do I find the location of my <code>site-packages</code> directory?</p>
[ { "answer_id": 122340, "author": "Daryl Spitzer", "author_id": 4766, "author_profile": "https://Stackoverflow.com/users/4766", "pm_score": 9, "selected": false, "text": "<p>A solution that:</p>\n\n<ul>\n<li>outside of virtualenv - provides the path of <strong>global</strong> site-package...
2008/09/23
[ "https://Stackoverflow.com/questions/122327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
How do I find the location of my `site-packages` directory?
There are two types of site-packages directories, *global* and *per user*. 1. **Global** site-packages ("[dist-packages](https://stackoverflow.com/questions/9387928/whats-the-difference-between-dist-packages-and-site-packages)") directories are listed in `sys.path` when you run: ``` python -m site ``` For a more c...
122,348
<p>I have a command which includes an includegraphics command - I can pass an image to my command, and it will do some standard formatting for me before actually including the image. Some of the images that I'm including via this command are smaller than \textwidth, while some are larger. I'd like to scale the larger...
[ { "answer_id": 122653, "author": "Steve Landey", "author_id": 8061, "author_profile": "https://Stackoverflow.com/users/8061", "pm_score": -1, "selected": false, "text": "<p>After a few minutes of searching through CTAN manuals and Google results, I think I can safely say that what you wa...
2008/09/23
[ "https://Stackoverflow.com/questions/122348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1322/" ]
I have a command which includes an includegraphics command - I can pass an image to my command, and it will do some standard formatting for me before actually including the image. Some of the images that I'm including via this command are smaller than \textwidth, while some are larger. I'd like to scale the larger imag...
To get the width of the image you can use this code: ``` \newlength{\imgwidth} \settowidth{\imgwidth}{\includegraphics{img}} ``` You could use this in the document preamble to create a new command to automatically set the width: ``` \usepackage{graphicx} \usepackage{calc} \newlength{\imgwidth} \newcommand\scalegr...
122,407
<p>I have a method that's about ten lines of code. I want to create more methods that do exactly the same thing, except for a small calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. W...
[ { "answer_id": 122414, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 9, "selected": true, "text": "<p>Anonymous inner class</p>\n\n<p>Say you want to have a function passed in with a <code>String</code> param that returns an...
2008/09/23
[ "https://Stackoverflow.com/questions/122407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
I have a method that's about ten lines of code. I want to create more methods that do exactly the same thing, except for a small calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. What's ...
Anonymous inner class Say you want to have a function passed in with a `String` param that returns an `int`. First you have to define an interface with the function as its only member, if you can't reuse an existing one. ``` interface StringFunction { int func(String param); } ``` A method that takes the poi...
122,422
<p>Is there any way to change the default datatype when importing an Excel file into Access? (I'm using Access 2003, by the way).</p> <p>I know that I sometimes have the freedom to assign any datatype to each column that is being imported, but that could only be when I'm importing non-Excel files. </p> <p><strong>EDI...
[ { "answer_id": 122442, "author": "theo", "author_id": 7870, "author_profile": "https://Stackoverflow.com/users/7870", "pm_score": -1, "selected": false, "text": "<p>Access will do this.</p>\n\n<p>In your import process you can define what the data type of each column is.</p>\n" }, { ...
2008/09/23
[ "https://Stackoverflow.com/questions/122422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3930756/" ]
Is there any way to change the default datatype when importing an Excel file into Access? (I'm using Access 2003, by the way). I know that I sometimes have the freedom to assign any datatype to each column that is being imported, but that could only be when I'm importing non-Excel files. **EDIT:** To be clear, I und...
This *may* be caused by Excel Jet driver default settings. Check out the following registry key and change it's value from default 8 to 0, meaning "guess column data type based on all values, not just first 8 rows." ``` [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel] "TypeGuessRows"=dword:00000000 ``` ...
122,424
<p>Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902".</p> <p>I'd like to switch over to using a distributed system (probably git) to make it easier to branc...
[ { "answer_id": 122508, "author": "foxxtrot", "author_id": 10369, "author_profile": "https://Stackoverflow.com/users/10369", "pm_score": 1, "selected": false, "text": "<p>I'd use \"Labels\" Create a label whenever you have a successful (or even unsuccessful) build, and you'll be able to ...
2008/09/23
[ "https://Stackoverflow.com/questions/122424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14528/" ]
Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902". I'd like to switch over to using a distributed system (probably git) to make it easier to branch and to w...
I second the suggestion of using `git describe`. Provided that you have a sane versioning policy, and you don't do any crazy stuff with your repository, `git describe` will always be monotonic (at least as monotonic as you can be, when your revision history is a DAG instead of a tree) and unique. A little demonstratio...
122,445
<p>I'm implementing charts using <a href="http://www.ziya.liquidrail.com/" rel="nofollow noreferrer">The Ziya Charts Gem</a>. Unfortunately, the documentation isn't really helpful or I haven't had enough coffee to figure out theming. I know I can set a theme using</p> <pre><code>chart.add(:theme, 'whatever') </code></...
[ { "answer_id": 122491, "author": "Matthias Winkelmann", "author_id": 4494, "author_profile": "https://Stackoverflow.com/users/4494", "pm_score": 0, "selected": false, "text": "<p>To partly answer my own question, there are some themes in the website sources which can be checked out at </...
2008/09/23
[ "https://Stackoverflow.com/questions/122445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4494/" ]
I'm implementing charts using [The Ziya Charts Gem](http://www.ziya.liquidrail.com/). Unfortunately, the documentation isn't really helpful or I haven't had enough coffee to figure out theming. I know I can set a theme using ``` chart.add(:theme, 'whatever') ``` Problem: I haven't found any predefined themes, nor ha...
As I understand it, the themes are used by initializing the theme directory in your ziya.rb file like so: `Ziya.initialize(:themes_dir => File.join( File.dirname(__FILE__), %w[.. .. public charts themes]) )` And you'll need to set up the proper directory, in this case public/charts/themes. It doesn't come with any i...
122,463
<p>I have an XML file that starts like this:</p> <pre><code>&lt;Elements name="Entities" xmlns="XS-GenerationToolElements"&gt; </code></pre> <p>I'll have to open a lot of these files. Each of these have a different namespace but will only have one namespace at a time (I'll never find two namespaces defined in one xml...
[ { "answer_id": 122786, "author": "skaffman", "author_id": 21234, "author_profile": "https://Stackoverflow.com/users/21234", "pm_score": 2, "selected": false, "text": "<p>Unfortunately, XPath doesn't have any concept of \"default namespace\". You need to register namespaces with prefixes...
2008/09/23
[ "https://Stackoverflow.com/questions/122463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20335/" ]
I have an XML file that starts like this: ``` <Elements name="Entities" xmlns="XS-GenerationToolElements"> ``` I'll have to open a lot of these files. Each of these have a different namespace but will only have one namespace at a time (I'll never find two namespaces defined in one xml file). Using XPath I'd like to...
There are a few techniques that you might try; which you use will depend on exactly what information you need to get out of the document, how rigorous you want to be, and how conformant the XPath implementation you're using is. One way to get the namespace URI associated with a particular prefix is using the `namespac...
122,483
<p>In crontab, I can use an asterisk to mean every value, or "*/2" to mean every even value.</p> <p>Is there a way to specify every <strong>odd</strong> value? (Would something like "1+*/2" work?)</p>
[ { "answer_id": 122496, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "<p>Try</p>\n\n<pre><code>1-23/2\n</code></pre>\n\n<p>From your question, I'm assuming Vixie Cron. I doubt this will wo...
2008/09/23
[ "https://Stackoverflow.com/questions/122483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
In crontab, I can use an asterisk to mean every value, or "\*/2" to mean every even value. Is there a way to specify every **odd** value? (Would something like "1+\*/2" work?)
Depending on your version of cron, you should be able to do (for hours, say): ``` 1-23/2 ``` Going by the EXTENSIONS section in the crontab(5) manpage: ``` Ranges can include "steps", so "1-9/2" is the same as "1,3,5,7,9". ``` For a more portable solution, I suspect you just have to use the simple list: ``...
122,514
<p>I have already posted something similar <a href="https://stackoverflow.com/questions/118051/c-grid-binding-not-update">here</a> but I would like to ask the question more general over here.</p> <p>Have you try to serialize an object that implement INotifyPropertyChanged and to get it back from serialization and to b...
[ { "answer_id": 122522, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>The trick of having it's own <a href=\"https://stackoverflow.com/questions/118051/c-grid-binding-not-update#...
2008/09/23
[ "https://Stackoverflow.com/questions/122514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I have already posted something similar [here](https://stackoverflow.com/questions/118051/c-grid-binding-not-update) but I would like to ask the question more general over here. Have you try to serialize an object that implement INotifyPropertyChanged and to get it back from serialization and to bind it to a DataGridV...
Use the `DataContractSerializer` and create a method for OnDeserialized ``` [OnDeserialized] private void OnDeserialized(StreamingContext c) {} ``` This will let you raise the PropertyChanged event when deserialization is complete
122,523
<p>Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption </p> <pre><code>DataRow exercise = _exerciseDataSet.Exercise.FindB...
[ { "answer_id": 122536, "author": "Austin Salonen", "author_id": 4068, "author_profile": "https://Stackoverflow.com/users/4068", "pm_score": 7, "selected": true, "text": "<p>A SQL float is a double according to <a href=\"http://msdn.microsoft.com/en-us/library/system.data.sqldbtype.aspx#M...
2008/09/23
[ "https://Stackoverflow.com/questions/122523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1048/" ]
Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption ``` DataRow exercise = _exerciseDataSet.Exercise.FindByExerciseID(65); _...
A SQL float is a double according to [the documentation for SQLDbType](http://msdn.microsoft.com/en-us/library/system.data.sqldbtype.aspx#Mtps_DropDownFilterText).
122,533
<p>Is there any way to down-format a Subversion repository to avoid messages like this:</p> <pre> svn: Expected format '3' of repository; found format '5' </pre> <p>This happens when you access repositories from more than one machine, and you aren't able to use a consistent version of Subversion across all of those m...
[ { "answer_id": 122549, "author": "zigdon", "author_id": 4913, "author_profile": "https://Stackoverflow.com/users/4913", "pm_score": 2, "selected": false, "text": "<p>I suspect you have to export the repository and re-import it into the older version. There might be some format incompati...
2008/09/23
[ "https://Stackoverflow.com/questions/122533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7255/" ]
Is there any way to down-format a Subversion repository to avoid messages like this: ``` svn: Expected format '3' of repository; found format '5' ``` This happens when you access repositories from more than one machine, and you aren't able to use a consistent version of Subversion across all of those machines. Wo...
If you can't use the same version of Subversion across all machines, then you should set up a server process (either svnserve or Apache) and access the repository only through the server. The server can mediate between different versions of Subversion; it's only when you're using direct repository access that you run i...
122,546
<p>We've written a plugin to the Xinha text editor to handle footnotes. You can take a look at: <a href="http://www.nicholasbs.com/xinha/examples/Newbie.html" rel="nofollow noreferrer">http://www.nicholasbs.com/xinha/examples/Newbie.html</a></p> <p>In order to handle some problems with the way Webkit and IE handle li...
[ { "answer_id": 122876, "author": "Douglas Mayle", "author_id": 8458, "author_profile": "https://Stackoverflow.com/users/8458", "pm_score": 4, "selected": true, "text": "<p>It's not visible in the snippet above, but newel has been appended to the dom using another element that was itself ...
2008/09/23
[ "https://Stackoverflow.com/questions/122546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8458/" ]
We've written a plugin to the Xinha text editor to handle footnotes. You can take a look at: <http://www.nicholasbs.com/xinha/examples/Newbie.html> In order to handle some problems with the way Webkit and IE handle links at the end of lines (there's no way to use the cursor to get out of the link on the same line) we ...
It's not visible in the snippet above, but newel has been appended to the dom using another element that was itself appended to the DOM. When inserting a dom element, you have to re-retrieve your handle if you wish to reference its siblings, since the handle is invalid (I'm not sure, but I think it refers to a DOM elem...
122,571
<p>Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic under...
[ { "answer_id": 122709, "author": "ColinD", "author_id": 13792, "author_profile": "https://Stackoverflow.com/users/13792", "pm_score": 1, "selected": false, "text": "<p>It does seem like it would be overkill for a very simple application, especially if you don't have plans to expand on it...
2008/09/23
[ "https://Stackoverflow.com/questions/122571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic understa...
Short answer: It depends on the complexity you want to support. Long answer: First of all, ORM ( object relational mapping - database mapping as you call it - ) and JNDI ( Java Naming and Directory Interfaces ) are two different things. The first as you already know, is used to map the Database tables to classes an...
122,582
<p>I'm using a lat/long SRID in my PostGIS database (-4326). I would like to find the nearest points to a given point in an efficient manner. I tried doing an</p> <pre><code>ORDER BY ST_Distance(point, ST_GeomFromText(?,-4326)) </code></pre> <p>which gives me ok results in the lower 48 states, but up in Alaska i...
[ { "answer_id": 123166, "author": "nathaniel", "author_id": 11947, "author_profile": "https://Stackoverflow.com/users/11947", "pm_score": 2, "selected": false, "text": "<p>This is from SQL Server, and I use Haversine for a ridiculously fast distance that may suffer from your Alaska issue ...
2008/09/23
[ "https://Stackoverflow.com/questions/122582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
I'm using a lat/long SRID in my PostGIS database (-4326). I would like to find the nearest points to a given point in an efficient manner. I tried doing an ``` ORDER BY ST_Distance(point, ST_GeomFromText(?,-4326)) ``` which gives me ok results in the lower 48 states, but up in Alaska it gives me garbage. Is there...
You are looking for ST\_distance\_sphere(point,point) or st\_distance\_spheroid(point,point). See: <http://postgis.refractions.net/documentation/manual-1.3/ch06.html#distance_sphere> <http://postgis.refractions.net/documentation/manual-1.3/ch06.html#distance_spheroid> This is normally referred to a geodesic or geode...
122,589
<p>I have a ASP.NET application running on a remote web server and I just started getting this error. I can't seem to reproduce it in my development environment:</p> <pre><code>Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'. </code></pre> <p>Could this be due to some misconfiguration of .N...
[ { "answer_id": 122604, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 0, "selected": false, "text": "<p>Is your IIS setup to use .NET 2.0? If not, change it to 2.0. If you can't see 2.0 in the list then you'll need to...
2008/09/23
[ "https://Stackoverflow.com/questions/122589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10475/" ]
I have a ASP.NET application running on a remote web server and I just started getting this error. I can't seem to reproduce it in my development environment: ``` Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'. ``` Could this be due to some misconfiguration of .NET Framework or IIS 6? Upd...
This was caused by a bug in the aspnet merge tool which incorrectly merged optimized assemblies. It can be solved by either not merging the assemblies or not optimizing them.
122,607
<p>I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service.</p> <p>So outside of the SOAP toolkit, what is the ...
[ { "answer_id": 122625, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 0, "selected": false, "text": "<p>The SOAP toolkit is arguably the best you could get. Trying to do the same thing without it would require conside...
2008/09/23
[ "https://Stackoverflow.com/questions/122607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7565/" ]
I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service. So outside of the SOAP toolkit, what is the best way t...
I use this function to get data from a web service. ``` Private Function HttpGetRequest(url As String) As DOMDocument Dim req As XMLHTTP60 Set req = New XMLHTTP60 req.Open "GET", url, False req.send "" Dim resp As DOMDocument If req.responseText <> vbNullString Then Set resp = New DOMD...
122,616
<p>Is there a clean, preferably standard method of trimming leading and trailing whitespace from a string in C? I'd roll my own, but I would think this is a common problem with an equally common solution.</p>
[ { "answer_id": 122721, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 9, "selected": true, "text": "<p>If you can modify the string:</p>\n\n<pre><code>// Note: This function returns a pointer to a substring of the ori...
2008/09/23
[ "https://Stackoverflow.com/questions/122616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14463/" ]
Is there a clean, preferably standard method of trimming leading and trailing whitespace from a string in C? I'd roll my own, but I would think this is a common problem with an equally common solution.
If you can modify the string: ``` // Note: This function returns a pointer to a substring of the original string. // If the given string was allocated dynamically, the caller must not overwrite // that pointer with the returned value, since the original pointer must be // deallocated using the same allocator with whic...
122,639
<p>I have a temp table with the exact structure of a concrete table <code>T</code>. It was created like this: </p> <pre><code>select top 0 * into #tmp from T </code></pre> <p>After processing and filling in content into <code>#tmp</code>, I want to copy the content back to <code>T</code> like this: </p> <pre><code...
[ { "answer_id": 122655, "author": "Orion Adrian", "author_id": 7756, "author_profile": "https://Stackoverflow.com/users/7756", "pm_score": 4, "selected": false, "text": "<p>SET IDENTITY_INSERT ON</p>\n\n<p>INSERT command</p>\n\n<p>SET IDENTITY_INSERT OFF</p>\n" }, { "answer_id": 1...
2008/09/23
[ "https://Stackoverflow.com/questions/122639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10088/" ]
I have a temp table with the exact structure of a concrete table `T`. It was created like this: ``` select top 0 * into #tmp from T ``` After processing and filling in content into `#tmp`, I want to copy the content back to `T` like this: ``` insert into T select * from #tmp ``` This is okay as long as `T` does...
As identity will be generated during insert anyway, could you simply remove this column from #tmp before inserting the data back to T? ``` alter table #tmp drop column id ``` **UPD:** Here's an example I've tested in SQL Server 2008: ``` create table T(ID int identity(1,1) not null, Value nvarchar(50)) insert into ...
122,688
<p>We use BigIP to load balance between our two IIS servers. We recently deployed a WCF service hosted on by IIS 6 onto these two Windows Server 2003R2 servers.</p> <p>Each server is configured with two host headers: one for the load balancer address, and then a second host header that points only to that server. T...
[ { "answer_id": 122754, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 0, "selected": false, "text": "<p>The URL it uses is based on the bindings in IIS. Does the website have more than one binding? If it does, or is the WCF s...
2008/09/23
[ "https://Stackoverflow.com/questions/122688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13368/" ]
We use BigIP to load balance between our two IIS servers. We recently deployed a WCF service hosted on by IIS 6 onto these two Windows Server 2003R2 servers. Each server is configured with two host headers: one for the load balancer address, and then a second host header that points only to that server. That way we ca...
On your bigIP Create 2 new virtual servers <http://server1.domain.com/> <http://server2.domain.com/> create a pool for each VS with only the specific server in it - so there will be no actual load balancing and access it that way. If you are short on external IP'S you can still use the same IP as your production domai...
122,690
<p>I've been too lax with performing DB backups on our internal servers. </p> <p>Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript? </p>
[ { "answer_id": 122705, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 3, "selected": false, "text": "<p>Schedule the following to backup all Databases:</p>\n\n<pre><code>Use Master\n\nDeclare @ToExecute VarChar(8000)\n\nSele...
2008/09/23
[ "https://Stackoverflow.com/questions/122690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
I've been too lax with performing DB backups on our internal servers. Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript?
To backup a single database from the command line, use [osql](https://msdn.microsoft.com/en-us/library/ms162806.aspx) or [sqlcmd](https://msdn.microsoft.com/en-us/library/ms162773.aspx). ``` "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\osql.exe" -E -Q "BACKUP DATABASE mydatabase TO DISK='C:\tmp\db.bak' WI...
122,695
<p>For example, I have an ASP.NET form that is called by another aspx:</p> <pre><code>string url = "http://somewhere.com?P1=" + Request["param"]; Response.Write(url); </code></pre> <p>I want to do something like this:</p> <pre><code>string url = "http://somewhere.com?P1=" + Request["param"]; string str = GetResponse...
[ { "answer_id": 122707, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 3, "selected": false, "text": "<pre><code>WebClient client = new WebClient();\nstring response = client.DownloadString(url);\n</code></pre>\n" }, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20682/" ]
For example, I have an ASP.NET form that is called by another aspx: ``` string url = "http://somewhere.com?P1=" + Request["param"]; Response.Write(url); ``` I want to do something like this: ``` string url = "http://somewhere.com?P1=" + Request["param"]; string str = GetResponse(url); if (str...) {} ``` I need to...
Webclient.DownloadString() is probably want you want.
122,714
<p>When I try the following lookup in my code:</p> <pre><code>Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); return (DataSource) envCtx.lookup("jdbc/mydb"); </code></pre> <p>I get the following exception:</p> <pre><code>java.sql.SQLException: QueryResults: Unable...
[ { "answer_id": 122820, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 1, "selected": false, "text": "<p>java:comp/env is known as the Enterprise Naming Context (ENC) and is not globally visible. See <a href=\"http://www.infor...
2008/09/23
[ "https://Stackoverflow.com/questions/122714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5917/" ]
When I try the following lookup in my code: ``` Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); return (DataSource) envCtx.lookup("jdbc/mydb"); ``` I get the following exception: ``` java.sql.SQLException: QueryResults: Unable to initialize naming context: N...
Thanks for the response toolkit.... yes, I can access my datasource by going directly to java:jdbc/mydb, but I'm using an existing code base that connects via the ENC. Here's some interesting info that I've found out .... 1. The above code works with **JBoss 4.2.2.GA** and here's the JNDI ctx parameters being used: ...
122,728
<p>I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. <br></p> <p>It's not hard in Java to put together <code>WHERE</code> clause with conditions, but it's not nice. And on PL/SQL side I also...
[ { "answer_id": 122759, "author": "Kyle Burton", "author_id": 19784, "author_profile": "https://Stackoverflow.com/users/19784", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://openhms.sourceforge.net/sqlbuilder/\" rel=\"nofollow noreferrer\">SQLBuilder</a> might be useful t...
2008/09/23
[ "https://Stackoverflow.com/questions/122728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13114/" ]
I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. It's not hard in Java to put together `WHERE` clause with conditions, but it's not nice. And on PL/SQL side I also found out that the onl...
[SQLBuilder](http://openhms.sourceforge.net/sqlbuilder/) might be useful to you from the Java side. It allows you to write compile-time checked Java code that dynamically builds sql: ``` String selectQuery = (new SelectQuery()) .addColumns(t1Col1, t1Col2, t2Col1) .addJoin(SelectQuery.JoinType.INNER_JOIN, joinOfT...
122,736
<p>I have a stored procedure that consists of a single select query used to insert into another table based on some minor math that is done to the arguments in the procedure. Can I generate the plan used for this query by referencing the procedure somehow, or do I have to copy and paste the query and create bind varia...
[ { "answer_id": 122790, "author": "Jasmine", "author_id": 5255, "author_profile": "https://Stackoverflow.com/users/5255", "pm_score": 1, "selected": false, "text": "<p>From what I understand, this was done on purpose. The idea is that individual queries within the procedure are considered...
2008/09/23
[ "https://Stackoverflow.com/questions/122736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
I have a stored procedure that consists of a single select query used to insert into another table based on some minor math that is done to the arguments in the procedure. Can I generate the plan used for this query by referencing the procedure somehow, or do I have to copy and paste the query and create bind variables...
Use [SQL Trace and TKPROF](http://68.142.116.68/docs/cd/B19306_01/server.102/b14211/sqltrace.htm#i4640). For example, open SQL\*Plus, and then issue the following code:- ``` alter session set tracefile_identifier = 'something-unique' alter session set sql_trace = true; alter session set events '10046 trace name contex...
122,741
<p>OK, I have been working on a random image selector and queue system (so you don't see the same images too often).</p> <p>All was going swimmingly (as far as my crappy code does) <strong>until</strong> I got to the random bit. I wanted to test it, but how do you test for it? There is no <code>Debug.Assert(i.IsRandom)...
[ { "answer_id": 122765, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 0, "selected": false, "text": "<p>Random is Random. Even if the same picture shows up 4 times in a row, it could still be considered random.</p>\n" }, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
OK, I have been working on a random image selector and queue system (so you don't see the same images too often). All was going swimmingly (as far as my crappy code does) **until** I got to the random bit. I wanted to test it, but how do you test for it? There is no `Debug.Assert(i.IsRandom)` (sadly) :D So, I got my ...
Test from the requirement : "so you don't see the same images too often" Ask for 100 images. Did you see an image too often?
122,752
<p>I've seen <a href="https://stackoverflow.com/questions/55622/best-tools-for-working-with-docbook-xml-documents">Best tools for working with DocBook XML documents</a>, but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook?</p> <...
[ { "answer_id": 122791, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 2, "selected": false, "text": "<p>A popular approach is to use <a href=\"http://docbook.sourceforge.net/\" rel=\"nofollow noreferrer\">DocBook XSL Stylesheets<...
2008/09/23
[ "https://Stackoverflow.com/questions/122752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15168/" ]
I've seen [Best tools for working with DocBook XML documents](https://stackoverflow.com/questions/55622/best-tools-for-working-with-docbook-xml-documents), but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook? In Eric Raymond's ['...
I've been doing some manual writing with DocBook, under cygwin, to produce One Page HTML, Many Pages HTML, CHM and PDF. I installed the following: 1. The [docbook](http://www.docbook.org) stylesheets (xsl) repository. 2. xmllint, to test if the xml is correct. 3. xsltproc, to process the xml with the stylesheets. 4. ...
122,763
<p>I have a dict, that looks like this:</p> <pre><code>{ 'foo': { 'opt1': 1, 'opt2': 2, }, 'foo/bar': { 'opt3': 3, 'opt4': 4, }, 'foo/bar/baz': { 'opt5': 5, 'opt6': 6, } } </code></pre> <p>And I need to get it to look like:</p> <...
[ { "answer_id": 122785, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 4, "selected": true, "text": "<p>Like this:</p>\n\n<pre><code>def nest(d):\n rv = {}\n for key, value in d.iteritems():\n node = rv\n...
2008/09/23
[ "https://Stackoverflow.com/questions/122763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18866/" ]
I have a dict, that looks like this: ``` { 'foo': { 'opt1': 1, 'opt2': 2, }, 'foo/bar': { 'opt3': 3, 'opt4': 4, }, 'foo/bar/baz': { 'opt5': 5, 'opt6': 6, } } ``` And I need to get it to look like: ``` { 'foo': { 'opt...
Like this: ``` def nest(d): rv = {} for key, value in d.iteritems(): node = rv for part in key.split('/'): node = node.setdefault(part, {}) node.update(value) return rv ```
122,772
<p>When I try to display the contents of a LOB (large object) column in SQL*Plus, it is truncated. How do I display the whole thing?</p>
[ { "answer_id": 122776, "author": "Anonymoose", "author_id": 2391, "author_profile": "https://Stackoverflow.com/users/2391", "pm_score": 7, "selected": true, "text": "<pre><code>SQL&gt; set long 30000\nSQL&gt; show long\nlong 30000\n</code></pre>\n" }, { "answer_id": 7272671, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2391/" ]
When I try to display the contents of a LOB (large object) column in SQL\*Plus, it is truncated. How do I display the whole thing?
``` SQL> set long 30000 SQL> show long long 30000 ```
122,778
<p>Under VS's external tools settings there is a "Use Output Window" check box that captures the tools command line output and dumps it to a VS tab.</p> <p>The question is: <em>can I get the same processing for my program when I hit F5?</em></p> <p><strong>Edit:</strong> FWIW I'm in C# but if that makes a difference ...
[ { "answer_id": 122988, "author": "ScaleOvenStove", "author_id": 12268, "author_profile": "https://Stackoverflow.com/users/12268", "pm_score": 0, "selected": false, "text": "<p>System.Diagnostics.Debug.Writeline() or Trace.Writeline()</p>\n" }, { "answer_id": 122991, "author"...
2008/09/23
[ "https://Stackoverflow.com/questions/122778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
Under VS's external tools settings there is a "Use Output Window" check box that captures the tools command line output and dumps it to a VS tab. The question is: *can I get the same processing for my program when I hit F5?* **Edit:** FWIW I'm in C# but if that makes a difference to your answer then it's unlikely tha...
I'm going to make a few assumptions here. First, I presume that you are talking about printf output from an application (whether it be from a console app or from a windows GUI app). My second assumption is the C language. *To my knowledge, you cannot direct printf output to the output window in dev studio, not directl...
122,781
<p>I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great.</p> <p>When you are panning in this way and you are release, the page stops dead where you dropped it.</p> <p>I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone ...
[ { "answer_id": 122988, "author": "ScaleOvenStove", "author_id": 12268, "author_profile": "https://Stackoverflow.com/users/12268", "pm_score": 0, "selected": false, "text": "<p>System.Diagnostics.Debug.Writeline() or Trace.Writeline()</p>\n" }, { "answer_id": 122991, "author"...
2008/09/23
[ "https://Stackoverflow.com/questions/122781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15721/" ]
I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great. When you are panning in this way and you are release, the page stops dead where you dropped it. I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone UI, I guess. I'm n...
I'm going to make a few assumptions here. First, I presume that you are talking about printf output from an application (whether it be from a console app or from a windows GUI app). My second assumption is the C language. *To my knowledge, you cannot direct printf output to the output window in dev studio, not directl...
122,782
<p>I'm looking to have two versions of BOOST compiled into a project at the same time. Ideally they should be usable along these lines:</p> <pre><code>boost_1_36_0::boost::shared_ptr&lt;SomeClass&gt; someClass = new SomeClass(); boost_1_35_0::boost::regex expression("[0-9]", boost_1_35_0::boost::regex_constants::basi...
[ { "answer_id": 122801, "author": "Matt Price", "author_id": 852, "author_profile": "https://Stackoverflow.com/users/852", "pm_score": 0, "selected": false, "text": "<p>You'll have a world of trouble linking because the mangled names will be different. And yes, I see you knew that, but it...
2008/09/23
[ "https://Stackoverflow.com/questions/122782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701/" ]
I'm looking to have two versions of BOOST compiled into a project at the same time. Ideally they should be usable along these lines: ``` boost_1_36_0::boost::shared_ptr<SomeClass> someClass = new SomeClass(); boost_1_35_0::boost::regex expression("[0-9]", boost_1_35_0::boost::regex_constants::basic); ```
I read (well scanned) through the [development list discussion](http://thread.gmane.org/gmane.comp.lib.boost.devel/180008). There's no easy solution. To sum up: 1. Wrapping header files in a namespace declaration ``` namespace boost_1_36_0 { #include <boost_1_36_0/boost/regex.hpp> } namespace boost_1_35_0 { ...
122,799
<p>There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc.</p>
[ { "answer_id": 122894, "author": "Jose Vega", "author_id": 17162, "author_profile": "https://Stackoverflow.com/users/17162", "pm_score": 4, "selected": false, "text": "<p>I guess I will start you off with the time complexity of a linked list:<br></p>\n\n<p>Indexing---->O(n)<br>\nInsertin...
2008/09/23
[ "https://Stackoverflow.com/questions/122799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340748/" ]
There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc.
Information on this topic is now available on Wikipedia at: [Search data structure](http://en.wikipedia.org/wiki/Search_data_structure) ``` +----------------------+----------+------------+----------+--------------+ | | Insert | Delete | Search | Space Usage | +----------------------+-----...
122,815
<p>I'm looking for a groovy equivalent on .NET <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">http://boo.codehaus.org/</a></p> <p>So far Boo looks interesting, but it is statically typed, yet does include some of the metaprogramming features I'd be looking for.</p> <p>Can anyone comment on the experienc...
[ { "answer_id": 122894, "author": "Jose Vega", "author_id": 17162, "author_profile": "https://Stackoverflow.com/users/17162", "pm_score": 4, "selected": false, "text": "<p>I guess I will start you off with the time complexity of a linked list:<br></p>\n\n<p>Indexing---->O(n)<br>\nInsertin...
2008/09/23
[ "https://Stackoverflow.com/questions/122815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1129162/" ]
I'm looking for a groovy equivalent on .NET <http://boo.codehaus.org/> So far Boo looks interesting, but it is statically typed, yet does include some of the metaprogramming features I'd be looking for. Can anyone comment on the experience of using Boo and is it worth looking into for more than hobby purposes at a 1....
Information on this topic is now available on Wikipedia at: [Search data structure](http://en.wikipedia.org/wiki/Search_data_structure) ``` +----------------------+----------+------------+----------+--------------+ | | Insert | Delete | Search | Space Usage | +----------------------+-----...
122,821
<p>I've got a Sharepoint WebPart which loads a custom User Control. The user control contains a Repeater which in turn contains several LinkButtons. </p> <p>In the RenderContent call in the Webpart I've got some code to add event handlers:</p> <pre><code> ArrayList nextPages = new ArrayList(); //popula...
[ { "answer_id": 122842, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 1, "selected": false, "text": "<p>You need to make sure that the link button is re-added to the control tree and/or that the event is rewired up to the con...
2008/09/23
[ "https://Stackoverflow.com/questions/122821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21299/" ]
I've got a Sharepoint WebPart which loads a custom User Control. The user control contains a Repeater which in turn contains several LinkButtons. In the RenderContent call in the Webpart I've got some code to add event handlers: ``` ArrayList nextPages = new ArrayList(); //populate nextPages .... ...
By the time RenderContent() is called, all the registered event handlers have been called by the framework. You need to add the event handlers in an earlier method, like OnLoad(): ``` protected override void OnLoad(EventArge e) { base.OnLoad(e); EnsureChildControls(); var linkButtons = from c in AfterPageRepea...
122,834
<p>Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider and makes an http request to it (Provider.php?data="data"). In this situation, Provider quickly finds the answer, but to maintain the system must perform various updates throughout the database. Is there a w...
[ { "answer_id": 122897, "author": "Peter Olsson", "author_id": 2703, "author_profile": "https://Stackoverflow.com/users/2703", "pm_score": 2, "selected": false, "text": "<p>You can flush the output buffer with the flush() command.<br>\nRead the comments in the <a href=\"http://se.php.net/...
2008/09/23
[ "https://Stackoverflow.com/questions/122834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8880/" ]
Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider and makes an http request to it (Provider.php?data="data"). In this situation, Provider quickly finds the answer, but to maintain the system must perform various updates throughout the database. Is there a way ...
You basically want to signal the end of 1 process (return to the original `Requester.php`) and spawn a new process (finish `Provider.php`). There is probably a more elegant way to pull this off, but I've managed this a couple different ways. All of them basically result in exec-ing a command in order to shell off the s...
122,853
<p>I want to get the size of an http:/.../file before I download it. The file can be a webpage, image, or a media file. Can this be done with HTTP headers? How do I download just the file HTTP header?</p>
[ { "answer_id": 122874, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": "<blockquote>\n <p>Can this be done with HTTP headers?</p>\n</blockquote>\n\n<p>Yes, this is the way to go. <em>If</e...
2008/09/23
[ "https://Stackoverflow.com/questions/122853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to get the size of an http:/.../file before I download it. The file can be a webpage, image, or a media file. Can this be done with HTTP headers? How do I download just the file HTTP header?
Yes, assuming the HTTP server you're talking to supports/allows this: ``` public long GetFileSize(string url) { long result = -1; System.Net.WebRequest req = System.Net.WebRequest.Create(url); req.Method = "HEAD"; using (System.Net.WebResponse resp = req.GetResponse()) { if (long.TryParse(...
122,855
<p>Anyone know if it is possible to write an app that uses the Java Sound API on a system that doesn't actually have a hardware sound device?</p> <p>I have some code I've written based on the API that manipulates some audio and plays the result but I am now trying to run this in a server environment, where the audio w...
[ { "answer_id": 122874, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": "<blockquote>\n <p>Can this be done with HTTP headers?</p>\n</blockquote>\n\n<p>Yes, this is the way to go. <em>If</e...
2008/09/23
[ "https://Stackoverflow.com/questions/122855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8063/" ]
Anyone know if it is possible to write an app that uses the Java Sound API on a system that doesn't actually have a hardware sound device? I have some code I've written based on the API that manipulates some audio and plays the result but I am now trying to run this in a server environment, where the audio will be rec...
Yes, assuming the HTTP server you're talking to supports/allows this: ``` public long GetFileSize(string url) { long result = -1; System.Net.WebRequest req = System.Net.WebRequest.Create(url); req.Method = "HEAD"; using (System.Net.WebResponse resp = req.GetResponse()) { if (long.TryParse(...
122,857
<p>As a follow up to <a href="https://stackoverflow.com/questions/104224/how-do-you-troubleshoot-wpf-ui-problems">my previous question</a>, I am wondering how to use transparent windows correctly. If I have set my window to use transparency, the UI will occasionally appear to stop responding. What is actually happeni...
[ { "answer_id": 123026, "author": "Abe Heidebrecht", "author_id": 9268, "author_profile": "https://Stackoverflow.com/users/9268", "pm_score": 2, "selected": false, "text": "<p>Are you using .NET 3.0, or .NET 3.5 on Windows XP SP2? If so, this is a known problem with the transparent windo...
2008/09/23
[ "https://Stackoverflow.com/questions/122857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312/" ]
As a follow up to [my previous question](https://stackoverflow.com/questions/104224/how-do-you-troubleshoot-wpf-ui-problems), I am wondering how to use transparent windows correctly. If I have set my window to use transparency, the UI will occasionally appear to stop responding. What is actually happening is that the U...
I think that I've finally found a workaround. From everything I've read this problem should not be occurring with XP SP3 & .NET 3.5 SP1, but it is. The example from [this blog post](http://jerryclin.wordpress.com/2007/11/13/creating-non-rectangular-windows-with-interop/) shows how to use the Win32 API functions to cre...
122,865
<p>I have a <code>div</code> and an <code>iframe</code> on the page the <code>div</code> has</p> <pre><code>z-index: 0; </code></pre> <p>the <code>iframe</code> has its content with a popup having a <code>z-index</code> of 1000</p> <pre><code>z-index: 1000; </code></pre> <p>However, the <code>div</code> still overs...
[ { "answer_id": 123037, "author": "nathaniel", "author_id": 11947, "author_profile": "https://Stackoverflow.com/users/11947", "pm_score": 1, "selected": false, "text": "<p>Which version of IE?</p>\n\n<p>I'm no javascript guru, but I think hiding the div when the popup pops might accomplis...
2008/09/23
[ "https://Stackoverflow.com/questions/122865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2486/" ]
I have a `div` and an `iframe` on the page the `div` has ``` z-index: 0; ``` the `iframe` has its content with a popup having a `z-index` of 1000 ``` z-index: 1000; ``` However, the `div` still overshadows the popup in IE (but works fine in Firefox). Does anyone know what I can do?
[Explorer Z-index bug](http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html) In general, <http://www.quirksmode.org/> is an excellent reference for this sort of thing.
122,877
<p>So I've got some C code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; /* putting one of the "char*"s here causes a segfault */ void main() { char* path = "/temp"; char* temp; strcpy(temp, path); } </code></pre> <p>This compiles, runs, and behaves as it looks. However, if one or both of ...
[ { "answer_id": 122885, "author": "terminus", "author_id": 9232, "author_profile": "https://Stackoverflow.com/users/9232", "pm_score": 3, "selected": false, "text": "<p>You forgot to allocate and initialize temp:</p>\n\n<pre><code>temp = (char *)malloc(TEMP_SIZE);\n</code></pre>\n\n<p>Jus...
2008/09/23
[ "https://Stackoverflow.com/questions/122877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12926/" ]
So I've got some C code: ``` #include <stdio.h> #include <string.h> /* putting one of the "char*"s here causes a segfault */ void main() { char* path = "/temp"; char* temp; strcpy(temp, path); } ``` This compiles, runs, and behaves as it looks. However, if one or both of the character pointers is declared as ...
As other posters mentioned, the root of the problem is that temp is uninitialized. When declared as an automatic variable on the stack it will contain whatever garbage happens to be in that memory location. Apparently for the compiler+CPU+OS you are running, the garbage at that location is a valid pointer. The strcpy "...
122,882
<p>What is the proper technique to have <strong>ThreadA</strong> signal <strong>ThreadB</strong> of some event, without having <strong>ThreadB</strong> sit blocked waiting for an event to happen?</p> <p>i have a background thread that will be filling a shared List&lt;T&gt;. i'm trying to find a way to asynchronously s...
[ { "answer_id": 122953, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 1, "selected": false, "text": "<p>If you use a backgroundworker to start the second thread and use the ProgressChanged event to notify the other ...
2008/09/23
[ "https://Stackoverflow.com/questions/122882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
What is the proper technique to have **ThreadA** signal **ThreadB** of some event, without having **ThreadB** sit blocked waiting for an event to happen? i have a background thread that will be filling a shared List<T>. i'm trying to find a way to asynchronously signal the "main" thread that there is data available to...
Here's a code sample for the System.ComponentModel.BackgroundWorker class. ``` private static BackgroundWorker worker = new BackgroundWorker(); static void Main(string[] args) { worker.DoWork += worker_DoWork; worker.RunWorkerCompleted += worker_RunWorkerCompleted; worker.ProgressCh...
122,883
<p>Could someone please demystify interfaces for me or point me to some good examples? I keep seeing interfaces popup here and there, but I haven't ever really been exposed to good explanations of interfaces or when to use them.</p> <p>I am talking about interfaces in a context of interfaces vs. abstract classes.</p>
[ { "answer_id": 122926, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "<p>Interfaces are a way to enforce that an object implements a certain amount of functionality, without having to use inheri...
2008/09/23
[ "https://Stackoverflow.com/questions/122883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16820/" ]
Could someone please demystify interfaces for me or point me to some good examples? I keep seeing interfaces popup here and there, but I haven't ever really been exposed to good explanations of interfaces or when to use them. I am talking about interfaces in a context of interfaces vs. abstract classes.
Interfaces allow you to program against a "description" instead of a type, which allows you to more-loosely associate elements of your software. Think of it this way: You want to share data with someone in the cube next to you, so you pull out your flash stick and copy/paste. You walk next door and the guy says "is t...
122,909
<p>I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?</p>
[ { "answer_id": 123017, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 0, "selected": false, "text": "<p>Depends a bit on your environment. In Java you could do it something like this...</p>\n\n<pre><code>// Need as Oracl...
2008/09/23
[ "https://Stackoverflow.com/questions/122909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13693/" ]
I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?
To do it entirely in PL/SQL, the file would need to be on the server, located in a directory which you'd need to define in the database. Create the following objects: ``` CREATE OR REPLACE DIRECTORY BLOB_DIR AS '/oracle/base/lobs' / CREATE OR REPLACE PROCEDURE BLOB_LOAD AS lBlob BLOB; lFile BFI...
122,914
<p>Does anyone know any implementation of a templated cache of objects?</p> <ul> <li>You use a key to find object (the same as in std::map&lt;>)</li> <li>You specify a maximum number of objects that can be in the cache at the same time</li> <li>There are facilities to create an object not found in the cache</li> <li>T...
[ { "answer_id": 123715, "author": "jpinto3912", "author_id": 11567, "author_profile": "https://Stackoverflow.com/users/11567", "pm_score": -1, "selected": false, "text": "<p>In an application I can hardly imagine it would speed/boost up performance to store objects that apparently can be ...
2008/09/23
[ "https://Stackoverflow.com/questions/122914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18800/" ]
Does anyone know any implementation of a templated cache of objects? * You use a key to find object (the same as in std::map<>) * You specify a maximum number of objects that can be in the cache at the same time * There are facilities to create an object not found in the cache * There are facilities to know when an ob...
You can use the [Boost.MultiIndex](http://www.boost.org/doc/libs/1_60_0/libs/multi_index/doc/index.html) library. It is easy to implement a [MRU cache](http://www.boost.org/doc/libs/1_60_0/libs/multi_index/doc/examples.html#example9).
122,919
<p>I have this bit of javascript written with jQuery 1.2.5. It's contained inside the main function() of a plugin that I wrote. The plugin is a horizontal gallery scroller very similar to jCarousel. It does alot of auto calculating of widths and determines how many to scroll based on that and the size of the images,...
[ { "answer_id": 122995, "author": "Davide Vosti", "author_id": 1812, "author_profile": "https://Stackoverflow.com/users/1812", "pm_score": 1, "selected": false, "text": "<p>Since JavaScript functions calls are asyncronus, you can pass as a in parameter a callback function that's called wh...
2008/09/23
[ "https://Stackoverflow.com/questions/122919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13611/" ]
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the main function() of a plugin that I wrote. The plugin is a horizontal gallery scroller very similar to jCarousel. It does alot of auto calculating of widths and determines how many to scroll based on that and the size of the images, which...
Just use a global busy flag. When you enter your click handler, check it, and only proceed if it's false. Immediately set it to true, and then set it back to false when the animation ends. JavaScript is single-threaded, so there is no race condition to worry about. ``` var busy = false; $("...").onclick(function() { ...
122,920
<p>I'd like to line up items approximately like this:</p> <pre><code>item1 item2 i3 longitemname i4 longitemname2 anotheritem i5 </code></pre> <p>Basically items of varying length arranged in a table like structure. The tricky part is the container for these can vary in size and I'...
[ { "answer_id": 122952, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 0, "selected": false, "text": "<p>You could use block level elements floated left, but you will need some javascript to check the sizes, find the l...
2008/09/23
[ "https://Stackoverflow.com/questions/122920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
I'd like to line up items approximately like this: ``` item1 item2 i3 longitemname i4 longitemname2 anotheritem i5 ``` Basically items of varying length arranged in a table like structure. The tricky part is the container for these can vary in size and I'd like to fit as many as I...
This can be done using floated div's, calculating the max width, and setting all widths to the max. Here's jquery code to do it: html: ``` <div class="item">something</div> <div class="item">something else</div> ``` css: ``` div.item { float: left; } ``` jquery: ``` var max_width=0; $('div.item').each( function...
122,942
<p>I have a table <code>UserAliases</code> (<code>UserId, Alias</code>) with multiple aliases per user. I need to query it and return all aliases for a given user, the trick is to return them all in one column.</p> <p>Example:</p> <pre><code>UserId/Alias 1/MrX 1/MrY 1/MrA 2/Abc 2/Xyz </code></pre> <p>I wan...
[ { "answer_id": 122956, "author": "gehsekky", "author_id": 21310, "author_profile": "https://Stackoverflow.com/users/21310", "pm_score": 0, "selected": false, "text": "<p>group_concat() sounds like what you're looking for.</p>\n\n<p><a href=\"http://dev.mysql.com/doc/refman/5.0/en/group-b...
2008/09/23
[ "https://Stackoverflow.com/questions/122942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3661/" ]
I have a table `UserAliases` (`UserId, Alias`) with multiple aliases per user. I need to query it and return all aliases for a given user, the trick is to return them all in one column. Example: ``` UserId/Alias 1/MrX 1/MrY 1/MrA 2/Abc 2/Xyz ``` I want the query result in the following format: ``` UserId...
You can use a function with COALESCE. ``` CREATE FUNCTION [dbo].[GetAliasesById] ( @userID int ) RETURNS varchar(max) AS BEGIN declare @output varchar(max) select @output = COALESCE(@output + ', ', '') + alias from UserAliases where userid = @userID return @output END GO SELECT UserID, dbo.G...
122,951
<p>I received the following exception when I was using the Regex class with the regular expression: (?'named a'asdf)</p> <pre><code>System.ArgumentException: parsing \"(?'named a'asdf)\" - Invalid group name: Group names must begin with a word character. </code></pre> <p>What is the problem with my regular expression...
[ { "answer_id": 122973, "author": "Simon Johnson", "author_id": 854, "author_profile": "https://Stackoverflow.com/users/854", "pm_score": -1, "selected": false, "text": "<p>The problem is your quotes around the name of the named capture group. Try the string: (?&lt;Named&gt;asdf)</p>\n" ...
2008/09/23
[ "https://Stackoverflow.com/questions/122951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12834/" ]
I received the following exception when I was using the Regex class with the regular expression: (?'named a'asdf) ``` System.ArgumentException: parsing \"(?'named a'asdf)\" - Invalid group name: Group names must begin with a word character. ``` What is the problem with my regular expression?
The problem is the space in the name of the capture. Remove the space and it works fine. From the MSDN documentation: "The string used for name must not contain any punctuation and cannot begin with a number. You can use single quotes instead of angle brackets; for example, (?'name')." It does not matter if you use a...
122,990
<p>I have several sources of tables with personal data, like this:</p> <pre><code>SOURCE 1 ID, FIRST_NAME, LAST_NAME, FIELD1, ... 1, jhon, gates ... SOURCE 2 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 1, jon, gate ... SOURCE 3 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 2, jhon, ballmer ... </code></pre> <p>...
[ { "answer_id": 123001, "author": "ScaleOvenStove", "author_id": 12268, "author_profile": "https://Stackoverflow.com/users/12268", "pm_score": 2, "selected": false, "text": "<p>SSIS , try using the Fuzzy Lookup transformation</p>\n" }, { "answer_id": 123050, "author": "Mike Mc...
2008/09/23
[ "https://Stackoverflow.com/questions/122990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18300/" ]
I have several sources of tables with personal data, like this: ``` SOURCE 1 ID, FIRST_NAME, LAST_NAME, FIELD1, ... 1, jhon, gates ... SOURCE 2 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 1, jon, gate ... SOURCE 3 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 2, jhon, ballmer ... ``` So, assuming that records ...
The crux of the problem is to compute one or more measures of distance between each pair of entries and then consider them to be the same when one of the distances is less than a certain acceptable threshold. The key is to setup the analysis and then vary the acceptable distance until you reach what you consider to be ...
123,002
<p>So I've got maybe 10 objects each of which has 1-3 dependencies (which I think is ok as far as loose coupling is concerned) but also some settings that can be used to define behavior (timeout, window size, etc).</p> <p>Now before I started using an Inversion of Control container I would have created a factory and m...
[ { "answer_id": 123055, "author": "Rob Wells", "author_id": 2974, "author_profile": "https://Stackoverflow.com/users/2974", "pm_score": 1, "selected": false, "text": "<p>G'day George,</p>\n\n<p>First off, what are the dependencies between the objects?</p>\n\n<p>Lots of \"isa\" relationshi...
2008/09/23
[ "https://Stackoverflow.com/questions/123002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
So I've got maybe 10 objects each of which has 1-3 dependencies (which I think is ok as far as loose coupling is concerned) but also some settings that can be used to define behavior (timeout, window size, etc). Now before I started using an Inversion of Control container I would have created a factory and maybe even ...
The relationship between class complexity and the size of the IoC constructor had not occurred to me before reading this question, but my analysis below suggests that having many arguments in the IoC constructor is a [code smell](https://stackoverflow.com/questions/114342/what-are-code-smells-what-is-the-best-way-to-co...
123,003
<p>I need to determine the ID of a form field from within an action handler. The field is a part of a included facelets component and so the form will vary.</p> <p><strong>included.xhtml</strong> </p> <pre><code>&lt;ui:component&gt; &lt;h:inputText id="contained_field"/&gt; &lt;h:commandButton actionListener="#{b...
[ { "answer_id": 123208, "author": "jsight", "author_id": 1432, "author_profile": "https://Stackoverflow.com/users/1432", "pm_score": 4, "selected": true, "text": "<p>Bind the button to your backing bean, then use getParent() until you find the nearest form.</p>\n" }, { "answer_id"...
2008/09/23
[ "https://Stackoverflow.com/questions/123003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
I need to determine the ID of a form field from within an action handler. The field is a part of a included facelets component and so the form will vary. **included.xhtml** ``` <ui:component> <h:inputText id="contained_field"/> <h:commandButton actionListener="#{backingBean.update}" value="Submit"/> </ui:compone...
Bind the button to your backing bean, then use getParent() until you find the nearest form.
123,007
<p>I can't quite figure this out. Microsoft Access 2000, on the report total section I have totals for three columns that are just numbers. These <code>=Sum[(ThisColumn1)], 2, 3</code>, etc and those grand totls all work fine. </p> <p>I want to have another column that says <code>=Sum([ThisColumn1])+Sum([ThisColumn2]...
[ { "answer_id": 123022, "author": "Gordon Bell", "author_id": 16473, "author_profile": "https://Stackoverflow.com/users/16473", "pm_score": 3, "selected": true, "text": "<p>Give the 3 Grand Totals meaningful Control Names and then for the Grand Grand Total use:</p>\n\n<pre><code>=[GrandTo...
2008/09/23
[ "https://Stackoverflow.com/questions/123007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I can't quite figure this out. Microsoft Access 2000, on the report total section I have totals for three columns that are just numbers. These `=Sum[(ThisColumn1)], 2, 3`, etc and those grand totls all work fine. I want to have another column that says `=Sum([ThisColumn1])+Sum([ThisColumn2]) + Sum([ThisColumn3])` but...
Give the 3 Grand Totals meaningful Control Names and then for the Grand Grand Total use: ``` =[GrandTotal1] + [GrandTotal2] + [GrandTotal3] ``` Your Grand Total formulas should be something like: ``` =Sum(Nz([ThisColumn1], 0)) ```
123,075
<p>How to do paging in Pervasive SQL (version 9.1)? I need to do something similar like:</p> <pre><code>//MySQL SELECT foo FROM table LIMIT 10, 10 </code></pre> <p>But I can't find a way to define offset.</p>
[ { "answer_id": 123168, "author": "Jasmine", "author_id": 5255, "author_profile": "https://Stackoverflow.com/users/5255", "pm_score": 0, "selected": false, "text": "<p>I face this problem in MS Sql too... no Limit or rownumber functions. What I do is insert the keys for my final query res...
2008/09/23
[ "https://Stackoverflow.com/questions/123075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5468/" ]
How to do paging in Pervasive SQL (version 9.1)? I need to do something similar like: ``` //MySQL SELECT foo FROM table LIMIT 10, 10 ``` But I can't find a way to define offset.
I ended up doing the paging in code. I just skip the first records in loop. I thought I made up an easy way for doing the paging, but it seems that pervasive sql doesn't allow order clauses in subqueries. But this should work on other DBs (I tested it on firebird) ``` select * from (select top [rows] * from (select ...
123,078
<p>On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy operation if I note that doing so would place the database in a invalid state? There are no validation callbacks on a destroy operation, so how does...
[ { "answer_id": 123190, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 7, "selected": true, "text": "<p>You can raise an exception which you then catch. Rails wraps deletes in a transaction, which helps matters.</p>\n\...
2008/09/23
[ "https://Stackoverflow.com/questions/123078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21317/" ]
On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy operation if I note that doing so would place the database in a invalid state? There are no validation callbacks on a destroy operation, so how does on...
You can raise an exception which you then catch. Rails wraps deletes in a transaction, which helps matters. For example: ``` class Booking < ActiveRecord::Base has_many :booking_payments .... def destroy raise "Cannot delete booking with payments" unless booking_payments.count == 0 # ... ok, go ahead ...
123,088
<p><strong>C#6 Update</strong></p> <p>In <a href="https://msdn.microsoft.com/en-us/magazine/dn802602.aspx" rel="nofollow noreferrer">C#6 <code>?.</code> is now a language feature</a>:</p> <pre><code>// C#1-5 propertyValue1 = myObject != null ? myObject.StringProperty : null; // C#6 propertyValue1 = myObject?.String...
[ { "answer_id": 123140, "author": "Swati", "author_id": 12682, "author_profile": "https://Stackoverflow.com/users/12682", "pm_score": 0, "selected": false, "text": "<p>Personally, even after all your explanation, I can't remember how the heck this works:</p>\n\n<pre><code>if( obj1.NullCom...
2008/09/23
[ "https://Stackoverflow.com/questions/123088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
**C#6 Update** In [C#6 `?.` is now a language feature](https://msdn.microsoft.com/en-us/magazine/dn802602.aspx): ``` // C#1-5 propertyValue1 = myObject != null ? myObject.StringProperty : null; // C#6 propertyValue1 = myObject?.StringProperty; ``` The question below still applies to older versions, but if develop...
We independently came up with the exact same extension method name and implementation: [Null-propagating extension method](http://code.logos.com/blog/2008/01/nullpropagating_extension_meth.html). So we don't think it's confusing or an abuse of extension methods. I would write your "multiple levels" example with chaini...
123,111
<p>I recently moved my website to a shared hosting solution at <a href="http://asmallorange.com" rel="nofollow noreferrer">asmallorange.com</a>, but I had to set my domain to use their provided nameservers in order for the site to properly resolve. I was determined to keep control of the domain's DNS but I could find ...
[ { "answer_id": 123133, "author": "cjm", "author_id": 8355, "author_profile": "https://Stackoverflow.com/users/8355", "pm_score": 4, "selected": true, "text": "<p>Nothing. DNS simply maps topleveldomain.com to server.sharedhost.com. It's the webserver which looks at the <code>Host: topl...
2008/09/23
[ "https://Stackoverflow.com/questions/123111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339/" ]
I recently moved my website to a shared hosting solution at [asmallorange.com](http://asmallorange.com), but I had to set my domain to use their provided nameservers in order for the site to properly resolve. I was determined to keep control of the domain's DNS but I could find no way to make my top level domain resolv...
Nothing. DNS simply maps topleveldomain.com to server.sharedhost.com. It's the webserver which looks at the `Host: topleveldomain.com` header and knows that's equivalent to server.sharedhost.com/~username.
123,127
<p>I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is:</p> <pre><code> &lt;junit fork="yes" forkmode="once" printsummary="off"&gt; &lt;classpath refid="test.classpath"/&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;batchte...
[ { "answer_id": 123169, "author": "Eric Asberry", "author_id": 20437, "author_profile": "https://Stackoverflow.com/users/20437", "pm_score": 1, "selected": false, "text": "<p>Difficult to tell with that information. First thing I would do is look at the test results and determine if all ...
2008/09/23
[ "https://Stackoverflow.com/questions/123127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is: ``` <junit fork="yes" forkmode="once" printsummary="off"> <classpath refid="test.classpath"/> <formatter type="brief" usefile="false"/> <batchtest todir="${test.results.dir}/xml">...
Here's a blind guess: try increasing the maximum heap size available to the forked VM by using a nested `<jvmarg>` tag to set the `-Xmx` option.