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 |
|---|---|---|---|---|---|---|
463,604 | <p>I have a Python function that takes a numeric argument that <strong>must</strong> be an integer in order for it behave correctly. What is the preferred way of verifying this in Python?</p>
<p>My first reaction is to do something like this:</p>
<pre><code>def isInteger(n):
return int(n) == n
</code></pre>
<p>B... | [
{
"answer_id": 463630,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 7,
"selected": true,
"text": "<pre><code>isinstance(n, int)\n</code></pre>\n\n<p>If you need to know whether it's definitely an actual int and not a subc... | 2009/01/20 | [
"https://Stackoverflow.com/questions/463604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6306/"
] | I have a Python function that takes a numeric argument that **must** be an integer in order for it behave correctly. What is the preferred way of verifying this in Python?
My first reaction is to do something like this:
```
def isInteger(n):
return int(n) == n
```
But I can't help thinking that this is 1) expen... | ```
isinstance(n, int)
```
If you need to know whether it's definitely an actual int and not a subclass of int (generally you shouldn't need to do this):
```
type(n) is int
```
this:
```
return int(n) == n
```
isn't such a good idea, as cross-type comparisons can be true - notably `int(3.0)==3.0` |
463,642 | <p>How can I convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?</p>
<p>Let's say I have 80 seconds; are there any specialized classes/techniques in .NET that would allow me to convert those 80 seconds into (00h:00m:00s:00ms) format like <code>Convert.ToDateTime</code> or something?</p>
| [
{
"answer_id": 463668,
"author": "Curtis Shipley",
"author_id": 57114,
"author_profile": "https://Stackoverflow.com/users/57114",
"pm_score": 10,
"selected": true,
"text": "<p>For <strong>.Net <= 4.0</strong> Use the TimeSpan class.</p>\n\n<pre><code>TimeSpan t = TimeSpan.FromSeconds(... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?
Let's say I have 80 seconds; are there any specialized classes/techniques in .NET that would allow me to convert those 80 seconds into (00h:00m:00s:00ms) format like `Convert.ToDateTime` or something? | For **.Net <= 4.0** Use the TimeSpan class.
```
TimeSpan t = TimeSpan.FromSeconds( secs );
string answer = string.Format("{0:D2}h:{1:D2}m:{2:D2}s:{3:D3}ms",
t.Hours,
t.Minutes,
t.Seconds,
t.Milliseconds);
```
(As noted by Inder Kumar Rathore) For *... |
463,643 | <p>Basically I'm asking the same question as this guy: <a href="https://stackoverflow.com/questions/72852/how-to-do-relative-imports-in-python">How to do relative imports in Python?</a></p>
<p>But no one gave him a correct answer. Given that you are inside a subfolder and you want to go up a directory and then into AN... | [
{
"answer_id": 463691,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 2,
"selected": false,
"text": "<p>If I'm <a href=\"http://www.python.org/dev/peps/pep-0328/\" rel=\"nofollow noreferrer\">reading</a> <a href=\"http://do... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49018/"
] | Basically I'm asking the same question as this guy: [How to do relative imports in Python?](https://stackoverflow.com/questions/72852/how-to-do-relative-imports-in-python)
But no one gave him a correct answer. Given that you are inside a subfolder and you want to go up a directory and then into ANOTHER subfolder, doin... | ```
main.py
setup.py
app/ ->
__init__.py
package_a/ ->
__init__.py
module_a.py
package_b/ ->
__init__.py
module_b.py
```
1. You run `python main.py`.
2. `main.py` does: `import app.package_a.module_a`
3. `module_a.py` does `import app.package_b.module_b`
Alternatively 2 or 3 c... |
463,644 | <p>I would like to dynamically add fields to an ASP.NET MVC form with JQuery.</p>
<p>Example:</p>
<pre><code><script language="javascript" type="text/javascript">
var widgets;
$(document).ready(function() {
widgets = 0;
AddWidget();
});
function AddWidget() {
$('#widget... | [
{
"answer_id": 805599,
"author": "Robert Sweeney",
"author_id": 95581,
"author_profile": "https://Stackoverflow.com/users/95581",
"pm_score": 0,
"selected": false,
"text": "<p>i might be missing the point here, but, do you need to actually post the data back to the controller via a form ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54612/"
] | I would like to dynamically add fields to an ASP.NET MVC form with JQuery.
Example:
```
<script language="javascript" type="text/javascript">
var widgets;
$(document).ready(function() {
widgets = 0;
AddWidget();
});
function AddWidget() {
$('#widgets').append("<li><input type... | My solution could be something like this (pseudo-code):
```
<script language="javascript" type="text/javascript">
var widgets;
$(document).ready(function() {
widgets = 0;
<% for each value in ViewData("WidgetValues") %>
AddWidget(<%= value %>);
<% next %>
});
func... |
463,657 | <p>When I generate a certificate using MakeCert.exe, I want to change the key size from 1024 to 2048.</p>
<p>Is this possible? Or do I need to setup a certificate authority (CA)?</p>
| [
{
"answer_id": 463687,
"author": "ISW",
"author_id": 56505,
"author_profile": "https://Stackoverflow.com/users/56505",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/bfsktky3(VS.80).aspx\" rel=\"nofollow noreferrer\">A description of Makec... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38686/"
] | When I generate a certificate using MakeCert.exe, I want to change the key size from 1024 to 2048.
Is this possible? Or do I need to setup a certificate authority (CA)? | [Here](http://www.mazecomputer.com/sxs/help/shared.htm) the following syntax is used:
```
makecert -pe -ss MY -$ individual -n "CN=your name here" -len 2048 -r
```
Sorry I cannot test it, since I don't have Makecert. |
463,670 | <p>I've tried my best to be a purist with my usage of Javascript/Ajax techniques, ensuring that all Ajax-y behavior is an enhancement of base functionality, while the site is also fully functional when Javascript is disabled. However, this causes some problems.</p>
<p>In some cases, a DOM node should only be visible ... | [
{
"answer_id": 463694,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 1,
"selected": false,
"text": "<p>I can think of two methods:</p>\n\n<p>1 - Pre-detect if Javascript is enabled and save that information in a cook... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32638/"
] | I've tried my best to be a purist with my usage of Javascript/Ajax techniques, ensuring that all Ajax-y behavior is an enhancement of base functionality, while the site is also fully functional when Javascript is disabled. However, this causes some problems.
In some cases, a DOM node should only be visible when Javasc... | How about combining some of these solutions:
```
<style type="text/javascript">
.only-without-script {
display: none;
}
</style>
<noscript>
<style type="text/javascript">
.only-with-script {
display: none;
}
.only-without-script {
display: block;
... |
463,689 | <p>Say I have an array of values:</p>
<pre><code>string[] text = new string[] { "val1", "val2", "val3", "val4", "val5" };
</code></pre>
<p>Then I have a basic loop:</p>
<pre><code>for (int i = 0; i <= 30; i++)
{
Console.WriteLine(i + " = " + text[i])
}
</code></pre>
<p>Obviously, this will cause an out of bo... | [
{
"answer_id": 463695,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 5,
"selected": true,
"text": "<p>You could use the modulus operator:</p>\n\n<pre><code>Console.WriteLine(i + \" = \" + text[i % 5])\n</code></pre>\n"
}... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Say I have an array of values:
```
string[] text = new string[] { "val1", "val2", "val3", "val4", "val5" };
```
Then I have a basic loop:
```
for (int i = 0; i <= 30; i++)
{
Console.WriteLine(i + " = " + text[i])
}
```
Obviously, this will cause an out of bounds exception, so what I want to do is when the cou... | You could use the modulus operator:
```
Console.WriteLine(i + " = " + text[i % 5])
``` |
463,705 | <p>I have a data template with a textbox and a button with some styles on it. I would like to have the button show the mouse over state when focus is on the textbox beside it. Is this possible?</p>
<p>I figure it would involve something like this. I can get the textbox through use of FindVisualChild and FindName. The... | [
{
"answer_id": 464585,
"author": "Jesper Larsen-Ledet",
"author_id": 1260066,
"author_profile": "https://Stackoverflow.com/users/1260066",
"pm_score": 2,
"selected": false,
"text": "<p>I don't think it's possible to fake the event but you can force the button to render itself <em>as if</... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36234/"
] | I have a data template with a textbox and a button with some styles on it. I would like to have the button show the mouse over state when focus is on the textbox beside it. Is this possible?
I figure it would involve something like this. I can get the textbox through use of FindVisualChild and FindName. Then I can set... | I don't think it's possible to fake the event but you can force the button to render itself *as if* it had MouseOver.
```
private void tb_GotFocus(object sender, RoutedEventArgs e)
{
// ButtonChrome is the first child of button
DependencyObject chrome = VisualTreeHelper.GetChild(button, 0);
chrome.SetValue... |
463,721 | <p>Basically I would like to be able to do something like this in my xaml:</p>
<pre><code><Image Source="Resources/logout.png" />
</code></pre>
<p>and have it find Resources/logout.png as a file in my xap file, without going back to the web server. I also want to be able to rebuild my xap file on the fly, so p... | [
{
"answer_id": 463783,
"author": "BenMaddox",
"author_id": 38698,
"author_profile": "https://Stackoverflow.com/users/38698",
"pm_score": 2,
"selected": false,
"text": "<p>Add the images to the project, but set the <em>Build Action</em> to Content and <em>Copy to Output Directory</em> to ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Basically I would like to be able to do something like this in my xaml:
```
<Image Source="Resources/logout.png" />
```
and have it find Resources/logout.png as a file in my xap file, without going back to the web server. I also want to be able to rebuild my xap file on the fly, so placing it as a resource in a dll ... | Add the images to the project, but set the *Build Action* to Content and *Copy to Output Directory* to Do not copy.
For a file in the root directory, I used this format.
```
<Image Source="/logout.png" />
``` |
463,722 | <p>I need to store persistent reference to third party device on an arbitrary IP network where the IP address of the devices may be static or randomly assigned by DHCP. I don't control the devices on the network and I can't rely on DNS and other ad-hoc networking protocols existing or working with the devices.</p>
<p>... | [
{
"answer_id": 463783,
"author": "BenMaddox",
"author_id": 38698,
"author_profile": "https://Stackoverflow.com/users/38698",
"pm_score": 2,
"selected": false,
"text": "<p>Add the images to the project, but set the <em>Build Action</em> to Content and <em>Copy to Output Directory</em> to ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11032/"
] | I need to store persistent reference to third party device on an arbitrary IP network where the IP address of the devices may be static or randomly assigned by DHCP. I don't control the devices on the network and I can't rely on DNS and other ad-hoc networking protocols existing or working with the devices.
So I have ... | Add the images to the project, but set the *Build Action* to Content and *Copy to Output Directory* to Do not copy.
For a file in the root directory, I used this format.
```
<Image Source="/logout.png" />
``` |
463,733 | <p>I have a solution in Visual Studio 2008 which contains multiple C# projects. Each project has it's own config file (App.config and Settings.settings). This makes sense architecturally as each module is autonomous and is used in a number of different solutions.</p>
<p>My problem is that when I compile the solution o... | [
{
"answer_id": 463745,
"author": "Spencer Ruport",
"author_id": 52551,
"author_profile": "https://Stackoverflow.com/users/52551",
"pm_score": 1,
"selected": false,
"text": "<p>I don't believe there is. But <a href=\"https://stackoverflow.com/questions/435261/asp-net-solution-with-class-l... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a solution in Visual Studio 2008 which contains multiple C# projects. Each project has it's own config file (App.config and Settings.settings). This makes sense architecturally as each module is autonomous and is used in a number of different solutions.
My problem is that when I compile the solution only the co... | I'm not sure if this is what you are looking for or if it will help but just as a lead into an area to explore, note that you can link two Config files. For example, I have my connection string in a separate file so my connectionStrings line in Web.config reads:
```
<connectionStrings configSource="WebCS.config"/>
``... |
463,778 | <p>I've got an application where there's a main background form, from there user can only non-modal forms that maintains different part of the system. The non-modal forms overrides the CreateParams method so each one displays a button in the start task bar:</p>
<pre><code>procedure TfmMaterialsPlanning.CreateParams(va... | [
{
"answer_id": 463984,
"author": "Argalatyr",
"author_id": 18484,
"author_profile": "https://Stackoverflow.com/users/18484",
"pm_score": 0,
"selected": false,
"text": "<p>Couldn't you achieve the same effect by preventing the \"Apples\" form from accepting focus while its child form is o... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26305/"
] | I've got an application where there's a main background form, from there user can only non-modal forms that maintains different part of the system. The non-modal forms overrides the CreateParams method so each one displays a button in the start task bar:
```
procedure TfmMaterialsPlanning.CreateParams(var Params: TCre... | If you have a look at the source code of TCustomForm.ShowModal() you will see that the VCL does not use the Windows API call for showing modal dialogs, but that it does instead disable all other forms in the application while the modal form is shown. You can of course try the very same, just Show() the form-modal dialo... |
463,785 | <p>I need the ability to place the labels for radio buttons above the selections, and not to the left or the right. Is there a way to use CSS that would give this effect?</p>
<p>THanks!</p>
| [
{
"answer_id": 463791,
"author": "Ed S.",
"author_id": 1053,
"author_profile": "https://Stackoverflow.com/users/1053",
"pm_score": 1,
"selected": false,
"text": "<p>So I know this isn't the answer you are looking for, but I would be confused to see that type of layout. It is not standar... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need the ability to place the labels for radio buttons above the selections, and not to the left or the right. Is there a way to use CSS that would give this effect?
THanks! | Instead of the following:
```
<label>Label <input type="radio" id="val" name="val" value="hello"></label>
```
You can use this and style the two separately:
```
<label for="val">Label</label>
<input type="radio" id="val" name="val" value="hello">
``` |
463,786 | <p>I am not that familiar with Javascript, and am looking for the function that returns the UNICODE value of a character, and given the UNICODE value, returns the string equivalent. I'm sure there is something simple, but I don't see it.</p>
<p>Example: </p>
<ul>
<li>ASC("A") = 65 </li>
<li>CHR(65) = "A"</li>
<l... | [
{
"answer_id": 463821,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 7,
"selected": true,
"text": "<p>Have a look at:</p>\n\n<pre><code>String.fromCharCode(64)\n</code></pre>\n\n<p>and</p>\n\n<pre><code>String.charCodeAt... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | I am not that familiar with Javascript, and am looking for the function that returns the UNICODE value of a character, and given the UNICODE value, returns the string equivalent. I'm sure there is something simple, but I don't see it.
Example:
* ASC("A") = 65
* CHR(65) = "A"
* ASC("ਔ") = 2580
* CHR(2580) = "ਔ" | Have a look at:
```
String.fromCharCode(64)
```
and
```
String.charCodeAt(0)
```
The first must be called on the String **class** (literally `String.fromCharCode...`) and will return "@" (for 64). The second should be run on a String **instance** (e.g., `"@@@".charCodeAt...`) and returns the Unicode code of the f... |
463,799 | <p>When setting a property on an entity object, it is saving the value to the database even if the value is exactly the same as it was before. Is there anyway to prevent this?</p>
<p>Example:</p>
<p>If I load a Movie object and the Title is "A", if I set the Title to "A" again and SaveChanges() I was hoping that I w... | [
{
"answer_id": 463836,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 2,
"selected": false,
"text": "<p>According to <a href=\"http://msdn.microsoft.com/en-us/library/bb738695.aspx\" rel=\"nofollow noreferrer\">MSDN</a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16008/"
] | When setting a property on an entity object, it is saving the value to the database even if the value is exactly the same as it was before. Is there anyway to prevent this?
Example:
If I load a Movie object and the Title is "A", if I set the Title to "A" again and SaveChanges() I was hoping that I wouldn't see the UP... | Yes, you can change this. Doing so isn't trivial, however, in the current version of the Entity Framework. It will become easier in the future.
The reason you're seeing this behavior is because of the default code generation for the entity model. Here is a representative example:
```
public global::System.Guid Id
{
... |
463,800 | <p>I have the following code:</p>
<pre><code>// Creates a timer to check for elements popping into the dom
timer = setInterval(function ()
{
for (p in pixelTypes)
{
checkElems(pixelTypes[p]);
}
}, 10);
// Add Document f... | [
{
"answer_id": 463807,
"author": "Sophie Alpert",
"author_id": 49485,
"author_profile": "https://Stackoverflow.com/users/49485",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think that you should really be polling for elements the way you are.</p>\n\n<p>The document ready event ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | I have the following code:
```
// Creates a timer to check for elements popping into the dom
timer = setInterval(function ()
{
for (p in pixelTypes)
{
checkElems(pixelTypes[p]);
}
}, 10);
// Add Document finished callba... | Just a few pointers for anyone that's interested:
`$(document).ready(function() {...});` and `$(function() {...});` means exactly the same thing. The latter is a shorthand for the former.
If you develop for a large site, using multiple Javascript libraries, or you develop plugins meant to be compatible with other peo... |
463,813 | <p>Is there a recommended way to prevent the Windows screensaver from starting? The closest thing I've found is <a href="http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx" rel="noreferrer">this article</a>, but what I would really like to do is just tell Windows that the computer isn't idle rather than fooling ... | [
{
"answer_id": 463850,
"author": "Eddie Parker",
"author_id": 56349,
"author_profile": "https://Stackoverflow.com/users/56349",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://community.devpinoy.org/blogs/rolvin/archive/2006/12/07/sc-screensave-i-ll-smoke-don-t-bother.aspx... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45459/"
] | Is there a recommended way to prevent the Windows screensaver from starting? The closest thing I've found is [this article](http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx), but what I would really like to do is just tell Windows that the computer isn't idle rather than fooling with the currently set screensav... | For testing, I set the screensaver to 1 minute and required a password.
I tried capturing SC\_SCREENSAVE and returning -1 in VB .Net. As commented, it works when there is no screensaver password but **fails** if the screensaver password is active. (I tried it in Windows XP). I also put this into a Timer's tick event, ... |
463,816 | <p>I think you can guess the problem I'm having. I'm inserting filenames in to an sql database in C++ Builder. Some files have an apostrophe in their name. This breaks the sql insert query. the usual way to fix this is to double up and apostrophes you want to be part of the field value.</p>
<p>For example if I wan... | [
{
"answer_id": 463834,
"author": "Eddie Parker",
"author_id": 56349,
"author_profile": "https://Stackoverflow.com/users/56349",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't used AnsiString, but basically I'd do the following:</p>\n\n<ul>\n<li>Reverse find single quotes in your... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21880/"
] | I think you can guess the problem I'm having. I'm inserting filenames in to an sql database in C++ Builder. Some files have an apostrophe in their name. This breaks the sql insert query. the usual way to fix this is to double up and apostrophes you want to be part of the field value.
For example if I want to add 'geor... | Actually I got the answer by myself...
```
item = StringReplace( item, "'", "''", TReplaceFlags() <<rfReplaceAll );
```
(so there is a built in replace function in AnsiString afterall)
Edit: Added code tags so we can distinguish between different quotes |
463,832 | <p>Is there a way to use the DPAPI (Data Protection Application Programming Interface) on Windows XP with Python?</p>
<p>I would prefer to use an existing module if there is one that can do it. Unfortunately I haven't been able to find a way with Google or Stack Overflow.</p>
<p><strong>EDIT:</strong> I've taken the... | [
{
"answer_id": 463840,
"author": "Alan",
"author_id": 37843,
"author_profile": "https://Stackoverflow.com/users/37843",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way would be to use <a href=\"http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython\" rel=\"nofollow n... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38403/"
] | Is there a way to use the DPAPI (Data Protection Application Programming Interface) on Windows XP with Python?
I would prefer to use an existing module if there is one that can do it. Unfortunately I haven't been able to find a way with Google or Stack Overflow.
**EDIT:** I've taken the example code pointed to by "dF... | I have been using `CryptProtectData` and `CryptUnprotectData` through ctypes, with the code from
<http://article.gmane.org/gmane.comp.python.ctypes/420>
and it has been working well. |
463,870 | <p>I'm curious as to how often experienced Haskell programmers really use type inference in practice. I often see it praised as an advantage over the always-explicit declarations needed in certain other languages, but for some reason (perhaps just because I'm new) it "feels" right to write a type signature just about a... | [
{
"answer_id": 464013,
"author": "sth",
"author_id": 56338,
"author_profile": "https://Stackoverflow.com/users/56338",
"pm_score": 5,
"selected": true,
"text": "<p>It's still an advantage, even if you write type signatures, because the compiler will catch type errors in your functions. I... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38803/"
] | I'm curious as to how often experienced Haskell programmers really use type inference in practice. I often see it praised as an advantage over the always-explicit declarations needed in certain other languages, but for some reason (perhaps just because I'm new) it "feels" right to write a type signature just about all ... | It's still an advantage, even if you write type signatures, because the compiler will catch type errors in your functions. I usually write type signatures too, but omit them in places like `where` or `let` clauses where you actually define new symbols but don't feel the need to specify a type signature.
Stupid example... |
463,878 | <p>Is there a way I can log the output of xm console in to some file? </p>
<p>Can I set something in the domain configuration file which automatically does this for me when I issue xm create?</p>
<p>I tried:</p>
<pre><code>xm console | tee domU-console.log
</code></pre>
<p>... , but that does not fit in my case. I ... | [
{
"answer_id": 466335,
"author": "Otto",
"author_id": 9594,
"author_profile": "https://Stackoverflow.com/users/9594",
"pm_score": 1,
"selected": true,
"text": "<p>If that works then you ought to be able to :</p>\n\n<pre><code>nohup xm console | tee domU-console.log & \n</code></pre>\... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48725/"
] | Is there a way I can log the output of xm console in to some file?
Can I set something in the domain configuration file which automatically does this for me when I issue xm create?
I tried:
```
xm console | tee domU-console.log
```
... , but that does not fit in my case. I want to log the output asynchronously in... | If that works then you ought to be able to :
```
nohup xm console | tee domU-console.log &
```
I don't know if `xm console` uses stderr at all but if you want to be sure to snag tht output, too, do this:
```
nohup xm console 2>&1 tee domU-console.log &
```
Drop the `tee` if you intend on logging out. |
463,889 | <p>I have a DLL in the BIN folder, and I need it to be referenced in the web.config, or I get that annoying error:</p>
<blockquote>
<p>Description: An error occurred during
the compilation of a resource required
to service this request. Please review
the following specific error details
and modify your sourc... | [
{
"answer_id": 463905,
"author": "Joshua",
"author_id": 14768,
"author_profile": "https://Stackoverflow.com/users/14768",
"pm_score": 0,
"selected": false,
"text": "<p>Funny I found that if the dll and all its dependencies are in the bin directory, it can be used even if not in the .SLN ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28004/"
] | I have a DLL in the BIN folder, and I need it to be referenced in the web.config, or I get that annoying error:
>
> Description: An error occurred during
> the compilation of a resource required
> to service this request. Please review
> the following specific error details
> and modify your source code
> approp... | Unless the assembly you are using is strongly named, placing it in the bin directory is all you should need to do.
The configSection you mention is not for adding references to assemblies. This is to define configuration sections in the web.config. So you could add a config section called exampleSection by adding a se... |
463,894 | <p>I have this method Verify_X which is called during databind for a listbox selected value. The problem is the strongly typed datasource. I want to use the abstract class BaseDataSource or an interface to call the methods supported:
Parameters[] and Select(), Instead of using the most specific implementation as seen... | [
{
"answer_id": 463921,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>Because the code isn't usable \"as is\", it is very hard to discuss the actual problem... can you simplify the exa... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55693/"
] | I have this method Verify\_X which is called during databind for a listbox selected value. The problem is the strongly typed datasource. I want to use the abstract class BaseDataSource or an interface to call the methods supported:
Parameters[] and Select(), Instead of using the most specific implementation as seen bel... | If you are unable to alter the class definition or to use some sort of extension methods, you can use Reflection. Here is a sample that I worked up using assumptions about your code:
```
public static string Verify(string valueToBind, object dataSource)
{
////what is the correct way to convert from obj... |
463,913 | <p>I'm trying to do something like </p>
<pre><code>read -d EOF stdin
for word in $stdin; do stuff; done
</code></pre>
<p>where I want to replace 'EOF' for an actual representation of the end of file character.</p>
<p><b>Edit:</b> Thanks for the answers, that was indeed what I was trying to do. I actually had a face... | [
{
"answer_id": 463943,
"author": "Daniel Nadasi",
"author_id": 54830,
"author_profile": "https://Stackoverflow.com/users/54830",
"pm_score": 3,
"selected": false,
"text": "<p>Two things...</p>\n\n<p>The EOF character is represented by C-d (or C-v C-d if you want to type it), but to do wh... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50264/"
] | I'm trying to do something like
```
read -d EOF stdin
for word in $stdin; do stuff; done
```
where I want to replace 'EOF' for an actual representation of the end of file character.
**Edit:** Thanks for the answers, that was indeed what I was trying to do. I actually had a facepalm moment when I saw `stdin=$(cat)... | There isn't an end-of-file character really. When you press Ctrl-d or similar characters, the terminal driver signals to the reading application that the end of file has been reached, by returning an invalid value. The same is done by the operation system, when you have reached the end of the file. This is done by usin... |
463,924 | <p>I am new to JQuery. I'm reading JQuery in action, but only up to page 39 and need some quick help!</p>
<p>Please note: I'm simplifying my actual requirement, so what I'm asking for may sound odd but I'm just tryin to get to the crux of the JQuery expression and not my situation (related to an animation plugin).</p>... | [
{
"answer_id": 463929,
"author": "clawr",
"author_id": 46201,
"author_profile": "https://Stackoverflow.com/users/46201",
"pm_score": 4,
"selected": true,
"text": "<p>The <a href=\"http://docs.jquery.com/Manipulation/append\" rel=\"noreferrer\"><code>append</code></a> method inserts nodes... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | I am new to JQuery. I'm reading JQuery in action, but only up to page 39 and need some quick help!
Please note: I'm simplifying my actual requirement, so what I'm asking for may sound odd but I'm just tryin to get to the crux of the JQuery expression and not my situation (related to an animation plugin).
I have my HT... | The [`append`](http://docs.jquery.com/Manipulation/append) method inserts nodes at the end of match elements. [`Prepend`](http://docs.jquery.com/Manipulation/prepend) inserts nodes at the beginning.
Example:
```
$('div.favorite div a').append('<span> (favorite)</span>');
```
The `span` element isn't necessary - you... |
463,936 | <p>I'm wondering if someone has already built a system for threaded comments (for lack of a better term) in Rails or if I need to build it myself. </p>
<p>In case it's not clear, what I'm referring to is a comment system like Reddit's that automatically indents replies so that they appear like branches of a tree (pref... | [
{
"answer_id": 463966,
"author": "Héctor Vergara",
"author_id": 44507,
"author_profile": "https://Stackoverflow.com/users/44507",
"pm_score": 0,
"selected": false,
"text": "<p>Did you tried <code>acts_as_tree</code> plugin on your model?\nIt's a official ActiveRecord component.</p>\n\n<p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm wondering if someone has already built a system for threaded comments (for lack of a better term) in Rails or if I need to build it myself.
In case it's not clear, what I'm referring to is a comment system like Reddit's that automatically indents replies so that they appear like branches of a tree (preferably wit... | Using the [`acts_as_tree`](http://wiki.rubyonrails.org/rails/pages/ActsAsTree) plugin should make this fairly easy to implement. Install it using
`ruby script/plugin install acts_as_tree`
`app/models/comment.rb`
```
class Comment < ActiveRecord::Base
acts_as_tree :order => 'created_at'
end
```
`db/migrate/200901... |
463,938 | <p>I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads ParentUserControl.</p>
<p>I would need to access properties in ParentUserControl from the ChildUserControl.</p>
<p>Thanks for your time </p>
| [
{
"answer_id": 463946,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>The platform / language etc isn't clear, so this answer is necessarily vague... however, in general a child control... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads ParentUserControl.
I would need to access properties in ParentUserControl from the ChildUserControl.
Thanks for your time | The platform / language etc isn't clear, so this answer is necessarily vague... however, in general a child control can't access properties from the parent (directly), because lots of different types of parent controls could be hosting the child control. The child shouldn't be hard-coded to a single parent, otherwise i... |
463,947 | <p>I currently use <a href="http://www.strawberryperl.com" rel="noreferrer">Strawberry Perl</a> as my primary Perl distribution. However, I have some applications that make Perl calls through cygwin. These generally fail because they are calling the version of Perl that was packaged with cygwin, and only looking in cyg... | [
{
"answer_id": 464205,
"author": "Shannon Nelson",
"author_id": 14450,
"author_profile": "https://Stackoverflow.com/users/14450",
"pm_score": -1,
"selected": false,
"text": "<p>I don't have my cygwin machine nearby so I can't test this, but perhaps you can front-end the perl command with... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28627/"
] | I currently use [Strawberry Perl](http://www.strawberryperl.com) as my primary Perl distribution. However, I have some applications that make Perl calls through cygwin. These generally fail because they are calling the version of Perl that was packaged with cygwin, and only looking in cygwin's lib folders. How can I mo... | If you remove Perl from cygwin using the setup program it will use Strawberry Perl by default.
If you are unable to remove Perl from cygwin, you can create a symbolic link to the Perl executable from Strawberry.
From a cygwin shell, use the following set of commands:
```
$ mv /usr/bin/perl /usr/bin/perl-cygwin
$ ln ... |
463,950 | <p>I have a method which takes String argument. In some cases I want to pass int value to that method. For invoking that method I want to convert int into String. For that I am doing the following:</p>
<pre><code> aMethod(""+100);
</code></pre>
<p>One more option is:</p>
<pre><code> aMethod(String.valueOf(100)... | [
{
"answer_id": 463961,
"author": "Fabian Steeg",
"author_id": 18154,
"author_profile": "https://Stackoverflow.com/users/18154",
"pm_score": 2,
"selected": false,
"text": "<p>Using <code>+</code> on strings creates multiple string instances, so using <code>valueOf</code> is probably a bit... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] | I have a method which takes String argument. In some cases I want to pass int value to that method. For invoking that method I want to convert int into String. For that I am doing the following:
```
aMethod(""+100);
```
One more option is:
```
aMethod(String.valueOf(100));
```
Both are correct. I don't kn... | Since you're mostly using it in GWT, I'd go with the ""+ method, since it's the neatest looking, and it's going to end up converted to javascript anyway, where there is no such thing as a StringBuilder.
Please don't hurt me Skeet Fanboys ;) |
463,963 | <p>I have a list/queue of 200 commands that I need to run in a shell on a Linux server. </p>
<p>I only want to have a maximum of 10 processes running (from the queue) at once. Some processes will take a few seconds to complete, other processes will take much longer. </p>
<p>When a process finishes I want the next com... | [
{
"answer_id": 463971,
"author": "Bjorn",
"author_id": 66475,
"author_profile": "https://Stackoverflow.com/users/66475",
"pm_score": 2,
"selected": false,
"text": "<p>If you are going to use Python, I recommend using <a href=\"http://twistedmatrix.com/trac/\" rel=\"nofollow noreferrer\">... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17453/"
] | I have a list/queue of 200 commands that I need to run in a shell on a Linux server.
I only want to have a maximum of 10 processes running (from the queue) at once. Some processes will take a few seconds to complete, other processes will take much longer.
When a process finishes I want the next command to be "poppe... | I would imagine you could do this using make and the make -j xx command.
Perhaps a makefile like this
```
all : usera userb userc....
usera:
imapsync usera
userb:
imapsync userb
....
```
make -j 10 -f makefile |
463,973 | <p>I understand it is possible to do so using Excel macro, see: <a href="https://stackoverflow.com/questions/49724/programmatically-extract-macro-vba-code-from-word-2007-docs">Programmatically extract macro (VBA) code from Word 2007 docs</a>, but what I want to do here is to use VB6 to make an application which does th... | [
{
"answer_id": 464480,
"author": "onedaywhen",
"author_id": 15354,
"author_profile": "https://Stackoverflow.com/users/15354",
"pm_score": 2,
"selected": false,
"text": "<p>Set a reference to the Microsoft Excel 12.0 Object Library (or whatever version required) and use the workbook's VBP... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I understand it is possible to do so using Excel macro, see: [Programmatically extract macro (VBA) code from Word 2007 docs](https://stackoverflow.com/questions/49724/programmatically-extract-macro-vba-code-from-word-2007-docs), but what I want to do here is to use VB6 to make an application which does the same thing.
... | Set a reference to the Microsoft Excel 12.0 Object Library (or whatever version required) and use the workbook's VBProject.VBComponents collection e.g.
```
Sub ExportCode()
Dim app As Excel.Application
Set app = New Excel.Application
Dim wb As Excel.Workbook
Set wb = Excel.Application.Workbooks.Open("C:\Book... |
463,998 | <p>I figured out through trial n error how to link an unmanaged static library to managed C++ dll, but I have no idea how to dynamically include a DLL. Does anyone know how to do this in Visual studio 2008?</p>
| [
{
"answer_id": 464480,
"author": "onedaywhen",
"author_id": 15354,
"author_profile": "https://Stackoverflow.com/users/15354",
"pm_score": 2,
"selected": false,
"text": "<p>Set a reference to the Microsoft Excel 12.0 Object Library (or whatever version required) and use the workbook's VBP... | 2009/01/21 | [
"https://Stackoverflow.com/questions/463998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209/"
] | I figured out through trial n error how to link an unmanaged static library to managed C++ dll, but I have no idea how to dynamically include a DLL. Does anyone know how to do this in Visual studio 2008? | Set a reference to the Microsoft Excel 12.0 Object Library (or whatever version required) and use the workbook's VBProject.VBComponents collection e.g.
```
Sub ExportCode()
Dim app As Excel.Application
Set app = New Excel.Application
Dim wb As Excel.Workbook
Set wb = Excel.Application.Workbooks.Open("C:\Book... |
464,021 | <p>I have a 4 dropdown boxes. The first 2 will populate the 3rd box. The 3rd box populates the 4th dropdown. When I go to submit, I go get the selectedvalue of the 4th dropdown. For some reason this is always the first value and not the actual selected value. The screen clearly shows another item selected. What ma... | [
{
"answer_id": 464025,
"author": "EndangeredMassa",
"author_id": 106,
"author_profile": "https://Stackoverflow.com/users/106",
"pm_score": 2,
"selected": false,
"text": "<p>Are you binding the dropdownlist in your page load? Page_Load happens before control events like button submit. So,... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a 4 dropdown boxes. The first 2 will populate the 3rd box. The 3rd box populates the 4th dropdown. When I go to submit, I go get the selectedvalue of the 4th dropdown. For some reason this is always the first value and not the actual selected value. The screen clearly shows another item selected. What may be the... | Are you binding the dropdownlist in your page load? Page\_Load happens before control events like button submit. So, if you rebind in the page\_load before you check the value in the button\_submit, it will be reset to the first value in the list.
You can generally avoid this by using the following
**Page\_Load:**
`... |
464,031 | <p>This seems like a silly question but I would really like your comments and would like to validate my tester thinking..</p>
<pre><code>I can think of following test cases:
1) Pop element from empty stack should return error
2) Push n+1 elements in stack should return error during insertion of n+1th element
3) valid... | [
{
"answer_id": 464044,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://Stackoverflow.com/users/44853",
"pm_score": 0,
"selected": false,
"text": "<p>Looks fine to me. Just make sure when you're validating the functionality, that you make sure multiple items come back in t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33411/"
] | This seems like a silly question but I would really like your comments and would like to validate my tester thinking..
```
I can think of following test cases:
1) Pop element from empty stack should return error
2) Push n+1 elements in stack should return error during insertion of n+1th element
3) validate empty,full ... | I think you got everything covered, except maybe checking in 3) that the `n` elements pushed before are how you'd expect them. This will catch erroneous boundary condition checking, i.e. checking whether the stack is full only after writing the new element.
Additionally, I'd group your test cases differently and test ... |
464,040 | <p>In PHP you can just use <code>$_POST</code> for POST and <code>$_GET</code> for GET (Query string) variables. What's the equivalent in Python?</p>
| [
{
"answer_id": 464060,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": false,
"text": "<p>It somewhat depends on what you use as a CGI framework, but they are available in dictionaries accessible to the... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] | In PHP you can just use `$_POST` for POST and `$_GET` for GET (Query string) variables. What's the equivalent in Python? | suppose you're posting a html form with this:
```
<input type="text" name="username">
```
If using [raw cgi](http://docs.python.org/library/cgi.html):
```
import cgi
form = cgi.FieldStorage()
print form["username"]
```
If using [Django](http://docs.djangoproject.com/), [Pylons](http://pylonshq.com/), [Flask](http... |
464,057 | <p>I'm trying to learn Scheme from the book "The Little Schemer" using DrScheme on a Macintosh. It starts with things like "What is the car of l where l is the argument (a b c)?"</p>
<p>I understand that the answer to this question is a, but I'm not able to actually figure out what to type into Dr Scheme to "follow a... | [
{
"answer_id": 464065,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 1,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>(define l '(a b c))\n</code></pre>\n\n<p>Here, the quote applies to the whole list <code>(... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10888/"
] | I'm trying to learn Scheme from the book "The Little Schemer" using DrScheme on a Macintosh. It starts with things like "What is the car of l where l is the argument (a b c)?"
I understand that the answer to this question is a, but I'm not able to actually figure out what to type into Dr Scheme to "follow along". A si... | To define something:
```
(define <name> <value>)
```
So to define l:
```
(define l '(a b c))
```
This defines `l` as the list `(a b c)`. The single quote mark quotes whatever is after it, whether it's a symbol or a list, which means it's not evaluated but read as-is. You *don't*, however, quote the name that you'... |
464,108 | <p>Final question for the night. And apologies for the complete noobness of this.</p>
<p>I have, with help from stackoverflow and google achieved the following...</p>
<pre><code>void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOCommand1->CommandText = "drop table pictures purge";
ADOCommand1->Execut... | [
{
"answer_id": 464099,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 6,
"selected": false,
"text": "<p><a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#exit(int)\" rel=\"noreferrer\">System.exit<... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21880/"
] | Final question for the night. And apologies for the complete noobness of this.
I have, with help from stackoverflow and google achieved the following...
```
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOCommand1->CommandText = "drop table pictures purge";
ADOCommand1->Execute();
ADOCommand1->CommandTe... | from the [Sun Tutorials](http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html)
>
> Note: If the JVM exits while the try
> or catch code is being executed, then
> the finally block may not execute.
> Likewise, if the thread executing the
> try or catch code is interrupted or
> killed, the fina... |
464,109 | <p>I'm trying to get my Perl Frontier XML-RPC daemon to know about the IP address of the caller. I have to say I'm a newbie at Perl, so maybe this is obvious. I'm aware that <a href="http://search.cpan.org/dist/Frontier-Daemon" rel="nofollow noreferrer">Frontier::Daemon</a> inherits from <a href="http://search.cpan.or... | [
{
"answer_id": 465756,
"author": "Marcus",
"author_id": 26848,
"author_profile": "https://Stackoverflow.com/users/26848",
"pm_score": 0,
"selected": false,
"text": "<p>I run both Frontier::Daemon and Frontier::RPC2 (under Apache). I do not know how to grab the client IP when using Front... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to get my Perl Frontier XML-RPC daemon to know about the IP address of the caller. I have to say I'm a newbie at Perl, so maybe this is obvious. I'm aware that [Frontier::Daemon](http://search.cpan.org/dist/Frontier-Daemon) inherits from [IO::Socket::INET](http://search.cpan.org/dist/IO), which has a `peerad... | Unfortunately, you can't do this using Frontier's server class. By the time the local procedure/method is called, you don't have any handle on the actual socket connection itself.
As it happens, being able to access this information is a recent feature I added to the server class in my [RPC::XML](http://search.cpan.or... |
464,116 | <p>The default the profile file is from the executable is run and the file is called <code>gmon.out</code>. Is there any way to specify a new location?</p>
<p>I'm using gcc 3.4.6 on i386/linux2.6</p>
| [
{
"answer_id": 464211,
"author": "derobert",
"author_id": 27727,
"author_profile": "https://Stackoverflow.com/users/27727",
"pm_score": 1,
"selected": false,
"text": "<p>To give a different file name to gprof:</p>\n\n<pre><code>gprof a.out gprof-foo.out\n</code></pre>\n\n<p>As to renamin... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42303/"
] | The default the profile file is from the executable is run and the file is called `gmon.out`. Is there any way to specify a new location?
I'm using gcc 3.4.6 on i386/linux2.6 | Too badly, the environment variable `GMON_OUT_PREFIX` is not documented in the glibc. I got the following information from the web and tested on my machine.
if you set the environment variable `GMON_OUT_PREFIX`, then the output file is named as
`${GMON_OUT_PREFIX}.[PID]`, the pid is the id of the profiled process.
... |
464,120 | <p>I had a doubt in CURL (PHP) . I want to login directly into a site using CURL. Is it possible, if possible please guide me. </p>
<p>I tried with the following but its not working</p>
<pre><code>http://username:password@myurl
</code></pre>
| [
{
"answer_id": 464132,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 2,
"selected": false,
"text": "<p>This is probably what you're looking for:</p>\n\n<pre><code>$ch = curl_init(\"http://myurl\");\ncurl_setopt($ch, CURLOP... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38172/"
] | I had a doubt in CURL (PHP) . I want to login directly into a site using CURL. Is it possible, if possible please guide me.
I tried with the following but its not working
```
http://username:password@myurl
``` | This is probably what you're looking for:
```
$ch = curl_init("http://myurl");
curl_setopt($ch, CURLOPT_USERPWD, "[username]:[password]");
$output = curl_exec($ch);
```
You can find more options for CURL [here](http://us2.php.net/manual/en/function.curl-setopt.php). |
464,137 | <p>I need to embed the bibliography information from the .bbl file in the .tex source file. This, according to any number of places from Google, should be as easy as copying the contents of the .bbl file to the .tex file, replace the \bibliography{} command.</p>
<p>However, when I do this, I get the following error:<... | [
{
"answer_id": 464161,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 1,
"selected": false,
"text": "<p>Is the contents of the .bbl file surrounded by a</p>\n\n<pre><code>\\begin{thebibliography}\n ...\n\\end{thebibliograph... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57379/"
] | I need to embed the bibliography information from the .bbl file in the .tex source file. This, according to any number of places from Google, should be as easy as copying the contents of the .bbl file to the .tex file, replace the \bibliography{} command.
However, when I do this, I get the following error:
```
./Witm... | You're right, it should just work.
I don't think the cite package will influence anything here. There's a [post on comp.text.tex](http://groups.google.com/group/comp.text.tex/browse_frm/thread/37d6becd04d5b2a2/1957fc4ebe22cb0e?lnk=gst&q=%5C%40listctr#1957fc4ebe22cb0e) that mentions a similar error, involving the use o... |
464,140 | <p>I need to embed the fonts that I'm using in my TeX document in my output PDF. I'm using pdflatex for TeX processing, and TextMate as my editor.</p>
<p>I can't find any reference on how to embed the fonts I need in the PDF document.</p>
| [
{
"answer_id": 464181,
"author": "derobert",
"author_id": 27727,
"author_profile": "https://Stackoverflow.com/users/27727",
"pm_score": 3,
"selected": true,
"text": "<p>From the pdfTex documentation,</p>\n\n<blockquote>\n <h1>5 Setting up fonts</h1>\n \n <p>pdfTEX can work with Type 1... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57379/"
] | I need to embed the fonts that I'm using in my TeX document in my output PDF. I'm using pdflatex for TeX processing, and TextMate as my editor.
I can't find any reference on how to embed the fonts I need in the PDF document. | From the pdfTex documentation,
>
> 5 Setting up fonts
> ==================
>
>
> pdfTEX can work with Type 1 and TrueType fonts (and to some extent also
> with OpenType fonts). Font les should be available and embedded for all
> fonts used in the document. It is possible to use METAFONT-- generated
> fonts in pd... |
464,143 | <p>For my exception class i have a constructor that has multi arguments (...) which works fine under windows, how ever, under linux it compiles fine but refuses to link to it. </p>
<p>Why does this not work under linux?</p>
<p>here is an example:</p>
<pre><code>class gcException
{
public:
gcException()
{
... | [
{
"answer_id": 464159,
"author": "derobert",
"author_id": 27727,
"author_profile": "https://Stackoverflow.com/users/27727",
"pm_score": 3,
"selected": true,
"text": "<p>It compiles and links just fine. I expanded your test code to a full \"program\":</p>\n\n<pre><code>class gcException {... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23339/"
] | For my exception class i have a constructor that has multi arguments (...) which works fine under windows, how ever, under linux it compiles fine but refuses to link to it.
Why does this not work under linux?
here is an example:
```
class gcException
{
public:
gcException()
{
//code here
}
... | It compiles and links just fine. I expanded your test code to a full "program":
```
class gcException {
public:
gcException() { }
gcException(int errId, const char* format, ...) { }
};
int main() { new gcException(1, "foo", "bar", "baz"); }
```
And then `g++ -Wall test.cpp` ran without errors. Ac... |
464,167 | <p>Can anyone help me spot my problem here:</p>
<p>I'm trying to implement a file upload routine using appengine and django, and I've run into a MultiValueDictKeyError error. It appears that the file is not making it from the webpage to the server.</p>
<p>Some part of this is a learning exercise, so I don't want to u... | [
{
"answer_id": 464245,
"author": "Baishampayan Ghose",
"author_id": 8024,
"author_profile": "https://Stackoverflow.com/users/8024",
"pm_score": 1,
"selected": false,
"text": "<p>For some reason the file is not getting uploaded, or if at all, it's getting bound to a different key in reque... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anyone help me spot my problem here:
I'm trying to implement a file upload routine using appengine and django, and I've run into a MultiValueDictKeyError error. It appears that the file is not making it from the webpage to the server.
Some part of this is a learning exercise, so I don't want to use a djangoform t... | Okay, the strangest thing happened. I wrote this question before I signed off yesterday. When I booted up tonight to try it again, the thing worked before I made any changes to it. Thanks anyway for the help. |
464,188 | <p>I am using PHP, jQuery, and JSON. Now I need to know how to parse the jQuery data in JavaScript.</p>
<h3>load.php</h3>
<pre><code><?php
...
$json =json_encode($array);
?>
</code></pre>
<p>It returns jQuery by the following data.</p>
<pre><code> [{"name":"STA","distance":"250","code":25},
{"name"... | [
{
"answer_id": 464192,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 4,
"selected": true,
"text": "<p>You have an array of JSON objects, so you need to loop through the array to get each individual object:</p>\n\n... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I am using PHP, jQuery, and JSON. Now I need to know how to parse the jQuery data in JavaScript.
### load.php
```
<?php
...
$json =json_encode($array);
?>
```
It returns jQuery by the following data.
```
[{"name":"STA","distance":"250","code":25},
{"name":"GIS","distance":"500","code":45}]
```
### jQ... | You have an array of JSON objects, so you need to loop through the array to get each individual object:
```
for(var x = 0; x < myjson.length; x++) {
alert(myjson[x].name);
// myjson[x].distance, myjson[x].code also available
}
```
Or, if you want to do it the jQuery way:
```
jQuery.each(myjson, function(x) ... |
464,191 | <p>The SQL Server (2000/2005) function gets the table name and the field name as parameters and returns results from a dynamic query within the function. The results should be assigned to a <code>Table</code> variable which will be used further in a stored procedure. How to achieve this?</p>
<p>I am getting error: "O... | [
{
"answer_id": 464198,
"author": "Simon Hartcher",
"author_id": 459159,
"author_profile": "https://Stackoverflow.com/users/459159",
"pm_score": 2,
"selected": true,
"text": "<p>I'm not sure how this works with functions, but if you have a Stored Procedure that returns a resultset, you ca... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | The SQL Server (2000/2005) function gets the table name and the field name as parameters and returns results from a dynamic query within the function. The results should be assigned to a `Table` variable which will be used further in a stored procedure. How to achieve this?
I am getting error: "Only functions and exte... | I'm not sure how this works with functions, but if you have a Stored Procedure that returns a resultset, you can insert that into a table variable using INSERT EXEC statements.
```
INSERT @TableVariable
EXEC spYourProcedure
```
As long as the fields match that will work. Otherwise you can use:
```
INSERT @TableVari... |
464,193 | <p>Is there any way to create a custom <code>ActionListener</code> class in JSF so that I can intercept an exception if it occurs on pressing the command button using my own ActionListener class</p>
<p>I tried using the following code:</p>
<code>firstpage.jsp</code>
<pre><code><f:view>
<html>
<h... | [
{
"answer_id": 464218,
"author": "Xn0vv3r",
"author_id": 42475,
"author_profile": "https://Stackoverflow.com/users/42475",
"pm_score": 0,
"selected": false,
"text": "<p>Here you can find, how to <a href=\"http://java.sun.com/javaee/5/docs/tutorial/doc/bnaut.html#bnauv\" rel=\"nofollow no... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there any way to create a custom `ActionListener` class in JSF so that I can intercept an exception if it occurs on pressing the command button using my own ActionListener class
I tried using the following code:
`firstpage.jsp`
```
<f:view>
<html>
<head>
<title>firstpage</title>
</head>
<body>... | javadoc for [Application.setActionListener](http://java.sun.com/javaee/5/docs/api/javax/faces/application/Application.html#setActionListener(javax.faces.event.ActionListener)):
>
> Set the default ActionListener to be
> registered for all **ActionSource**
> components.
>
>
>
The [ActionListener](http://java.sun... |
464,196 | <p>I have an application written in VB.NET that interacts with Excel via interop.
I eventually ran into the known issue of Cell-edit mode (see <a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4087801&SiteID=1" rel="nofollow noreferrer">MSDN</a> and <a href="https://stackoverflow.com/questions/221984/... | [
{
"answer_id": 464411,
"author": "barry",
"author_id": 35709,
"author_profile": "https://Stackoverflow.com/users/35709",
"pm_score": 3,
"selected": true,
"text": "<p>As a quick-and-dirty fix i used the following code as an alternative</p>\n\n<pre><code>Private Function isEditMode() As Bo... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35709/"
] | I have an application written in VB.NET that interacts with Excel via interop.
I eventually ran into the known issue of Cell-edit mode (see [MSDN](http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4087801&SiteID=1) and [stackoverflow](https://stackoverflow.com/questions/221984/how-to-tell-if-excel-application-is-i... | As a quick-and-dirty fix i used the following code as an alternative
```
Private Function isEditMode() As Boolean
isEditMode = False
Try
oExcel.GoTo("###")
Catch Ex As Exception
' Either returns "Reference is not valid."
' or "Exception from HRESULT: 0x800A03EC"
If ex.Message.... |
464,206 | <p>Given an object like:</p>
<pre><code>class M(models.Model):
test = models.BooleanField()
created_date = models.DateTimeField(auto_now_add=True)
</code></pre>
<p>Given sample data (assume monotonically increasing automatic created_date):</p>
<pre><code>M(test=False).save()
M(test=True).save()
M(test=False).s... | [
{
"answer_id": 464221,
"author": "ayaz",
"author_id": 23191,
"author_profile": "https://Stackoverflow.com/users/23191",
"pm_score": 2,
"selected": false,
"text": "<p>With the help of <a href=\"http://docs.djangoproject.com/en/dev/ref/models/querysets/#id7\" rel=\"nofollow noreferrer\">Dj... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19212/"
] | Given an object like:
```
class M(models.Model):
test = models.BooleanField()
created_date = models.DateTimeField(auto_now_add=True)
```
Given sample data (assume monotonically increasing automatic created\_date):
```
M(test=False).save()
M(test=True).save()
M(test=False).save()
X = M(test=True).save()
M(te... | Try this
```
M.objects.filter(created_date__lte=Y.created_date).filter(test=True)[0:1]
```
You can also add an order\_by clause like
```
M.objects.filter(created_date__lte=Y.created_date)\
.filter(test=True)\
.order_by('-created_date')[0:1]
```
This should work. |
464,214 | <p>I have a <code>DBAdmin</code> class that connects to the database, and then some other classes such as <code>Article</code>, <code>Category</code> and so on, that perform certain queries to a database.</p>
<p>I am using these classes in a Swing application to build a sort of small Intranet CMS application.</p>
<p>... | [
{
"answer_id": 464246,
"author": "Miserable Variable",
"author_id": 18573,
"author_profile": "https://Stackoverflow.com/users/18573",
"pm_score": 0,
"selected": false,
"text": "<p>As Adeel pointed out, you seem to be mixing the data and operation in a single class. But if you want to sti... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44084/"
] | I have a `DBAdmin` class that connects to the database, and then some other classes such as `Article`, `Category` and so on, that perform certain queries to a database.
I am using these classes in a Swing application to build a sort of small Intranet CMS application.
Now, the `Category` class has a bunch of `static` ... | It sounds like what you want is a single thread which does all the database access for the whole program, and in that case you shouldn't be passing things to the run method. Because when you have a single thread, all it does is call a single run method once, when it starts, and that run method just keeps executing unti... |
464,216 | <p>I have some MATLAB code and some Java code that need to talk with each other. I was getting a <code>NoSuchMethodError</code>. When I pass a MATLAB double array to a Java method that accepts <code>double[]</code> argument.</p>
<p>So I write a simple "hello world" to get the class of an object passed to the method</p... | [
{
"answer_id": 464230,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 2,
"selected": false,
"text": "<p>Looks simple to me: Matlab passes numbers to Java as Double instances, strings as String instances, booleans as Boolean... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9425/"
] | I have some MATLAB code and some Java code that need to talk with each other. I was getting a `NoSuchMethodError`. When I pass a MATLAB double array to a Java method that accepts `double[]` argument.
So I write a simple "hello world" to get the class of an object passed to the method
```
public void printArray(Object... | I think the original problem has been [updated by the OP](https://stackoverflow.com/questions/464216/strange-classes-passed-from-matlab-to-java#466400), so I'll take the chance to summarize our findings so far:
* We have established that the sample code in the original question produces the expected behavior. **MATLAB... |
464,217 | <p>I am trying to fix my website and found this great tool called
Firebug. I was trying to pinpoint why my website is really slow at
loading (wordpress based website). I was hoping to see if anybody
could give me some hints. The results that I get under Net->All is.</p>
<pre><code>GET www.XXXXX.com http://www.XXXX... | [
{
"answer_id": 464233,
"author": "Ignacio Vazquez-Abrams",
"author_id": 20862,
"author_profile": "https://Stackoverflow.com/users/20862",
"pm_score": 1,
"selected": false,
"text": "<p>Install YSlow and let it tell you what's wrong.</p>\n"
},
{
"answer_id": 464235,
"author": "... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to fix my website and found this great tool called
Firebug. I was trying to pinpoint why my website is really slow at
loading (wordpress based website). I was hoping to see if anybody
could give me some hints. The results that I get under Net->All is.
```
GET www.XXXXX.com http://www.XXXXX.com/ 302 Moved... | For performance analysis I recommend you to use [YSlow](http://developer.yahoo.com/yslow/), if a page can be improved, YSlow will list the specific changes to be done:
[](https://i.stack.imgur.com/AXjgd.png)
(source: [yimg.com](http://us.i1.yimg.com/us.yimg.com/i/rt/yslow/per... |
464,220 | <p>I am currently creating an e-commerce site using C# ASP.NET MVC and have just come across a problem. On pages such as product pages and search results pages, I have to pass Lists of data from my controller to the ViewPage and that works just fine. However, a null reference exception occurs if the Viewdata equals nul... | [
{
"answer_id": 464229,
"author": "Odd",
"author_id": 11908,
"author_profile": "https://Stackoverflow.com/users/11908",
"pm_score": 4,
"selected": true,
"text": "<p>In your case I would have your database.GetByCategory(category, page) method simply return an empty list rather than null, t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57388/"
] | I am currently creating an e-commerce site using C# ASP.NET MVC and have just come across a problem. On pages such as product pages and search results pages, I have to pass Lists of data from my controller to the ViewPage and that works just fine. However, a null reference exception occurs if the Viewdata equals null. ... | In your case I would have your database.GetByCategory(category, page) method simply return an empty list rather than null, this way your foreach statement just won't have any data to loop through but you won't get a null exception.
In the case that you're not dealing with a list and the item is null, we use
```
Html... |
464,253 | <p>Related to <a href="https://stackoverflow.com/questions/459554/how-do-i-tell-if-one-instance-of-my-program-is-running">this question</a>, what is the best practice for naming a mutex? I realize this may vary with OS and even with version (esp for Windows), so please specify platform in answering. My interest is in... | [
{
"answer_id": 464257,
"author": "Stephen Denne",
"author_id": 11721,
"author_profile": "https://Stackoverflow.com/users/11721",
"pm_score": 2,
"selected": false,
"text": "<p>You could combine a description of what you're protecting against with the word \"Guard\"</p>\n"
},
{
"an... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18484/"
] | Related to [this question](https://stackoverflow.com/questions/459554/how-do-i-tell-if-one-instance-of-my-program-is-running), what is the best practice for naming a mutex? I realize this may vary with OS and even with version (esp for Windows), so please specify platform in answering. My interest is in Win XP and Vist... | A really safe name for a global mutex is `<a description> + <a GUID>`:
```
MyApp Single Instance Mutex : {c96f7db4-d743-4718-bef0-8533a198bcca}
```
By using a name like this there is absolutely no chance someone else will use the same mutex name as your mutex.
Sniffing around with process explorer, you can see that... |
464,254 | <p>I am creating a register form that is submitted via the Jquery form plugin. I am attempting to validate the form fields through ajax with a backend php file. Here is my Javascript. It only works if I set it to return false no matter what otherwise it submits it without validating it if I return it true.</p>
<pre><c... | [
{
"answer_id": 464258,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 2,
"selected": false,
"text": "<p>You could take a look at the <a href=\"http://bassistance.de/jquery-plugins/jquery-plugin-validation/\" rel=\"nofollow nore... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am creating a register form that is submitted via the Jquery form plugin. I am attempting to validate the form fields through ajax with a backend php file. Here is my Javascript. It only works if I set it to return false no matter what otherwise it submits it without validating it if I return it true.
```
$(document... | You could take a look at the [jQuery Validator plugin](http://bassistance.de/jquery-plugins/jquery-plugin-validation/), which gives you many options for validation, including AJAX calls. |
464,295 | <p>For example, something like this rule in a css</p>
<p><code>div.something {
background-image: url(http://i2.photobucket.com/albums/y24/5609903697/Beyond Birthday/BB39.jpg);
}</code></p>
<p>won't work in FF but will in IE because there is a space between "Beyond" and "Birthday". I know the solution is to either no... | [
{
"answer_id": 464301,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 4,
"selected": false,
"text": "<p>Have you tried surrounding the url with single quotes?</p>\n\n<pre><code>background-image: url('/folder/file name.jp... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52287/"
] | For example, something like this rule in a css
`div.something {
background-image: url(http://i2.photobucket.com/albums/y24/5609903697/Beyond Birthday/BB39.jpg);
}`
won't work in FF but will in IE because there is a space between "Beyond" and "Birthday". I know the solution is to either not have a space or put %20%, ... | Have you tried surrounding the url with single quotes?
```
background-image: url('/folder/file name.jpg');
```
This doesn't answer the why part, but I'm assuming it is because IE is just more forgiving and Firefox parses the CSS properly. |
464,299 | <p>I am learning castle.windsor following the tutorial online. this is the simple sample code:</p>
<pre><code>public class Form1 {
private readonly HttpServiceWatcher serviceWatcher;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
public Form1(HttpServ... | [
{
"answer_id": 464336,
"author": "Sander",
"author_id": 2928,
"author_profile": "https://Stackoverflow.com/users/2928",
"pm_score": 0,
"selected": false,
"text": "<p>The dependency container itself creates the object (and thus calls the constructor).</p>\n"
},
{
"answer_id": 4703... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57400/"
] | I am learning castle.windsor following the tutorial online. this is the simple sample code:
```
public class Form1 {
private readonly HttpServiceWatcher serviceWatcher;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
public Form1(HttpServiceWatcher ser... | The container calls the constructor when it creates the requested object. The constructor that gets called is the constructor with the most arguments that the container can satisfy. |
464,317 | <p>I have my database on remote Linux machine, and I want to connect using SSH and PHP functions (I am currently using ssh2 library for that). I tried using mysql_connect, but it gives me can't access (although I have granted permission)
when I tried using this function:</p>
<pre><code>$connection = ssh2_connect('SERV... | [
{
"answer_id": 464331,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 1,
"selected": false,
"text": "<p>According to <a href=\"http://us.php.net/manual/en/mysqli.connect.php\" rel=\"nofollow noreferrer\">the docs</a>, that ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have my database on remote Linux machine, and I want to connect using SSH and PHP functions (I am currently using ssh2 library for that). I tried using mysql\_connect, but it gives me can't access (although I have granted permission)
when I tried using this function:
```
$connection = ssh2_connect('SERVER IP', 22);
... | ### SSH Tunnel Solution
Set up an SSH tunnel to your MySQL database server (through a Jumpbox proxy for security).
### (A) GUI Tools
Depending on your requirements, you can use a GUI MySQL client with SSH Tunnelling support built-in such as **Visual Studio Code** [Forwarding a port / creating SSH tunnel](https://cod... |
464,332 | <p>I am building a web based free dynamic news reader (aka "autoplay" feature), that you can test it from here:</p>
<p><a href="http://www.fivetechsoft.com/news" rel="noreferrer">http://www.fivetechsoft.com/news</a></p>
<p>and I would like to implement a button to fullscreen it. Any hints?</p>
<p>Please notice that ... | [
{
"answer_id": 464340,
"author": "Justin Yost",
"author_id": 657,
"author_profile": "https://Stackoverflow.com/users/657",
"pm_score": 3,
"selected": false,
"text": "<p>Here is some information regarding that problem: <a href=\"http://www.htmlgoodies.com/beyond/dhtml/article.php/3470521\... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am building a web based free dynamic news reader (aka "autoplay" feature), that you can test it from here:
<http://www.fivetechsoft.com/news>
and I would like to implement a button to fullscreen it. Any hints?
Please notice that only IE is supported by now. Other browsers support comming soon. | This will simply send F11.
Will be good enough for IE with weak security settings. This is something you might want to keep for internal use only, though:
```
<script type="text/javascript">
function max() {
var wscript = new ActiveXObject("Wscript.shell");
wscript.SendKeys("{F11}");
}
</script... |
464,339 | <p>I am finding I'm writing a lot of code that looks like this:</p>
<pre><code> <div id="leftCol">
<div style="padding-top:10px">
<asp:Image ID="imgRazor1" ImageUrl="http://www.example.com/dynimg.aspx?imageKey=XXX" runat="server" />
</... | [
{
"answer_id": 464352,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 0,
"selected": false,
"text": "<p>You can have a general rule and the override it with id rules in specific cases if needed:</p>\n\n<pre><code>#leftC... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | I am finding I'm writing a lot of code that looks like this:
```
<div id="leftCol">
<div style="padding-top:10px">
<asp:Image ID="imgRazor1" ImageUrl="http://www.example.com/dynimg.aspx?imageKey=XXX" runat="server" />
</div>
<div style... | Your code suffers from a serious case of div-itis. I would first start by using proper tags for headers, paragraphs, etc. Once you have a properly marked-up document, you can add classes for common elements, then style those classes as necessary. You'll find that certain types of elements share a style no matter where ... |
464,342 | <p>I have two lists of objects. Each list is already sorted by a property of the object that is of the datetime type. I would like to combine the two lists into one sorted list. Is the best way just to do a sort or is there a smarter way to do this in Python?</p>
| [
{
"answer_id": 464350,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 5,
"selected": false,
"text": "<p>This is simply merging. Treat each list as if it were a stack, and continuously pop the smaller of the two stack head... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66475/"
] | I have two lists of objects. Each list is already sorted by a property of the object that is of the datetime type. I would like to combine the two lists into one sorted list. Is the best way just to do a sort or is there a smarter way to do this in Python? | People seem to be over complicating this.. Just combine the two lists, then sort them:
```
>>> l1 = [1, 3, 4, 7]
>>> l2 = [0, 2, 5, 6, 8, 9]
>>> l1.extend(l2)
>>> sorted(l1)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```
..or shorter (and without modifying `l1`):
```
>>> sorted(l1 + l2)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```
..e... |
464,343 | <p>I have the following frameset:</p>
<p><code><frameset rows="625,*" cols="*" framespacing="0" frameborder="0" border="0" noresize>
<frame marginheight="0px" src="music-NEW.php" name="mainFrame" scrolling="NO" frameborder="0" noresize>
<frame marginheight="0px" src="musicplayer.php" name="... | [
{
"answer_id": 464355,
"author": "Bjorn",
"author_id": 66475,
"author_profile": "https://Stackoverflow.com/users/66475",
"pm_score": 2,
"selected": false,
"text": "<p>Add a noresize=\"noresize\" to your frame:</p>\n\n<pre><code><frame noresize=\"noresize\">\n</code></pre>\n"
},... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following frameset:
`<frameset rows="625,*" cols="*" framespacing="0" frameborder="0" border="0" noresize>
<frame marginheight="0px" src="music-NEW.php" name="mainFrame" scrolling="NO" frameborder="0" noresize>
<frame marginheight="0px" src="musicplayer.php" name="bottomFrame" scrolling="NO" frameborder="... | Add a noresize="noresize" to your frame:
```
<frame noresize="noresize">
``` |
464,358 | <p>I'm summing two negative floats:</p>
<pre><code>char * lhs = "-2234.6016114467412141";
char * rhs = "-4939600281397002.2812";
</code></pre>
<p>According to Perl, using bignum and Math::BigFloat, the answer is</p>
<pre><code>-4939600281399236.8828114467412141
</code></pre>
<p>However, according to GMP, using the ... | [
{
"answer_id": 464475,
"author": "robottobor",
"author_id": 10184,
"author_profile": "https://Stackoverflow.com/users/10184",
"pm_score": 3,
"selected": true,
"text": "<p>Looks like you are overflowing the mantissa at 64 bits. Try doing <code>mpf_get_prec(f_res)</code> to check it is th... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] | I'm summing two negative floats:
```
char * lhs = "-2234.6016114467412141";
char * rhs = "-4939600281397002.2812";
```
According to Perl, using bignum and Math::BigFloat, the answer is
```
-4939600281399236.8828114467412141
```
However, according to GMP, using the code below, the answer is
```
-4939600281399236.... | Looks like you are overflowing the mantissa at 64 bits. Try doing `mpf_get_prec(f_res)` to check it is the precision you want. If not call the `mpf_set_default_prec()` before you initialize any mpf vars (line 1 of main). |
464,359 | <p>Can I define custom types for user-defined exceptions in JavaScript? If so, how would I do it?</p>
| [
{
"answer_id": 464427,
"author": "Xn0vv3r",
"author_id": 42475,
"author_profile": "https://Stackoverflow.com/users/42475",
"pm_score": 3,
"selected": false,
"text": "<p>Use the <a href=\"http://www.w3schools.com/js/js_throw.asp\" rel=\"noreferrer\">throw</a> statement.</p>\n\n<p>JavaScri... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13326/"
] | Can I define custom types for user-defined exceptions in JavaScript? If so, how would I do it? | From [WebReference](http://webreference.com/programming/javascript/rg32/index-2.html):
```js
throw {
name: "System Error",
level: "Show Stopper",
message: "Error detected. Please contact the system administrator.",
htmlMessage: "Error detected. Please contact the <a href=\"mailto:sysadmin@... |
464,384 | <p>Is there anybody who has clear instructions on how to add a pre-commit hook that avoids changes to tags subdirectories?</p>
<p>I already searched the internet quite a bit. I found this link: <a href="https://metacpan.org/pod/SVN::Hooks::DenyChanges" rel="noreferrer">SVN::Hooks::DenyChanges</a> , but I can't seem to... | [
{
"answer_id": 497691,
"author": "Nick Brooks",
"author_id": 58180,
"author_profile": "https://Stackoverflow.com/users/58180",
"pm_score": 2,
"selected": false,
"text": "<p>Pretty late to the party, however I wrote a python pre-commit hook for work which is based off the log-police.py sc... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40064/"
] | Is there anybody who has clear instructions on how to add a pre-commit hook that avoids changes to tags subdirectories?
I already searched the internet quite a bit. I found this link: [SVN::Hooks::DenyChanges](https://metacpan.org/pod/SVN::Hooks::DenyChanges) , but I can't seem to compile things. | I don't have enough reputation to "comment" on Raim's answer above, but his worked great, with one exception, his grep pattern is wrong.
I simply used the below as my pre-commit hook (I didn't have an existing one, you'd need to merge in that case):
```
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/opt/local/bin/svnlook
... |
464,416 | <p>I want to show a local image in the webview , How to do ? somebody has a easy demo ? thanks a lot!!!</p>
| [
{
"answer_id": 464914,
"author": "Mike Abdullah",
"author_id": 28768,
"author_profile": "https://Stackoverflow.com/users/28768",
"pm_score": 3,
"selected": false,
"text": "<pre><code>NSURL *imageURL = [NSURL fileURLWithPath:localImagePath];\nNSURLRequest *request = [NSURLRequest requestW... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51958/"
] | I want to show a local image in the webview , How to do ? somebody has a easy demo ? thanks a lot!!! | The best way to do is set the baseURL to the Bundles Path. Then from there you can call images from your Bundle like so:
```
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSURL *bundleBaseURL = [NSURL fileURLWithPath: bundlePath];
[webView loadHTMLString:htmlContent baseURL: bundleBaseURL];
```
The Ima... |
464,425 | <p>I inherited MYSQL database that has lots of tables with data like </p>
<pre><code>CREATE TABLE IF NOT EXISTS `ejl_registration` (
`id` int(11) NOT NULL auto_increment,
`team_id` int(11) default NULL,
`start_date` date default NULL,
`end_date` date default NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAUL... | [
{
"answer_id": 464444,
"author": "David Hanak",
"author_id": 42136,
"author_profile": "https://Stackoverflow.com/users/42136",
"pm_score": 3,
"selected": true,
"text": "<p>Try this (please double check, I have not tested the command):</p>\n\n<pre><code>UPDATE `ejl_registration` SET `end_... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44715/"
] | I inherited MYSQL database that has lots of tables with data like
```
CREATE TABLE IF NOT EXISTS `ejl_registration` (
`id` int(11) NOT NULL auto_increment,
`team_id` int(11) default NULL,
`start_date` date default NULL,
`end_date` date default NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=lati... | Try this (please double check, I have not tested the command):
```
UPDATE `ejl_registration` SET `end_date`= CONCAT(YEAR(`start_date`),'-12-31')
WHERE `end_date` IS NULL OR `end_date` = '0000-00-00';
``` |
464,437 | <p>How to reference VB 6.0 component(.dll) with C# in Visual Studio .NET 2005</p>
<p>After I referenced this DLL file, I can see the new icon in the reference folder icon in solution explorer. But this new icon has "!" sybbol. I double clicked this new icon that said "This project cannot be viewed in the object browse... | [
{
"answer_id": 464439,
"author": "Spence",
"author_id": 53771,
"author_profile": "https://Stackoverflow.com/users/53771",
"pm_score": 2,
"selected": false,
"text": "<p>Try adding it as a reference to your project. Visual studio will add a wrapper to it and you should be able to use the ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How to reference VB 6.0 component(.dll) with C# in Visual Studio .NET 2005
After I referenced this DLL file, I can see the new icon in the reference folder icon in solution explorer. But this new icon has "!" sybbol. I double clicked this new icon that said "This project cannot be viewed in the object browser because ... | Just add the reference and Visual Studio will create a wrapper (Interop) assembly for you.
If you want more control over the creation of this assembly (like the name, the signing), do this at the command line using tlbimp.exe
example:
```
tlbimp.exe MyCOMDLL.dll /keyfile:KeyFile.snk /out:MyCOMInterop.dll
``` |
464,471 | <p>How can I write a program in Java that will execute another program? Also, the input of that program should be given from our program and the output of that program should be written into a file.</p>
<p>This is my small set of code to get its output:</p>
<pre><code>Process p = Runtime.getRuntime().exec("C:\\j2sdk1... | [
{
"answer_id": 464479,
"author": "Spence",
"author_id": 53771,
"author_profile": "https://Stackoverflow.com/users/53771",
"pm_score": 1,
"selected": false,
"text": "<p>What platform are you in? </p>\n\n<p>If you are on *nix you can type:</p>\n\n<p>java MyProgram | myexternalprogram > myf... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201406/"
] | How can I write a program in Java that will execute another program? Also, the input of that program should be given from our program and the output of that program should be written into a file.
This is my small set of code to get its output:
```
Process p = Runtime.getRuntime().exec("C:\\j2sdk1.4.0\bin\\helloworld.... | The API that Java offers for this is the [ProcessBuilder](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html). It is relatively straightforward to set working directory and pass parameters.
What is a little tricky is passing STDIN and reading STDERR and STDOUT, at least for non-trivial sizes thereof... |
464,474 | <p>What's the best way to check if a table exists in a Sql database in a database independant way? </p>
<p>I came up with:</p>
<pre><code> bool exists;
const string sqlStatement = @"SELECT COUNT(*) FROM my_table";
try
{
using (OdbcCommand cmd = new OdbcCommand(sqlStatement, myOdbcConnection))
... | [
{
"answer_id": 464498,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 3,
"selected": false,
"text": "<p>I don't think that there exists one generic way that works for all Databases, since this is something very sp... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21679/"
] | What's the best way to check if a table exists in a Sql database in a database independant way?
I came up with:
```
bool exists;
const string sqlStatement = @"SELECT COUNT(*) FROM my_table";
try
{
using (OdbcCommand cmd = new OdbcCommand(sqlStatement, myOdbcConnection))
{
cmd.... | ```
bool exists;
try
{
// ANSI SQL way. Works in PostgreSQL, MSSQL, MySQL.
var cmd = new OdbcCommand(
"select case when exists((select * from information_schema.tables where table_name = '" + tableName + "')) then 1 else 0 end");
exists = (int)cmd.ExecuteScalar() == 1;
}
catch
{
try
{
... |
464,476 | <p>Is there any known algorithm that can generate a shuffled range [0..n) in linear time and constant space (when output produced iteratively), given an arbitrary seed value?</p>
<p>Assume n may be large, e.g. in the many millions, so a requirement to potentially produce every possible permutation is not required, not... | [
{
"answer_id": 465473,
"author": "Jason S",
"author_id": 44330,
"author_profile": "https://Stackoverflow.com/users/44330",
"pm_score": 3,
"selected": false,
"text": "<p>Sounds like you want an algorithm which is guaranteed to produce a cycle from 0 to n-1 without any repeats. There are a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3712/"
] | Is there any known algorithm that can generate a shuffled range [0..n) in linear time and constant space (when output produced iteratively), given an arbitrary seed value?
Assume n may be large, e.g. in the many millions, so a requirement to potentially produce every possible permutation is not required, not least bec... | Based on [Jason's answer](https://stackoverflow.com/questions/464476/generating-shuffled-range-using-a-prng-rather-than-shuffling#465473), I've made a simple straightforward implementation in C#. Find the next largest power of two greater than N. This makes it trivial to generate a and c, since c needs to be relatively... |
464,478 | <p>Some background:
in order to provide authentication I'm using certificates on client and server side (WCF) and use one certificate for all clients (manually loading it from application directory - not the safest way, but it doesn't require to manage certificate storage and making installation more difficult):</p>
<p... | [
{
"answer_id": 464729,
"author": "Tanner",
"author_id": 57475,
"author_profile": "https://Stackoverflow.com/users/57475",
"pm_score": 0,
"selected": false,
"text": "<p>If you're using message security with certificates at each end securing it, I'm not quite sure why you would need a wind... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45695/"
] | Some background:
in order to provide authentication I'm using certificates on client and server side (WCF) and use one certificate for all clients (manually loading it from application directory - not the safest way, but it doesn't require to manage certificate storage and making installation more difficult):
```
... | Try this link re: Impersonation:
<http://msdn.microsoft.com/en-us/library/ms730088.aspx>
section on - "Mapping a Client Certificate to a Windows Account", seems like what you're after.
with config on client:
```
authentication mapClientCertificateToWindowsAccount="true"
```
Client code:
' Create a binding that ... |
464,516 | <p>I am trying to write a Firefox 3 add-on which will enable me to easily re-tag bookmarks. For example I have some bookmarks tagged "development" and some tagged "Development" and I would like a way to easily update all the "delelopment" tags to "Development". Unfortunately I can not find an add-on to do this so I tho... | [
{
"answer_id": 475213,
"author": "Leftblank",
"author_id": 52057,
"author_profile": "https://Stackoverflow.com/users/52057",
"pm_score": 2,
"selected": false,
"text": "<p>I can't quite help you with the how-to, however, perhaps the extension 'SQLite Manager' will help you at least for th... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12377/"
] | I am trying to write a Firefox 3 add-on which will enable me to easily re-tag bookmarks. For example I have some bookmarks tagged "development" and some tagged "Development" and I would like a way to easily update all the "delelopment" tags to "Development". Unfortunately I can not find an add-on to do this so I though... | You probably already found out yourself, but tags are applied as follows:
The central place for all URLS in the database is `moz_places`. The table `moz_bookmarks` refers to it by the foreign key column `fk`.
If you tag a bookmark, there are multiple entries in `moz_bookmarks`, all having the same reference `fk`: Th... |
464,525 | <p>I've got an OR mapper (iBatis.Net) that returns an IList.</p>
<pre><code>// IList<T> QueryForList<T>(string statementName, object parameterObject);
var data = mapper.QueryForList<Something>(statement, parameters);
</code></pre>
<p>I'm trying to use it in an webservice an want to return the data 1... | [
{
"answer_id": 464544,
"author": "Norbert B.",
"author_id": 2605840,
"author_profile": "https://Stackoverflow.com/users/2605840",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you need a c).\nIt should be pretty safe to use solution a).</p>\n\n<p>This solution depends on th... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20580/"
] | I've got an OR mapper (iBatis.Net) that returns an IList.
```
// IList<T> QueryForList<T>(string statementName, object parameterObject);
var data = mapper.QueryForList<Something>(statement, parameters);
```
I'm trying to use it in an webservice an want to return the data 1:1. Of course I can't return IList in a WebM... | If it really is a `List<T>` but you want to protect against change and have it still work, then the most performant solution will be to attempt to cast it to a list, and if that fails then create a new list from its content, e.g.
```
var data = mapper.QueryForList<T>(statement, parameters);
var list = data as List<T> ... |
464,567 | <p>I cannot get trailing spaces from varchar column in Informix database.</p>
<p>I created test table, filled it with field with some trailing spaces,
but they are not returned by SELECT while it seems they are stored in db.</p>
<pre><code>CREATE TABLE tmptable (txt varchar(240));
INSERT INTO tmptable (txt) VALUES ('... | [
{
"answer_id": 464581,
"author": "Spence",
"author_id": 53771,
"author_profile": "https://Stackoverflow.com/users/53771",
"pm_score": 5,
"selected": false,
"text": "<p>The big one that always tripped me up was this:</p>\n\n<p>This searches in the header path: </p>\n\n<pre><code>#include ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22595/"
] | I cannot get trailing spaces from varchar column in Informix database.
I created test table, filled it with field with some trailing spaces,
but they are not returned by SELECT while it seems they are stored in db.
```
CREATE TABLE tmptable (txt varchar(240));
INSERT INTO tmptable (txt) VALUES ('123 ');
SELECT txt,... | * Check Large-Scale C++ Software Design from John Lakos if you have the money.
* Google C++ coding guidelines also have some OK stuff.
* Check Sutter Herb materials online (blog) as well.
Basically you need to understand where include headers are NOT required, eg. forward declaration. Also try to make sure that includ... |
464,593 | <p>We are trying to develop a screen capture utility.</p>
<p>How do we capture selected screen of another application using Java? And how do we add a callout to the captured screen?</p>
| [
{
"answer_id": 464611,
"author": "Clay Fowler",
"author_id": 44322,
"author_profile": "https://Stackoverflow.com/users/44322",
"pm_score": 2,
"selected": false,
"text": "<p>You will need to provide more specific information in order to receive meaningful help. To start with, Which operat... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are trying to develop a screen capture utility.
How do we capture selected screen of another application using Java? And how do we add a callout to the captured screen? | Based on [Prajakta's description of the project](https://stackoverflow.com/questions/464593/how-to-capture-selected-screen-of-other-application-using-java/490843#490843), I believe some explanation of manipulating a screen shot is in order (I think John did an excellent job of explaining [how to capture the screen shot... |
464,609 | <p>I am using SQL server 2000.
I have a stored procedure sitting on machine A. I want to call this stored procedure from within a stored procedure on machine B. How do I go about this?</p>
| [
{
"answer_id": 464626,
"author": "jwanagel",
"author_id": 15118,
"author_profile": "https://Stackoverflow.com/users/15118",
"pm_score": 2,
"selected": false,
"text": "<p>Read this <a href=\"http://blog.sqlauthority.com/2007/10/06/sql-server-executing-remote-stored-procedure-calling-store... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24108/"
] | I am using SQL server 2000.
I have a stored procedure sitting on machine A. I want to call this stored procedure from within a stored procedure on machine B. How do I go about this? | You could use the [Linked Server feature](http://msdn.microsoft.com/en-us/library/aa213778.aspx) of SQL Server.
>
> A linked server configuration allows
> Microsoft SQL Server to execute
> commands against OLE DB data sources
> on different servers. Linked servers
> offer these advantages:
>
>
> * Remote server... |
464,623 | <p>How can you get the active users connected to a postgreSQL database via SQL? This could be the userid's or number of users.</p>
| [
{
"answer_id": 464629,
"author": "balexandre",
"author_id": 28004,
"author_profile": "https://Stackoverflow.com/users/28004",
"pm_score": 8,
"selected": true,
"text": "<p>(question) Don't you get that info in</p>\n\n<blockquote>\n <p>select * from <a href=\"http://www.postgresql.org/doc... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3535708/"
] | How can you get the active users connected to a postgreSQL database via SQL? This could be the userid's or number of users. | (question) Don't you get that info in
>
> select \* from [pg\_user](http://www.postgresql.org/docs/current/interactive/user-manag.html#DATABASE-USERS);
>
>
>
or using the view [pg\_stat\_activity](http://www.postgresql.org/docs/current/interactive/monitoring-stats.html):
```
select * from pg_stat_activity;
```
... |
464,627 | <p>I have the following php code, which has been snipped for brevity. I am having trouble with the code after $lastImg is declared, specifically size never seems to get assigned any value, and the hence outputwidth and outputheight remain blank. I have been unable to spot the cause of this.</p>
<p>pic_url is just a st... | [
{
"answer_id": 464650,
"author": "Effata",
"author_id": 5740,
"author_profile": "https://Stackoverflow.com/users/5740",
"pm_score": 1,
"selected": false,
"text": "<p>I'd have to say it looks like $row['PIC_URL'] might not point to a valid image, thats the only reason getimagesize would f... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have the following php code, which has been snipped for brevity. I am having trouble with the code after $lastImg is declared, specifically size never seems to get assigned any value, and the hence outputwidth and outputheight remain blank. I have been unable to spot the cause of this.
pic\_url is just a string in t... | First, to get the right error message, change your code to:
```
$size = getimagesize($lastImg);
echo "SIZE = ".$size."";
if ($size) {
$imageWidth = $size[0];
$imageHeight = $size[1];
$wRatio = $imageWidth / $maxWidth;
$hRatio = $imageHeight / $maxHeight;
$maxRatio = max($wRatio, $hRatio);
if ... |
464,631 | <p>I am using VB.NET to Create Labels in Microsoft. This is my code:</p>
<pre><code>Public Sub CreateLabel(ByVal StrFilter As String, ByVal Path As String)
WordApp = CreateObject("Word.Application")
''Add a new document.
WordDoc = WordApp.Documents.Add()
Dim oConn As SqlConnection = New SqlConnection(c... | [
{
"answer_id": 464650,
"author": "Effata",
"author_id": 5740,
"author_profile": "https://Stackoverflow.com/users/5740",
"pm_score": 1,
"selected": false,
"text": "<p>I'd have to say it looks like $row['PIC_URL'] might not point to a valid image, thats the only reason getimagesize would f... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40293/"
] | I am using VB.NET to Create Labels in Microsoft. This is my code:
```
Public Sub CreateLabel(ByVal StrFilter As String, ByVal Path As String)
WordApp = CreateObject("Word.Application")
''Add a new document.
WordDoc = WordApp.Documents.Add()
Dim oConn As SqlConnection = New SqlConnection(connSTR)
oC... | First, to get the right error message, change your code to:
```
$size = getimagesize($lastImg);
echo "SIZE = ".$size."";
if ($size) {
$imageWidth = $size[0];
$imageHeight = $size[1];
$wRatio = $imageWidth / $maxWidth;
$hRatio = $imageHeight / $maxHeight;
$maxRatio = max($wRatio, $hRatio);
if ... |
464,642 | <p>I have a table that contains a number and a range value. For instance, one column has the value of 40 and the other column has a value of 100 meaning that starting 40 the range has 100 values ending in 139 inclusive of the number 40. I want to write a tsql statement that expands my data into individual rows. </p>
<... | [
{
"answer_id": 464780,
"author": "kristof",
"author_id": 3241,
"author_profile": "https://Stackoverflow.com/users/3241",
"pm_score": 0,
"selected": false,
"text": "<p>you could try this approach:</p>\n\n<pre><code>create function [dbo].[fRange](@a int, @b int)\n returns @ret table (va... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42434/"
] | I have a table that contains a number and a range value. For instance, one column has the value of 40 and the other column has a value of 100 meaning that starting 40 the range has 100 values ending in 139 inclusive of the number 40. I want to write a tsql statement that expands my data into individual rows.
I think ... | If you want CTE here is an example:
Initial insert:
```
insert into rangeTable (StartValue, RangeValue)
select 40,100
union all select 150,10
go
```
the query:
```
with r_CTE (startVal, rangeVal, generatedVal)
as
(
select r.startValue, r.rangeValue, r.startValue
from rangeTable r
union all
select r... |
464,679 | <p>I have a simple HTML (as HTA) application that shows strange behavior on Windows XP x64 machine. I getting periodically (not every time) error message "Access is denied." when I start the application. The same application on Windows XP 32bit runs just fine...</p>
<p>Does somebody has any idea or explanation?</p>
<... | [
{
"answer_id": 464734,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": true,
"text": "<p>Try adding a try catch around the startup code</p>\n\n<pre><code>try\n{ \n window.resizeTo(500, 300); \n} catch... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47418/"
] | I have a simple HTML (as HTA) application that shows strange behavior on Windows XP x64 machine. I getting periodically (not every time) error message "Access is denied." when I start the application. The same application on Windows XP 32bit runs just fine...
Does somebody has any idea or explanation?
Error message:
... | Try adding a try catch around the startup code
```
try
{
window.resizeTo(500, 300);
} catch(e) { }
```
Alternatively try setTimeout:-
```
setTimeout(function() {
window.resizeTo(500, 300);
}, 100);
``` |
464,707 | <p>I'm writing a small WCF/WPF app to resize images but WCF is giving me grief when I try to send an image of size 28K to my service from the client. The service works fine when I send it smaller images. I immediately assumed that this was a configuration issue and I've trawled the web looking at posts regarding the Ma... | [
{
"answer_id": 464758,
"author": "Dav Evans",
"author_id": 47835,
"author_profile": "https://Stackoverflow.com/users/47835",
"pm_score": 6,
"selected": true,
"text": "<p>My Bad - I forgot to apply my binding configuration to my endpoint in my server-side config. The server config should ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47835/"
] | I'm writing a small WCF/WPF app to resize images but WCF is giving me grief when I try to send an image of size 28K to my service from the client. The service works fine when I send it smaller images. I immediately assumed that this was a configuration issue and I've trawled the web looking at posts regarding the MaxAr... | My Bad - I forgot to apply my binding configuration to my endpoint in my server-side config. The server config should read:
```
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ImageResizerServiceContract" closeTimeout="00:01:00"
openTimeout="00:01:0... |
464,717 | <p>Coming from <a href="https://stackoverflow.com/questions/462320/window-overflowing-widget-in-wxwidgets">this question</a>, I have a wxComboCtrl with a custom popup made of a panel with a bunch of radiobuttons.. My problem is that when I open the popup the combo doesn't get keystrokes, because the events get handled ... | [
{
"answer_id": 479060,
"author": "Joril",
"author_id": 3497,
"author_profile": "https://Stackoverflow.com/users/3497",
"pm_score": 1,
"selected": true,
"text": "<p>I've got an answer from Robin Dunn himself on wxpython-users:</p>\n\n<blockquote>\n <p>Sending low-level events to native\n... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3497/"
] | Coming from [this question](https://stackoverflow.com/questions/462320/window-overflowing-widget-in-wxwidgets), I have a wxComboCtrl with a custom popup made of a panel with a bunch of radiobuttons.. My problem is that when I open the popup the combo doesn't get keystrokes, because the events get handled by the panel i... | I've got an answer from Robin Dunn himself on wxpython-users:
>
> Sending low-level events to native
> widgets like this does not work the
> way that most people expect it to.
> You are expecting this to result in
> the character being added to the text
> ctrl,but it can't do that because all
> that ProcessEve... |
464,727 | <p>How can I convert this code </p>
<pre><code><span jwcid="permissionInEachStep@InvokeListener"
listener="listener:onEditPermissionInEachStep"/>
</code></pre>
<p>into tapestry5 or have a different way to invoke method?</p>
| [
{
"answer_id": 464779,
"author": "fbonnet",
"author_id": 54574,
"author_profile": "https://Stackoverflow.com/users/54574",
"pm_score": 1,
"selected": false,
"text": "<p>Take a look at <a href=\"https://haxe.org/\" rel=\"nofollow noreferrer\">Haxe</a>: it is an open source language that c... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I convert this code
```
<span jwcid="permissionInEachStep@InvokeListener"
listener="listener:onEditPermissionInEachStep"/>
```
into tapestry5 or have a different way to invoke method? | If you are not interested in Haxe, you will basically need to write your own compiler that compiles objects down to ABC (Actionscript Byte Code). The [AVM2 Overview](http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf) document available from Adobe on ABC and the AVM2 which should help you get started. I... |
464,765 | <p>This is what I need to do:</p>
<pre><code>object foo = GetFoo();
Type t = typeof(BarType);
(foo as t).FunctionThatExistsInBarType();
</code></pre>
<p>Can something like this be done?</p>
| [
{
"answer_id": 464773,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 5,
"selected": true,
"text": "<p>No, you cannot. C# does not implement <a href=\"http://en.wikipedia.org/wiki/Duck_typing\" rel=\"noreferrer\">duck typi... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95/"
] | This is what I need to do:
```
object foo = GetFoo();
Type t = typeof(BarType);
(foo as t).FunctionThatExistsInBarType();
```
Can something like this be done? | No, you cannot. C# does not implement [duck typing](http://en.wikipedia.org/wiki/Duck_typing).
You must implement an interface and cast to it.
(However there are attempts to do it. Look at [Duck Typing Project](http://www.deftflux.net/blog/page/Duck-Typing-Project.aspx) for an example.) |
464,775 | <p>I'm building my personal CMS and need your advice organizing core functions and classes.
I have folders:</p>
<pre><code>/shared
/classes
DB.php
Session.php
Config.php
...
/libraries
Arrays.php
DateTime.php
Email.php
...
</code></pre>
<p>The files in 'cl... | [
{
"answer_id": 466979,
"author": "Evan Fosmark",
"author_id": 49701,
"author_profile": "https://Stackoverflow.com/users/49701",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>Should i just write them as functions,\n or make them static and wrap in some\n class? Basically... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53948/"
] | I'm building my personal CMS and need your advice organizing core functions and classes.
I have folders:
```
/shared
/classes
DB.php
Session.php
Config.php
...
/libraries
Arrays.php
DateTime.php
Email.php
...
```
The files in 'classes' folder contains cor... | My suggestion is to first think through about the architectural goals of your CMS. Sure, it's going to be 100% yours, but that doesn't mean you wont suffer from not begin sure whats hooked where and how, what this does and how do I get that from here.
That's why I definitely wouldn't suggest you have libraries calling... |
464,777 | <p>I have a Powershell script that copies files from one location to another. Once the copy is complete I want to clear the Archive attribute on the files in the source location that have been copied.</p>
<p>How do I clear the Archive attribute of a file using Powershell?</p>
| [
{
"answer_id": 464800,
"author": "Simon Steele",
"author_id": 4591,
"author_profile": "https://Stackoverflow.com/users/4591",
"pm_score": 5,
"selected": false,
"text": "<p>You can use the good old dos attrib command like this:</p>\n\n<pre><code>attrib -a *.*\n</code></pre>\n\n<p>Or to do... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24490/"
] | I have a Powershell script that copies files from one location to another. Once the copy is complete I want to clear the Archive attribute on the files in the source location that have been copied.
How do I clear the Archive attribute of a file using Powershell? | From [here](http://scriptolog.blogspot.com/2007/10/file-attributes-helper-functions.html):
```
function Get-FileAttribute{
param($file,$attribute)
$val = [System.IO.FileAttributes]$attribute;
if((gci $file -force).Attributes -band $val -eq $val){$true;} else { $false; }
}
function Set-FileAttribute{
... |
464,784 | <p>I am using in my code at the moment a <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html" rel="noreferrer">ReentrantReadWriteLock</a> to synchronize access over a tree-like structure. This structure is large, and read by many threads at once with occasional modific... | [
{
"answer_id": 464824,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 6,
"selected": true,
"text": "<p>I have made a little progress on this. By declaring the lock variable explicitly as a <code>ReentrantReadWriteLoc... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45664/"
] | I am using in my code at the moment a [ReentrantReadWriteLock](http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html) to synchronize access over a tree-like structure. This structure is large, and read by many threads at once with occasional modifications to small parts of it - so... | I have made a little progress on this. By declaring the lock variable explicitly as a `ReentrantReadWriteLock` instead of simply a `ReadWriteLock` (less than ideal, but probably a necessary evil in this case) I can call the [`getReadHoldCount()`](http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/Reentran... |
464,808 | <p><a href="http://www.mobal.com/worldphone/indexa.php" rel="nofollow noreferrer">Heres my page.</a></p>
<p>If you find the red 'Special Offer' box, you'll see it expands when its header is clicked. There is another identical box at the bottom of the page. If you click that one too, you'll see my problem. The click ev... | [
{
"answer_id": 559172,
"author": "privateace",
"author_id": 66572,
"author_profile": "https://Stackoverflow.com/users/66572",
"pm_score": -1,
"selected": false,
"text": "<p>It's not possible with the current Joomla code. </p>\n\n<p>The intro text is used to display a brief intro the arti... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | [Heres my page.](http://www.mobal.com/worldphone/indexa.php)
If you find the red 'Special Offer' box, you'll see it expands when its header is clicked. There is another identical box at the bottom of the page. If you click that one too, you'll see my problem. The click event is firing both boxes. This was an oversight... | Could one not duplicate the the opening paragraph/content above the [Read More] line, except with whatever changes are needed? Then, in the article's Advanced Parameters, set the [Intro Text] value to "Hide" so the intro doesn't appear when the article is displayed normally? |
464,817 | <p>I can find a direct table foreign key in c# like:</p>
<pre><code> foreach (ForeignKey key in CurrentTable.ForeignKeys) {
Console.WriteLine("FK:" + key.ReferencedTable);
}
</code></pre>
<p>The classic representation for a many to many relationship is achieved via an intermediate tabl... | [
{
"answer_id": 464830,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 2,
"selected": false,
"text": "<p>For notepad, I have no useful advice, however I would advise you to use one of the free IDE's, Microsofts <a hre... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1929/"
] | I can find a direct table foreign key in c# like:
```
foreach (ForeignKey key in CurrentTable.ForeignKeys) {
Console.WriteLine("FK:" + key.ReferencedTable);
}
```
The classic representation for a many to many relationship is achieved via an intermediate table that has a one to many re... | I think you're suffering a bit from the fact that you've used to working in one way during some years, and now must take time to get yourself comfortable using / developing in a new platform.
I do not agree with you , that MS hasn't been consistent on the fact that a string knows how it should convert itself to anothe... |
464,825 | <p>I'd like to convert gif images to jpeg using Java. It works great for most images, but I have a simple transparent gif image:</p>
<p><a href="http://img292.imageshack.us/img292/2103/indexedtestal7.gif" rel="nofollow noreferrer">Input gif image http://img292.imageshack.us/img292/2103/indexedtestal7.gif</a></p>
<p>[... | [
{
"answer_id": 464832,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 2,
"selected": false,
"text": "<p>JPEG has no support for transparency. So even when you get the circle color correctly you will still have a black or whit... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21348/"
] | I'd like to convert gif images to jpeg using Java. It works great for most images, but I have a simple transparent gif image:
[Input gif image http://img292.imageshack.us/img292/2103/indexedtestal7.gif](http://img292.imageshack.us/img292/2103/indexedtestal7.gif)
[In case the image is missing: it's a blue circle with ... | For Java 6 (and 5 too, I think):
```
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
g = bufferedImage.createGraphics();
//Color.WHITE estes the background to white. You can use any other color
g.drawImage(image, 0, 0, bufferedImage.getWidth(), ... |
464,834 | <p>I'm looking for a way to edit a configuration file (web.config in an asp.net project) in a Team Build.</p>
<p>Specifically I'm looking at either uncommenting or adding identiy impersonate in the config file before copying the built web application to its destination.</p>
<p>I know that it's possible to have multip... | [
{
"answer_id": 464832,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 2,
"selected": false,
"text": "<p>JPEG has no support for transparency. So even when you get the circle color correctly you will still have a black or whit... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4582/"
] | I'm looking for a way to edit a configuration file (web.config in an asp.net project) in a Team Build.
Specifically I'm looking at either uncommenting or adding identiy impersonate in the config file before copying the built web application to its destination.
I know that it's possible to have multiple config files a... | For Java 6 (and 5 too, I think):
```
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
g = bufferedImage.createGraphics();
//Color.WHITE estes the background to white. You can use any other color
g.drawImage(image, 0, 0, bufferedImage.getWidth(), ... |
464,852 | <p>I have my Windows Application that accepts args and I use this in order to set up the Window behaviour</p>
<p>problem is that I need to pass text in some of this arguments but my application is looking at it as multiple args, so, this:</p>
<pre><code>"http://www.google.com/" contact 450 300 false "Contact Info" tr... | [
{
"answer_id": 464861,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>Are you running it directly from the command line? If so, I'd expect that to work just fine. (I assume you're using th... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28004/"
] | I have my Windows Application that accepts args and I use this in order to set up the Window behaviour
problem is that I need to pass text in some of this arguments but my application is looking at it as multiple args, so, this:
```
"http://www.google.com/" contact 450 300 false "Contact Info" true "Stay Visible" tru... | Are you running it directly from the command line? If so, I'd expect that to work just fine. (I assume you're using the parameters from the Main method, by the way?)
For instance, here's a small test app:
```
using System;
class Test
{
static void Main(string[] args)
{
foreach (string arg in args)
... |
464,853 | <p>I'm trying to design an XML document structure for my application.</p>
<p>I want to store a list of holes like following</p>
<pre><code><Holes>
<Hole id='1' dia='0.1' depth='2'/>
<Hole id='2' dia='0.2' depth='1.67'/>
<Hole id='3' dia='0.3' depth='0.44'/>
</Holes>
</code></pre>
<p>... | [
{
"answer_id": 464884,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 3,
"selected": true,
"text": "<p>XPath is certainly one way to do it. An Xpath query to find the hold with id 1 would be something like <code>Holes/Hole... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25125/"
] | I'm trying to design an XML document structure for my application.
I want to store a list of holes like following
```
<Holes>
<Hole id='1' dia='0.1' depth='2'/>
<Hole id='2' dia='0.2' depth='1.67'/>
<Hole id='3' dia='0.3' depth='0.44'/>
</Holes>
```
In another part of my document I want to refer to a hole by its... | XPath is certainly one way to do it. An Xpath query to find the hold with id 1 would be something like `Holes/Hole[@id="1"]` |
464,862 | <p>hi im trying to using flashVars however for some reason there not getting sent to my flex app.</p>
<p>Im embedding my object in a velocity file and here is the object embed code;</p>
<pre><code><object width="$!WIDTH" height="$!HEIGHT">
<param name="flashVars" value="maximizeUrl=http://maximizeUrl"/&g... | [
{
"answer_id": 464949,
"author": "David Hanak",
"author_id": 42136,
"author_profile": "https://Stackoverflow.com/users/42136",
"pm_score": 3,
"selected": true,
"text": "<p>I assume you're having problems with Firefox, which ignores the object tag, and uses the embed tag instead. You nee... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | hi im trying to using flashVars however for some reason there not getting sent to my flex app.
Im embedding my object in a velocity file and here is the object embed code;
```
<object width="$!WIDTH" height="$!HEIGHT">
<param name="flashVars" value="maximizeUrl=http://maximizeUrl"/>
<param name="movie"... | I assume you're having problems with Firefox, which ignores the object tag, and uses the embed tag instead. You need to add the flashvars parameter as an attribute there as well:
```
<object width="$!WIDTH" height="$!HEIGHT">
<param name="flashVars" value="maximizeUrl=http://maximizeUrl"/>
<param na... |
464,864 | <p>I have a list with 15 numbers, and I need to write some code that produces all 32,768 combinations of those numbers.</p>
<p>I've found <a href="http://desk.stinkpot.org:8080/tricks/index.php/2008/04/get-all-possible-combinations-of-a-lists-elements-in-python/" rel="noreferrer">some code</a> (by Googling) that appare... | [
{
"answer_id": 464882,
"author": "James Brady",
"author_id": 29903,
"author_profile": "https://Stackoverflow.com/users/29903",
"pm_score": 10,
"selected": true,
"text": "<p>Have a look at <a href=\"http://docs.python.org/library/itertools.html#itertools.combinations\" rel=\"noreferrer\">... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] | I have a list with 15 numbers, and I need to write some code that produces all 32,768 combinations of those numbers.
I've found [some code](http://desk.stinkpot.org:8080/tricks/index.php/2008/04/get-all-possible-combinations-of-a-lists-elements-in-python/) (by Googling) that apparently does what I'm looking for, but I... | Have a look at [itertools.combinations](http://docs.python.org/library/itertools.html#itertools.combinations):
>
>
> ```
> itertools.combinations(iterable, r)
>
> ```
>
> Return r length subsequences of elements from
> the input iterable.
>
>
> Combinations are emitted in lexicographic sort order. So, if the
> ... |
464,874 | <p>I'm currently working on a Java project that is emitting the following warning when I compile:</p>
<pre><code>/src/com/myco/apps/AppDBCore.java:439: warning: unmappable character for encoding UTF8
[javac] String copyright = "� 2003-2008 My Company. All rights reserved.";
</code></pre>
<p>I'm not sure h... | [
{
"answer_id": 464886,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "<p>Use the \"\\uxxxx\" escape format.</p>\n\n<p>According to <a href=\"http://en.wikipedia.org/wiki/Copyright_symbol\" re... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43662/"
] | I'm currently working on a Java project that is emitting the following warning when I compile:
```
/src/com/myco/apps/AppDBCore.java:439: warning: unmappable character for encoding UTF8
[javac] String copyright = "� 2003-2008 My Company. All rights reserved.";
```
I'm not sure how SO will render the char... | Use the "\uxxxx" escape format.
According to [Wikipedia](http://en.wikipedia.org/wiki/Copyright_symbol), the copyright symbol is unicode U+00A9 so your line should read:
```
String copyright = "\u00a9 2003-2008 My Company. All rights reserved.";
``` |
464,889 | <p>I was told that in c# attributes are not allowed on the auto-implemented properties. Is that true? if so why?</p>
<p>EDIT: I got this information from a popular book on LINQ and could not believe it!
EDIT: Refer page 34 of LINQ Unleashed by Paul Kimmel where he says "<em>Attributes are not allowed on auto-implement... | [
{
"answer_id": 464900,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 4,
"selected": false,
"text": "<p>You can apply attributes to automatic properties without a problem.</p>\n\n<p>Quote from <a href=\"http://msdn.microsoft.com/... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38807/"
] | I was told that in c# attributes are not allowed on the auto-implemented properties. Is that true? if so why?
EDIT: I got this information from a popular book on LINQ and could not believe it!
EDIT: Refer page 34 of LINQ Unleashed by Paul Kimmel where he says "*Attributes are not allowed on auto-implemented properties... | The easiest way to prove that's wrong is to just test it:
```
using System;
using System.ComponentModel;
using System.Reflection;
class Test
{
[Description("Auto-implemented property")]
public static string Foo { get; set; }
static void Main(string[] args)
{
var property = typeof(Test).GetP... |
464,902 | <p>I am trying to convert some <a href="http://en.wikipedia.org/wiki/Visual_Basic_for_Applications" rel="noreferrer">VBA</a> code to C#. I am new to C#. Currently I am trying to open an Excel file from a folder and if it does not exist then create it. I am trying something like the following. How can I make it work?</p... | [
{
"answer_id": 464943,
"author": "Frederick The Fool",
"author_id": 32688,
"author_profile": "https://Stackoverflow.com/users/32688",
"pm_score": 2,
"selected": false,
"text": "<p>For opening a file, try this:</p>\n\n<pre><code>objexcel.Workbooks.Open(@\"C:\\YourPath\\YourExcelFile.xls\"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] | I am trying to convert some [VBA](http://en.wikipedia.org/wiki/Visual_Basic_for_Applications) code to C#. I am new to C#. Currently I am trying to open an Excel file from a folder and if it does not exist then create it. I am trying something like the following. How can I make it work?
```
Excel.Application objexcel;
... | You need to have installed Microsoft Visual Studio Tools for Office (VSTO).
VSTO can be selected in the Visual Studio installer under Workloads > Web & Cloud > Office/SharePoint Development.
After that create a generic .NET project and add a reference to `Microsoft.Office.Interop.Excel` via 'Add Reference... > Assemb... |