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 |
|---|---|---|---|---|---|---|
356,321 | <p>I'm about to be forced to write a script to download some number of files under Windows XP. The machines the script will be run at are all behind a proxy, and the proxy settings are entered into the IE configuration.</p>
<p>What came to my mind was either to somehow call IE from the command line, and using its conf... | [
{
"answer_id": 356859,
"author": "user18714",
"author_id": 18714,
"author_profile": "https://Stackoverflow.com/users/18714",
"pm_score": 0,
"selected": false,
"text": "<p>Using radioButton.setItemId() and getItemId() resolve it.</p>\n"
},
{
"answer_id": 1687944,
"author": "us... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4172/"
] | I'm about to be forced to write a script to download some number of files under Windows XP. The machines the script will be run at are all behind a proxy, and the proxy settings are entered into the IE configuration.
What came to my mind was either to somehow call IE from the command line, and using its configuration ... | Create radio
```
Radio radio = new Radio();
radio.setBoxLabel("Si");
radio.setValue(true);
radio.setValueAttribute("true");
Radio radio2 = new Radio();
radio2.setBoxLabel("No");
radio2.setValueAttribute("false");
RadioGroup radioGroup = new RadioGroup();
radioGroup.setFieldLabel("Afecto");
radioGroup.add(r... |
356,323 | <p>I want to add all the files in the current directory to git:</p>
<pre><code>git add .
error: open(".mysql_history"): Permission denied
fatal: unable to index file .mysql_history
</code></pre>
<p>That's fine. That file happens to be in this directory and owned by root. I want to add all <em>other</em> files. Is th... | [
{
"answer_id": 356332,
"author": "mwilliams",
"author_id": 23909,
"author_profile": "https://Stackoverflow.com/users/23909",
"pm_score": 3,
"selected": false,
"text": "<p>Would it help if you added that file to your .gitignore file? So all other files would be versioned and that file wo... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8611/"
] | I want to add all the files in the current directory to git:
```
git add .
error: open(".mysql_history"): Permission denied
fatal: unable to index file .mysql_history
```
That's fine. That file happens to be in this directory and owned by root. I want to add all *other* files. Is there a way to do that without havin... | Use `git add --ignore-errors .`
This will still give an error for the unreadable file(s), but not a fatal one. The other files will be added. |
356,330 | <p>I'm currently using msbuild for a solution of over 600 projects. </p>
<p>Imagine I change the code for 1 library that is used by 10 projects. Instead of providing all 600 projects to msbuild and let it compile all of them and figure out the dependencys. I was wondering if there was a program or library I could u... | [
{
"answer_id": 356357,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://msbuildtasks.tigris.org/\" rel=\"nofollow noreferrer\">MSBuild Tasks</a> doesn't have what you're... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45005/"
] | I'm currently using msbuild for a solution of over 600 projects.
Imagine I change the code for 1 library that is used by 10 projects. Instead of providing all 600 projects to msbuild and let it compile all of them and figure out the dependencys. I was wondering if there was a program or library I could use that would... | Have you tried [.NET assembly dependency analyser](http://www.drewnoakes.com/code/dependancyanalyser/)?.
It is open source, and the graph output in [dot script](http://www.graphviz.org/doc/info/lang.html) might be what you need. An example from the site:
```
digraph G {
size="100,69"
center=""
rat... |
356,336 | <p>A few years ago I worked on a system where a numeric primary key was stored in a [SQL Server] varchar column, so I quickly came unstuck when querying with a BETWEEN operator:</p>
<pre><code>SELECT ID FROM MyTable WHERE ID BETWEEN 100 AND 110;
</code></pre>
<p>Results:</p>
<pre><code>100
102
103
109
110
11
</code>... | [
{
"answer_id": 356349,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 3,
"selected": false,
"text": "<p>If you're sure that the values in ID are numeric only, why not just CAST them</p>\n\n<pre><code>WHERE CAST(ID as int) BETWE... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6898/"
] | A few years ago I worked on a system where a numeric primary key was stored in a [SQL Server] varchar column, so I quickly came unstuck when querying with a BETWEEN operator:
```
SELECT ID FROM MyTable WHERE ID BETWEEN 100 AND 110;
```
Results:
```
100
102
103
109
110
11
```
This was simply bad design. However, I... | If you're sure that the values in ID are numeric only, why not just CAST them
```
WHERE CAST(ID as int) BETWEEN iStartValue AND iEndValue
```
EDIT 1:
An extension to the casting method which should work is to use a sub-query to pull out all numeric records. Please note - I do not think this method is better than the... |
356,337 | <p>I have a Perl script that sets up variables near the top for directories and files that it will use. It also requires a few variables to be set as command-line arguments.
Example:</p>
<pre><code>use Getopt::Long;
my ($mount_point, $sub_dir, $database_name, $database_schema);
# Populate variables from the command ... | [
{
"answer_id": 356404,
"author": "dsm",
"author_id": 7780,
"author_profile": "https://Stackoverflow.com/users/7780",
"pm_score": 0,
"selected": false,
"text": "<p>GetOptions can be called with an array as its input data. Read the <a href=\"http://perldoc.perl.org/Getopt/Long.html#Parsing... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40619/"
] | I have a Perl script that sets up variables near the top for directories and files that it will use. It also requires a few variables to be set as command-line arguments.
Example:
```
use Getopt::Long;
my ($mount_point, $sub_dir, $database_name, $database_schema);
# Populate variables from the command line:
GetOption... | Here's another approach. It uses arrays of names and a hash to store the options. It makes all options truly optional, but validates the required ones unless you include "--debug" on the command line. Regardless of whether you use "--debug", you can override any of the others.
You could do more explicit logic checks ... |
356,340 | <p>I am looking for a regex statement that will let me extract the HTML content from just between the body tags from a XHTML document.</p>
<p>The XHTML that I need to parse will be very simple files, I do not have to worry about JavaScript content or <code><![CDATA[</code> tags, for example.</p>
<p>Below is the ex... | [
{
"answer_id": 356374,
"author": "Karl",
"author_id": 36093,
"author_profile": "https://Stackoverflow.com/users/36093",
"pm_score": 3,
"selected": false,
"text": "<p>XHTML would be more easily parsed with an XML parser, than with a regex. I know it's not what youre asking, but an XML pa... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506/"
] | I am looking for a regex statement that will let me extract the HTML content from just between the body tags from a XHTML document.
The XHTML that I need to parse will be very simple files, I do not have to worry about JavaScript content or `<![CDATA[` tags, for example.
Below is the expected structure of the HTML fi... | Would this work ?
```
((?:.(?!<body[^>]*>))+.<body[^>]*>)|(</body\>.+)
```
Of course, you need to add the necessary `\s` in order to take into account `< body ...>` (element with spaces), as in:
```
((?:.(?!<\s*body[^>]*>))+.<\s*body[^>]*>)|(<\s*/\s*body\s*\>.+)
```
On second thought, I am not sure why I needed a... |
356,347 | <p>I'm writing a Greasemonkey script to connect two company-internal webpages. One is SSL, and the other is insecure and can only be accessed via a POST request. If I create a hidden form on the secure page and submit it via an <code>onclick()</code> in an <code><a></code>, it works fine, but FF gives a warning... | [
{
"answer_id": 356630,
"author": "Raymond Martineau",
"author_id": 33952,
"author_profile": "https://Stackoverflow.com/users/33952",
"pm_score": 0,
"selected": false,
"text": "<p>That's a browser configuration setting, which can't (or shouldn't) be changable by Javascript.</p>\n\n<p>Unle... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm writing a Greasemonkey script to connect two company-internal webpages. One is SSL, and the other is insecure and can only be accessed via a POST request. If I create a hidden form on the secure page and submit it via an `onclick()` in an `<a>`, it works fine, but FF gives a warning:
>
> Although this page is enc... | This may be possible by doing a GM\_xmlhttpRequest. e.g.,
```
GM_xmlhttpRequest({
method: 'POST',
url: 'http://your.insecure.site.here',
onload: function(details) {
// look in the JavaScript console
GM_log(details.responseText);
/* This function will be called when the page (url)
has ... |
356,348 | <p>I'm kind of like stuck trying to implement YUI autocomplete textbox. here's the code:</p>
<pre><code><div id="myAutoComplete">
<input id="myInput" type="text" />
<div id="myContainer"></div>
</div>
<script type="text/javascript">
YAHOO.example.BasicRemote = function() {
oDS = ... | [
{
"answer_id": 356516,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 1,
"selected": true,
"text": "<p>To be honest, and I know this isn't the most helpful answer... you should look into using jQuery these days as it has total... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm kind of like stuck trying to implement YUI autocomplete textbox. here's the code:
```
<div id="myAutoComplete">
<input id="myInput" type="text" />
<div id="myContainer"></div>
</div>
<script type="text/javascript">
YAHOO.example.BasicRemote = function() {
oDS = new YAHOO.util.XHRDataSource("../User/Home2.aspx")... | To be honest, and I know this isn't the most helpful answer... you should look into using jQuery these days as it has totally blown YUI out of the water in terms of ease-of-use, syntax and community following.
Then you could toddle onto <http://plugins.jquery.com> and find a whole bunch of cool autocomplete plugins wi... |
356,371 | <p>I was wondering what I could do to improve the performance of Excel automation, as it can be quite slow if you have a lot going on in the worksheet...</p>
<p>Here's a few I found myself:</p>
<ul>
<li><p><code>ExcelApp.ScreenUpdating = false</code> -- turn off the redrawing of the screen</p></li>
<li><p><code>Excel... | [
{
"answer_id": 356397,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 2,
"selected": false,
"text": "<p>Performance also depends a lot on how you automate Excel. VBA is faster than COM automation is faster than .NET au... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39259/"
] | I was wondering what I could do to improve the performance of Excel automation, as it can be quite slow if you have a lot going on in the worksheet...
Here's a few I found myself:
* `ExcelApp.ScreenUpdating = false` -- turn off the redrawing of the screen
* `ExcelApp.Calculation = Excel.XlCalculation.xlCalculationMan... | When using C# or VB.Net to either get or set a range, figure out what the total size of the range is, and then get one large 2 dimensional object array...
```
//get values
object[,] objectArray = shtName.get_Range("A1:Z100").Value2;
iFace = Convert.ToInt32(objectArray[1,1]);
//set values
object[,] objectArray = new o... |
356,373 | <p>Assuming following definition:</p>
<pre><code>/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </summary>... | [
{
"answer_id": 356383,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 6,
"selected": true,
"text": "<p>Oh, whatever, I found the answer myself: </p>\n\n<pre><code>/// <summary>\n/// Replaces each occurrence of sPat... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] | Assuming following definition:
```
/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </summary>
[SqlFunction(IsDeterminis... | Oh, whatever, I found the answer myself:
```
/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </summary>
[SqlFunction(I... |
356,382 | <p>Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity.</p>
<p>1: <a href="http://example... | [
{
"answer_id": 356383,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 6,
"selected": true,
"text": "<p>Oh, whatever, I found the answer myself: </p>\n\n<pre><code>/// <summary>\n/// Replaces each occurrence of sPat... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4830/"
] | Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity.
1: [http://example.com/orders/add-or... | Oh, whatever, I found the answer myself:
```
/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </summary>
[SqlFunction(I... |
356,390 | <p>I have a div with two nested divs inside, the (float:left) one is the menu bar, and the right (float:right) should display whatever content the page has, it works fine when the window is at a maximum, but when i resize it the content is collapsed until it can no longer has any space, at which it is forced to be disp... | [
{
"answer_id": 356400,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 1,
"selected": false,
"text": "<p>Well, putting a <code>width</code> or <code>min-width</code> property is the way to go.</p>\n\n<p>Now, without an example, ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45016/"
] | I have a div with two nested divs inside, the (float:left) one is the menu bar, and the right (float:right) should display whatever content the page has, it works fine when the window is at a maximum, but when i resize it the content is collapsed until it can no longer has any space, at which it is forced to be display... | This should do it (container is the parent div containing that 2 divs):
```
.container {
width: 1024px;
display: block;
}
``` |
356,411 | <p>I have a stack panel inside of an expander panel that I programaticaly adds check boxes to. Currently the exanpander stops at the bottom of the form, but the stack panel keeps growing. I would like the stack panel to be bounded by the expander and scroll to display the check boxes. Do I need house the check boxes... | [
{
"answer_id": 356439,
"author": "Pete OHanlon",
"author_id": 43635,
"author_profile": "https://Stackoverflow.com/users/43635",
"pm_score": 2,
"selected": false,
"text": "<p>Set <strong>ScrollViewer.VerticalScrollBarVisibility=\"Auto\"</strong> in your StackPanel declaration.</p>\n"
},... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | I have a stack panel inside of an expander panel that I programaticaly adds check boxes to. Currently the exanpander stops at the bottom of the form, but the stack panel keeps growing. I would like the stack panel to be bounded by the expander and scroll to display the check boxes. Do I need house the check boxes in a ... | You can nest the StackPanel in a ScrollViewer:
```
<Grid>
<Expander Header="Expander1" Margin="0,0,0,2" Name="Expander1" VerticalAlignment="Top" Background="Coral">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Name="StackScroll" Margin="0,0,0,2" Background="Aqua">
</Sta... |
356,418 | <p>With SMO objects using Server.JobServer.jobs to get a list of jobs, I can find the status of each job. For those that are currently executing I would like to find the SPID it is executing on. I can also get a list of the server's processes using Server.EnumProcesses(). This gives me a list of currently active SPID... | [
{
"answer_id": 356439,
"author": "Pete OHanlon",
"author_id": 43635,
"author_profile": "https://Stackoverflow.com/users/43635",
"pm_score": 2,
"selected": false,
"text": "<p>Set <strong>ScrollViewer.VerticalScrollBarVisibility=\"Auto\"</strong> in your StackPanel declaration.</p>\n"
},... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3854/"
] | With SMO objects using Server.JobServer.jobs to get a list of jobs, I can find the status of each job. For those that are currently executing I would like to find the SPID it is executing on. I can also get a list of the server's processes using Server.EnumProcesses(). This gives me a list of currently active SPIDs. I ... | You can nest the StackPanel in a ScrollViewer:
```
<Grid>
<Expander Header="Expander1" Margin="0,0,0,2" Name="Expander1" VerticalAlignment="Top" Background="Coral">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Name="StackScroll" Margin="0,0,0,2" Background="Aqua">
</Sta... |
356,460 | <p>I'm trying to create a LINQ to SQL class that represents the "latest" version of itself.</p>
<p>Right now, the table that this entity represents has a single auto-incrementing ID, and I was thinking that I would add a version number to the primary key. I've never done anything like this, so I'm not sure how to proc... | [
{
"answer_id": 356521,
"author": "NotMe",
"author_id": 2424,
"author_profile": "https://Stackoverflow.com/users/2424",
"pm_score": 0,
"selected": false,
"text": "<p>The best way to proceed is to stop and seriously rethink your approach. </p>\n\n<p>If you are going to keep different vers... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] | I'm trying to create a LINQ to SQL class that represents the "latest" version of itself.
Right now, the table that this entity represents has a single auto-incrementing ID, and I was thinking that I would add a version number to the primary key. I've never done anything like this, so I'm not sure how to proceed. I wou... | If you can avoid keeping a history, do. It's a pain.
If a complete history is unavoidable (regulated financial and medical data or the like), consider adding history tables. Use a trigger to 'version' into the history tables. That way, you're not dependent on your application to ensure a version is recorded - all inse... |
356,464 | <p>I am looking for a way to localize properties names displayed in a PropertyGrid. The property's name may be "overriden" using the DisplayNameAttribute attribute. Unfortunately attributes can not have non constant expressions. So I can not use strongly typed resources such as: </p>
<pre><code>class Foo
{
[Display... | [
{
"answer_id": 356493,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 1,
"selected": false,
"text": "<p>Well, the assembly is <code>Microsoft.VisualStudio.Modeling.Sdk.dll</code>. which comes with the Visual Studio SDK (... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37706/"
] | I am looking for a way to localize properties names displayed in a PropertyGrid. The property's name may be "overriden" using the DisplayNameAttribute attribute. Unfortunately attributes can not have non constant expressions. So I can not use strongly typed resources such as:
```
class Foo
{
[DisplayAttribute(Reso... | Here is the solution I ended up with in a separate assembly (called "Common" in my case):
```
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event)]
public class DisplayNameLocalizedAttribute : DisplayNameAttribute
{
public DisplayNameLoc... |
356,465 | <p>Each month I get new CMYK and RGB images that shall be used on the web.</p>
<p>I had a script using a patched up ImageMagick doing this, but it got deleted. So I need to do it again, but it was hard last time.</p>
<p>How do you <em>easily</em> and quickly convert CMYK image files to RGB?</p>
| [
{
"answer_id": 660407,
"author": "davethegr8",
"author_id": 12930,
"author_profile": "https://Stackoverflow.com/users/12930",
"pm_score": 1,
"selected": false,
"text": "<p>Like so:</p>\n\n<pre><code>convert CMYK.tiff -profile \"RGB.icc\" RGB.tiff\n</code></pre>\n"
},
{
"answer_id... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Each month I get new CMYK and RGB images that shall be used on the web.
I had a script using a patched up ImageMagick doing this, but it got deleted. So I need to do it again, but it was hard last time.
How do you *easily* and quickly convert CMYK image files to RGB? | Like so:
```
convert CMYK.tiff -profile "RGB.icc" RGB.tiff
``` |
356,480 | <p>I want to extract 'James\, Brown' from the string below but I don't always know what the name will be. The comma is causing me some difficuly so what would you suggest to extract James\, Brown?</p>
<p>OU=James\, Brown,OU=Test,DC=Internal,DC=Net</p>
<p>Thanks</p>
| [
{
"answer_id": 356491,
"author": "xan",
"author_id": 15667,
"author_profile": "https://Stackoverflow.com/users/15667",
"pm_score": 0,
"selected": false,
"text": "<p>If the format is always the same:</p>\n\n<pre><code>string line = GetStringFromWherever();\n\nint start = line.IndexOf(\"=\... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to extract 'James\, Brown' from the string below but I don't always know what the name will be. The comma is causing me some difficuly so what would you suggest to extract James\, Brown?
OU=James\, Brown,OU=Test,DC=Internal,DC=Net
Thanks | A regex is likely your best approach
```
static string ParseName(string arg) {
var regex = new Regex(@"^OU=([a-zA-Z\\]+\,\s+[a-zA-Z\\]+)\,.*$");
var match = regex.Match(arg);
return match.Groups[1].Value;
}
``` |
356,502 | <p>I often get a PDF from our designer (built in Adobe InDesign) which is supposed to be sent out to thousands of people.</p>
<p>I've got the list with all the people, and it's easy doing a mail merge in OpenOffice.org. However, OpenOffice.org doesn't support the advanced PDF. I just want to output some text onto each... | [
{
"answer_id": 356536,
"author": "Rad",
"author_id": 1349,
"author_profile": "https://Stackoverflow.com/users/1349",
"pm_score": 2,
"selected": false,
"text": "<p>You could probably look at a PDF library like <a href=\"http://www.lowagie.com/iText/\" rel=\"nofollow noreferrer\">iText</a>... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I often get a PDF from our designer (built in Adobe InDesign) which is supposed to be sent out to thousands of people.
I've got the list with all the people, and it's easy doing a mail merge in OpenOffice.org. However, OpenOffice.org doesn't support the advanced PDF. I just want to output some text onto each page and ... | Now I've made an account. I fixed it by using the ingenious pdftk.
In my quest I totally overlook the feature "background" and "overlay". My solution was this:
```
pdftk names.pdf background boat_background.pdf output out.pdf
```
Creating the `names.pdf` you can easily do with Python reportlab or similar PDF-creati... |
356,506 | <p>I have created a windows service that uses Windows Messaging System. When I test the app from the debugger the Messages go through nicely but when I install it my messag … asked 14 mins ago</p>
<p>vladimir
1tuga </p>
| [
{
"answer_id": 356702,
"author": "Mick",
"author_id": 12458,
"author_profile": "https://Stackoverflow.com/users/12458",
"pm_score": 3,
"selected": false,
"text": "<p>What do you mean when you say it \"uses\" Windows Messaging System? Are you consuming or sending Windows Messages?</p>\n\n... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have created a windows service that uses Windows Messaging System. When I test the app from the debugger the Messages go through nicely but when I install it my messag … asked 14 mins ago
vladimir
1tuga | What do you mean when you say it "uses" Windows Messaging System? Are you consuming or sending Windows Messages?
If you send a Windows message, you need ensure you are doing it correctly. I'd suggest writing a message loop to ensure your messages are being dispatched properly. I'd also suggest reading up on message lo... |
356,543 | <p>I was just wondering how I could <em>automatically</em> increment the build (and version?) of my files using Visual Studio (2005). </p>
<p>If I look up the properties of say <code>C:\Windows\notepad.exe</code>, the Version tab gives "File version: 5.1.2600.2180". I would like to get these cool numbers in the versio... | [
{
"answer_id": 356553,
"author": "Brian Knoblauch",
"author_id": 15689,
"author_profile": "https://Stackoverflow.com/users/15689",
"pm_score": 0,
"selected": false,
"text": "<p>Each time I do a build it auto-increments the least-significant digit.</p>\n\n<p>I don't have any idea how to u... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31765/"
] | I was just wondering how I could *automatically* increment the build (and version?) of my files using Visual Studio (2005).
If I look up the properties of say `C:\Windows\notepad.exe`, the Version tab gives "File version: 5.1.2600.2180". I would like to get these cool numbers in the version of my dll's too, not versi... | In visual Studio 2008, the following works.
Find the AssemblyInfo.cs file and find these 2 lines:
```
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
```
You could try changing this to:
```
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
```
But thi... |
356,547 | <p>MS SQL Server 2000</p>
<p>I have a column in Table A called Name. I wish to sort the Name field. Many but not all of the records for Name start will KL and are followed by a number (KL 1234, KL 2, KL 323, etc).</p>
<h2>Table A</h2>
<h2>Name</h2>
<p>Able<br>
Bravo<br>
KL 2<br>
KL 323<br>
KL 1234<br>
Zebra</p>
<p... | [
{
"answer_id": 356625,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>Order By \n Case When Left(name, 2) = 'KL' \n Then 'KL' + Replace(Str(Cast... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45042/"
] | MS SQL Server 2000
I have a column in Table A called Name. I wish to sort the Name field. Many but not all of the records for Name start will KL and are followed by a number (KL 1234, KL 2, KL 323, etc).
Table A
-------
Name
----
Able
Bravo
KL 2
KL 323
KL 1234
Zebra
If I use
```
Select Name from A ... | Try this:
```
Order By
Case When Left(name, 2) = 'KL'
Then 'KL' + Replace(Str(Cast(replace(name, 'KL', '') as BigInt), 12), ' ', '0')
Else name End
``` |
356,548 | <p>I am trying to respond back to a client with a PDF stored in a MSSQL varbinary(MAX) field. The response works on my localhost and a test server over http connection, but does not work on the production server over https connection. I am using just a simple BinaryWrite (code below).</p>
<pre><code> byte[] display... | [
{
"answer_id": 356581,
"author": "Jonas Elfström",
"author_id": 44620,
"author_profile": "https://Stackoverflow.com/users/44620",
"pm_score": 0,
"selected": false,
"text": "<p>I ran into kind of the same problem a couple of years back. The solution we found were not the most beautiful on... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576/"
] | I am trying to respond back to a client with a PDF stored in a MSSQL varbinary(MAX) field. The response works on my localhost and a test server over http connection, but does not work on the production server over https connection. I am using just a simple BinaryWrite (code below).
```
byte[] displayFile = Databas... | I just managed to get around this by replacing
```
Response.Clear();
```
with
```
Response.ClearContent();
Response.ClearHeaders();
```
so the whole thing looks like:
```
byte[] downloadBytes = doc.GetData();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "appli... |
356,551 | <p>I'm researching this for a project and I'm wondering what other people are doing to prevent stale CSS and JavaScript files from being served with each new release. I don't want to append a timestamp or something similar which may prevent caching on every request. </p>
<p>I'm working with the Spring 2.5 MVC framewor... | [
{
"answer_id": 356574,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 1,
"selected": false,
"text": "<p>Use a <code>conditional get</code> request with an <code>If-Modified-Since</code> header</p>\n"
},
{
"ans... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22436/"
] | I'm researching this for a project and I'm wondering what other people are doing to prevent stale CSS and JavaScript files from being served with each new release. I don't want to append a timestamp or something similar which may prevent caching on every request.
I'm working with the Spring 2.5 MVC framework and I'm ... | I add a parameter to the request with the revision number, something like:
```
<script type="text/javascript" src="/path/to/script.js?ver=456"></script>
```
The 'ver' parameter is updated automatically with each build (read from file, which the build updates). This makes sure the scripts are cached only for the curr... |
356,557 | <p>I have created a class library in VB .NET. Some code in the library connects to the database. I want to create a config file that would hold the connection string.
<br /><br />
I have created a "Settings.settings" file and stored the connection string in there.
<br /><br />
When a class library having a settings f... | [
{
"answer_id": 356571,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 3,
"selected": true,
"text": "<p>If you have an application which uses your library called MyApp, then the connection string defined in MyApp.exe.config will... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] | I have created a class library in VB .NET. Some code in the library connects to the database. I want to create a config file that would hold the connection string.
I have created a "Settings.settings" file and stored the connection string in there.
When a class library having a settings file is built, it generates ... | If you have an application which uses your library called MyApp, then the connection string defined in MyApp.exe.config will be available to your library. Generally speaking the client program should set the configuration environment, not the library.
```
If GetApplicationSetting("connectionString") Is Nothing Then
... |
356,570 | <p>We have a query that selects rows depending on the value of another, ie. the max. I don't think that really makes much sense, so here is the query:</p>
<pre><code>var deatched = DetachedCriteria.For<Enquiry>("e2")
.SetProjection(Projections.Alias(Projections.Max("Property"), "maxProperty"))
.Add(Restri... | [
{
"answer_id": 8346773,
"author": "Sleiman Jneidi",
"author_id": 822588,
"author_profile": "https://Stackoverflow.com/users/822588",
"pm_score": 1,
"selected": false,
"text": "<p>For aggregations it is better to use SQL and not HQL.Use Nhibernate just for main Entities and their relation... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5802/"
] | We have a query that selects rows depending on the value of another, ie. the max. I don't think that really makes much sense, so here is the query:
```
var deatched = DetachedCriteria.For<Enquiry>("e2")
.SetProjection(Projections.Alias(Projections.Max("Property"), "maxProperty"))
.Add(Restrictions.EqProperty("e2... | For aggregations it is better to use SQL and not HQL.Use Nhibernate just for main Entities and their relations (very maintainable design) .Stored procedures are a better place to these aggregations and functions because they are data dependent and not object dependent |
356,578 | <p>Is there an easy way to run a MySQL query from the Linux command line and output the results in <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="noreferrer">CSV</a> format?</p>
<p>Here's what I'm doing now:</p>
<pre class="lang-none prettyprint-override"><code>mysql -u uid -ppwd -D dbname << ... | [
{
"answer_id": 356605,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 12,
"selected": true,
"text": "<p>From <em><a href=\"http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/\" rel=\"nor... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1094969/"
] | Is there an easy way to run a MySQL query from the Linux command line and output the results in [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) format?
Here's what I'm doing now:
```none
mysql -u uid -ppwd -D dbname << EOQ | sed -e 's/ /,/g' | tee list.csv
select id, concat("\"",name,"\"") as name
f... | From *[Save MySQL query results into a text or CSV file](http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/)*:
```
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED B... |
356,583 | <p>Is it possible to reflectively instantiate a generic type in Java? Using the technique described <a href="http://www.velocityreviews.com/forums/t149816-generics-and-forname.html" rel="noreferrer">here</a> I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subcla... | [
{
"answer_id": 356596,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 2,
"selected": false,
"text": "<p>You don't need that line. Nor do you need the constructor as you're just using the default one. Just instantiate the clas... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16399/"
] | Is it possible to reflectively instantiate a generic type in Java? Using the technique described [here](http://www.velocityreviews.com/forums/t149816-generics-and-forname.html) I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subclass of Creator that implements C... | The generic information is lost in runtime. There is no runtime equivalent of a Creator<String>.class. You could create a type between Creator and StringCreator which fixes the generic type:
```
public interface Creator<T> {
T create();
}
public interface StringCreator extends Creator<String> { }
public class ... |
356,585 | <p>I have a program that needs to run as a separate NT user to connect to a SQL Server databases. For running a program itself, this isn't a big deal as I can just right click on it in windows explorer and select run as. Is there any way to run my tests as a different user as well? (it would be nice if I could do so... | [
{
"answer_id": 356596,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 2,
"selected": false,
"text": "<p>You don't need that line. Nor do you need the constructor as you're just using the default one. Just instantiate the clas... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | I have a program that needs to run as a separate NT user to connect to a SQL Server databases. For running a program itself, this isn't a big deal as I can just right click on it in windows explorer and select run as. Is there any way to run my tests as a different user as well? (it would be nice if I could do so in Vi... | The generic information is lost in runtime. There is no runtime equivalent of a Creator<String>.class. You could create a type between Creator and StringCreator which fixes the generic type:
```
public interface Creator<T> {
T create();
}
public interface StringCreator extends Creator<String> { }
public class ... |
356,597 | <p>I'm importing some data from another test/bug tracking tool into tfs, and I would like to convert it's description, which is in simple HTML, so a plain string, where the 'layout' of the HTML is preserved.</p>
<p>For example:</p>
<pre><code><body>
<ol>
<li>Log on with user Acme &amp; Co.... | [
{
"answer_id": 356609,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>Rather than regex, you could try loading it into the <a href=\"http://www.codeplex.com/htmlagilitypack\" rel=\"nor... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45045/"
] | I'm importing some data from another test/bug tracking tool into tfs, and I would like to convert it's description, which is in simple HTML, so a plain string, where the 'layout' of the HTML is preserved.
For example:
```
<body>
<ol>
<li>Log on with user Acme & Co.</li>
<li>Navigate to the details tab</... | In the end, once I got more comfortable with TFS, I customized the work item type to include a new HTML Field, and just copied the contents into that field.
This solution was so much better, because we could now see the intended formatting of the field. |
356,598 | <p>Is there a way for me to delete items from calendar by using iCalendar import?</p>
<p>I know that there is a METHOD:CANCEL, however when I tried it, it didn't do anything to the calendar event.</p>
<p>Here is what is in my iCalendar file. When I try to import it to Outlook, it just adds these events.</p>
<pre><co... | [
{
"answer_id": 357641,
"author": "dev.e.loper",
"author_id": 37759,
"author_profile": "https://Stackoverflow.com/users/37759",
"pm_score": 5,
"selected": true,
"text": "<p>I forgot to add <code>STATUS:CANCELLED</code> </p>\n\n<p>Now this should cancel items according to <a href=\"http://... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37759/"
] | Is there a way for me to delete items from calendar by using iCalendar import?
I know that there is a METHOD:CANCEL, however when I tried it, it didn't do anything to the calendar event.
Here is what is in my iCalendar file. When I try to import it to Outlook, it just adds these events.
```
BEGIN:VCALENDAR
VERSION:2... | I forgot to add `STATUS:CANCELLED`
Now this should cancel items according to <http://en.wikipedia.org/wiki/ICalendar#Events_.28VEVENT.29>
This works in Google Calendar but not in Outlook 2003. Outlook still creates duplicate entries.
Here are modified "cancel" events with 'STATUS:CANCELLED'. (British spelling with... |
356,599 | <p>I've inherited an ASP.NET application built on top of webforms, and the application suffers from having all of its business logic embedded in the codebehind. As a result, this application can't be unit tested.</p>
<p>I want to break out the functionality of every form into an MVC style, but I've found that ASP.NET ... | [
{
"answer_id": 356631,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 1,
"selected": false,
"text": "<p>Is it not easier to re-write this using asp.net mvc?</p>\n"
},
{
"answer_id": 1116254,
"author": "synhershk... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40516/"
] | I've inherited an ASP.NET application built on top of webforms, and the application suffers from having all of its business logic embedded in the codebehind. As a result, this application can't be unit tested.
I want to break out the functionality of every form into an MVC style, but I've found that ASP.NET resists ev... | Is it not easier to re-write this using asp.net mvc? |
356,645 | <p>I have a dynamic query that returns around 590,000 records. It runs successfully the first time, but if I run it again, I keep getting a <code>System.OutOfMemoryException</code>. What are some reasons this could be happening?</p>
<p>The error is happening here:</p>
<pre><code> public static DataSet GetDataSet(s... | [
{
"answer_id": 356654,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 3,
"selected": false,
"text": "<p>Perhaps you're not disposing of the previous connection/ result classes from the previous run which means their still hang... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | I have a dynamic query that returns around 590,000 records. It runs successfully the first time, but if I run it again, I keep getting a `System.OutOfMemoryException`. What are some reasons this could be happening?
The error is happening here:
```
public static DataSet GetDataSet(string databaseName,string
... | >
> It runs successfully the first time,
> but if I run it again, I keep getting
> a System.OutOfMemoryException. What
> are some reasons this could be
> happening?
>
>
>
Regardless of what the others have said, the error has nothing to do with forgetting to dispose your DBCommand or DBConnection, and you will... |
356,651 | <p>The full error is - "Value cannot be null. Parameter name: virtualPath". This is occurring in our QA and Training environments (Win 2003 Server & IIS6) but of course defies recreation in a debugger. To make matters worse, despite a reasonable global error handler, no stack trace accompanies the error and nothing... | [
{
"answer_id": 356687,
"author": "Victor",
"author_id": 42518,
"author_profile": "https://Stackoverflow.com/users/42518",
"pm_score": 0,
"selected": false,
"text": "<p>this might sound silly, but heck i have had this happen to me before.</p>\n\n<p>if you copy and pasted your error, i not... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45050/"
] | The full error is - "Value cannot be null. Parameter name: virtualPath". This is occurring in our QA and Training environments (Win 2003 Server & IIS6) but of course defies recreation in a debugger. To make matters worse, despite a reasonable global error handler, no stack trace accompanies the error and nothing is wri... | Follow up - make sure your servers are up to the proper patch level.
The root cause of this turned out to be 3 QA VMs that did not have
2.0 .Net Framework SP1 installed. |
356,666 | <p>Is there a "win64" identifier in Qmake project files? <a href="http://doc.trolltech.com/4.4/qmake-advanced-usage.html" rel="noreferrer">Qt Qmake advanced</a> documentation does not mention other than unix / macx / win32.</p>
<p>So far I've tried using:</p>
<pre><code>win32:message("using win32")
win64:message("usi... | [
{
"answer_id": 357337,
"author": "Reed Hedges",
"author_id": 39686,
"author_profile": "https://Stackoverflow.com/users/39686",
"pm_score": 0,
"selected": false,
"text": "<p>No, but you can create and use a new mkspec, I think qmake also defines a platform identifier named after the curre... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40657/"
] | Is there a "win64" identifier in Qmake project files? [Qt Qmake advanced](http://doc.trolltech.com/4.4/qmake-advanced-usage.html) documentation does not mention other than unix / macx / win32.
So far I've tried using:
```
win32:message("using win32")
win64:message("using win64")
amd64:message("using amd64")
```
The... | I do it like this
```
win32 {
## Windows common build here
!contains(QMAKE_TARGET.arch, x86_64) {
message("x86 build")
## Windows x86 (32bit) specific build here
} else {
message("x86_64 build")
## Windows x64 (64bit) specific build here
}
}
``` |
356,671 | <p>The <code>JFileChooser</code> seems to be missing a feature: a way to suggest the file name when saving a file (the thing that usually gets selected so that it would get replaced when the user starts typing).</p>
<p>Is there a way around this?</p>
| [
{
"answer_id": 356706,
"author": "bruno conde",
"author_id": 31136,
"author_profile": "https://Stackoverflow.com/users/31136",
"pm_score": 8,
"selected": true,
"text": "<p>If I understand you correctly, you need to use the <code>setSelectedFile</code> method.</p>\n<pre><code>JFileChooser... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15187/"
] | The `JFileChooser` seems to be missing a feature: a way to suggest the file name when saving a file (the thing that usually gets selected so that it would get replaced when the user starts typing).
Is there a way around this? | If I understand you correctly, you need to use the `setSelectedFile` method.
```
JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File("fileToSave.txt"));
jFileChooser.showSaveDialog(parent);
```
The file doesn't need to exist.
If you pass a File with an absolute path, `JFileChooser`... |
356,674 | <p>I'm developing my first ASP.NET MVC application. This application tracks events, users, donors, etc. for a charitable organization. In my events controller I support standard CRUD operations with New/Edit/Show views (delete is done via a button on Show view). But I also want to list all of the events.</p>
<p>Is... | [
{
"answer_id": 357002,
"author": "Todd Smith",
"author_id": 31624,
"author_profile": "https://Stackoverflow.com/users/31624",
"pm_score": 0,
"selected": false,
"text": "<p>Your Index view page could include</p>\n\n<pre><code><body>\n <% RenderPartial(\"List\", \"Events\") %&g... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12950/"
] | I'm developing my first ASP.NET MVC application. This application tracks events, users, donors, etc. for a charitable organization. In my events controller I support standard CRUD operations with New/Edit/Show views (delete is done via a button on Show view). But I also want to list all of the events.
Is it better to ... | I've decided to have the Index action redirect to the List action. This saves me from having to create and maintain an Index view, but leaves open the possibility that I can implement an Index action that is something other than the list of models.
```
public ActionResult Index()
{
return RedirectToAction( "List" ... |
356,675 | <p>I have a query which is meant to show me any rows in table A which have not been updated recently enough. (Each row should be updated within 2 months after "month_no".):</p>
<pre><code>SELECT A.identifier
, A.name
, TO_NUMBER(DECODE( A.month_no
, 1, 200803
, 2, 200804
... | [
{
"answer_id": 356699,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 8,
"selected": true,
"text": "<p>This is not possible directly, because chronologically, WHERE happens <em>before</em> SELECT, which always is the last s... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019/"
] | I have a query which is meant to show me any rows in table A which have not been updated recently enough. (Each row should be updated within 2 months after "month\_no".):
```
SELECT A.identifier
, A.name
, TO_NUMBER(DECODE( A.month_no
, 1, 200803
, 2, 200804
, 3, 2008... | This is not possible directly, because chronologically, WHERE happens *before* SELECT, which always is the last step in the execution chain.
You can do a sub-select and filter on it:
```
SELECT * FROM
(
SELECT A.identifier
, A.name
, TO_NUMBER(DECODE( A.month_no
, 1, 200803
, 2, 200804
,... |
356,705 | <p>I wish to send a header to my Apache server on a Linux box. How can I achieve this via a cURL call?</p>
| [
{
"answer_id": 356714,
"author": "Tader",
"author_id": 30700,
"author_profile": "https://Stackoverflow.com/users/30700",
"pm_score": 11,
"selected": false,
"text": "<p><a href=\"https://curl.haxx.se/docs/manpage.html\" rel=\"noreferrer\"><code>man curl</code></a>:</p>\n<pre><code> -H/-... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35416/"
] | I wish to send a header to my Apache server on a Linux box. How can I achieve this via a cURL call? | **GET:**
*with JSON:*
```
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
```
*with XML:*
```
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
```
**POST:**
*For posting data:*
```
curl --data "param1=value1&... |
356,718 | <p>Is there a way in Python, to have more than one constructor or more than one method with the <em>same name</em>, who differ in the <em>number of arguments</em> they accept or the <em>type(s) of one or more argument(s)</em>?</p>
<p>If not, what would be the best way to handle such situations?</p>
<p>For an example ... | [
{
"answer_id": 356782,
"author": "kender",
"author_id": 4172,
"author_profile": "https://Stackoverflow.com/users/4172",
"pm_score": -1,
"selected": false,
"text": "<p>You can check the type of the argument passed to your constructor inside:</p>\n\n<pre><code>def __init__(self, r = 0, g =... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11666/"
] | Is there a way in Python, to have more than one constructor or more than one method with the *same name*, who differ in the *number of arguments* they accept or the *type(s) of one or more argument(s)*?
If not, what would be the best way to handle such situations?
For an example I made up a color class. *This class s... | In general, use factory methods, marked up as `@classmethod`s. They'll also work correctly on subclasses. From a design perspective, they are more explicit, especially when given a good name.
In this case, mixing everything together is probably more convenient, but it also makes the contract for your constructor more... |
356,722 | <p>I have a defunct process on my system:</p>
<pre><code>abc 22093 19508 0 23:29 pts/4 00:00:00 grep ProcA
abc 31756 1 0 Dec08 ? 00:00:00 [ProcA_my_collect] <defunct>
</code></pre>
<p>How can I kill the above process, without a reboot of the machine? I have tried with</p>
<pre><code>k... | [
{
"answer_id": 356841,
"author": "Brian Knoblauch",
"author_id": 15689,
"author_profile": "https://Stackoverflow.com/users/15689",
"pm_score": 0,
"selected": false,
"text": "<p>You're probably not going to be able to if killing the parent doesn't resolve it. For whatever reason the syst... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35416/"
] | I have a defunct process on my system:
```
abc 22093 19508 0 23:29 pts/4 00:00:00 grep ProcA
abc 31756 1 0 Dec08 ? 00:00:00 [ProcA_my_collect] <defunct>
```
How can I kill the above process, without a reboot of the machine? I have tried with
```
kill -9 31756
sudo kill -9 31756
``` | You have killed the process, but a dead process doesn't disappear from the process table until its parent process performs a task called "reaping" (essentially calling `wait(3)` for that process to read its exit status). Dead processes that haven't been reaped are called "[zombie processes](http://en.wikipedia.org/wiki... |
356,724 | <p>I've used Emacs for years on Linux, and I have lots of personally useful keybindings I've put under <kbd>Hyper</kbd> and <kbd>Super</kbd>. Nowadays I'm using Emacs on Windows and am missing those extra keybindings.</p>
<p>Is there some way in Windows to get modifier keys other than <kbd>Ctrl</kbd> and <kbd>Meta</kb... | [
{
"answer_id": 363133,
"author": "singpolyma",
"author_id": 8611,
"author_profile": "https://Stackoverflow.com/users/8611",
"pm_score": -1,
"selected": false,
"text": "<p>You may find this difficult, because Super (and, I believe, Hyper) are intercepted by the Windows Shell (explorer.exe... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39683/"
] | I've used Emacs for years on Linux, and I have lots of personally useful keybindings I've put under `Hyper` and `Super`. Nowadays I'm using Emacs on Windows and am missing those extra keybindings.
Is there some way in Windows to get modifier keys other than `Ctrl` and `Meta`? | There are some settings mentioned in [this google-groups thread:](http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/93ee43478903f273)
```
; setting the PC keyboard's various keys to Super or Hyper
(setq w32-pass-lwindow-to-system nil
w32-pass-rwindow-to-system nil
w32-pass-apps-to-system n... |
356,726 | <p>I got this doubt while writing some code. Is 'bool' a basic datatype defined in the C++ standard or is it some sort of extension provided by the compiler ? I got this doubt because Win32 has 'BOOL' which is nothing but a typedef of long. Also what happens if I do something like this:</p>
<pre><code>int i = true;
</... | [
{
"answer_id": 356728,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 7,
"selected": true,
"text": "<p>bool is a fundamental datatype in C++. Converting <code>true</code> to an integer type will yield 1, and ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39742/"
] | I got this doubt while writing some code. Is 'bool' a basic datatype defined in the C++ standard or is it some sort of extension provided by the compiler ? I got this doubt because Win32 has 'BOOL' which is nothing but a typedef of long. Also what happens if I do something like this:
```
int i = true;
```
Is it "alw... | bool is a fundamental datatype in C++. Converting `true` to an integer type will yield 1, and converting `false` will yield 0 (4.5/4 and 4.7/4). In C, until C99, there was no bool datatype, and people did stuff like
```
enum bool {
false, true
};
```
So did the Windows API. Starting with C99, we have `_Bool` as ... |
356,759 | <p>I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is:</p>
<pre><code>margin-top: 2px;
margin-bottom: 4px;
margin-left: 3px;
margin-right: 8px;
</code></pre>
<p>may be written as</p>
<pre><code>margin: 2px 8px 4px 3px;
</code></pre>
<p>Yes I unde... | [
{
"answer_id": 356764,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 9,
"selected": true,
"text": "<p>If you don't get it right, there will be TRouBLe</p>\n"
},
{
"answer_id": 356766,
"author": "Ian G",
"a... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18625/"
] | I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is:
```
margin-top: 2px;
margin-bottom: 4px;
margin-left: 3px;
margin-right: 8px;
```
may be written as
```
margin: 2px 8px 4px 3px;
```
Yes I understand that one can visualise the order by th... | If you don't get it right, there will be TRouBLe |
356,763 | <p>I have a huge mbox file, with maybe 500 emails in it. </p>
<p>It looks like the following:</p>
<pre><code>From x@blah.com Fri Aug 12 09:34:09 2005
Message-ID: <42FBEE81.9090701@blah.com>
Date: Fri, 12 Aug 2005 09:34:09 +0900
From: me <x@blah.com>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)... | [
{
"answer_id": 356780,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 1,
"selected": false,
"text": "<p>As a start, I would probably use \"formail\" to extract the mails with just the headers you want. Either that, or u... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have a huge mbox file, with maybe 500 emails in it.
It looks like the following:
```
From x@blah.com Fri Aug 12 09:34:09 2005
Message-ID: <42FBEE81.9090701@blah.com>
Date: Fri, 12 Aug 2005 09:34:09 +0900
From: me <x@blah.com>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: en-us, en
MIM... | [Mail::Box::Mbox](http://search.cpan.org/~markov/Mail-Box-2.084/lib/Mail/Box/Mbox.pod) will let you easily parse the file into separate messages. Mark Overmeer's [slides from YAPC::Europe 2002](http://perl.overmeer.net/yapc2002-mailbox/img0.html) go into quite a bit of detail as to why parsing is much more difficult th... |
356,775 | <p>I was recently trying to explain to a programmer why, in ASP.Net, they should create HTMLControls instead of creating HTML strings to create Web pages.</p>
<p>I know it is a better way of doing things, but I really couldn't give concrete reasons, other than, "This way is better."</p>
<p>If you had to answer this q... | [
{
"answer_id": 356815,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 0,
"selected": false,
"text": "<p>It's only REALLY better in two cases:</p>\n\n<ol>\n<li>You need to do something with those controls in your code ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13449/"
] | I was recently trying to explain to a programmer why, in ASP.Net, they should create HTMLControls instead of creating HTML strings to create Web pages.
I know it is a better way of doing things, but I really couldn't give concrete reasons, other than, "This way is better."
If you had to answer this question, what wou... | I don't do either. Instead, I:
1. Create a custom control that encapsulates the desired construct
2. or (very similar) create a simple class with the properties I want and override the `.ToString()` method to create the desired HTML.
But of your two choices, a couple reasons the former is better are:
* You can chang... |
356,778 | <p>I have a function that looks something like this:</p>
<pre><code>//iteration over scales
foreach ($surveyScales as $scale)
{
$surveyItems = $scale->findDependentRowset('SurveyItems');
//nested iteration over items in scale
foreach ($surveyItems as $item)
{
//retrieve a single value from ... | [
{
"answer_id": 356786,
"author": "TravisO",
"author_id": 35116,
"author_profile": "https://Stackoverflow.com/users/35116",
"pm_score": 5,
"selected": true,
"text": "<p>One query that returns a dozen pieces of data is almost 12x faster than 12 queries that return 1 piece of data.</p>\n\n<... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11995/"
] | I have a function that looks something like this:
```
//iteration over scales
foreach ($surveyScales as $scale)
{
$surveyItems = $scale->findDependentRowset('SurveyItems');
//nested iteration over items in scale
foreach ($surveyItems as $item)
{
//retrieve a single value from a result table an... | One query that returns a dozen pieces of data is almost 12x faster than 12 queries that return 1 piece of data.
Oh, and NEVER EVER NEVER put a SQL inside a loop, it will always lead in a disaster.
Depending on how your app works, a new connection might be opened for each query, this is especially bad as every DB ser... |
356,779 | <p>I have a small form inside a table. POSTing that form creates a new entity. I then want users to see that new entity, but it should open in a new window so that the original view isn't lost.</p>
<p>(How) can I open the result of the form submission in a new window?</p>
| [
{
"answer_id": 356787,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>One request, one response. That is the way of the web. </p>\n\n<p>If you want a new window after a post, you eith... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4937/"
] | I have a small form inside a table. POSTing that form creates a new entity. I then want users to see that new entity, but it should open in a new window so that the original view isn't lost.
(How) can I open the result of the form submission in a new window? | ```
<form ... target="windowName">
```
or
```
<form ... target="windowName" onsubmit="window.open(this.action, this.target, '...attributes...');return true;">
```
...attributes... can consist of the stuff documented at the [mozilla developer center](https://developer.mozilla.org/en/DOM/window.open#Position_and_siz... |
356,807 | <p>I wrote a class that tests for equality, less than, and greater than with two doubles in Java. My general case is comparing price that can have an accuracy of a half cent. 59.005 compared to 59.395. Is the epsilon I chose adequate for those cases?</p>
<pre><code>private final static double EPSILON = 0.00001;
/... | [
{
"answer_id": 356825,
"author": "Alex B",
"author_id": 6180,
"author_profile": "https://Stackoverflow.com/users/6180",
"pm_score": 4,
"selected": false,
"text": "<p>Yes. Java doubles will hold their precision better than your given epsilon of 0.00001. </p>\n\n<p>Any rounding error tha... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wrote a class that tests for equality, less than, and greater than with two doubles in Java. My general case is comparing price that can have an accuracy of a half cent. 59.005 compared to 59.395. Is the epsilon I chose adequate for those cases?
```
private final static double EPSILON = 0.00001;
/**
* Returns true... | You do NOT use double to represent money. Not ever. Use [`java.math.BigDecimal`](https://docs.oracle.com/javase/9/docs/api/java/math/BigDecimal.html) instead.
Then you can specify how exactly to do rounding (which is sometimes dictated by law in financial applications!) and don't have to do stupid hacks like this epsi... |
356,809 | <p>Best way to center a <code><div></code> element on a page both vertically and horizontally?</p>
<p>I know that <code>margin-left: auto; margin-right: auto;</code> will center on the horizontal, but what is the best way to do it vertically, too?</p>
| [
{
"answer_id": 356829,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 4,
"selected": false,
"text": "<p>Here is a script i wrote a while back (<em>it is written using the jQuery library</em>):</p>\n\n<pre><code>var ce... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Best way to center a `<div>` element on a page both vertically and horizontally?
I know that `margin-left: auto; margin-right: auto;` will center on the horizontal, but what is the best way to do it vertically, too? | The best and most flexible way
------------------------------
The main trick in this demo is that in the normal flow of elements going from top to bottom, so the `margin-top: auto` is set to zero. However, an absolutely positioned element acts the same for distribution of free space, and similarly can be centered vert... |
356,830 | <p>I'm doing a Python script where I need to spawn several ssh-copy-id processes, and they need for me to type in a password, so i'm using PExpect.</p>
<p>I have basically this:</p>
<pre><code>child = pexpect.spawn('command')
child.expect('password:')
child.sendline('the password')
</code></pre>
<p>and then I want t... | [
{
"answer_id": 357021,
"author": "rob",
"author_id": 43927,
"author_profile": "https://Stackoverflow.com/users/43927",
"pm_score": 0,
"selected": false,
"text": "<p>Reading <a href=\"http://pexpect.sourceforge.net/pexpect.html#spawn\" rel=\"nofollow noreferrer\">pexpect documentation for... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3314/"
] | I'm doing a Python script where I need to spawn several ssh-copy-id processes, and they need for me to type in a password, so i'm using PExpect.
I have basically this:
```
child = pexpect.spawn('command')
child.expect('password:')
child.sendline('the password')
```
and then I want to spawn another process, I don't ... | Fortunately or not, but OpenSSH client seems to be very picky about passwords and where they come from.
You may try using [Paramiko](http://www.lag.net/paramiko/) Python SSH2 library. Here's a simple [example how to use it with password authentication](http://www.lag.net/pipermail/paramiko/2006-January/000180.html), t... |
356,835 | <p>OK, if anyone could help me with this I'd be much appreciative. If you copy and paste the following and open up in IE or Firefox</p>
<pre><code><div style="border: solid 1px navy; float: left;">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3<... | [
{
"answer_id": 356872,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 3,
"selected": true,
"text": "<p>If you want the blue box to be beside the list, you need to float it as well:</p>\n\n<pre><code><d... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44702/"
] | OK, if anyone could help me with this I'd be much appreciative. If you copy and paste the following and open up in IE or Firefox
```
<div style="border: solid 1px navy; float: left;">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</... | If you want the blue box to be beside the list, you need to float it as well:
```
<div style="border: solid 1px navy; float: left;">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div>
<div style="background-color: blue; float:left;"><p>Some Text</p><p>... |
356,839 | <p>I've inherited a legacy application that is supposed to grab an on the fly pdf from a reporting services server. Everything works fine up until the point where you try to open the pdf being returned and adobe acrobat tells you:</p>
<blockquote>
<p>Adobe Reader could not open
'thisStoopidReport'.pdf' because it ... | [
{
"answer_id": 357514,
"author": "Jeremy",
"author_id": 44356,
"author_profile": "https://Stackoverflow.com/users/44356",
"pm_score": 0,
"selected": false,
"text": "<p>Could your problem be caused by declaring your byte array to a length of 2048 rather than basing the length on the lengt... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've inherited a legacy application that is supposed to grab an on the fly pdf from a reporting services server. Everything works fine up until the point where you try to open the pdf being returned and adobe acrobat tells you:
>
> Adobe Reader could not open
> 'thisStoopidReport'.pdf' because it is
> either not a ... | View the pdf file that you get back in notepad.exe. I suspect that you will see HTML in there. If you call a web page that is a pass through page, that severs up a pdf file. The web request will get back the HTML not the PDF file.
If you call a web site that has a pdf file directly, like <http://www.somesite.com/file... |
356,851 | <p>I have been given a DLL ("InfoLookup.dll") that internally allocates structures and returns pointers to them from a lookup function. The structures contain string pointers:</p>
<pre><code>extern "C"
{
struct Info
{
int id;
char* szName;
};
Info* LookupInfo( int id );
}
</code></pre>
<p>In... | [
{
"answer_id": 356874,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": -1,
"selected": false,
"text": "<p>You need to implement the structure in C# as well, making sure to use the attributes in the Marshal class properl... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4540/"
] | I have been given a DLL ("InfoLookup.dll") that internally allocates structures and returns pointers to them from a lookup function. The structures contain string pointers:
```
extern "C"
{
struct Info
{
int id;
char* szName;
};
Info* LookupInfo( int id );
}
```
In C#, how can I declare the ... | Try the following layout. Code automatically generated using the [PInvoke Interop Assistant](http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120). Hand coded LookpInfoWrapper()
```
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
p... |
356,882 | <p>I've looked at every question so far and none seem to actually answer this question.</p>
<p>I created a UITabBarController and added several view controllers to it. Most of the views are viewed in portrait, but one should be viewed in landscape. I don't want to use the accelerometer or detect when the user rotate... | [
{
"answer_id": 356903,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackoverflow.com/users/1075",
"pm_score": 4,
"selected": true,
"text": "<p>An <a href=\"http://www.iphonedevsdk.com/forum/iphone-sdk-development/3219-force-landscape-mode-one-view-2.html\" rel=... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36007/"
] | I've looked at every question so far and none seem to actually answer this question.
I created a UITabBarController and added several view controllers to it. Most of the views are viewed in portrait, but one should be viewed in landscape. I don't want to use the accelerometer or detect when the user rotates the device... | An [post](http://www.iphonedevsdk.com/forum/iphone-sdk-development/3219-force-landscape-mode-one-view-2.html) on a forum that might help. Short answer is you have to manually rotate your view or controller once the view has been drawn, in the viewWillAppear: method
```
CGAffineTransform landscapeTransform = CGAffineTr... |
356,883 | <p>Is there any way to change the taskbar icon of a browser in windows?</p>
<p>I open alot of browser windows, and I like to group similar websites (in tabs) by window. So I was wondering if there was a way to assign a taskbar icon to them so that you can more easily differentiate between them. </p>
| [
{
"answer_id": 356952,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 1,
"selected": false,
"text": "<p>I believe the taskbar uses the icon resource embedded in the executable. I tried creating multiple shortcuts to Inte... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18149/"
] | Is there any way to change the taskbar icon of a browser in windows?
I open alot of browser windows, and I like to group similar websites (in tabs) by window. So I was wondering if there was a way to assign a taskbar icon to them so that you can more easily differentiate between them. | Here's something I put together in under 5 minutes to change the icon on a specific window. You could easily use this code to create a winform that would enumerate the currently open windows and allow you to assign arbitrary icons to them. (C# code below)
```
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public stat... |
356,886 | <p>I'm using CFHTTP to post data to my payment gateway (Protx).</p>
<p>Protx requires that I whitelist the IP that will send this request.</p>
<p>I am hosted on a shared server running Windows 2008.</p>
<p>This morning, my hosting company assigned a new IP to this server for a customer who required an SSL certificat... | [
{
"answer_id": 356952,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 1,
"selected": false,
"text": "<p>I believe the taskbar uses the icon resource embedded in the executable. I tried creating multiple shortcuts to Inte... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22113/"
] | I'm using CFHTTP to post data to my payment gateway (Protx).
Protx requires that I whitelist the IP that will send this request.
I am hosted on a shared server running Windows 2008.
This morning, my hosting company assigned a new IP to this server for a customer who required an SSL certificate.
Since then, my CFHTTP... | Here's something I put together in under 5 minutes to change the icon on a specific window. You could easily use this code to create a winform that would enumerate the currently open windows and allow you to assign arbitrary icons to them. (C# code below)
```
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public stat... |
356,928 | <p>I am writing a key record look up where the I have an index between the key and the rec number. This is sorted on the key. Is there away to do this better that what I have for speed optimization?</p>
<pre><code>typedef struct
{
char key[MAX_KEYLEN];
int rec;
} KeyRecPair;
typedef struct
{
KeyRecPair... | [
{
"answer_id": 356944,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"http://www.opengroup.org/onlinepubs/007908799/xsh/bsearch.html\" rel=\"nofollow noreferrer\"><code>bsear... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064/"
] | I am writing a key record look up where the I have an index between the key and the rec number. This is sorted on the key. Is there away to do this better that what I have for speed optimization?
```
typedef struct
{
char key[MAX_KEYLEN];
int rec;
} KeyRecPair;
typedef struct
{
KeyRecPair *map;
int ... | A good chunk of your time will be spent in the strncmp.
I suggest forcing that to be [inlined](http://en.wikipedia.org/wiki/Inlining), or rewriting it inline, to avoid the function call over head.
If you are feeling brave it may be possible to [unroll the loop](http://en.wikipedia.org/wiki/Loop_unwinding) once or twi... |
356,929 | <p>I have following situation. A main table and many other tables linked together with foreign keys. Now when I would like to delete a row in the main table a ConstraintsViolation will occur, which is intended and good.</p>
<p>Now I want to be able to check if the ConstraintsViolation will occur before I trigger the d... | [
{
"answer_id": 356943,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": true,
"text": "<pre><code>If Exists ( Select * From OtherTable\n Where OtherTableFKColumn = MainTablePrimaryKey) \n B... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6482/"
] | I have following situation. A main table and many other tables linked together with foreign keys. Now when I would like to delete a row in the main table a ConstraintsViolation will occur, which is intended and good.
Now I want to be able to check if the ConstraintsViolation will occur before I trigger the delete row ... | ```
If Exists ( Select * From OtherTable
Where OtherTableFKColumn = MainTablePrimaryKey)
Begin
Rollback Transaction
RaisError('Violating FK Constraint in Table [OtherTable]', 16, 1)
End
``` |
356,947 | <p>Can someone help me identify what the purpose of this unidentified syntax is. It is an extra little something in the constructor for this object. What I'm trying to figure out is what is the "< IdT >" at the end of the class declaration line? I think that this is something I would find useful, I just need to unde... | [
{
"answer_id": 356971,
"author": "gcores",
"author_id": 40256,
"author_profile": "https://Stackoverflow.com/users/40256",
"pm_score": 3,
"selected": true,
"text": "<p>Read about Generics: <a href=\"http://msdn.microsoft.com/en-us/library/512aeb7t.aspx\" rel=\"nofollow noreferrer\">MSDN<... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42987/"
] | Can someone help me identify what the purpose of this unidentified syntax is. It is an extra little something in the constructor for this object. What I'm trying to figure out is what is the "< IdT >" at the end of the class declaration line? I think that this is something I would find useful, I just need to understand... | Read about Generics: [MSDN](http://msdn.microsoft.com/en-us/library/512aeb7t.aspx)
That is how you define a generic class.
Hence calling
```
new DomainObject<string>();
```
would create a domain object with an Id of type string.
The way you define the ID must be an int.
The way it is defined the id can be an... |
356,948 | <p>I'm building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at runtime. Aptana's Jaxer is also not an option. So I was looking into usin... | [
{
"answer_id": 357284,
"author": "Ryan Cook",
"author_id": 43029,
"author_profile": "https://Stackoverflow.com/users/43029",
"pm_score": 6,
"selected": true,
"text": "<p><em>I realize that this may not be an exact answer to your question, but I figured I would put my 2 cents worth in as ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30544/"
] | I'm building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at runtime. Aptana's Jaxer is also not an option. So I was looking into using a... | *I realize that this may not be an exact answer to your question, but I figured I would put my 2 cents worth in as I doubt to many people have tried this.*
I got it to work by created a managed wrapper using mixed mode C++. There are other ways to do it, but I was going to attempt to make a full wrapper that could be ... |
356,950 | <p>I keep hearing a lot about functors in C++. Can someone give me an overview as to what they are and in what cases they would be useful?</p>
| [
{
"answer_id": 356992,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 7,
"selected": false,
"text": "<p>A Functor is a object which acts like a function.\nBasically, a class which defines <code>operator()</code>.</p>\n... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I keep hearing a lot about functors in C++. Can someone give me an overview as to what they are and in what cases they would be useful? | A functor is pretty much just a class which defines the operator(). That lets you create objects which "look like" a function:
```
// this is a functor
struct add_x {
add_x(int val) : x(val) {} // Constructor
int operator()(int y) const { return x + y; }
private:
int x;
};
// Now you can use it like this:
add... |
356,957 | <p>Here's the basic idea:</p>
<p>There is a java window (main) that opens another java window (child). When the child is created, part of the initialization sets the focus in the appropriate text field in the child window:</p>
<pre><code>childTextField.requestFocusInWindow();
childTextField.setCaretPosition(0);
</co... | [
{
"answer_id": 356978,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": true,
"text": "<p>On first look, that sounds like it might be a bug in the implementation; the key should be in the same event queu... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45077/"
] | Here's the basic idea:
There is a java window (main) that opens another java window (child). When the child is created, part of the initialization sets the focus in the appropriate text field in the child window:
```
childTextField.requestFocusInWindow();
childTextField.setCaretPosition(0);
```
The child is general... | On first look, that sounds like it might be a bug in the implementation; the key should be in the same event queue as the mouse events. There's another issue possible though: the event queue is running in a thread separate from the program main; without knowing what's going on in the rest of the application, it's tempt... |
356,974 | <p>I have a mystery on my hands. I am trying to learn managed C++ coming from a C# background and have run into a snag. If I have a project which includes two classes, a base class <strong>Soup</strong> and a derived class <strong>TomatoSoup</strong> which I compile as a static library (.lib), I get unresolved tokens o... | [
{
"answer_id": 357003,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": true,
"text": "<p>The error you are getting (LNK2020) means the linker can't find a definition for the <code>Abstracts.Soup::heat</code> ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2831/"
] | I have a mystery on my hands. I am trying to learn managed C++ coming from a C# background and have run into a snag. If I have a project which includes two classes, a base class **Soup** and a derived class **TomatoSoup** which I compile as a static library (.lib), I get unresolved tokens on the virtual methods in **So... | The error you are getting (LNK2020) means the linker can't find a definition for the `Abstracts.Soup::heat` function anywhere. When you declare the function as `virtual void heat(int Degrees);` the linker will expect to find the function body defined somewhere.
If you intend not to supply a function body, and require ... |
356,980 | <p>I have an Access Database that outputs a report in Excel format.</p>
<p>The report is dependent on a date parameter chosen by the user. This parameter is selected via a textbox (text100) that has a pop up calendar.</p>
<p>I would like to use the date in the text box (text100) in the filename.</p>
| [
{
"answer_id": 357039,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 3,
"selected": true,
"text": "<p>You have to take responsibility for asking for the parameter. I like using global parameters that I can get/set via global f... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44685/"
] | I have an Access Database that outputs a report in Excel format.
The report is dependent on a date parameter chosen by the user. This parameter is selected via a textbox (text100) that has a pop up calendar.
I would like to use the date in the text box (text100) in the filename. | You have to take responsibility for asking for the parameter. I like using global parameters that I can get/set via global functions - this way they can be set anywhere and the queries can have access to them as well.
**Just need a couple subs/functions in module:**
```
Some Module
Dim vParam1 as variant
Dim vParam1... |
356,982 | <p>I'm creating a multi-tenancy web site which hosts pages for clients. The first segment of the URL will be a string which identifies the client, defined in Global.asax using the following URL routing scheme:</p>
<pre><code>"{client}/{controller}/{action}/{id}"
</code></pre>
<p>This works fine, with URLs such as /fo... | [
{
"answer_id": 358554,
"author": "Nicholas Piasecki",
"author_id": 32187,
"author_profile": "https://Stackoverflow.com/users/32187",
"pm_score": 6,
"selected": true,
"text": "<p>I think the main issue is that if you're going to piggyback on the built-in ASP.NET FormsAuthentication class ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/356982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43649/"
] | I'm creating a multi-tenancy web site which hosts pages for clients. The first segment of the URL will be a string which identifies the client, defined in Global.asax using the following URL routing scheme:
```
"{client}/{controller}/{action}/{id}"
```
This works fine, with URLs such as /foo/Home/Index.
However, wh... | I think the main issue is that if you're going to piggyback on the built-in ASP.NET FormsAuthentication class (and there's no good reason you shouldn't), something at the end of the day is going to call `FormsAuthentication.RedirectToLoginPage()` which is going to look at the one configured URL. There's only one login ... |
357,033 | <p>I'm trying to do a Data Binding in the C# code behind rather than the XAML. The XAML binding created in Expression Blend 2 to my CLR object works fine. My C# implementation only updates when the application is started after which subsequent changes to the CLR doesn't update my label content. </p>
<p>Here's the wo... | [
{
"answer_id": 357045,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 0,
"selected": false,
"text": "<p>Write this inside Loaded event instead of Constructor.\nHope you implmented INotifyPropertyChanged triggered on the Disp... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36234/"
] | I'm trying to do a Data Binding in the C# code behind rather than the XAML. The XAML binding created in Expression Blend 2 to my CLR object works fine. My C# implementation only updates when the application is started after which subsequent changes to the CLR doesn't update my label content.
Here's the working XAML b... | Your C# version does not match the XAML version. It should be possible to write a code version of your markup, though I am not familiar with ObjectDataProvider.
Try something like this:
```
Binding displayNameBinding = new Binding( "MyAccountService.Accounts[0].DisplayName" );
displayNameBinding.Source = new ObjectDa... |
357,041 | <p>I have LINQ statement that looks like this:</p>
<pre><code>return ( from c in customers select new ClientEntity() { Name = c.Name, ... });
</code></pre>
<p>I'd like to be able to abstract out the select into its own method so that I can have different "mapping" option. What does my method need to return?</p>
<p>I... | [
{
"answer_id": 357056,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 0,
"selected": false,
"text": "<p>This is for linq to objects? Or for a linq to ?</p>\n\n<p>Because ... select new Mapper(c), requires that 'c' is a... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] | I have LINQ statement that looks like this:
```
return ( from c in customers select new ClientEntity() { Name = c.Name, ... });
```
I'd like to be able to abstract out the select into its own method so that I can have different "mapping" option. What does my method need to return?
In essence, I'd like my LINQ query... | New answer now I've noticed that it's Linq to SQL... :)
If you look at the version of Select that works on `IQueryable<T>` it doesn't take a `Func<In, Out>`. Instead, it takes an `Expression<Func<In, Out>>`. The compiler knows how to generate such a thing from a lambda, which is why your normal code compiles.
So to h... |
357,049 | <p>I have a simple email address sign up form as follows:</p>
<pre><code><form action="" id="newsletterform" method="get">
<input type="text" name="email" class="required email" id="textnewsletter" />
<input type="submit" id="signup" />
</form>
</code></pre>
<p><strong>Here's what... | [
{
"answer_id": 357075,
"author": "MrChrister",
"author_id": 24229,
"author_profile": "https://Stackoverflow.com/users/24229",
"pm_score": 4,
"selected": true,
"text": "<p>First, please be sure you do all of your validation on the server-side. I like to get my forms working without any J... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37418/"
] | I have a simple email address sign up form as follows:
```
<form action="" id="newsletterform" method="get">
<input type="text" name="email" class="required email" id="textnewsletter" />
<input type="submit" id="signup" />
</form>
```
**Here's what I want to be able to do:**
* Validate the form to look... | First, please be sure you do all of your validation on the server-side. I like to get my forms working without any JavaScript whatsoever. I am assuming you have done that much.
\*\*\*\*ORIGINAL ANSWER\*\*\*
Then, change your "submit" element to a button element. On the OnClick of the button element, run a JavaScript ... |
357,076 | <p>I've been a .NET developer for several years now and this is still one of those things I don't know how to do properly. It's easy to hide a window from the taskbar via a property in both Windows Forms and WPF, but as far as I can tell, this doesn't guarantee (or necessarily even affect) it being hidden from the <kbd... | [
{
"answer_id": 357172,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": -1,
"selected": false,
"text": "<p>Personally as far as I know this is not possible without hooking into windows in some fashion, I'm not even su... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/238948/"
] | I've been a .NET developer for several years now and this is still one of those things I don't know how to do properly. It's easy to hide a window from the taskbar via a property in both Windows Forms and WPF, but as far as I can tell, this doesn't guarantee (or necessarily even affect) it being hidden from the `Alt`+`... | **Update:**
According to @donovan, modern days WPF supports this natively, through setting
`ShowInTaskbar="False"` and `Visibility="Hidden"` in the XAML. (I haven't tested this yet, but nevertheless decided to bump the comment visibility)
**Original answer:**
There are two ways of hiding a window from the task switc... |
357,084 | <p>I do my php work on my dev box at home, where I've got a rudimentary LAMP setup. When I look at my website on my home box, any numbers I echo are automatically truncated to the least required precision. Eg 2 is echoed as 2, 2.2000 is echoed as 2.2.</p>
<p>On the production box, all the numbers are echoed with at ... | [
{
"answer_id": 357112,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 2,
"selected": false,
"text": "<p>A quick look through the available <a href=\"http://us2.php.net/manual/en/ini.php#ini.list\" rel=\"nofollow noreferr... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42387/"
] | I do my php work on my dev box at home, where I've got a rudimentary LAMP setup. When I look at my website on my home box, any numbers I echo are automatically truncated to the least required precision. Eg 2 is echoed as 2, 2.2000 is echoed as 2.2.
On the production box, all the numbers are echoed with at least one un... | And when you can't rely on the PHP configuration, don't forget about [number\_format()](http://us.php.net/manual/en/function.number-format.php) which you can use to define how a number is returned, ex:
```
// displays 3.14 as 3 and 4.00 as 4
print number_format($price, 0);
// display 4 as 4.00 and 1234.56 as 1,23... |
357,095 | <p>I would like to use JConsole to monitor my Websphere application, but I am not sure how to enable JMX.</p>
| [
{
"answer_id": 358814,
"author": "eljenso",
"author_id": 30316,
"author_profile": "https://Stackoverflow.com/users/30316",
"pm_score": 5,
"selected": false,
"text": "<p>Following information is for Websphere 6.1 on Windows.</p>\n\n<p>First of all, the magic URL to connect to the MBean se... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I would like to use JConsole to monitor my Websphere application, but I am not sure how to enable JMX. | Following information is for Websphere 6.1 on Windows.
First of all, the magic URL to connect to the MBean server is:
```
service:jmx:iiop://<host>:<port>/jndi/JMXConnector
```
If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, ... depending on how many servers there are i... |
357,121 | <p>In my mock class, I'm mocking method foo(). For some test cases, I want the mock implementation of foo() to return a special value. For other test cases, I want to use the real implementation of foo(). I have a boolean defined in my mock class so that I can determine in the mock method whether I want to return th... | [
{
"answer_id": 357424,
"author": "ebo",
"author_id": 13226,
"author_profile": "https://Stackoverflow.com/users/13226",
"pm_score": 1,
"selected": false,
"text": "<p>Instead of throwing in a mock object you could also subclass the object you want to test and override the methods that shou... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20437/"
] | In my mock class, I'm mocking method foo(). For some test cases, I want the mock implementation of foo() to return a special value. For other test cases, I want to use the real implementation of foo(). I have a boolean defined in my mock class so that I can determine in the mock method whether I want to return the spec... | I think you can do this with the `@Mock` annotation. From the docs, `@Mock(reentrant=true)` on your mock class should do it.
See <http://jmockit.googlecode.com/svn/trunk/www/javadoc/mockit/Mock.html>
For an example look here <http://jmockit.googlecode.com/svn/trunk/www/tutorial/StateBasedTesting.html#reentrant>
I ha... |
357,122 | <p>Coming from <a href="https://stackoverflow.com/questions/356778/php-query-single-value-per-iteration-or-fetch-all-at-start-and-retrieve-from-ar">another question of mine</a> where I learnt not to EVER use db queries within loops I consequently have to learn how to fetch all the data in a convenient way before I loop... | [
{
"answer_id": 357241,
"author": "OIS",
"author_id": 36175,
"author_profile": "https://Stackoverflow.com/users/36175",
"pm_score": 1,
"selected": false,
"text": "<p>It might be easier to first get all the scales, then all the items.</p>\n\n<pre><code>//first get scales\nwhile ($row = fet... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11995/"
] | Coming from [another question of mine](https://stackoverflow.com/questions/356778/php-query-single-value-per-iteration-or-fetch-all-at-start-and-retrieve-from-ar) where I learnt not to EVER use db queries within loops I consequently have to learn how to fetch all the data in a convenient way before I loop through it.
... | The query should look something like this:
```
SELECT * FROM scales
INNER JOIN items ON scales.id = items.scale_id
```
If you want to iterate through with nested loops, you'll need to pull this data into an array - hopefully you're not pulling back so much that it'll eat up too much memory.
```
$scales = array();
... |
357,138 | <p>I want to add an ajax:TabContainer to my webpage. I don't get any build errors, but when I try to browse to the page, it gives me the error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).".</p>
<p>I re-downloaded the Ajax Control Toolkit for the sample site... | [
{
"answer_id": 357154,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 2,
"selected": false,
"text": "<p>This error is not specific to Ajax.</p>\n\n<p>You could try putting your ajax:TabContainer inside an asp:Panel.\nAlternativ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32998/"
] | I want to add an ajax:TabContainer to my webpage. I don't get any build errors, but when I try to browse to the page, it gives me the error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).".
I re-downloaded the Ajax Control Toolkit for the sample sites, opened the... | You can't use <%= %> (write) blocks inside a control that uses the standard server rendering - you get this error.
In order for the ASP AJAX components to work you need:
```
<head runat="server">...
```
Otherwise it crashes with this error too.
However you can *databind* inside these server controls:
```
<head ru... |
357,190 | <p>I'm trying to find the file size of a file on a server. The following code I got from <a href="http://www.thejackol.com/2005/06/11/aspnet-get-file-size/" rel="nofollow noreferrer">this guy</a> accomplishes that for your own server:</p>
<pre><code>string MyFile = "~/photos/mymug.gif";
FileInfo finfo = new FileInfo(... | [
{
"answer_id": 357198,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>To get this value you would have to first download the file locally, then you can use the standard methods to g... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557/"
] | I'm trying to find the file size of a file on a server. The following code I got from [this guy](http://www.thejackol.com/2005/06/11/aspnet-get-file-size/) accomplishes that for your own server:
```
string MyFile = "~/photos/mymug.gif";
FileInfo finfo = new FileInfo(Server.MapPath(MyFile));
long FileInBytes = finfo.L... | You can use the `WebRequest` class to issue an HTTP request to the server and read the `Content-Length` header (you could probably use HTTP `HEAD` method to accomplish it). However, not all Web servers respond with a `Content-Length` header. In those cases, you have to receive all data to get the size. |
357,203 | <p>Because I am a newbie I am trying to log out any errors that may occur with stored procedures I write. I understand Try/Catch in SQL 2005 and error_procedure(), ERROR_MESSAGE() and the other built in functions. What I can't figure out how to do is capture what record caused the error on an update.</p>
<p>I could ... | [
{
"answer_id": 357345,
"author": "rlb.usa",
"author_id": 449902,
"author_profile": "https://Stackoverflow.com/users/449902",
"pm_score": -1,
"selected": false,
"text": "<p>Alternative: how about using transactions and @@IDENTITY ?</p>\n\n<pre><code>DECLARE @problemClientID INT\nBEGIN TRA... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18068/"
] | Because I am a newbie I am trying to log out any errors that may occur with stored procedures I write. I understand Try/Catch in SQL 2005 and error\_procedure(), ERROR\_MESSAGE() and the other built in functions. What I can't figure out how to do is capture what record caused the error on an update.
I could probably u... | A try/catch block like this...
```
BEGIN TRY
-- Your Code Goes Here --
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR... |
357,243 | <p>I am inputting a 200mb file in my application and due to a very strange reason the memory usage of my application is more than 600mb. I have tried vector and deque, as well as std::string and char * with no avail. I need the memory usage of my application to be almost the same as the file I am reading, any suggestio... | [
{
"answer_id": 357296,
"author": "Matt Cruikshank",
"author_id": 8643,
"author_profile": "https://Stackoverflow.com/users/8643",
"pm_score": 0,
"selected": false,
"text": "<p>Try using a list instead of a vector. Vectors are (almost always) linear in memory.</p>\n\n<p>Granted, the fact ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28954/"
] | I am inputting a 200mb file in my application and due to a very strange reason the memory usage of my application is more than 600mb. I have tried vector and deque, as well as std::string and char \* with no avail. I need the memory usage of my application to be almost the same as the file I am reading, any suggestions... | Your memory is being fragmented.
Try something like this :
```
HANDLE heaps[1025];
DWORD nheaps = GetProcessHeaps((sizeof(heaps) / sizeof(HANDLE)) - 1, heaps);
for (DWORD i = 0; i < nheaps; ++i)
{
ULONG HeapFragValue = 2;
HeapSetInformation(heaps[i],
HeapCompatibilityInformat... |
357,244 | <p>One of my columns type is DateTime (Date Registered). I cannot create a query that filters all the data for eg. All registrations who registered on the 22/10/2008 between 18:00 and 20:00.</p>
<p>Thanks</p>
| [
{
"answer_id": 357271,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 4,
"selected": true,
"text": "<pre><code>SELECT *\nFROM YourTable\nWHERE DateRegistered BETWEEN '10/22/2008 18:00:00' AND '10/22/2008 20:00:00'\n... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | One of my columns type is DateTime (Date Registered). I cannot create a query that filters all the data for eg. All registrations who registered on the 22/10/2008 between 18:00 and 20:00.
Thanks | ```
SELECT *
FROM YourTable
WHERE DateRegistered BETWEEN '10/22/2008 18:00:00' AND '10/22/2008 20:00:00'
```
Should do the trick |
357,283 | <p>In SQL Server Profile, I have it tracing SP:StmtStarting events. The "TextData" includes information like the following:</p>
<pre><code>EXEC MySortedProc
@param, NULL,
@param2, NULL
</code></pre>
<p>What would I have to trace (or can I?) to view the value of those parameters?</p>
| [
{
"answer_id": 357736,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 2,
"selected": false,
"text": "<p>If I get you correctly, you have a stored procedure being called by another stored procedure and you want to get the ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1582760/"
] | In SQL Server Profile, I have it tracing SP:StmtStarting events. The "TextData" includes information like the following:
```
EXEC MySortedProc
@param, NULL,
@param2, NULL
```
What would I have to trace (or can I?) to view the value of those parameters? | Somewhat scared to have misunderstood the question, but you could profile on the RPC:Completed event which will return the result for stored procedure execution in the textdata column like:
exec usp\_yourproc @param = 'value' |
357,297 | <p>The site I'm working on is done in Classic ASP, and I'm trying to do it as best as possible. I've abstracted it out into a Rails-like directory structure:</p>
<pre>
app_name
- app
- includes
- helpers
- lib
- partials
- public
- stylesheets
- images
- javascripts
</pre>
<p>I've cr... | [
{
"answer_id": 357317,
"author": "Kevin Tighe",
"author_id": 39461,
"author_profile": "https://Stackoverflow.com/users/39461",
"pm_score": 0,
"selected": false,
"text": "<p>-Could it be an issue with the generated html?<br>\n-You might want to try making IMAGE_ROOT an absolute path like ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40667/"
] | The site I'm working on is done in Classic ASP, and I'm trying to do it as best as possible. I've abstracted it out into a Rails-like directory structure:
```
app_name
- app
- includes
- helpers
- lib
- partials
- public
- stylesheets
- images
- javascripts
```
I've created some Rai... | An excellent tool to use when troubleshooting these types of issues is Fiddler. It will show you the calls and responses directly bewtween your web browser and the server. It works out of the box with IE and FireFox support is just a config setting away.
I'ver personally used Fiddler to track down image load issues, C... |
357,307 | <p>How do I call the parent function from a derived class using C++? For example, I have a class called <code>parent</code>, and a class called <code>child</code> which is derived from parent. Within
each class there is a <code>print</code> function. In the definition of the child's print function I would like to mak... | [
{
"answer_id": 357312,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 8,
"selected": false,
"text": "<p>Given a parent class named <code>Parent</code> and a child class named <code>Child</code>, you can do something like t... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17337/"
] | How do I call the parent function from a derived class using C++? For example, I have a class called `parent`, and a class called `child` which is derived from parent. Within
each class there is a `print` function. In the definition of the child's print function I would like to make a call to the parents print functio... | I'll take the risk of stating the obvious: You call the function, if it's defined in the base class it's automatically available in the derived class (unless it's `private`).
If there is a function with the same signature in the derived class you can disambiguate it by adding the base class's name followed by two colo... |
357,311 | <p>Greetings!</p>
<p>I have some XML like this:</p>
<pre><code><Root>
<MainSection>
<SomeNode>Some Node Value</SomeNode>
<SomeOtherNode>Some Other Node Value</SomeOtherNode>
<Areas>
<Area someattribute="aaa" name="Alpha" value="0" /&... | [
{
"answer_id": 357420,
"author": "Toji",
"author_id": 25968,
"author_profile": "https://Stackoverflow.com/users/25968",
"pm_score": -1,
"selected": false,
"text": "<p>Forgive my lack of familiarity with ASP, but shouldn't your paths include the @?</p>\n\n<p><asp:DropDownList ID=\"MyDd... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] | Greetings!
I have some XML like this:
```
<Root>
<MainSection>
<SomeNode>Some Node Value</SomeNode>
<SomeOtherNode>Some Other Node Value</SomeOtherNode>
<Areas>
<Area someattribute="aaa" name="Alpha" value="0" />
<Area someattribute="bbb" name="Beta" value="1" />
... | XPathSelect doesn't return a DataSource that can be directly bound like that. Just as you had the FormView bound and your bindings with in it used XPath("...") not Bind("..."), you have the same issue with the DropDownList. Either build a standard DataSource with your attributes and bind the DDL to that, or roll your o... |
357,323 | <p>I have a page that renders slowly. The trip across the net is quick. The initial load of the page is quick. You can actually see (if your machine is slow enough), the initial layout of the html components. Then some javascript stuff runs, making some of those components all ajaxy. Then finally the css gets appl... | [
{
"answer_id": 357346,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<p>Check to see when the DOM is ready before calling all your Ajax stuff.</p>\n\n<p>using <a href=\"htt... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45108/"
] | I have a page that renders slowly. The trip across the net is quick. The initial load of the page is quick. You can actually see (if your machine is slow enough), the initial layout of the html components. Then some javascript stuff runs, making some of those components all ajaxy. Then finally the css gets applied.
I ... | Show the throbber before the code is run and hide it after.
Using JQuery:
```
$("#throbber").show();
/* Your AJAX calls */
$("#throbber").hide();
``` |
357,328 | <p>I have four tables (A,B,C,D) where A is the parent of one to many relationships with B and C. C and D are parents to a one to many relationship with table D. Conceptually, the primary keys of these tables could be:</p>
<ul>
<li>A: Aid </li>
<li>B: Aid, bnum (with foreign key to A)</li>
<li>C: Aid, cnum (with fore... | [
{
"answer_id": 357346,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<p>Check to see when the DOM is ready before calling all your Ajax stuff.</p>\n\n<p>using <a href=\"htt... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9940/"
] | I have four tables (A,B,C,D) where A is the parent of one to many relationships with B and C. C and D are parents to a one to many relationship with table D. Conceptually, the primary keys of these tables could be:
* A: Aid
* B: Aid, bnum (with foreign key to A)
* C: Aid, cnum (with foreign key to A)
* D: Aid, bnum, c... | Show the throbber before the code is run and hide it after.
Using JQuery:
```
$("#throbber").show();
/* Your AJAX calls */
$("#throbber").hide();
``` |
357,353 | <p>What happens when I do the following?</p>
<pre><code>(define ((func x) y)
(if (zero? y)
((func x) 1)
12))
</code></pre>
<p>I understand that I can do this:</p>
<pre><code>(define curried (func 5))
</code></pre>
<p>And now I can use curried. What I'm curious about is in the definition of the f... | [
{
"answer_id": 357409,
"author": "plinth",
"author_id": 20481,
"author_profile": "https://Stackoverflow.com/users/20481",
"pm_score": 2,
"selected": false,
"text": "<p>It's been too long since I worked with scheme, but you might find <a href=\"http://www.engr.uconn.edu/~jeffm/Papers/curr... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | What happens when I do the following?
```
(define ((func x) y)
(if (zero? y)
((func x) 1)
12))
```
I understand that I can do this:
```
(define curried (func 5))
```
And now I can use curried. What I'm curious about is in the definition of the function. Does the line
```
((func x) 1)
```
cr... | In the Scheme standard it is specified that
```
(define (f x) 42) is short for (define f (lambda (x) 42)) .
```
The natural (non-standard) generalization implies:
```
(define ((f x) y) (list x y)) is short for (define (f x) (lambda (y) (list x y)))
which is short for (define f (lambda (x) (lambda (y... |
357,363 | <p>I'm looking for a macro which can be run to select a consistent range of cells so that I can easily copy them to another spreadsheet. The range would be F3:BJ3.</p>
| [
{
"answer_id": 357377,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 2,
"selected": false,
"text": "<p>This should do the trick:</p>\n\n<pre><code>Public Sub selectCells()\n Range(\"F3:BJ3\").Select\nEnd Sub</code></pre... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for a macro which can be run to select a consistent range of cells so that I can easily copy them to another spreadsheet. The range would be F3:BJ3. | This should do the trick:
```
Public Sub selectCells()
Range("F3:BJ3").Select
End Sub
```
**edit:** for that matter, you can use the following to actually perform the 'copy' command for you as well:
```
Public Sub selectCellsAndCopy()
Range("F3:BJ3").Select
Selection.Copy
End Sub
``` |
357,370 | <p>I would like to store my FreeMarker templates in a database table that looks something like:</p>
<pre><code>template_name | template_content
---------------------------------
hello |Hello ${user}
goodbye |So long ${user}
</code></pre>
<p>When a request is received for a template with a particular nam... | [
{
"answer_id": 357508,
"author": "Dan Vinton",
"author_id": 21849,
"author_profile": "https://Stackoverflow.com/users/21849",
"pm_score": 4,
"selected": false,
"text": "<p>A couple of ways:</p>\n\n<ul>\n<li><p>Create a new implementation of <a href=\"http://freemarker.sourceforge.net/doc... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] | I would like to store my FreeMarker templates in a database table that looks something like:
```
template_name | template_content
---------------------------------
hello |Hello ${user}
goodbye |So long ${user}
```
When a request is received for a template with a particular name, this should cause a que... | We use a StringTemplateLoader to load our tempates which we got from the db (as Dan Vinton suggested)
Here is an example:
```
StringTemplateLoader stringLoader = new StringTemplateLoader();
String firstTemplate = "firstTemplate";
stringLoader.putTemplate(firstTemplate, freemarkerTemplate);
// It's possible to add mor... |
357,388 | <p>I would class myself as a typical small developer/independant designer and I recently purchased some new hardware for the office and thought I better organise myself better than I have in the past.</p>
<p>So I am wondering how you all organise all your files etc so that you can find them easily enough, and relate t... | [
{
"answer_id": 357508,
"author": "Dan Vinton",
"author_id": 21849,
"author_profile": "https://Stackoverflow.com/users/21849",
"pm_score": 4,
"selected": false,
"text": "<p>A couple of ways:</p>\n\n<ul>\n<li><p>Create a new implementation of <a href=\"http://freemarker.sourceforge.net/doc... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28241/"
] | I would class myself as a typical small developer/independant designer and I recently purchased some new hardware for the office and thought I better organise myself better than I have in the past.
So I am wondering how you all organise all your files etc so that you can find them easily enough, and relate them togeth... | We use a StringTemplateLoader to load our tempates which we got from the db (as Dan Vinton suggested)
Here is an example:
```
StringTemplateLoader stringLoader = new StringTemplateLoader();
String firstTemplate = "firstTemplate";
stringLoader.putTemplate(firstTemplate, freemarkerTemplate);
// It's possible to add mor... |
357,396 | <p>I have two classes: Media and Container.</p>
<p>I have two lists <code>List<Media></code> and <code>List<Container></code></p>
<p>I'm passing these lists to another function (one at a time);</p>
<p>it can be one or another; </p>
<p>what's the proper way to check for the "template" type of the list so... | [
{
"answer_id": 357407,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 4,
"selected": false,
"text": "<p>The proper thing to do is to have two overloads for this function, accepting each type:</p>\n\n<pre><code>public void MyMet... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33082/"
] | I have two classes: Media and Container.
I have two lists `List<Media>` and `List<Container>`
I'm passing these lists to another function (one at a time);
it can be one or another;
what's the proper way to check for the "template" type of the list so i can call an asssociated method depending on the list type?
or... | You can use the GetGenericArguments method of type Type, something like this:
object[] templates = myObject.GetType().GetGenericArguments(); |
357,399 | <p>I have a import directive in my inline .aspx page (no code-behind).</p>
<p>Getting an error: The type or namespace name 'Dts' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)</p>
<p>What is the issue? Do I need a /bin directory with the .dll in it or something?</p>
| [
{
"answer_id": 357405,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Does your project reference microsoft.sqlserver.manageddts.dll?</p>\n"
},
{
"answer_id": 357430,
"author": "Joe... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have a import directive in my inline .aspx page (no code-behind).
Getting an error: The type or namespace name 'Dts' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)
What is the issue? Do I need a /bin directory with the .dll in it or something? | Sounds like there is no "project". In that case, to reference a dll (assembly) you use an [`<%@ Assembly >`](http://msdn.microsoft.com/en-us/library/d864zc1k.aspx) directive.
```
<%@ Assembly Name="microsoft.sqlserver.manageddts.dll" %>
<%@ Import namespace="Microsoft.SqlServer.Dts.Runtime" %>
``` |
357,404 | <p>I just joined a new C++ software project and I'm trying to understand the design. The project makes frequent use of unnamed namespaces. For example, something like this may occur in a class definition file:</p>
<pre><code>// newusertype.cc
namespace {
const int SIZE_OF_ARRAY_X;
const int SIZE_OF_ARRAY_Y;
bo... | [
{
"answer_id": 357427,
"author": "Motti",
"author_id": 3848,
"author_profile": "https://Stackoverflow.com/users/3848",
"pm_score": 7,
"selected": false,
"text": "<p>Having something in an anonymous namespace means it's local to this <a href=\"https://en.wikipedia.org/wiki/Translation_uni... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688/"
] | I just joined a new C++ software project and I'm trying to understand the design. The project makes frequent use of unnamed namespaces. For example, something like this may occur in a class definition file:
```
// newusertype.cc
namespace {
const int SIZE_OF_ARRAY_X;
const int SIZE_OF_ARRAY_Y;
bool getState(user... | Unnamed namespaces are a utility to make an identifier [translation unit](https://stackoverflow.com/a/1106167/) local. They behave as if you would choose a unique name per translation unit for a namespace:
```
namespace unique { /* empty */ }
using namespace unique;
namespace unique { /* namespace body. stuff in here ... |
357,415 | <p>I'm sure this is really simple if you know anything about binary files, but I'm a newbie on that score.</p>
<p>How would I extract the data from NASA .hgt files? Here is a description from www2.jpl.nasa.gov/srtm/faq.html:</p>
<blockquote>
<p><b>The SRTM data files have names like "N34W119.hgt". What do the
l... | [
{
"answer_id": 357469,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 3,
"selected": false,
"text": "<p>Since the records are fixed length (16-bit signed integers) and you know the grid size (1201 x 1201 or 3601x3601), Py... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm sure this is really simple if you know anything about binary files, but I'm a newbie on that score.
How would I extract the data from NASA .hgt files? Here is a description from www2.jpl.nasa.gov/srtm/faq.html:
>
> **The SRTM data files have names like "N34W119.hgt". What do the
> letters and numbers refer to,... | A tested numpy example:
```
import os
import math
import numpy
fn = 'DMV/N51E000.hgt'
siz = os.path.getsize(fn)
dim = int(math.sqrt(siz/2))
assert dim*dim*2 == siz, 'Invalid file size'
data = numpy.fromfile(fn, numpy.dtype('>i2'), dim*dim).reshape((dim, dim))
``` |
357,425 | <p>I have several Models and want to return a queryset of all the Models belonging to a User, I'm wondering if its possible to return one Queryset from multiple Models?</p>
| [
{
"answer_id": 357584,
"author": "Evgeny Lazin",
"author_id": 42371,
"author_profile": "https://Stackoverflow.com/users/42371",
"pm_score": 2,
"selected": false,
"text": "<p>Your models must contain relationship fields (ForeigKey and ManyToManyField), with related_name keyword argument s... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2041708/"
] | I have several Models and want to return a queryset of all the Models belonging to a User, I'm wondering if its possible to return one Queryset from multiple Models? | I am assuming that you mean you would like to return a single queryset of all the objects belonging to the user from each model.
Do you need a queryset or just an iterable? AFAIK, heterogeneous qs's are not possible. However, you could easily return a list, a chained iterator (itertools) or a generator to do what you ... |
357,445 | <p>I'm trying to debug the MSBuild Customtask, that I have just created, but for some reason it never stops at the breakpoint. I've even tried this:</p>
<pre><code> public override bool Execute()
{
System.Diagnostics.Debugger.Break();
</code></pre>
<p>And added a break point on that line... I even eli... | [
{
"answer_id": 357544,
"author": "Joel Martinez",
"author_id": 5416,
"author_profile": "https://Stackoverflow.com/users/5416",
"pm_score": 6,
"selected": true,
"text": "<p>It's a bit of a hack, but you could always just put this line of code wherever it is that you want to start debuggin... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17787/"
] | I'm trying to debug the MSBuild Customtask, that I have just created, but for some reason it never stops at the breakpoint. I've even tried this:
```
public override bool Execute()
{
System.Diagnostics.Debugger.Break();
```
And added a break point on that line... I even eliminated all the other code ... | It's a bit of a hack, but you could always just put this line of code wherever it is that you want to start debugging:
```
System.Diagnostics.Debugger.Launch();
```
When you invoke it, the CLR will launch a dialog asking you what debugger you want to attach. |
357,447 | <p>I think the direct answer to the question is 'No' but I'm hoping that someone has written a real simple library to do this (or I can do it...ugh...)</p>
<p>Let me demonstrate what I am looking for with an example.
Suppose I had the following:</p>
<pre><code>class Person {
string Name {get; set;}
int NumberOfCa... | [
{
"answer_id": 357453,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackoverflow.com/users/1075",
"pm_score": 2,
"selected": false,
"text": "<p>You could override the ToString() for your class.</p>\n\n<p>Good Article <a href=\"http://codebetter.com/blogs/david.... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I think the direct answer to the question is 'No' but I'm hoping that someone has written a real simple library to do this (or I can do it...ugh...)
Let me demonstrate what I am looking for with an example.
Suppose I had the following:
```
class Person {
string Name {get; set;}
int NumberOfCats {get; set;}
Date... | Edit: You don't have to implement IFormattable for each object...that'd be a PITA, severely limiting, and a fairly large maintenance burden. Just use Reflection and a IFormatProvider with ICustomFormatter and it'll work with *any* object. String.Format has an overload to take one as a parameter.
I've never thought of ... |
357,452 | <p>I have been trying to link to Pb (11.5) generated native Win32 dlls: both from a different Pb app and from a .net (2.0) app. I am aware that registered COM objects are visible to Pb. What I want to do is have Pb (running 11.5 Enterprise) call functions in a native Win32 dll--not COM. I also want to go the other w... | [
{
"answer_id": 358498,
"author": "Terry",
"author_id": 22509,
"author_profile": "https://Stackoverflow.com/users/22509",
"pm_score": 3,
"selected": true,
"text": "<p>Basically, you don't. You can create a COM object project, or with 11 or 11.5 you can create a .NET assembly. The DLLs cre... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45123/"
] | I have been trying to link to Pb (11.5) generated native Win32 dlls: both from a different Pb app and from a .net (2.0) app. I am aware that registered COM objects are visible to Pb. What I want to do is have Pb (running 11.5 Enterprise) call functions in a native Win32 dll--not COM. I also want to go the other way: I ... | Basically, you don't. You can create a COM object project, or with 11 or 11.5 you can create a .NET assembly. The DLLs created by "native" generation aren't standard Windows DLLs, so can't be called with normal DLL methods.
Good luck,
Terry. |
357,465 | <p>Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application?</p>
<p>I have tried the following but am told that the configuration file is readonly.</p>
<pre><code>ConfigurationManager.ConnectionStrings.Add(new Connec... | [
{
"answer_id": 357496,
"author": "ema",
"author_id": 19520,
"author_profile": "https://Stackoverflow.com/users/19520",
"pm_score": -1,
"selected": false,
"text": "<p>No, you can't modify the config file at runtime, it isn't intended for that.\nMaybe you could use the Enterprise Libraries... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28540/"
] | Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application?
I have tried the following but am told that the configuration file is readonly.
```
ConfigurationManager.ConnectionStrings.Add(new ConnectionStringSettings(pa... | ```
var cfg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(@"/");
cfg.ConnectionStrings.ConnectionStrings.Add(new ConnectionStringSettings(params));
cfg.Save();
```
Be Advised this will cause your website to recycle since it modifies the config file. Check out [http://msdn.microsoft.com/en-u... |
357,470 | <p>I am in charge of providing a theme functionality for a site using a big CSS file (thousands of elements) I've just inherited.
Basically we want to allow the user to be able to change the colors on the screen.</p>
<p>Every CSS element, besides color definition also have lots of other attributes - size, font, float,... | [
{
"answer_id": 357484,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 3,
"selected": true,
"text": "<p>You only have to duplicate the color attributes so if you have </p>\n\n<pre><code>a:hover\n{\n text-decoration:none;... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37955/"
] | I am in charge of providing a theme functionality for a site using a big CSS file (thousands of elements) I've just inherited.
Basically we want to allow the user to be able to change the colors on the screen.
Every CSS element, besides color definition also have lots of other attributes - size, font, float, etc... As... | You only have to duplicate the color attributes so if you have
```
a:hover
{
text-decoration:none;
color:Black;
display:block
}
```
in your css file in your theme you only need:
```
a:hover
{
color:Red;
}
```
Now in your page you want to make sure you still reference the original css file, and t... |
357,499 | <p>I am trying to create a simple page that enters data in to a database and my code is below.</p>
<pre><code><%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!--#include FILE=dbcano.inc-->
<%
dim username,password,f_name,l_name,objConn,objs,query
username = Request.Form("user")
password = ... | [
{
"answer_id": 357517,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 3,
"selected": true,
"text": "<p><strong>User</strong> is a reserved word in SQL server. Put it into square brackets, e.g. <strong>[user]</strong>.</p>\n"
... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create a simple page that enters data in to a database and my code is below.
```
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!--#include FILE=dbcano.inc-->
<%
dim username,password,f_name,l_name,objConn,objs,query
username = Request.Form("user")
password = Request.Form("pass")
f_name = R... | **User** is a reserved word in SQL server. Put it into square brackets, e.g. **[user]**. |