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 |
|---|---|---|---|---|---|---|
49,267 | <p>Embedded custom-tag in dynamic content (nested tag) not rendering.</p>
<p>I have a page that pulls dynamic content from a javabean and passes the list of objects to a custom tag for processing into html. Within each object is a bunch of html to be output that contains a second custom tag that I would like to also b... | [
{
"answer_id": 49410,
"author": "Georgy Bolyuba",
"author_id": 4052,
"author_profile": "https://Stackoverflow.com/users/4052",
"pm_score": 2,
"selected": true,
"text": "<p>Just using </p>\n\n<pre><code><bodycontent>JSP</bodycontent>\n</code></pre>\n\n<p>is not enough. You sho... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3431280/"
] | Embedded custom-tag in dynamic content (nested tag) not rendering.
I have a page that pulls dynamic content from a javabean and passes the list of objects to a custom tag for processing into html. Within each object is a bunch of html to be output that contains a second custom tag that I would like to also be rendered... | Just using
```
<bodycontent>JSP</bodycontent>
```
is not enough. You should do soimething like
```
JspFragment body = getJspBody();
StringWriter stringWriter = new StringWriter();
StringBuffer buff = stringWriter.getBuffer();
buff.append("<h1>");
body.invoke(stringWriter);
buff.append("</h1>");
out.println(... |
49,269 | <p>I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors and I want to add a button for reverting to default color settings. How can I read the default settings?</p>
<p>For example:</p>
<ol>
<li>I ha... | [
{
"answer_id": 49288,
"author": "jfs",
"author_id": 718,
"author_profile": "https://Stackoverflow.com/users/718",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>How do I go back to Color.White?</p>\n</blockquote>\n\n<p>Two ways you can do:</p>\n\n<ul>\n<li>Save a copy of t... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/976/"
] | I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors and I want to add a button for reverting to default color settings. How can I read the default settings?
For example:
1. I have a user setting na... | @ozgur,
```
Settings.Default.Properties["property"].DefaultValue // initial value from config file
```
Example:
```
string foo = Settings.Default.Foo; // Foo = "Foo" by default
Settings.Default.Foo = "Boo";
Settings.Default.Save();
string modifiedValue = Settings.Default.Foo; // modifiedValue = "Boo"
string origina... |
49,274 | <p>I have a string, say <code>'123'</code>, and I want to convert it to the integer <code>123</code>.</p>
<p>I know you can simply do <code>some_string.to_i</code>, but that converts <code>'lolipops'</code> to <code>0</code>, which is not the effect I have in mind. I want it to blow up in my face when I try to convert... | [
{
"answer_id": 49282,
"author": "Slartibartfast",
"author_id": 4433,
"author_profile": "https://Stackoverflow.com/users/4433",
"pm_score": 9,
"selected": true,
"text": "<p>Ruby has this functionality built in:</p>\n\n<pre><code>Integer('1001') # => 1... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2018/"
] | I have a string, say `'123'`, and I want to convert it to the integer `123`.
I know you can simply do `some_string.to_i`, but that converts `'lolipops'` to `0`, which is not the effect I have in mind. I want it to blow up in my face when I try to convert something invalid, with a nice and painful `Exception`. Otherwis... | Ruby has this functionality built in:
```
Integer('1001') # => 1001
Integer('1001 nights')
# ArgumentError: invalid value for Integer: "1001 nights"
```
As noted in answer by [Joseph Pecoraro](https://stackoverflow.com/questions/49274/safe-integer-parsing-in-ruby/53359#53359)... |
49,284 | <p>I've come across a rather interesing (and frustrating) problem with IE6. We are serving up some server generated pdfs and then simply setting headers in PHP to force a browser download of the file. Works fine and all, except in IE6 but <strong>only</strong> if the windows user account is set to standard user (ie. no... | [
{
"answer_id": 49306,
"author": "Stu Thompson",
"author_id": 2961,
"author_profile": "https://Stackoverflow.com/users/2961",
"pm_score": 1,
"selected": false,
"text": "<p>I have had the exact same problem about a year ago, and after much googling and research, my headers (from Java code)... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3196/"
] | I've come across a rather interesing (and frustrating) problem with IE6. We are serving up some server generated pdfs and then simply setting headers in PHP to force a browser download of the file. Works fine and all, except in IE6 but **only** if the windows user account is set to standard user (ie. not administrator)... | some versions of IE seem to take
```
header( 'Expires: 0' );
header( 'Cache-Control: must-revalidate, pre-check=0, post-check=0' );
```
way too seriously and remove the downloaded content before it's passed to the plugin to display it.
Remove these two and you should be fine.
And make sure you are not using any s... |
49,302 | <p>We have some legacy code that needs to identify in the Page_Load which event caused the postback.
At the moment this is implemented by checking the Request data like this...</p>
<p>if (Request.Form["__EVENTTARGET"] != null<br>
&& (Request.Form["__EVENTTARGET"].IndexOf("BaseGrid") > -1 // BaseGrid event ( e.... | [
{
"answer_id": 49311,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 4,
"selected": true,
"text": "<p>This should get you the control that caused the postback:</p>\n\n<pre><code>public static Control GetPostBackControl(Page page... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127460/"
] | We have some legacy code that needs to identify in the Page\_Load which event caused the postback.
At the moment this is implemented by checking the Request data like this...
if (Request.Form["\_\_EVENTTARGET"] != null
&& (Request.Form["\_\_EVENTTARGET"].IndexOf("BaseGrid") > -1 // BaseGrid event ( e.g. sort)
... | This should get you the control that caused the postback:
```
public static Control GetPostBackControl(Page page)
{
Control control = null;
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if (ctrlname != null && ctrlname != string.Empty)
{
control = page.FindControl(ctrlname);
... |
49,307 | <p>Using the <code>zip</code> function, Python allows for loops to traverse multiple sequences in parallel. </p>
<p><code>for (x,y) in zip(List1, List2):</code></p>
<p>Does MATLAB have an equivalent syntax? If not, what is the best way to iterate over two parallel arrays at the same time using MATLAB?</p>
| [
{
"answer_id": 49514,
"author": "sven",
"author_id": 46,
"author_profile": "https://Stackoverflow.com/users/46",
"pm_score": 3,
"selected": false,
"text": "<p>If I'm not mistaken the zip function you use in python <a href=\"http://groups.google.com/group/comp.lang.python/browse_thread/th... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5148/"
] | Using the `zip` function, Python allows for loops to traverse multiple sequences in parallel.
`for (x,y) in zip(List1, List2):`
Does MATLAB have an equivalent syntax? If not, what is the best way to iterate over two parallel arrays at the same time using MATLAB? | If x and y are column vectors, you can do:
```
for i=[x';y']
# do stuff with i(1) and i(2)
end
```
(with row vectors, just use `x` and `y`).
Here is an example run:
```matlab
>> x=[1 ; 2; 3;]
x =
1
2
3
>> y=[10 ; 20; 30;]
y =
10
20
30
>> for i=[x';y']
disp(['size of i = ' num2str(s... |
49,334 | <p>In my database, I have an entity table (let's call it Entity). Each entity can have a number of entity types, and the set of entity types is static. Therefore, there is a connecting table that contains rows of the entity id and the name of the entity type. In my code, EntityType is an enum, and Entity is a Hibernate... | [
{
"answer_id": 50402,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 0,
"selected": false,
"text": "<p>Is your relationship bidirectional, i.e., does <code>EntityType</code> have an <code>Entity</code> property? If so, you c... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2819/"
] | In my database, I have an entity table (let's call it Entity). Each entity can have a number of entity types, and the set of entity types is static. Therefore, there is a connecting table that contains rows of the entity id and the name of the entity type. In my code, EntityType is an enum, and Entity is a Hibernate-ma... | HQL:
```
select entity from Entity entity where :type = some elements(entity.types)
```
I think that you can also write it like:
```
select entity from Entity entity where :type in(entity.types)
``` |
49,346 | <p>Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?</p>
<p>I know that marking it as disabled works but then it gets displayed differently (greyed out).</p>
<p>... | [
{
"answer_id": 49358,
"author": "Jon Limjap",
"author_id": 372,
"author_profile": "https://Stackoverflow.com/users/372",
"pm_score": 2,
"selected": false,
"text": "<p>If you merely want to modify the appearance of the link so as not to look like a link, you can set the CSS for your \"a\"... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127460/"
] | Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?
I know that marking it as disabled works but then it gets displayed differently (greyed out).
To clarify my poi... | This sounds like a job for JQuery. Just give a specific class name to all of the HyperLink controls that you want the URLs removed and then apply the following JQuery snippet to the bottom of your page:
```
$(document).ready(function() {
$('a.NoLink').removeAttr('href')
});
```
All of the HyperLink controls with... |
49,350 | <p>What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?</p>
<p>Some details:</p>
<ul>
<li><p>I am looking for solution for the entire page.</p></li>
<li><p>You need to specify only width of the element to be centered. Height of the element is not k... | [
{
"answer_id": 49353,
"author": "Oleksandr Yanovets",
"author_id": 5139,
"author_profile": "https://Stackoverflow.com/users/5139",
"pm_score": 2,
"selected": false,
"text": "<pre><code><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5139/"
] | What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?
Some details:
* I am looking for solution for the entire page.
* You need to specify only width of the element to be centered. Height of the element is not known in design time.
* When minimizing... | ```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Centering</title>
<style type="text/css" media="screen">
body, html {height: 100%; padding: 0px; margin: 0px;}
#outer {width: 100%; height: 10... |
49,356 | <p>We have the standard Subversion trunk/branches/tags layout. We have several branches for medium- and long-term projects, but none so far for a release. This is approaching fast.</p>
<p>Should we:</p>
<ol>
<li>Mix release branches and project branches together?</li>
<li>Create a releases folder? If so, is there a b... | [
{
"answer_id": 49366,
"author": "Polsonby",
"author_id": 137,
"author_profile": "https://Stackoverflow.com/users/137",
"pm_score": -1,
"selected": false,
"text": "<p>Releases is the same as tags... Have you got multiple projects inside your trunk? In that case, I would copy the same fold... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3984/"
] | We have the standard Subversion trunk/branches/tags layout. We have several branches for medium- and long-term projects, but none so far for a release. This is approaching fast.
Should we:
1. Mix release branches and project branches together?
2. Create a releases folder? If so, is there a better name than releases?
... | I recommend the following layout, for two reasons:
- all stuff related to a given project is within the same part of the tree; makes
it easier for people to grasp
- permissions handling may be easier this way
And by the way: It's a good idea with few repositories, instead of many, because change history normally is... |
49,368 | <p><a href="http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors" rel="noreferrer">CSS Attribute selectors</a> allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly th... | [
{
"answer_id": 49373,
"author": "Antti Kissaniemi",
"author_id": 2948,
"author_profile": "https://Stackoverflow.com/users/2948",
"pm_score": 6,
"selected": true,
"text": "<p>As for CSS 2.1, see <a href=\"http://www.w3.org/TR/CSS21/selector.html#attribute-selectors\" rel=\"noreferrer\">ht... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1968/"
] | [CSS Attribute selectors](http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors) allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly that I was able to use them to ad... | As for CSS 2.1, see <http://www.w3.org/TR/CSS21/selector.html#attribute-selectors>
Executive summary:
```
Attribute selectors may match in four ways:
[att]
Match when the element sets the "att" attribute, whatever the value of the attribute.
[att=val]
Match when the element's "att" attribute val... |
49,402 | <p>Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order.</p>
<p>Example:<br>
1) Launch a server application by calling an exe with parameters.<br>
2) Wait for the server to become initialized (or a fixed amount of time).<br>
3) Launch client application by calli... | [
{
"answer_id": 49520,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 0,
"selected": false,
"text": "<p>To wait 10 seconds between launching the applications, try</p>\n\n<pre><code>launch-server-application serverparam1 s... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5085/"
] | Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order.
Example:
1) Launch a server application by calling an exe with parameters.
2) Wait for the server to become initialized (or a fixed amount of time).
3) Launch client application by calling an exe wit... | Remember that PowerShell can access .Net objects. The Start-Sleep as suggested by [Blair Conrad](https://stackoverflow.com/questions/49402/creating-batch-jobs-in-powershell#49520) can be replaced by a call to [WaitForInputIdle](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.waitforinputidle.aspx) of... |
49,403 | <p>I have a filename in a format like:</p>
<blockquote>
<p><code>system-source-yyyymmdd.dat</code></p>
</blockquote>
<p>I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.</p>
| [
{
"answer_id": 49406,
"author": "David",
"author_id": 381,
"author_profile": "https://Stackoverflow.com/users/381",
"pm_score": 3,
"selected": false,
"text": "<p>Use the <code>cut</code> command.</p>\n\n<p>e.g.</p>\n\n<pre><code>echo \"system-source-yyyymmdd.dat\" | cut -f1 -d'-'\n</code... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003/"
] | I have a filename in a format like:
>
> `system-source-yyyymmdd.dat`
>
>
>
I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter. | You can use the [cut command](http://en.wikipedia.org/wiki/Cut_(Unix)) to get at each of the 3 'fields', e.g.:
```
$ echo "system-source-yyyymmdd.dat" | cut -d'-' -f2
source
```
"-d" specifies the delimiter, "-f" specifies the number of the field you require |
49,404 | <p>I have a table containing prices for a lot of different "things" in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times.</p>
<pre><code>ID uniqueidentifier not null,
ThingID int NOT NULL,
PriceDateTime datetime NOT NULL,
Price decimal(1... | [
{
"answer_id": 49414,
"author": "BlaM",
"author_id": 999,
"author_profile": "https://Stackoverflow.com/users/999",
"pm_score": 5,
"selected": true,
"text": "<p>I think the only solution with your table structure is to work with a subquery:</p>\n\n<pre><code>SELECT *\n FROM Thing\n WH... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008/"
] | I have a table containing prices for a lot of different "things" in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times.
```
ID uniqueidentifier not null,
ThingID int NOT NULL,
PriceDateTime datetime NOT NULL,
Price decimal(18,4) NOT NULL
... | I think the only solution with your table structure is to work with a subquery:
```
SELECT *
FROM Thing
WHERE ID IN (SELECT max(ID) FROM Thing
WHERE ThingID IN (1,2,3,4)
GROUP BY ThingID)
```
(Given the highest ID also means the newest price)
However I suggest you add a ... |
49,430 | <p>I have just started working with the <code>AnimationExtender</code>. I am using it to show a new div with a list gathered from a database when a button is pressed. The problem is the button needs to do a postback to get this list as I don't want to make the call to the database unless it's needed. The postback ho... | [
{
"answer_id": 57774,
"author": "Andrew Johnson",
"author_id": 5109,
"author_profile": "https://Stackoverflow.com/users/5109",
"pm_score": 2,
"selected": true,
"text": "<p>The flow you are seeing is something like this:</p>\n\n<ol>\n<li>Click on button</li>\n<li>AnimationExtender catches... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5170/"
] | I have just started working with the `AnimationExtender`. I am using it to show a new div with a list gathered from a database when a button is pressed. The problem is the button needs to do a postback to get this list as I don't want to make the call to the database unless it's needed. The postback however stops the a... | The flow you are seeing is something like this:
1. Click on button
2. AnimationExtender catches action and call clickOn callback
3. linkPostback starts asynchronous request for page and then returns flow to AnimationExtender
4. Animation begins
5. pageRequest returns and calls playAnimation, which starts the animation... |
49,461 | <p>Is there a C# equivalent for the VB.NET <code>FormatNumber</code> function? </p>
<p>I.e.:</p>
<pre><code>JSArrayString += "^" + (String)FormatNumber(inv.RRP * oCountry.ExchangeRate, 2);
</code></pre>
| [
{
"answer_id": 49476,
"author": "d91-jal",
"author_id": 5085,
"author_profile": "https://Stackoverflow.com/users/5085",
"pm_score": 1,
"selected": false,
"text": "<p>You can use string formatters to accomplish the same thing.</p>\n\n<pre><code>double MyNumber = inv.RRP * oCountry.Exchang... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1583/"
] | Is there a C# equivalent for the VB.NET `FormatNumber` function?
I.e.:
```
JSArrayString += "^" + (String)FormatNumber(inv.RRP * oCountry.ExchangeRate, 2);
``` | In both C# and VB.NET you can use either the [.ToString()](http://www.java2s.com/Code/CSharp/Development-Class/UseToStringtoformatvalues.htm) function or the [String.Format()](http://www.java2s.com/Code/CSharp/Development-Class/UseStringFormattoformatavalue.htm) method to format the text.
Using the .ToString() method... |
49,473 | <p>Is <a href="http://bouncycastle.org/java.html" rel="nofollow noreferrer">Bouncy Castle API</a> Thread Safe ? Especially,</p>
<pre><code>org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
org.bouncycastle.crypto.paddings.PKCS7Padding
org.bouncycastle.crypto.engines.AESFastEngine
org.bouncycastle.crypto.modes... | [
{
"answer_id": 49498,
"author": "Tnilsson",
"author_id": 4165,
"author_profile": "https://Stackoverflow.com/users/4165",
"pm_score": 5,
"selected": true,
"text": "<p>It really does not matter if the API/Code is thread safe. CBC encryption in itself is not thread safe. \nSome terminology ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959/"
] | Is [Bouncy Castle API](http://bouncycastle.org/java.html) Thread Safe ? Especially,
```
org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
org.bouncycastle.crypto.paddings.PKCS7Padding
org.bouncycastle.crypto.engines.AESFastEngine
org.bouncycastle.crypto.modes.CBCBlockCipher
```
I am planning to write a sing... | It really does not matter if the API/Code is thread safe. CBC encryption in itself is not thread safe.
Some terminology -
```
E(X) = Enctrypt message X
D(X) = Dectrypt X. (Note that D(E(X)) = X)
IV = Initialization vector. A random sequence to bootstrap the CBC algorithm
CBC = Cipher block chaining.
```
A really si... |
49,478 | <p>Which files should I include in <code>.gitignore</code> when using <em>Git</em> in conjunction with <em>Xcode</em>?</p>
| [
{
"answer_id": 49488,
"author": "Hagelin",
"author_id": 5156,
"author_profile": "https://Stackoverflow.com/users/5156",
"pm_score": 8,
"selected": false,
"text": "<p>Based on <a href=\"http://boredzo.org/blog/archives/2008-03-20/hgignore-for-mac-os-x-applications\" rel=\"noreferrer\" tit... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5156/"
] | Which files should I include in `.gitignore` when using *Git* in conjunction with *Xcode*? | I was previously using the top-voted answer, but it needs a bit of cleanup, so here it is redone for Xcode 4, with some improvements.
I've researched *every* file in this list, but several of them do not exist in Apple's official Xcode documentation, so I had to go on Apple mailing lists.
Apple continues to add undoc... |
49,500 | <p>I'm trying to redirect requests for a wildcard domain to a sub-directory.<br />
ie. <code>something.blah.example.com</code> --> <code>blah.example.com/something</code></p>
<p>I don't know how to get the subdomain name to use in the rewrite rule.</p>
<p><strong>Final Solution:</strong></p>
<pre><code>RewriteCond %... | [
{
"answer_id": 49504,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 6,
"selected": true,
"text": "<p>You should have a look at the <a href=\"http://httpd.apache.org/docs/2.2/rewrite/\" rel=\"noreferrer\" title=\"URL Rewriting ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428/"
] | I'm trying to redirect requests for a wildcard domain to a sub-directory.
ie. `something.blah.example.com` --> `blah.example.com/something`
I don't know how to get the subdomain name to use in the rewrite rule.
**Final Solution:**
```
RewriteCond %{HTTP_HOST} !^blah\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)... | You should have a look at the [URL Rewriting Guide](http://httpd.apache.org/docs/2.2/rewrite/ "URL Rewriting Guide") from the apache documentation.
The following is untested, but it should to the trick:
```
RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$
RewriteRule ^/(.*)$ http://blah.domain.com/%1/$... |
49,507 | <p>The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/I... | [
{
"answer_id": 49518,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 1,
"selected": false,
"text": "<p>Basically, once the TcpClient.Connect method has been successful, it will have created a mapping between the physical MA... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1898/"
] | The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/IP m... | Try using a Socket for your client instead of the TcpClient Class.
Then you can use Socket.Bind to target your local network adapter
```
int port = 1234;
IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName());
//find ip address for your adapter here
IPAddress localAddress = entry.AddressList.FirstO... |
49,510 | <p>How do you set your Cocoa application as the default web browser?</p>
<p>I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.).</p>
| [
{
"answer_id": 49512,
"author": "georgebrock",
"author_id": 5168,
"author_profile": "https://Stackoverflow.com/users/5168",
"pm_score": 7,
"selected": true,
"text": "<p>There are four steps to making an app that can act as the default web browser. The first three steps allow your app to ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5168/"
] | How do you set your Cocoa application as the default web browser?
I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.). | There are four steps to making an app that can act as the default web browser. The first three steps allow your app to act as a role handler for the relevant URL schemes (HTTP and HTTPS) and the final step makes it the default role handler for those schemes.
**1) Add the URL schemes your app can handle to your applica... |
49,511 | <p>I have played with the idea of using a wiki (MediaWiki) to centralize all project information for a development project. This was done using extensions that pull information from SVN (using <a href="http://svnkit.com/" rel="nofollow noreferrer">SVNKit</a>) and by linking to Bugzilla to extract work assigned to a de... | [
{
"answer_id": 49523,
"author": "Andreas Kraft",
"author_id": 4799,
"author_profile": "https://Stackoverflow.com/users/4799",
"pm_score": 3,
"selected": true,
"text": "<p>I think this would be extremly useful. Depending on the size of a project team members come and go. And a wiki is a g... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2939/"
] | I have played with the idea of using a wiki (MediaWiki) to centralize all project information for a development project. This was done using extensions that pull information from SVN (using [SVNKit](http://svnkit.com/)) and by linking to Bugzilla to extract work assigned to a developer or work remaining for a release.
... | I think this would be extremly useful. Depending on the size of a project team members come and go. And a wiki is a good tool to keep the history and the "spirit" of a project available to new team members. I did that in many projects, and though the projects were already finished, all the informations are available.
... |
49,536 | <p>You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:</p>
<pre><code># THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE #
# ^ ... | [
{
"answer_id": 49538,
"author": "Jordi Bunster",
"author_id": 4272,
"author_profile": "https://Stackoverflow.com/users/4272",
"pm_score": 2,
"selected": false,
"text": "<p>Make it a <code><p></code> with <code>text-align: justify</code> ?</p>\n\n<p><strong>Update</strong>: Nevermin... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3377/"
] | You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:
```
# THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE #
# ^ ^ #
```
... | ### Modern Approach - [Flexboxes](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes)!
Now that [CSS3 flexboxes](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes) have [better browser support](http://caniuse.com/#feat=flexbox), some of us can finally start using them. Just add a... |
49,547 | <p>Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner.</p>
<p>For security reasons we do not want certain pages in our application to be cached, <strong>ever,</strong> by the web browser. This must work for at least the following browsers:</p>
<ul>
<li>Interne... | [
{
"answer_id": 49548,
"author": "Anders Sandvig",
"author_id": 1709,
"author_profile": "https://Stackoverflow.com/users/1709",
"pm_score": 3,
"selected": false,
"text": "<p>Setting the modified http header to some date in 1995 usually does the trick.</p>\n\n<p>Here's an example:</p>\n\n<... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5182/"
] | Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner.
For security reasons we do not want certain pages in our application to be cached, **ever,** by the web browser. This must work for at least the following browsers:
* Internet Explorer 6+
* Firefox 1.5+
* Saf... | Introduction
============
The correct minimum set of headers that works across all mentioned clients (and proxies):
```
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
```
The [`Cache-Control`](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) is per the HTTP 1.1 spec fo... |
49,562 | <p>I think this is a fun engineering-level question.</p>
<p>I need to design a control which displays a line chart. What I want to be able to do is use a designer to add multiple <code>Pens</code> which actually describe the data and presentation so that it ends up with Xaml something along these lines:</p>
<pre><co... | [
{
"answer_id": 51997,
"author": "NotDan",
"author_id": 3291,
"author_profile": "https://Stackoverflow.com/users/3291",
"pm_score": 0,
"selected": false,
"text": "<p>Another option is to extend Canvas for the chart and extend Shape for the Pens. Then dynamically draw the shape based on t... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93/"
] | I think this is a fun engineering-level question.
I need to design a control which displays a line chart. What I want to be able to do is use a designer to add multiple `Pens` which actually describe the data and presentation so that it ends up with Xaml something along these lines:
```
<Chart>
<Pen Name="SalesData... | I would go with Chart as an ItemsControl and its ItemsPanel be a Canvas(For some light use I would go with Grid as ItemsPanel). And each Pen will be a CustomControl derived from PolyLine class. Does that make any sense? |
49,596 | <p>What is the difference between</p>
<pre><code>char str1[32] = "\0";
</code></pre>
<p>and </p>
<pre><code>char str2[32] = "";
</code></pre>
| [
{
"answer_id": 49620,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 6,
"selected": true,
"text": "<p>Since you already declared the sizes, the two declarations are exactly equal. However, if you do not specify the sizes, y... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123/"
] | What is the difference between
```
char str1[32] = "\0";
```
and
```
char str2[32] = "";
``` | Since you already declared the sizes, the two declarations are exactly equal. However, if you do not specify the sizes, you can see that the first declaration makes a larger string:
```
char a[] = "a\0";
char b[] = "a";
printf("%i %i\n", sizeof(a), sizeof(b));
```
prints
```
3 2
```
This is because a ends with t... |
49,599 | <p>Jquery has a great language construct that looks like this:</p>
<pre><code>$(document).ready(function() {
$("a").click(function() {
alert("Hello world!");
});
});
</code></pre>
<p>As you might guess this, once the document has loaded, binds a custom function to the onClick event of all <strong><em>... | [
{
"answer_id": 49618,
"author": "David McLaughlin",
"author_id": 3404,
"author_profile": "https://Stackoverflow.com/users/3404",
"pm_score": 1,
"selected": false,
"text": "<pre><code>Event.observe(window, 'load', function() { \n Event.observe(element, 'click', function() { \n ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] | Jquery has a great language construct that looks like this:
```
$(document).ready(function() {
$("a").click(function() {
alert("Hello world!");
});
});
```
As you might guess this, once the document has loaded, binds a custom function to the onClick event of all ***a*** tags.
The question is, how ca... | Prototype 1.6 provides the ["dom:loaded"](http://prototypejs.org/api/document/observe) event on document:
```
document.observe("dom:loaded", function() {
$$('a').each(function(elem) {
elem.observe("click", function() { alert("Hello World"); });
});
});
```
I also use the [each](http://prototypejs.org... |
49,602 | <p>In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the "virtual" <code>rownum</code> column. Consider the following example, which will return, at most, 10 rows.</p>
<pre>SELECT * FROM all_tables WHERE rownum <= 10</pre>
<p>Is there a simple, generic way to do something ... | [
{
"answer_id": 49604,
"author": "Tnilsson",
"author_id": 4165,
"author_profile": "https://Stackoverflow.com/users/4165",
"pm_score": 4,
"selected": true,
"text": "<p>Blatantly changing my answer. \"Limit 10\" works for MySql and others, Ingres uses</p>\n\n<pre><code>Select First 10 * fro... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5193/"
] | In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the "virtual" `rownum` column. Consider the following example, which will return, at most, 10 rows.
```
SELECT * FROM all_tables WHERE rownum <= 10
```
Is there a simple, generic way to do something similar in Ingres? | Blatantly changing my answer. "Limit 10" works for MySql and others, Ingres uses
```
Select First 10 * from myTable
```
[Ref](http://docs.ingres.com/sqlref/Selectinteractive) |
49,630 | <p>I'm using JavaScript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop.</p>
<p>The html looks like this:</p>
<pre><code>&l... | [
{
"answer_id": 49645,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": -1,
"selected": false,
"text": "<p>This may not be the best solution but you could set a global boolean variable that would be accessible to bot... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/550/"
] | I'm using JavaScript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop.
The html looks like this:
```
<div onmouseover="jsHov... | I'd give the container div:
```
position: relative;
```
and add a third div in the container (should be the last child of the container) with:
```
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
```
and catch the mouseover and mouseout events on this div instead.
Because it has no child elements, you s... |
49,652 | <p>Can someone suggest some good automated test suite framework for Perl?</p>
| [
{
"answer_id": 49694,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 0,
"selected": false,
"text": "<p>I'd go for Test::More, or in general, anything that outputs <a href=\"http://en.wikipedia.org/wiki/Test_Anything_P... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406/"
] | Can someone suggest some good automated test suite framework for Perl? | It really depends on what you're trying to do, but here's some background for much of this.
First, you would generally write your test programs with Test::More or Test::Simple as the core testing program:
```
use Test::More tests => 2;
is 3, 3, 'basic equality should work';
ok !0, '... and zero should be false';
``... |
49,662 | <p>My company is looking to start distributing some software we developed and would like to be able to let people try the software out before buying. We'd also like to make sure it can't be copied and distributed to our customers' customers.</p>
<p>One model we've seen is tying a license to a MAC address so the softw... | [
{
"answer_id": 49666,
"author": "Matt Sheppard",
"author_id": 797,
"author_profile": "https://Stackoverflow.com/users/797",
"pm_score": 4,
"selected": true,
"text": "<p>I'd suggest you take the pieces of information you want in the key, and hash it with md5, and then just take the first ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5106/"
] | My company is looking to start distributing some software we developed and would like to be able to let people try the software out before buying. We'd also like to make sure it can't be copied and distributed to our customers' customers.
One model we've seen is tying a license to a MAC address so the software will on... | I'd suggest you take the pieces of information you want in the key, and hash it with md5, and then just take the first X characters (where X is a key length you think is manageable).
Cryptographically, it's far from perfect, but this is the sort of area where you want to put in the minimum amount of effort which will ... |
49,668 | <p>I need to find out time taken by a function in my application. Application is a MS VIsual Studio 2005 solution, all C code. </p>
<p>I used thw windows API GetLocalTime(SYSTEMTIME *) to get the current system time before and after the function call which I want to measure time of.
But this has shortcoming that it lo... | [
{
"answer_id": 49673,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 2,
"selected": false,
"text": "<p>You can try to use <a href=\"http://www.cplusplus.com/reference/clibrary/ctime/clock.html\" rel=\"nofollow noreferrer\">... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759376/"
] | I need to find out time taken by a function in my application. Application is a MS VIsual Studio 2005 solution, all C code.
I used thw windows API GetLocalTime(SYSTEMTIME \*) to get the current system time before and after the function call which I want to measure time of.
But this has shortcoming that it lowest reso... | There are some other possibilities.
QueryPerformanceCounter and QueryPerformanceFrequency
-----------------------------------------------------
[QueryPerformanceCounter](http://msdn.microsoft.com/en-us/library/ms644904.aspx) will return a "performance counter" which is actually a CPU-managed 64-bit counter that incre... |
49,724 | <p>Is it possible to extract all of the VBA code from a Word 2007 "docm" document using the API?</p>
<p>I have found how to insert VBA code at runtime, and how to delete all VBA code, but not pull the actual code out into a stream or string that I can store (and insert into other documents in the future).</p>
<p>Any ... | [
{
"answer_id": 49773,
"author": "Aardvark",
"author_id": 3655,
"author_profile": "https://Stackoverflow.com/users/3655",
"pm_score": 5,
"selected": true,
"text": "<p>You'll have to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3 (or whatever version you have)... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2194/"
] | Is it possible to extract all of the VBA code from a Word 2007 "docm" document using the API?
I have found how to insert VBA code at runtime, and how to delete all VBA code, but not pull the actual code out into a stream or string that I can store (and insert into other documents in the future).
Any tips or resources... | You'll have to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3 (or whatever version you have). I have the VBA SDK and such on my box - so this may not be exactly what office ships with.
Also you have to enable access to the VBA Object Model specifically - see the "Trust Center" in Word opt... |
49,757 | <p>So if I have a method of parsing a text file and returning a <strong>list</strong> <em>of a</em> <strong>list</strong> <em>of</em> <strong>key value pairs</strong>, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?</p>
<p>The first met... | [
{
"answer_id": 49772,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 1,
"selected": false,
"text": "<p>You could create an interface that matched the column names, and then use the Reflection.Emit API to create a type at... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61/"
] | So if I have a method of parsing a text file and returning a **list** *of a* **list** *of* **key value pairs**, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?
The first method that pops into mind is pretty simple, just keep a list of ... | Take a deep look at the [XmlSerializer](http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx). Even if you are constrained to not use XML on-disk, you might want to copy some of its features. This could then look like this:
```
public class DataObject {
[Column("name")]
public string... |
49,790 | <p>In my specific example, I'm dealing with a drop-down, e.g.:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><select name="foo" id="bar">
<option disabled=... | [
{
"answer_id": 49802,
"author": "David Heggie",
"author_id": 4309,
"author_profile": "https://Stackoverflow.com/users/4309",
"pm_score": 3,
"selected": false,
"text": "<p>The HTML specs are a bit vague (ie. completely lacking) with regard to this odd combination. They do say that a form ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058/"
] | In my specific example, I'm dealing with a drop-down, e.g.:
```html
<select name="foo" id="bar">
<option disabled="disabled" selected="selected">Select an item:</option>
<option>an item</option>
<option>another item</option>
</select>
```
Of course, that's pretty nonsensical, but I'm wondering whether any s... | In reply to the update in the question, I would say that the 'label' option should be selectable but either make it do nothing on submission or via JavaScript, don't allow the form to be submitted without a value being selected (assuming it's a required field).
From a usablilty point of view I'd suggest doing both, th... |
49,883 | <p>Say I have this given XML file:</p>
<pre><code><root>
<node>x</node>
<node>y</node>
<node>a</node>
</root>
</code></pre>
<p>And I want the following to be displayed:</p>
<pre><code>ayx
</code></pre>
<p>Using something similar to:</p>
<pre><code><xsl... | [
{
"answer_id": 49887,
"author": "Pierre Spring",
"author_id": 1532,
"author_profile": "https://Stackoverflow.com/users/1532",
"pm_score": 2,
"selected": false,
"text": "<p>You can do this, using <code>xsl:sort</code>. It is important to set the <code>data-type=\"number\"</code> because e... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1532/"
] | Say I have this given XML file:
```
<root>
<node>x</node>
<node>y</node>
<node>a</node>
</root>
```
And I want the following to be displayed:
```
ayx
```
Using something similar to:
```
<xsl:template match="/">
<xsl:apply-templates select="root/node"/>
</xsl:template>
<xsl:template match="node">
... | Easy!
```
<xsl:template match="/">
<xsl:apply-templates select="root/node">
<xsl:sort select="position()" data-type="number" order="descending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="node">
<xsl:value-of select="."/>
</xsl:template>
``` |
49,890 | <p>I created a few mediawiki custom tags, using the guide found here</p>
<p><a href="http://www.mediawiki.org/wiki/Manual:Tag_extensions" rel="nofollow noreferrer">http://www.mediawiki.org/wiki/Manual:Tag_extensions</a></p>
<p>I will post my code below, but the problem is after it hits the first custom tag in the pag... | [
{
"answer_id": 49887,
"author": "Pierre Spring",
"author_id": 1532,
"author_profile": "https://Stackoverflow.com/users/1532",
"pm_score": 2,
"selected": false,
"text": "<p>You can do this, using <code>xsl:sort</code>. It is important to set the <code>data-type=\"number\"</code> because e... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673/"
] | I created a few mediawiki custom tags, using the guide found here
<http://www.mediawiki.org/wiki/Manual:Tag_extensions>
I will post my code below, but the problem is after it hits the first custom tag in the page, it calls it, and prints the response, but does not get anything that comes after it in the wikitext. It ... | Easy!
```
<xsl:template match="/">
<xsl:apply-templates select="root/node">
<xsl:sort select="position()" data-type="number" order="descending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="node">
<xsl:value-of select="."/>
</xsl:template>
``` |
49,896 | <p>When connecting to remote hosts via ssh, I frequently want to bring a file on that system to the local system for viewing or processing. Is there a way to copy the file over without (a) opening a new terminal/pausing the ssh session (b) authenticating again to either the local or remote hosts which works (c) even w... | [
{
"answer_id": 49913,
"author": "chris",
"author_id": 4782,
"author_profile": "https://Stackoverflow.com/users/4782",
"pm_score": -1,
"selected": false,
"text": "<p>You should be able to set up public & private keys so that no auth is needed. </p>\n\n<p>Which way you do it depends on... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5222/"
] | When connecting to remote hosts via ssh, I frequently want to bring a file on that system to the local system for viewing or processing. Is there a way to copy the file over without (a) opening a new terminal/pausing the ssh session (b) authenticating again to either the local or remote hosts which works (c) even when ... | Here is my preferred solution to this problem. Set up a reverse ssh tunnel upon creating the ssh session. This is made easy by two bash function: grabfrom() needs to be defined on the local host, while grab() should be defined on the remote host. You can add any other ssh variables you use (e.g. -X or -Y) as you see fi... |
49,900 | <p>We have an Apache ANT script to build our application, then check in the resulting JAR file into version control (VSS in this case). However, now we have a change that requires us to build 2 JAR files for this project, then check both into VSS.</p>
<p>The current target that checks the original JAR file into VSS d... | [
{
"answer_id": 49920,
"author": "Chris Dail",
"author_id": 5077,
"author_profile": "https://Stackoverflow.com/users/5077",
"pm_score": 4,
"selected": false,
"text": "<p>It is generally considered a bad idea to version control your binaries and I do not recommend doing so. But if you abso... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1471/"
] | We have an Apache ANT script to build our application, then check in the resulting JAR file into version control (VSS in this case). However, now we have a change that requires us to build 2 JAR files for this project, then check both into VSS.
The current target that checks the original JAR file into VSS discovers th... | I would suggest to work with [macros](http://ant.apache.org/manual/Tasks/macrodef.html) over subant/antcall because the main advantage I found with macros is that you're in complete control over the properties that are passed to the macro (especially if you want to add new properties).
You simply refactor your Ant scr... |
49,908 | <p>I know I've seen this in the past, but I can't seem to find it now.</p>
<p>Basically I want to create a page that I can host on a <a href="http://www.codeplex.com/dasblog" rel="nofollow noreferrer">dasBlog</a> instance that contains the layout from my theme, but the content of the page I control.</p>
<p>Ideally th... | [
{
"answer_id": 49973,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>I did something similar setting up a handler to stream video files from the blog on my home server. I ended up ditc... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3381/"
] | I know I've seen this in the past, but I can't seem to find it now.
Basically I want to create a page that I can host on a [dasBlog](http://www.codeplex.com/dasblog) instance that contains the layout from my theme, but the content of the page I control.
Ideally the content is a user control or ASPX that I write. Anyb... | The easist way to do this is to "hijack" the FormatPage functionality.
First add the following to your web.config in the newtelligence.DasBlog.UrlMapper section:
```
<add matchExpression="(?<basedir>.*?)/Static\.aspx\?=(?<value>.+)" mapTo="{basedir}/FormatPage.aspx?path=content/static/{value}.format.html"... |
49,919 | <p>I am looking for a Regular expression to match only if a date is in the first 28 days of the month. This is for my validator control in ASP.NET</p>
| [
{
"answer_id": 49923,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 2,
"selected": false,
"text": "<p>I don't think this is a task very well-suited for a regexp.</p>\n\n<p>I'd try and use the library functions (DateTime.Parse ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] | I am looking for a Regular expression to match only if a date is in the first 28 days of the month. This is for my validator control in ASP.NET | Don't do this with Regex. Dates are formatted differently in different countries. Use the DateTime.TryParse routine instead:
```
DateTime parsedDate;
if ( DateTime.TryParse( dateString, out parsedDate) && parsedDate.Day <= 28 )
{
// logic goes here.
}
```
Regex is nearly the [golden hammer](http://en.wikipedia.org... |
49,925 | <p>What is the difference between <code>UNION</code> and <code>UNION ALL</code>?</p>
| [
{
"answer_id": 49927,
"author": "George Mauer",
"author_id": 5056,
"author_profile": "https://Stackoverflow.com/users/5056",
"pm_score": 5,
"selected": false,
"text": "<blockquote>\n <p>The basic difference between UNION and UNION ALL is union operation eliminates the duplicated rows fr... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] | What is the difference between `UNION` and `UNION ALL`? | `UNION` removes duplicate records (where all columns in the results are the same), `UNION ALL` does not.
There is a performance hit when using `UNION` instead of `UNION ALL`, since the database server must do additional work to remove the duplicate rows, but usually you do not want the duplicates (especially when deve... |
49,934 | <p>On my OS X box, the kernel is a 32-bit binary and yet it can run a 64-bit binary.
How does this work?</p>
<pre><code>cristi:~ diciu$ file ./a.out
./a.out: Mach-O 64-bit executable x86_64
cristi:~ diciu$ file /mach_kernel
/mach_kernel: Mach-O universal binary with 2 architectures
/mach_kernel (for architecture i386):... | [
{
"answer_id": 49939,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 3,
"selected": false,
"text": "<p>It's not the kernel that runs the binary. It's the processor.</p>\n\n<p>The binary does call library functions and those nee... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2811/"
] | On my OS X box, the kernel is a 32-bit binary and yet it can run a 64-bit binary.
How does this work?
```
cristi:~ diciu$ file ./a.out
./a.out: Mach-O 64-bit executable x86_64
cristi:~ diciu$ file /mach_kernel
/mach_kernel: Mach-O universal binary with 2 architectures
/mach_kernel (for architecture i386): Mach-O exe... | The CPU can be switched from 64 bit execution mode to 32 bit when it traps into kernel context, and a 32 bit kernel can still be constructed to understand the structures passed in from 64 bit user-space apps.
The MacOS X kernel does not directly dereference pointers from the user app anyway, as it resides its own sepa... |
49,962 | <p>Had an interesting discussion with some colleagues about the best scheduling strategies for realtime tasks, but not everyone had a good understanding of the common or useful scheduling strategies.</p>
<p>For your answer, please choose one strategy and go over it in some detail, rather than giving a little info on s... | [
{
"answer_id": 50056,
"author": "Sean",
"author_id": 4919,
"author_profile": "https://Stackoverflow.com/users/4919",
"pm_score": 4,
"selected": true,
"text": "<p>As described in a paper titled <a href=\"http://www.ee.duke.edu/~krish/wip.pdf\" rel=\"noreferrer\">Real-Time Task Scheduling ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] | Had an interesting discussion with some colleagues about the best scheduling strategies for realtime tasks, but not everyone had a good understanding of the common or useful scheduling strategies.
For your answer, please choose one strategy and go over it in some detail, rather than giving a little info on several str... | As described in a paper titled [Real-Time Task Scheduling for Energy-Aware Embedded Systems](http://www.ee.duke.edu/~krish/wip.pdf), Swaminathan and Chakrabarty describe the challenges of real-time task scheduling in low-power (embedded) devices with multiple processor speeds and power consumption profiles available. T... |
49,966 | <p>When I turn an image (<code><img></code>) into a hyperlink (by wrapping it in <code><a></code>), Firefox adds a black border around the image. Safari does not display the same border. </p>
<p>What CSS declaration would be best to eliminate the border?</p>
| [
{
"answer_id": 49975,
"author": "George Mauer",
"author_id": 5056,
"author_profile": "https://Stackoverflow.com/users/5056",
"pm_score": 2,
"selected": false,
"text": "<pre><code>a img {\n border-width: 0;\n}\n</code></pre>\n"
},
{
"answer_id": 49977,
"author": "pilif",
... | 2008/09/08 | [
"https://Stackoverflow.com/questions/49966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4540/"
] | When I turn an image (`<img>`) into a hyperlink (by wrapping it in `<a>`), Firefox adds a black border around the image. Safari does not display the same border.
What CSS declaration would be best to eliminate the border? | ```
img {
border: 0
}
```
Or old-fashioned:
```
<img border="0" src="..." />
^^^^^^^^^^
``` |
50,005 | <p>I have a weird bug involving Flash text and hyperlinks, htmlText in a TextField with <code><a></code> tags seem to truncate surrounding space:</p>
<p><a href="https://i.stack.imgur.com/FDA7a.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FDA7a.gif" alt="output"></a></p>
<p>Once I place my... | [
{
"answer_id": 51590,
"author": "Jon Cram",
"author_id": 5343,
"author_profile": "https://Stackoverflow.com/users/5343",
"pm_score": 0,
"selected": false,
"text": "<p>Does it make any difference if you put non-breaking spaces immediately before and after the anchor element?</p>\n\n<pre><... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1306/"
] | I have a weird bug involving Flash text and hyperlinks, htmlText in a TextField with `<a>` tags seem to truncate surrounding space:
[](https://i.stack.imgur.com/FDA7a.gif)
Once I place my cursor over the text, it "fixes" itself:
[. </p>
<p>Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens... | [
{
"answer_id": 50039,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 1,
"selected": false,
"text": "<p>For this particular issue, the reason is because javascript generated by \nASP.NET 2.0 has some IE only notation: event.srcEl... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3617/"
] | The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially).
Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside of... | I use this function adapted from codesta. [Edit: the very same one, I see, that scares you! Oops. Can't help you then.]
<http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html>.
You use it by surrounding your code with a div like so. You could subclass the Form to include this automatically. I don't use ... |
50,064 | <p>This is pretty simple, I come from a swing/awt background.</p>
<p>I'm just wondering what the proper way to set the background color for a SWT widget is?</p>
<p>I've been trying:</p>
<pre><code>widget.setBackground( );
</code></pre>
<p>Except I have no idea how to create the color Object in SWT?</p>
| [
{
"answer_id": 50128,
"author": "jodonnell",
"author_id": 4223,
"author_profile": "https://Stackoverflow.com/users/4223",
"pm_score": 7,
"selected": true,
"text": "<p>To create a color, try this:</p>\n\n<pre><code>Device device = Display.getCurrent ();\nColor red = new Color (device, 255... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3415/"
] | This is pretty simple, I come from a swing/awt background.
I'm just wondering what the proper way to set the background color for a SWT widget is?
I've been trying:
```
widget.setBackground( );
```
Except I have no idea how to create the color Object in SWT? | To create a color, try this:
```
Device device = Display.getCurrent ();
Color red = new Color (device, 255, 0, 0);
``` |
50,097 | <p>I would like to use an add-in like simple-modal or the dialog add-in in the UI kit. However, how do I use these or any other and get a result back. Basically I want the modal to do some AJAX interaction with the server and return the result for the calling code to do some stuff with.</p>
| [
{
"answer_id": 50104,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 0,
"selected": false,
"text": "<p>Since the modal dialog is on the page, you're free to set any document variable you want. However all of the modal ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5236/"
] | I would like to use an add-in like simple-modal or the dialog add-in in the UI kit. However, how do I use these or any other and get a result back. Basically I want the modal to do some AJAX interaction with the server and return the result for the calling code to do some stuff with. | Here is how the confirm window works on simpleModal:
```
$(document).ready(function () {
$('#confirmDialog input:eq(0)').click(function (e) {
e.preventDefault();
// example of calling the confirm function
// you must use a callback function to perform the "yes" action
confirm("Continue to the Simple... |
50,098 | <p>I would like to compare two collections (in C#), but I'm not sure of the best way to implement this efficiently.</p>
<p>I've read the other thread about <a href="https://stackoverflow.com/questions/43500/is-there-a-built-in-method-to-compare-collections-in-c">Enumerable.SequenceEqual</a>, but it's not exactly what ... | [
{
"answer_id": 50154,
"author": "Daniel Jennings",
"author_id": 3641,
"author_profile": "https://Stackoverflow.com/users/3641",
"pm_score": 5,
"selected": false,
"text": "<p>Create a Dictionary \"dict\" and then for each member in the first collection, do dict[member]++;</p>\n\n<p>Then, ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810/"
] | I would like to compare two collections (in C#), but I'm not sure of the best way to implement this efficiently.
I've read the other thread about [Enumerable.SequenceEqual](https://stackoverflow.com/questions/43500/is-there-a-built-in-method-to-compare-collections-in-c), but it's not exactly what I'm looking for.
In ... | It turns out Microsoft already has this covered in its testing framework: [CollectionAssert.AreEquivalent](http://msdn.microsoft.com/en-us/library/ms243779.aspx)
>
> Remarks
>
>
> Two collections are equivalent if they
> have the same elements in the same
> quantity, but in any order. Elements
> are equal if their ... |
50,115 | <p>So my site uses <a href="http://mjijackson.com/shadowbox/" rel="nofollow noreferrer">shadowbox</a> to do display some dynamic text. Problem is I need the user to be able to copy and paste that text. </p>
<p>Right-clicking and selecting copy works but <kbd>Ctrl</kbd>+<kbd>C</kbd> doesn't (no keyboard shortcuts do)... | [
{
"answer_id": 58063,
"author": "Robby Slaughter",
"author_id": 1854,
"author_profile": "https://Stackoverflow.com/users/1854",
"pm_score": 1,
"selected": false,
"text": "<p>This problem is caused by some JavaScript which eats keyboard events. You can hit the escape key, for example, whi... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5234/"
] | So my site uses [shadowbox](http://mjijackson.com/shadowbox/) to do display some dynamic text. Problem is I need the user to be able to copy and paste that text.
Right-clicking and selecting copy works but `Ctrl`+`C` doesn't (no keyboard shortcuts do) and most people use `Ctrl`+`C`? You can see an example of what I'm... | The best option is to disable keyboard navigation shortcuts in the shadowbox by setting the "enableKeys" option to false (see [this page](http://mjijackson.com/shadowbox/doc/api.html)).
Alternatively you could do what Robby suggests and modify the shadowbox.js file, **but only do this if you need to have the shadowbox... |
50,149 | <p>I wrote a SQL function to convert a datetime value in SQL to a friendlier "n Hours Ago" or "n Days Ago" etc type of message. And I was wondering if there was a better way to do it. </p>
<p>(Yes I know "don't do it in SQL" but for design reasons I have to do it this way).</p>
<p>Here is the function I've written:</... | [
{
"answer_id": 50192,
"author": "Craig",
"author_id": 2894,
"author_profile": "https://Stackoverflow.com/users/2894",
"pm_score": 1,
"selected": false,
"text": "<p>Your code looks functional. As for a better way, that is going to get subjective. You might want to check out this <a href... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980/"
] | I wrote a SQL function to convert a datetime value in SQL to a friendlier "n Hours Ago" or "n Days Ago" etc type of message. And I was wondering if there was a better way to do it.
(Yes I know "don't do it in SQL" but for design reasons I have to do it this way).
Here is the function I've written:
```
CREATE FUNCTI... | As you say, I probably wouldn't do it in SQL, but as a thought exercise have a MySQL implementation:
```
CASE
WHEN compare_date between date_sub(now(), INTERVAL 60 minute) and now()
THEN concat(minute(TIMEDIFF(now(), compare_date)), ' minutes ago')
WHEN datediff(now(), compare_date) = 1
THEN... |
50,159 | <p>I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this?</p>
| [
{
"answer_id": 50166,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 6,
"selected": false,
"text": "<p>to learn what libraries a binary uses, use ldd</p>\n\n<pre><code>ldd path/to/the/tool\n</code></pre>\n\n<p>You'd have to wri... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3756/"
] | I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this? | 1. Use `ldd` to list shared libraries for each executable.
2. Cleanup the output
3. Sort, compute counts, sort by count
To find the answer for all executables in the "/bin" directory:
```
find /bin -type f -perm /a+x -exec ldd {} \; \
| grep so \
| sed -e '/^[^\t]/ d' \
| sed -e 's/\t//' \
| sed -e 's/.*=..//' \
| se... |
50,169 | <p>I have a query that looks like this:</p>
<pre><code>public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)
{
DatabaseDataContext db = new DatabaseDataContext();
return (from o in db.Orders
orderby o.CreatedDate descending
select o)
.Skip(pageIndex * re... | [
{
"answer_id": 50191,
"author": "John Boker",
"author_id": 2847,
"author_profile": "https://Stackoverflow.com/users/2847",
"pm_score": 0,
"selected": false,
"text": "<p>you might want to look into using compiled queries</p>\n\n<p>have a look at <a href=\"http://www.3devs.com/?p=3\" rel=\... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4269/"
] | I have a query that looks like this:
```
public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)
{
DatabaseDataContext db = new DatabaseDataContext();
return (from o in db.Orders
orderby o.CreatedDate descending
select o)
.Skip(pageIndex * recordCount)
... | Something else you can do is EagerLoading. In Linq2SQL you can use LoadOptions : [More on LoadOptions](http://oakleafblog.blogspot.com/2007/08/linq-to-sql-query-execution-with.html)
One VERY weird thing about L2S is that you can set LoadOptions only before the first query is sent to the Database. |
50,170 | <p>I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.</p>
<p>My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.</p>
<p>So the code below, which I <em>think</em> is correct... | [
{
"answer_id": 50201,
"author": "knuton",
"author_id": 4991,
"author_profile": "https://Stackoverflow.com/users/4991",
"pm_score": 3,
"selected": true,
"text": "<p>Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.\nI s... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3191/"
] | I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.
My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.
So the code below, which I *think* is correct according to [the spec]... | Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.
I suppose that didn’t help its popularity …
Source: <http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display> (German) |
50,182 | <p>Is there a good library to use for gathering user input in Linux from the mouse/keyboard/joystick that doesn't force you to create a visible window to do so? SDL lets you get user input in a reasonable way, but seems to force you to create a window, which is troublesome if you have abstracted control so the control... | [
{
"answer_id": 50220,
"author": "Brian Gianforcaro",
"author_id": 3415,
"author_profile": "https://Stackoverflow.com/users/3415",
"pm_score": 2,
"selected": false,
"text": "<p>For the mouse you can use <a href=\"http://www.linuxjournal.com/article/4600\" rel=\"nofollow noreferrer\">GPM</... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5070/"
] | Is there a good library to use for gathering user input in Linux from the mouse/keyboard/joystick that doesn't force you to create a visible window to do so? SDL lets you get user input in a reasonable way, but seems to force you to create a window, which is troublesome if you have abstracted control so the control mac... | OK, if you're under X11 and you want to get the kbd, you need to do a grab.
If you're not, my only good answer is ncurses from a terminal.
Here's how you grab everything from the keyboard and release again:
```
/* Demo code, needs more error checking, compile
* with "gcc nameofthisfile.c -lX11".
/* weird formattin... |
50,223 | <p>We're using Mercurial where I work and I want to have a setup similar to how I used SVN:</p>
<ul>
<li>Trunk</li>
<li>Tags
<ul>
<li>Production</li>
</ul></li>
<li>Branches</li>
</ul>
<p>Since Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to rep... | [
{
"answer_id": 50239,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 2,
"selected": false,
"text": "<p>Something like <a href=\"http://www.selenic.com/mercurial/wiki/index.cgi/TransplantExtension\" rel=\"nofollow noreferrer\"... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/956/"
] | We're using Mercurial where I work and I want to have a setup similar to how I used SVN:
* Trunk
* Tags
+ Production
* Branches
Since Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to repeatedly merge 'Trunk' with 'Production'.
Quite simply, I w... | As the previous poster mentioned, the transplant extension can be used for cherry-picking individual changes from one branch to another. If, however, you always want to pull *all* the latest changes, the `hg merge` command will get you there.
The simplest case is when you're using clones to implement branching (since ... |
50,236 | <p>Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect. In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control.</p>
| [
{
"answer_id": 50241,
"author": "Karim",
"author_id": 2494,
"author_profile": "https://Stackoverflow.com/users/2494",
"pm_score": 5,
"selected": true,
"text": "<p>I recently discovered that you can use SetWindowPos to accomplish this. Determine which control after which you want to inse... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2494/"
] | Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect. In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control. | I recently discovered that you can use SetWindowPos to accomplish this. Determine which control after which you want to insert the new control in the tab order then use SetWindowPos like this:
```
SetWindowPos(hNewControl, hOldControl, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
```
This changes the z-order of controls whi... |
50,251 | <p>I'm stuck trying to create a dynamic linq extension method that returns a string in JSON format - I'm using System.Linq.Dynamic and Newtonsoft.Json and I can't get the Linq.Dynamic to parse the "cell=new object[]" part. Perhaps too complex? Any ideas? : </p>
<p><strong>My Main method:</strong></p>
<pre><code>stat... | [
{
"answer_id": 50592,
"author": "Scott Nichols",
"author_id": 4299,
"author_profile": "https://Stackoverflow.com/users/4299",
"pm_score": 0,
"selected": false,
"text": "<pre><code>static void Main(string[] args)\n{\n NorthwindDataContext db = new NorthwindDataContext();\n var query... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3396/"
] | I'm stuck trying to create a dynamic linq extension method that returns a string in JSON format - I'm using System.Linq.Dynamic and Newtonsoft.Json and I can't get the Linq.Dynamic to parse the "cell=new object[]" part. Perhaps too complex? Any ideas? :
**My Main method:**
```
static void Main(string[] args)
{
N... | This is really ugly and there may be some issues with the string replacement, but it produces the expected results:
```
public static class JSonify
{
public static string GetJsonTable<T>(
this IQueryable<T> query, int pageNumber, int pageSize, string IDColumnName, string[] columnNames)
{
string... |
50,280 | <p>I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to <code>padding</code> and <code>position:relative</code>,... | [
{
"answer_id": 50302,
"author": "Mike H",
"author_id": 4563,
"author_profile": "https://Stackoverflow.com/users/4563",
"pm_score": 1,
"selected": false,
"text": "<p>Have you tried floating the #right_content div to the right?</p>\n\n<pre class=\"lang-css prettyprint-override\"><code>#rig... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1385358/"
] | I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to `padding` and `position:relative`, but nothing has worked f... | I believe the error lies in the mark up that the color picker is generating. I saved the page and removed that code for the color picker and it renders fine in IE/FF/SF. |
50,312 | <p>I'm running some <a href="http://jakarta.apache.org/jmeter/" rel="noreferrer">JMeter</a> tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds... | [
{
"answer_id": 50334,
"author": "Ben Collins",
"author_id": 3279,
"author_profile": "https://Stackoverflow.com/users/3279",
"pm_score": 5,
"selected": true,
"text": "<p>Use <code>top -b</code> (and other switches if you want different outputs). It will just dump to stdout instead of jum... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] | I'm running some [JMeter](http://jakarta.apache.org/jmeter/) tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds which will get me the current ... | Use `top -b` (and other switches if you want different outputs). It will just dump to stdout instead of jumping into a curses window. |
50,315 | <p>I have a couple of solutions, but none of them work perfectly.</p>
<p><strong>Platform</strong></p>
<ol>
<li>ASP.NET / VB.NET / .NET 2.0</li>
<li>IIS 6</li>
<li>IE6 (primarily), with some IE7; Firefox not necessary, but useful</li>
</ol>
<p><em>Allowed 3rd Party Options</em></p>
<ol>
<li>Flash</li>
<li>ActiveX (... | [
{
"answer_id": 50657,
"author": "Bermo",
"author_id": 5110,
"author_profile": "https://Stackoverflow.com/users/5110",
"pm_score": 1,
"selected": false,
"text": "<p>You could try <a href=\"http://www.swfupload.org/\" rel=\"nofollow noreferrer\">SWFUpload</a> as well - it would fit in your... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106/"
] | I have a couple of solutions, but none of them work perfectly.
**Platform**
1. ASP.NET / VB.NET / .NET 2.0
2. IIS 6
3. IE6 (primarily), with some IE7; Firefox not necessary, but useful
*Allowed 3rd Party Options*
1. Flash
2. ActiveX (would like to avoid)
3. Java (would like to avoid)
**Current Attempts**
*Gmail S... | [@davidinbcn.myopenid.co](https://stackoverflow.com/questions/50315/how-do-you-allow-multiple-file-uploads-on-an-internal-windows-authentication-in#70521): That's basically how I solved this issue. But, in an effort to provide a more detailed answer, I'm posting my solution here.
**The Solution!**
Create two web appl... |
50,316 | <p>I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and password. This is a problem on the form... | [
{
"answer_id": 50319,
"author": "Rob Rolnick",
"author_id": 4798,
"author_profile": "https://Stackoverflow.com/users/4798",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried adding the autocomplete=\"off\" attribute in the input tag? Not sure if it'll work, but it is worth a t... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3757/"
] | I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and password. This is a problem on the form to... | From Mozilla's documentation
```
<form name="form1" id="form1" method="post" autocomplete="off"
action="http://www.example.com/form.cgi">
[...]
</form>
```
<http://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion> |
50,332 | <p>I'm trying to implement Drag & Drop functionality with source being a TreeView control. When I initiate a drag on a node, I'm getting:</p>
<p><em>Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))</em></p>
<p>The ItemDrag handler (where the exception takes place), looks like:</p>... | [
{
"answer_id": 52030,
"author": "Stradas",
"author_id": 5410,
"author_profile": "https://Stackoverflow.com/users/5410",
"pm_score": 1,
"selected": false,
"text": "<p><strong><code>FORMATETC</code></strong> is a type of application clipboard, for lack of a better term. In order to pull o... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4398/"
] | I'm trying to implement Drag & Drop functionality with source being a TreeView control. When I initiate a drag on a node, I'm getting:
*Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV\_E\_FORMATETC))*
The ItemDrag handler (where the exception takes place), looks like:
```
private void treeView_It... | In case it helps anyone else - I encountered this problem with the WPF TreeView (not Windows Forms as listed in the question) and the solution was simply to make sure to mark the event as handled in the drop event handler.
```
private void OnDrop(object sender, DragEventArgs e)
{
// Other logic...
... |
50,339 | <pre><code>- Unit Testing
- Mocking
- Inversion of Control
- Refactoring
- Object Relational Mapping
- Others?
</code></pre>
<p>I have found <a href="http://www.lastcraft.com/simple_test.php" rel="nofollow noreferrer">simpletest</a> for unit testing and mocking and, though it leaves much to be desired, it k... | [
{
"answer_id": 50428,
"author": "Mike H",
"author_id": 4563,
"author_profile": "https://Stackoverflow.com/users/4563",
"pm_score": 1,
"selected": false,
"text": "<p>Unit Testing - PHPUnit <a href=\"http://www.phpunit.de/\" rel=\"nofollow noreferrer\">phpunit.de</a></p>\n\n<p>ORM - Doctri... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | ```
- Unit Testing
- Mocking
- Inversion of Control
- Refactoring
- Object Relational Mapping
- Others?
```
I have found [simpletest](http://www.lastcraft.com/simple_test.php) for unit testing and mocking and, though it leaves much to be desired, it kind-of sort of works.
I have yet to find any reasonable... | [phpUnderControl](http://www.phpundercontrol.org/) - continuous integration.
Don't forget about version control (e.g. using [CVS](http://www.nongnu.org/cvs/) or [Subversion](http://subversion.tigris.org/))! |
50,373 | <p>I'm trying to mixin the <code>MultiMap</code> trait with a <code>HashMap</code> like so:</p>
<pre><code>val children:MultiMap[Integer, TreeNode] =
new HashMap[Integer, Set[TreeNode]] with MultiMap[Integer, TreeNode]
</code></pre>
<p>The definition for the <code>MultiMap</code> trait is:</p>
<pre><code>trait ... | [
{
"answer_id": 50420,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 6,
"selected": true,
"text": "<p>I had to import <code>scala.collection.mutable.Set</code>. It seems the compiler thought the Set in <code>HashMap[Integer, ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4893/"
] | I'm trying to mixin the `MultiMap` trait with a `HashMap` like so:
```
val children:MultiMap[Integer, TreeNode] =
new HashMap[Integer, Set[TreeNode]] with MultiMap[Integer, TreeNode]
```
The definition for the `MultiMap` trait is:
```
trait MultiMap[A, B] extends Map[A, Set[B]]
```
Meaning that a `MultiMap` ... | I had to import `scala.collection.mutable.Set`. It seems the compiler thought the Set in `HashMap[Integer, Set[TreeNode]]` was `scala.collection.Set`. The Set in the MultiMap def is `scala.collection.`**`mutable`**`.Set`. |
50,384 | <p>I'm using <a href="http://en.wikipedia.org/wiki/Windows_Script_Host#Usage" rel="noreferrer">WScript</a> to automate some tasks, by using WScript.Shell to call external programs.</p>
<p>However, right now it does not wait for the external program to finish, and instead moves on. This causes issues because I have som... | [
{
"answer_id": 50395,
"author": "Guy Starbuck",
"author_id": 2194,
"author_profile": "https://Stackoverflow.com/users/2194",
"pm_score": 3,
"selected": false,
"text": "<p>If you use the \"Exec\" method, it returns a reference, so you can poll the \"Status\" property to determine when it ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | I'm using [WScript](http://en.wikipedia.org/wiki/Windows_Script_Host#Usage) to automate some tasks, by using WScript.Shell to call external programs.
However, right now it does not wait for the external program to finish, and instead moves on. This causes issues because I have some tasks dependent on others finishing ... | Turns out, that while loop is severe CPU hog :P
I found a better way:
```
ZipCommand = "7za.exe a -r -y " & ZipDest & BuildLabel & ".zip " & buildSourceDir
Set wshShell = WScript.CreateObject("Wscript.Shell")
wshShell.Run ZipCommand,1,1
```
The last two arguments are Show window and Block Execution :) |
50,394 | <p>I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly.</p>
<p>I did some search to try to find a pythonic way to do this task. Generally I got quite m... | [
{
"answer_id": 50413,
"author": "Justin Standard",
"author_id": 92,
"author_profile": "https://Stackoverflow.com/users/92",
"pm_score": 0,
"selected": false,
"text": "<p>Another way to do it is to use <code>urllib2</code> module to parse some other page's whois service (many sites like t... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4172/"
] | I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly.
I did some search to try to find a pythonic way to do this task. Generally I got quite much nothin... | There's nothing wrong with using a command line utility to do what you want. If you put a nice wrapper around the service, you can implement the internals however you want! For example:
```
class Whois(object):
_whois_by_query_cache = {}
def __init__(self, query):
"""Initializes the instance variables... |
50,417 | <p>When I use Emacs I want to be able to easily display and navigate through a list of files I worked on from not just the current session but from previous sessions. (BTW, running Emacs 22.2 on Windows)</p>
| [
{
"answer_id": 50422,
"author": "Ben Collins",
"author_id": 3279,
"author_profile": "https://Stackoverflow.com/users/3279",
"pm_score": 6,
"selected": true,
"text": "<p>From <a href=\"http://www.joegrossberg.com/archives/000182.html\" rel=\"noreferrer\">Joe Grossberg</a>'s blog (no longe... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | When I use Emacs I want to be able to easily display and navigate through a list of files I worked on from not just the current session but from previous sessions. (BTW, running Emacs 22.2 on Windows) | From [Joe Grossberg](http://www.joegrossberg.com/archives/000182.html)'s blog (no longer available):
>
> But if you're using GNU Emacs 21.2
> (the latest version, which includes
> this as part of the standard distro),
> you can just put the following lines
> into your .emacs file
>
>
>
> ```
> ;; recentf stuff... |
50,450 | <p>This has been driving me crazy for a few days. Why doesn't the following work?</p>
<blockquote>
<pre><code> Dim arr(3, 3) As Integer
For y As Integer = 0 To arr.GetLength(0) - 1
For x As Integer = 0 To arr.GetLength(y) - 1
arr(y, x) = y + x
Next
Next
</code></pre>
</blockquo... | [
{
"answer_id": 50454,
"author": "harpo",
"author_id": 4525,
"author_profile": "https://Stackoverflow.com/users/4525",
"pm_score": 2,
"selected": false,
"text": "<p><code>arr.GetLength(y)</code></p>\n\n<p>should be</p>\n\n<p><code>arr.GetLength(1)</code></p>\n"
},
{
"answer_id": 5... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/795/"
] | This has been driving me crazy for a few days. Why doesn't the following work?
>
>
> ```
> Dim arr(3, 3) As Integer
>
> For y As Integer = 0 To arr.GetLength(0) - 1
> For x As Integer = 0 To arr.GetLength(y) - 1
> arr(y, x) = y + x
> Next
> Next
>
> ```
>
>
Also, what if ... | Ok, so what you really need is a "jagged array". This will allow you to have an "array that contains other arrays of varying lengths".
```
Dim arr As Integer()() = {New Integer() {1, 2, 3}, New Integer() {4, 5, 6, 7, 8, 9, 9, 9}, New Integer() {5, 4, 3, 2}}
For x = 0 To arr.GetUpperBound(0)
Console.WriteLin... |
50,467 | <p>Is there a good way to adjust the size of a <code>UITextView</code> to conform to its content? Say for instance I have a <code>UITextView</code> that contains one line of text:</p>
<pre><code>"Hello world"
</code></pre>
<p>I then add another line of text:</p>
<pre><code>"Goodbye world"
</code></pre>
<p>Is there ... | [
{
"answer_id": 50608,
"author": "Mike McMaster",
"author_id": 544,
"author_profile": "https://Stackoverflow.com/users/544",
"pm_score": 4,
"selected": false,
"text": "<p>Did you try <code>[textView sizeThatFits:textView.bounds]</code> ?</p>\n\n<p>Edit: sizeThatFits returns the size but d... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1967/"
] | Is there a good way to adjust the size of a `UITextView` to conform to its content? Say for instance I have a `UITextView` that contains one line of text:
```
"Hello world"
```
I then add another line of text:
```
"Goodbye world"
```
Is there a good way in Cocoa Touch to get the `rect` that will hold all of the l... | This works for both iOS 6.1 and iOS 7:
```
- (void)textViewDidChange:(UITextView *)textView
{
CGFloat fixedWidth = textView.frame.size.width;
CGSize newSize = [textView sizeThatFits:CGSizeMake(fixedWidth, MAXFLOAT)];
CGRect newFrame = textView.frame;
newFrame.size = CGSizeMake(fmaxf(newSize.width, fixe... |
50,470 | <p>I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page. Like the WYSIWYG editor on most blog engines or forums.</p>
<p>I'm trying to think of all potential security holes I need to plug, one of which is a user pasting... | [
{
"answer_id": 50474,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": 2,
"selected": false,
"text": "<p>As Jason said, I would focus more on cleaning the data on the server side. You don't really have any real cont... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366/"
] | I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page. Like the WYSIWYG editor on most blog engines or forums.
I'm trying to think of all potential security holes I need to plug, one of which is a user pasting in Javascr... | >
> ...I'm worried about the possibility of someone being able to paste some script in and run it there and then, without even sending it back to the server for processing.
>
>
> Am I worrying over nothing?
>
>
>
Firefox has a plug-in called Greasemonkey that allows users to arbitrarily run JavaScript against a... |
50,499 | <p>I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. </p>
<p>For example, let's say I have three files. Using <a href="http://docs.python.org/library/functions.html#execfile" rel="noreferrer">execfile</a>:</p>
<ul>
<li><code>script_1.py<... | [
{
"answer_id": 50502,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 4,
"selected": false,
"text": "<p>It's not entirely clear what you mean by \"the filepath of the file that is currently running within the process\".\n... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.
For example, let's say I have three files. Using [execfile](http://docs.python.org/library/functions.html#execfile):
* `script_1.py` calls `script_2.py`.
* In turn, `script_2.py` calls `... | p1.py:
```
execfile("p2.py")
```
p2.py:
```
import inspect, os
print (inspect.getfile(inspect.currentframe())) # script filename (usually with path)
print (os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # script directory
``` |
50,525 | <p>Let's take the code</p>
<pre><code>int a, b, c;
...
if ((a + b) > C)
</code></pre>
<p>If we add the values of a and b and the sum exceeds the maximum value of an int, will the integrity of the comparison be compromised? I was thinking that there might be an implicit up cast or overflow bit check and that will ... | [
{
"answer_id": 50530,
"author": "hazzen",
"author_id": 5066,
"author_profile": "https://Stackoverflow.com/users/5066",
"pm_score": 4,
"selected": true,
"text": "<p>C will do no such thing. It will silently overflow and lead to a possibly incorrect comparison. You can up-cast yourself, bu... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064/"
] | Let's take the code
```
int a, b, c;
...
if ((a + b) > C)
```
If we add the values of a and b and the sum exceeds the maximum value of an int, will the integrity of the comparison be compromised? I was thinking that there might be an implicit up cast or overflow bit check and that will be factored into the evaluatio... | C will do no such thing. It will silently overflow and lead to a possibly incorrect comparison. You can up-cast yourself, but it will not be done automatically. |
50,532 | <p>How do I format a number in Java?<br />
What are the "Best Practices"?</p>
<p>Will I need to round a number before I format it?</p>
<blockquote>
<p><code>32.302342342342343</code> => <code>32.30</code></p>
<p><code>.7323</code> => <code>0.73</code></p>
</blockquote>
<p>etc.</p>
| [
{
"answer_id": 50543,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 8,
"selected": true,
"text": "<p>From <a href=\"http://bytes.com/forum/thread16212.html\" rel=\"noreferrer\">this thread</a>, there are different ways to do th... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1310/"
] | How do I format a number in Java?
What are the "Best Practices"?
Will I need to round a number before I format it?
>
> `32.302342342342343` => `32.30`
>
>
> `.7323` => `0.73`
>
>
>
etc. | From [this thread](http://bytes.com/forum/thread16212.html), there are different ways to do this:
```
double r = 5.1234;
System.out.println(r); // r is 5.1234
int decimalPlaces = 2;
BigDecimal bd = new BigDecimal(r);
// setScale is immutable
bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
r = bd.doubleVal... |
50,539 | <p>One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover</p>
<p>does anyone have any ideas or have created such a thing before<br>
we have a couple ideas but they involve to much database usage </p>
<p>We pref... | [
{
"answer_id": 50543,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 8,
"selected": true,
"text": "<p>From <a href=\"http://bytes.com/forum/thread16212.html\" rel=\"noreferrer\">this thread</a>, there are different ways to do th... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2486/"
] | One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover
does anyone have any ideas or have created such a thing before
we have a couple ideas but they involve to much database usage
We prefer that it be FREE!... | From [this thread](http://bytes.com/forum/thread16212.html), there are different ways to do this:
```
double r = 5.1234;
System.out.println(r); // r is 5.1234
int decimalPlaces = 2;
BigDecimal bd = new BigDecimal(r);
// setScale is immutable
bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
r = bd.doubleVal... |
50,558 | <p>I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height (estimated around 4000 records, but variable).</p>
<p>I have it declared as follows: </p>
<pre><code>float[,] _calibrationSet;
....
int calibrationRow = 0;
While (recordsToRead)... | [
{
"answer_id": 50581,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 4,
"selected": true,
"text": "<p>You can't use an array.\nOr rather, you would need to pick a size, and if you ended up needing more then you would have to allo... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] | I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height (estimated around 4000 records, but variable).
I have it declared as follows:
```
float[,] _calibrationSet;
....
int calibrationRow = 0;
While (recordsToRead)
{
for (int i = 0; i ... | You can't use an array.
Or rather, you would need to pick a size, and if you ended up needing more then you would have to allocate a new, larger, array, copy the data from the old one into the new one, and continue on as before (until you exceed the size of the new one...)
Generally, you would go with one of the colle... |
50,565 | <p>I have a ContextMenu that is displayed after a user right clicks on a ComboBox. When the user selects an item in the context menu, a form is brought up using the <code>ShowDialog()</code> method. </p>
<pre><code>If frmOptions.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
LoadComboBoxes()
End If
</code>... | [
{
"answer_id": 50590,
"author": "DaveK",
"author_id": 4244,
"author_profile": "https://Stackoverflow.com/users/4244",
"pm_score": 2,
"selected": true,
"text": "<p>One way to handle this would be to use the context menu's Popup event to grab the selected index of the combobox launching th... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/299/"
] | I have a ContextMenu that is displayed after a user right clicks on a ComboBox. When the user selects an item in the context menu, a form is brought up using the `ShowDialog()` method.
```
If frmOptions.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
LoadComboBoxes()
End If
```
When that form is closed, I... | One way to handle this would be to use the context menu's Popup event to grab the selected index of the combobox launching the menu. When the dialog form closes reset the selected index. |
50,579 | <p>I'm having a strange problem.</p>
<p>I have to use <code>GetPostBackEventRefence</code> to force a Postback, but it works the first time, after the first postback, the .NET function is not rendered... any ideas?</p>
<p>This is what I'm missing after the postback:</p>
<pre><code><script language="javascript" ty... | [
{
"answer_id": 50593,
"author": "Haydar",
"author_id": 288,
"author_profile": "https://Stackoverflow.com/users/288",
"pm_score": 3,
"selected": true,
"text": "<p>The first thing I would look at is whether you have any asp controls (such as linkbutton, comboboxes,that don't normally gener... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] | I'm having a strange problem.
I have to use `GetPostBackEventRefence` to force a Postback, but it works the first time, after the first postback, the .NET function is not rendered... any ideas?
This is what I'm missing after the postback:
```
<script language="javascript" type="text/javascript">
<!--
function __doPo... | The first thing I would look at is whether you have any asp controls (such as linkbutton, comboboxes,that don't normally generate a submit but requre a postback) being displayed on the page.
**The \_\_doPostback function will only be put into the page if ASP thinks that one of your controls requires it.**
If you aren... |
50,585 | <p>How do you capture the mouse events, move and click over top of a Shockwave Director Object (not flash) in Firefox, via JavaScript. The code works in IE but not in FF. </p>
<p>The script works on the document body of both IE and Moz, but mouse events do not fire when mouse is over a shockwave director object embed.... | [
{
"answer_id": 171164,
"author": "ken",
"author_id": 20300,
"author_profile": "https://Stackoverflow.com/users/20300",
"pm_score": 1,
"selected": false,
"text": "<p>Just an idea.</p>\n\n<p>Try overlaying the shockwave object with a div with opacity 0, then you can capture events on the d... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/567/"
] | How do you capture the mouse events, move and click over top of a Shockwave Director Object (not flash) in Firefox, via JavaScript. The code works in IE but not in FF.
The script works on the document body of both IE and Moz, but mouse events do not fire when mouse is over a shockwave director object embed.
Update: ... | You could also catch the mouse event within Director (That never fails) and then call your JS functions from there, using gotoNetPage "javascript:function('" & argument & "')"
ej:
```
on mouseDown me
gotoNetPage "javascript:function('" & argument & "')"
end
```
The mouse move detection is a little bit trickier, ... |
50,605 | <p>Suppose I have the following C code.</p>
<pre><code>unsigned int u = 1234;
int i = -5678;
unsigned int result = u + i;
</code></pre>
<p>What implicit conversions are going on here, and is this code safe for all values of <code>u</code> and <code>i</code>? (Safe, in the sense that even though <em>result</em> in th... | [
{
"answer_id": 50632,
"author": "Ozgur Ozcitak",
"author_id": 976,
"author_profile": "https://Stackoverflow.com/users/976",
"pm_score": 9,
"selected": true,
"text": "<p><strong>Short Answer</strong></p>\n\n<p>Your <code>i</code> will be <em>converted</em> to an unsigned integer by adding... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4828/"
] | Suppose I have the following C code.
```
unsigned int u = 1234;
int i = -5678;
unsigned int result = u + i;
```
What implicit conversions are going on here, and is this code safe for all values of `u` and `i`? (Safe, in the sense that even though *result* in this example will overflow to some huge positive number, ... | **Short Answer**
Your `i` will be *converted* to an unsigned integer by adding `UINT_MAX + 1`, then the addition will be carried out with the unsigned values, resulting in a large `result` (depending on the values of `u` and `i`).
**Long Answer**
According to the C99 Standard:
>
> 6.3.1.8 Usual arithmetic conversi... |
50,618 | <p>Syntax aside, what is the difference between</p>
<pre><code>try {
}
catch() {
}
finally {
x = 3;
}
</code></pre>
<p>and </p>
<pre><code>try {
}
catch() {
}
x = 3;
</code></pre>
<p>edit: in .NET 2.0?</p>
<hr>
<p>so</p>
<pre><code>try {
throw something maybe
x = 3
}
catch (...) {
x = 3
}
</code... | [
{
"answer_id": 50621,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": 0,
"selected": false,
"text": "<p>So you can clean up any open connections, etc. initialized in the try block. If you opened a connection and th... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5278/"
] | Syntax aside, what is the difference between
```
try {
}
catch() {
}
finally {
x = 3;
}
```
and
```
try {
}
catch() {
}
x = 3;
```
edit: in .NET 2.0?
---
so
```
try {
throw something maybe
x = 3
}
catch (...) {
x = 3
}
```
is behaviourally equivalent? | Depends on the language as there might be some slight semantic differences, but the idea is that it will execute (almost) always, even if the code in the try block threw an exception.
In the second example, if the code in the catch block returns or quits, the x = 3 will not be executed. In the first it will.
In the .... |
50,702 | <p>If I have 2 query sources how do I find ones that are in one that are not in the other?</p>
<p>example of join to find items in both:</p>
<pre><code>var results = from item1 in qs1.Items
join item2 in qs2 on item1.field1 equals item2.field2
select item1;
</code></pre>
<p>So what would the linq code be to re... | [
{
"answer_id": 50719,
"author": "Bramha Ghosh",
"author_id": 3268,
"author_profile": "https://Stackoverflow.com/users/3268",
"pm_score": 2,
"selected": false,
"text": "<p>From <a href=\"http://programminglinq.com/blogs/marcorusso/archive/2008/01/14/the-not-in-clause-in-linq-to-sql.aspx\"... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1215/"
] | If I have 2 query sources how do I find ones that are in one that are not in the other?
example of join to find items in both:
```
var results = from item1 in qs1.Items
join item2 in qs2 on item1.field1 equals item2.field2
select item1;
```
So what would the linq code be to return the items in qs1 that are no... | Darren Kopp's [answer](https://stackoverflow.com/questions/50702/linq-how-do-you-do-a-query-for-items-in-one-query-source-that-are-not-in-anothe/50724#50724):
```
var excluded = items1.Except(items2);
```
is the best solution from a performance perspective.
*(NB: This true for at least regular LINQ, perhaps LINQ to... |
50,737 | <p>Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?</p>
| [
{
"answer_id": 50742,
"author": "Blorgbeard",
"author_id": 369,
"author_profile": "https://Stackoverflow.com/users/369",
"pm_score": 3,
"selected": false,
"text": "<p>If you just commit your working copy, you'll get a file list showing you your unversioned files, which you can tick to ad... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day? | I would probably make a batch file, something like this (untested):
```
dir /b /S *.cs > allcsfiles.txt
svn add --targets allcsfiles.txt
```
I believe svn won't mind you trying to add files which are already versioned..
Anyway, that's probably about as automatic as you will easily get. |
50,744 | <p>What's the simplest way of blocking a thread until a file has been unlocked and is accessible for reading and renaming? For example, is there a WaitOnFile() somewhere in the .NET Framework?</p>
<p>I have a service that uses a FileSystemWatcher to look for files that are to be transmitted to an FTP site, but the <em... | [
{
"answer_id": 50753,
"author": "Gulzar Nazim",
"author_id": 4337,
"author_profile": "https://Stackoverflow.com/users/4337",
"pm_score": 2,
"selected": false,
"text": "<p>One of the techniques I used some time back was to write my own function. Basically catch the exception and retry usi... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5548/"
] | What's the simplest way of blocking a thread until a file has been unlocked and is accessible for reading and renaming? For example, is there a WaitOnFile() somewhere in the .NET Framework?
I have a service that uses a FileSystemWatcher to look for files that are to be transmitted to an FTP site, but the *file created... | This was the answer I gave on a [related question](https://stackoverflow.com/questions/41290/file-access-strategy-in-a-multi-threaded-environment-web-app#41559):
```
/// <summary>
/// Blocks until the file is not locked any more.
/// </summary>
/// <param name="fullPath"></param>
bool WaitForFile(s... |
50,746 | <p>We are using VS 2008 Team System with the automated test suite, and upon running tests the test host "randomly" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a "pending" state.</p>
<p>Has anyone experience similar behavior and kn... | [
{
"answer_id": 51063,
"author": "Cory Foy",
"author_id": 4083,
"author_profile": "https://Stackoverflow.com/users/4083",
"pm_score": 2,
"selected": false,
"text": "<p>When you say lock up, do you mean VS is actually hung, or do the tests not run?</p>\n\n<p>The easiest way to track down w... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5289/"
] | We are using VS 2008 Team System with the automated test suite, and upon running tests the test host "randomly" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a "pending" state.
Has anyone experience similar behavior and know of a fi... | When you say lock up, do you mean VS is actually hung, or do the tests not run?
The easiest way to track down what is going on would be to look at a dump of the hung process. If you are on Vista, just right-click on the process and choose to create a memory dump. If you are on Windows XP, and don't have the [Debugging... |
50,771 | <p>This would be a question for anyone who has code in the App_Code folder and uses a hardware load balancer. Its true the hardware load balancer could be set to sticky sessions to solve the issue, but in a perfect world, I would like the feature turned off.</p>
<p>When a file in the App_Code folder, and the site is n... | [
{
"answer_id": 50780,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 1,
"selected": false,
"text": "<p>Does your load balancer supports sticky sessions? With this on, the balancer will route the same IP to the same server o... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3453/"
] | This would be a question for anyone who has code in the App\_Code folder and uses a hardware load balancer. Its true the hardware load balancer could be set to sticky sessions to solve the issue, but in a perfect world, I would like the feature turned off.
When a file in the App\_Code folder, and the site is not pre-c... | You could move whatever is in your app\_code to an external class library if your QA dept can promote that entire library. I think you are stuck with sticky sessions if you can't find a convenient or tolerable way to switch to a pre-compiled site. |
50,786 | <p>How do I get ms-access to connect (through ODBC) to an ms-sql database as a different user than their Active Directory ID? </p>
<p>I don't want to specify an account in the ODBC connection, I want to do it on the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to ... | [
{
"answer_id": 51016,
"author": "tbreffni",
"author_id": 637,
"author_profile": "https://Stackoverflow.com/users/637",
"pm_score": 0,
"selected": false,
"text": "<p>I think you'd have to launch the MS Access process under the account you want to use to connect. There are various tools t... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685/"
] | How do I get ms-access to connect (through ODBC) to an ms-sql database as a different user than their Active Directory ID?
I don't want to specify an account in the ODBC connection, I want to do it on the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to the origin... | I think you can get this to work the way you want it to if you use an ["ODBC DSN-LESS connection"](http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForSQLServer)
If you need to, keep your ODBC DSN's on your users' machines using windows authentication. Give your users read-only access to your database. (If ... |
50,794 | <p>How does unix handle full path name with space and arguments ?<br>
In windows we quote the path and add the command-line arguments after, how is it in unix?</p>
<pre><code> "c:\foo folder with space\foo.exe" -help
</code></pre>
<p><strong>update:</strong></p>
<p>I meant how do I recognize a path from the command ... | [
{
"answer_id": 50798,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 4,
"selected": false,
"text": "<p>You can quote if you like, or you can escape the spaces with a preceding \\, but most UNIX paths (Mac OS X aside) don't ... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2566/"
] | How does unix handle full path name with space and arguments ?
In windows we quote the path and add the command-line arguments after, how is it in unix?
```
"c:\foo folder with space\foo.exe" -help
```
**update:**
I meant how do I recognize a path from the command line arguments. | You can either quote it like your Windows example above, or escape the spaces with backslashes:
```
"/foo folder with space/foo" --help
/foo\ folder\ with\ space/foo --help
``` |
50,801 | <p>How would you find the fractional part of a floating point number in PHP?</p>
<p>For example, if I have the value <code>1.25</code>, I want to return <code>0.25</code>.</p>
| [
{
"answer_id": 50806,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 7,
"selected": true,
"text": "<pre><code>$x = $x - floor($x)\n</code></pre>\n"
},
{
"answer_id": 50807,
"author": "Ethan Gunderson",
"author... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4925/"
] | How would you find the fractional part of a floating point number in PHP?
For example, if I have the value `1.25`, I want to return `0.25`. | ```
$x = $x - floor($x)
``` |
50,824 | <p>I wrote a simple tool to generate a DBUnit XML dataset using queries that the user enters. I want to include each query entered in the XML as a comment, but the DBUnit API to generate the XML file doesn't support inserting the comment where I would like it (above the data it generates), so I am resorting to putting... | [
{
"answer_id": 50832,
"author": "Anonymoose",
"author_id": 2391,
"author_profile": "https://Stackoverflow.com/users/2391",
"pm_score": 5,
"selected": true,
"text": "<p>According to the <a href=\"http://www.w3.org/TR/2006/REC-xml-20060816/#sec-comments\" rel=\"noreferrer\">XML specificati... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] | I wrote a simple tool to generate a DBUnit XML dataset using queries that the user enters. I want to include each query entered in the XML as a comment, but the DBUnit API to generate the XML file doesn't support inserting the comment where I would like it (above the data it generates), so I am resorting to putting the... | According to the [XML specification](http://www.w3.org/TR/2006/REC-xml-20060816/#sec-comments), a well-formed XML document is:
>
> `document ::= prolog element Misc*`
>
>
>
where `prolog` is
>
> `prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?`
>
>
>
and `Misc` is
>
> `Misc ::= Comment | PI | S`
>
>
>
... |
50,845 | <p>For my acceptance testing I'm writing text into the auto complete extender and I need to click on the populated list.</p>
<p>In order to populate the list I have to use AppendText instead of TypeText, otherwise the textbox looses focus before the list is populated.</p>
<p>Now my problem is when I try to click on t... | [
{
"answer_id": 50857,
"author": "17 of 26",
"author_id": 2284,
"author_profile": "https://Stackoverflow.com/users/2284",
"pm_score": -1,
"selected": false,
"text": "<p>I would go with XML. XML is widely supported on all platforms and has lots of libraries and tools available for it. An... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1560/"
] | For my acceptance testing I'm writing text into the auto complete extender and I need to click on the populated list.
In order to populate the list I have to use AppendText instead of TypeText, otherwise the textbox looses focus before the list is populated.
Now my problem is when I try to click on the populated list... | The best solution (if we're talking .NET) seem to be to use WCF and streaming http. The client makes the first http connection to the server at port 80, the connection is then kept open with a streaming response that never ends. (And if it does it reconnects).
Here's a sample that demonstrates this: [Streaming XML](ht... |
50,853 | <p>I have a relationship between two entities (e1 and e2) and e1 has a collection of e2, however I have a similar relationship set up between (e2 and e3), yet e2 does not contain a collection of e3's, any reason why this would happen? Anything I can post to make this easier to figure out?</p>
<p>Edit: I just noticed t... | [
{
"answer_id": 50957,
"author": "Gabe Anzelini",
"author_id": 5236,
"author_profile": "https://Stackoverflow.com/users/5236",
"pm_score": 0,
"selected": false,
"text": "<p>the FK_Contraints are set up like this:</p>\n\n<p>ALTER TABLE [dbo].[e2] WITH CHECK ADD CONSTRAINT [FK_e2_e1] FOREIG... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5236/"
] | I have a relationship between two entities (e1 and e2) and e1 has a collection of e2, however I have a similar relationship set up between (e2 and e3), yet e2 does not contain a collection of e3's, any reason why this would happen? Anything I can post to make this easier to figure out?
Edit: I just noticed that the re... | **Using this setup, everything worked.**
*1) LINQ to SQL Query, 2) DB Tables, 3) LINQ to SQL Data Model in VS.NET 2008*
**1 - LINQ to SQL Query**
```
DataClasses1DataContext db = new DataClasses1DataContext();
var results = from threes in db.tableThrees
join twos in db.tableTwos on threes.fk_tableTwo equals tw... |
50,900 | <p>So I have about 10 short css files that I use with mvc app.
There are like
error.css
login.css
etc...
Just some really short css files that make updating and editing easy (At least for me). What I want is something that will optimize the if else branch and not incorporate it within the final bits. I want to do somet... | [
{
"answer_id": 50921,
"author": "jdelator",
"author_id": 438,
"author_profile": "https://Stackoverflow.com/users/438",
"pm_score": 3,
"selected": false,
"text": "<p>I should had used google.</p>\n\n<pre><code>#if DEBUG\n Console.WriteLine(\"Debug mode.\") \n#else \n Console.WriteLi... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438/"
] | So I have about 10 short css files that I use with mvc app.
There are like
error.css
login.css
etc...
Just some really short css files that make updating and editing easy (At least for me). What I want is something that will optimize the if else branch and not incorporate it within the final bits. I want to do somethin... | Specifically, like this in C#:
```
#if (DEBUG)
Debug Stuff
#endif
```
C# has the following preprocessor directives:
```
#if
#else
#elif // Else If
#endif
#define
#undef // Undefine
#warning // Causes the preprocessor to fire warning
#error // Causes the preprocessor to fire a fatal error
#line // Lets the prep... |
50,931 | <p>I'm using <a href="http://www.helicontech.com/isapi_rewrite/" rel="nofollow noreferrer">Helicon's ISAPI Rewrite 3</a>, which basically enables .htaccess in IIS. I need to redirect a non-www URL to the www version, i.e. example.com should redirect to www.example.com. I used the following rule from the examples but ... | [
{
"answer_id": 50937,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 0,
"selected": false,
"text": "<p>Can't you adjust the RewriteCond to only operate on example.com?</p>\n\n<pre><code>RewriteCond %{HTTP:Host} ^example\\.com(... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2614/"
] | I'm using [Helicon's ISAPI Rewrite 3](http://www.helicontech.com/isapi_rewrite/), which basically enables .htaccess in IIS. I need to redirect a non-www URL to the www version, i.e. example.com should redirect to www.example.com. I used the following rule from the examples but it affects subdomains:
```
RewriteCond %{... | Append the following RewriteCond:
```
RewriteCond %{HTTP:Host} ^[^.]+\.[a-z]{2,5}$ [NC]
```
That way it'll only apply the rule to nondottedsomething.uptofiveletters as you can see, subdomain.domain.com will not match the condition and thus will not be rewritten.
You can change [a-z]{2,5} for a stricter tld matching... |
50,983 | <p>I liked the discussion at <a href="https://stackoverflow.com/questions/31693/differences-in-generics">Differences in Generics</a>, and was wondering whether there were any languages that used this feature particularly well.</p>
<p>I really dislike Java's <code>List<? extends Foo></code> for a <code>List</code... | [
{
"answer_id": 50991,
"author": "Apocalisp",
"author_id": 3434,
"author_profile": "https://Stackoverflow.com/users/3434",
"pm_score": 5,
"selected": true,
"text": "<p>Haskell implements type-constructor parameterisation (generics, or parametric polymorphism) quite well. So does Scala (al... | 2008/09/08 | [
"https://Stackoverflow.com/questions/50983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] | I liked the discussion at [Differences in Generics](https://stackoverflow.com/questions/31693/differences-in-generics), and was wondering whether there were any languages that used this feature particularly well.
I really dislike Java's `List<? extends Foo>` for a `List` of things that are Liskov-substitutable for `Fo... | Haskell implements type-constructor parameterisation (generics, or parametric polymorphism) quite well. So does Scala (although it needs a bit of hand-holding sometimes).
Both of these languages have higher-kinded types (a.k.a. abstract type constructors, or type-constructor polymorphism, or higher-order polymorphism)... |
50,995 | <p>I'm a C# developer who's fumbling in the first VB code he's written since VB6, so if I am asking a rather obvious question, please forgive me.</p>
<p>I decided to experiment with XML Literals to generate some XML code for me, instead of using XMLDocument</p>
<p>I have 2 questions, the second regarding a workaround... | [
{
"answer_id": 51025,
"author": "DaveK",
"author_id": 4244,
"author_profile": "https://Stackoverflow.com/users/4244",
"pm_score": 1,
"selected": true,
"text": "<p>If I understand correctly what you are trying to do, you can use the StringBuilder. Use the StringBuilder.Append method and a... | 2008/09/09 | [
"https://Stackoverflow.com/questions/50995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5302/"
] | I'm a C# developer who's fumbling in the first VB code he's written since VB6, so if I am asking a rather obvious question, please forgive me.
I decided to experiment with XML Literals to generate some XML code for me, instead of using XMLDocument
I have 2 questions, the second regarding a workaround due to my inabil... | If I understand correctly what you are trying to do, you can use the StringBuilder. Use the StringBuilder.Append method and append the XmlElement 'OuterXml' property.
For example:
sb.Append(xmlElement.OuterXml) |
51,010 | <p>I have 2 time values which have the type <code>datetime.time</code>. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type <code>datetime.datetime</code> but not for <code>datetime.time</code>. So what is the best way to do this?</p>
| [
{
"answer_id": 51015,
"author": "pkaeding",
"author_id": 4257,
"author_profile": "https://Stackoverflow.com/users/4257",
"pm_score": 1,
"selected": false,
"text": "<p>It seems that this isn't supported, since there wouldn't be a good way to deal with overflows in datetime.time. I know t... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] | I have 2 time values which have the type `datetime.time`. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type `datetime.datetime` but not for `datetime.time`. So what is the best way to do this? | Firstly, note that a datetime.time is a time of day, independent of a given day, and so the different between any two datetime.time values is going to be less than 24 hours.
One approach is to convert both datetime.time values into comparable values (such as milliseconds), and find the difference.
```
t1, t2 = dateti... |
51,019 | <p>What does it mean when a <a href="http://en.wikipedia.org/wiki/PostgreSQL" rel="noreferrer">PostgreSQL</a> process is "idle in transaction"?</p>
<p>On a server that I'm looking at, the output of "ps ax | grep postgres" I see 9 PostgreSQL processes that look like the following:</p>
<pre><code>postgres: user db 127.... | [
{
"answer_id": 51058,
"author": "Anonymoose",
"author_id": 2391,
"author_profile": "https://Stackoverflow.com/users/2391",
"pm_score": 7,
"selected": true,
"text": "<p>The <a href=\"http://www.postgresql.org/docs/8.3/interactive/monitoring-ps.html\" rel=\"noreferrer\">PostgreSQL manual</... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | What does it mean when a [PostgreSQL](http://en.wikipedia.org/wiki/PostgreSQL) process is "idle in transaction"?
On a server that I'm looking at, the output of "ps ax | grep postgres" I see 9 PostgreSQL processes that look like the following:
```
postgres: user db 127.0.0.1(55658) idle in transaction
```
Does this ... | The [PostgreSQL manual](http://www.postgresql.org/docs/8.3/interactive/monitoring-ps.html) indicates that this means the transaction is open (inside BEGIN) and idle. It's most likely a user connected using the monitor who is thinking or typing. I have plenty of those on my system, too.
If you're using Slony for replic... |
51,028 | <p>How do I create a background process with Haskell on windows without a visible command window being created?</p>
<p>I wrote a Haskell program that runs backup processes periodically but every time I run it, a command window opens up to the top of all the windows. I would like to get rid of this window. What is the ... | [
{
"answer_id": 51049,
"author": "Apocalisp",
"author_id": 3434,
"author_profile": "https://Stackoverflow.com/users/3434",
"pm_score": 0,
"selected": false,
"text": "<p>The simplest way I can think of is to run the rsync command from within a Windows Shell script (vbs or cmd).</p>\n"
},... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] | How do I create a background process with Haskell on windows without a visible command window being created?
I wrote a Haskell program that runs backup processes periodically but every time I run it, a command window opens up to the top of all the windows. I would like to get rid of this window. What is the simplest w... | You should really tell us how you are trying to do this currently, but on my system (using linux) the following snippet will run a command without opening a new terminal window. It should work the same way on windows.
```
module Main where
import System
import System.Process
import Control.Monad
main :: IO ()
main = ... |