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 |
|---|---|---|---|---|---|---|
82,929 | <p>I have a PHP application that displays a list of options to a user. The list is generated from a simple query against SQL 2000. What I would like to do is have a specific option at the top of the list, and then have the remaining options sorted alphabetically.</p>
<p>For example, here's the options if sorted alph... | [
{
"answer_id": 82944,
"author": "mercutio",
"author_id": 1951,
"author_profile": "https://Stackoverflow.com/users/1951",
"pm_score": 2,
"selected": false,
"text": "<pre><code>SELECT name FROM options ORDER BY name = \"Montreal\", name;\n</code></pre>\n\n<p>Note: This works with MySQL, no... | 2008/09/17 | [
"https://Stackoverflow.com/questions/82929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37/"
] | I have a PHP application that displays a list of options to a user. The list is generated from a simple query against SQL 2000. What I would like to do is have a specific option at the top of the list, and then have the remaining options sorted alphabetically.
For example, here's the options if sorted alphabetically: ... | ```
SELECT name
FROM locations
ORDER BY
CASE
WHEN name = 'Montreal'
THEN 0
ELSE 1
END, name
``` |
82,949 | <p>I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm looking to port back to jUnit. What hooks are available for execution before any tests are run and after all tests have c... | [
{
"answer_id": 83175,
"author": "user15299",
"author_id": 15299,
"author_profile": "https://Stackoverflow.com/users/15299",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know there is no mechanism for doing this in JUnit, however you could try subclassing Suite and overriding... | 2008/09/17 | [
"https://Stackoverflow.com/questions/82949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4893/"
] | I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm looking to port back to jUnit. What hooks are available for execution before any tests are run and after all tests have comp... | Yes, it is possible to reliably run set up and tear down methods before and after any tests in a test suite. Let me demonstrate in code:
```
package com.test;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.Suit... |
82,993 | <p>We need to programatically burn files to CD in a C\C++ Windows XP/Vista application we are developing using Borlands Turbo C++.</p>
<p>What is the simplest and best way to do this? We would prefer a native windows API (that doesnt rely on MFC) so as not to rely on any third party software/drivers if one is availabl... | [
{
"answer_id": 83211,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>You should be able to use the shell's ICDBurn interface. Back in the XP day MFC didn't even have any classes for cd burnin... | 2008/09/17 | [
"https://Stackoverflow.com/questions/82993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14260/"
] | We need to programatically burn files to CD in a C\C++ Windows XP/Vista application we are developing using Borlands Turbo C++.
What is the simplest and best way to do this? We would prefer a native windows API (that doesnt rely on MFC) so as not to rely on any third party software/drivers if one is available. | We used the following:
Store files in the directory returned by GetBurnPath, then write using Burn. GetCDRecordableInfo is used to check when the CD is ready.
```
#include <stdio.h>
#include <imapi.h>
#include <windows.h>
struct MEDIAINFO {
BYTE nSessions;
BYTE nLastTrack;
ULONG nStartAddress;
ULONG... |
83,038 | <p>When supplying dates to a stored procedure via a parameter I'm a little confused over which format to use for the dates. My original VBA syntax used the ADO Connection object to execute the stored procedure:</p>
<pre><code>Set SentDetailRS = Me.ADOConnectionToIntegrity.Execute("dbo.s_SelectAggregatedSentDetailList ... | [
{
"answer_id": 83164,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profile": "https://Stackoverflow.com/users/8220",
"pm_score": 0,
"selected": false,
"text": "<p>I would guess that fCSQLDate function is culture-specific - i.e. it will parse the date based on the user's locale s... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When supplying dates to a stored procedure via a parameter I'm a little confused over which format to use for the dates. My original VBA syntax used the ADO Connection object to execute the stored procedure:
```
Set SentDetailRS = Me.ADOConnectionToIntegrity.Execute("dbo.s_SelectAggregatedSentDetailList '" & fCSQLDate... | Be careful, and do not believe that ADO is taking care of the problem. Universal SQL date format is 'YYYYMMDD', while both SQL and ACCESS are influenced by the regional settings of the machine in the way they display dates and convert them in character strings.
Do not forget that Date separator is # in Access, while i... |
83,045 | <p>I have a costumer showing Notepad with a large set of data that looks totally misaligned if word wrap is on and I want to force it off. Is there a command switch to do this?</p>
| [
{
"answer_id": 83091,
"author": "Neoaikon",
"author_id": 15837,
"author_profile": "https://Stackoverflow.com/users/15837",
"pm_score": 1,
"selected": false,
"text": "<p>you could just turn it off by going to Format -> Word Wrap.</p>\n"
},
{
"answer_id": 83127,
"author": "Cetr... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9077/"
] | I have a costumer showing Notepad with a large set of data that looks totally misaligned if word wrap is on and I want to force it off. Is there a command switch to do this? | I dont think there is a command switch to do this at all. If you want to force it off all the time then you may want to edit the registry:
```
Hive: HKEY_CURRENT_USER
Key: SOFTWARE\Microsoft\Notepad
Name: fWrap
Type: REG_DWORD
Value: 0
```
You could even create a .reg file and put it in a batch file to run it and re... |
83,050 | <p>I had this question in mind and since I just discovered this site I decided to post it here.</p>
<p>Let's say I have a table with a timestamp and a state for a given "object" (generic meaning, not OOP object); is there an optimal way to calculate the time between a state and the next occurrence of another (or same)... | [
{
"answer_id": 83129,
"author": "GUI Junkie",
"author_id": 11498,
"author_profile": "https://Stackoverflow.com/users/11498",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you can get that answer with one SQL statement as you are trying to obtain one result from many records... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15805/"
] | I had this question in mind and since I just discovered this site I decided to post it here.
Let's say I have a table with a timestamp and a state for a given "object" (generic meaning, not OOP object); is there an optimal way to calculate the time between a state and the next occurrence of another (or same) state (wh... | Here's an Oracle methodology using an analytic function.
```
with data as (
SELECT 1 trip_id, to_date('20080801 13:30:00','YYYYMMDD HH24:mi:ss') dt, 'Initial' step from dual UNION ALL
SELECT 1 trip_id, to_date('20080802 13:30:00','YYYYMMDD HH24:mi:ss') dt, 'Work' step from dual UNION ALL
SELECT 1 trip_id, to_dat... |
83,093 | <p>is there a solution for batch insert via hibernate in partitioned postgresql table? currently i'm getting an error like this...</p>
<pre><code>ERROR org.hibernate.jdbc.AbstractBatcher - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual ... | [
{
"answer_id": 90031,
"author": "alexguev",
"author_id": 436199,
"author_profile": "https://Stackoverflow.com/users/436199",
"pm_score": 3,
"selected": true,
"text": "<p>You might want to try using a custom Batcher by setting the hibernate.jdbc.factory_class property. Making sure hiberna... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15878/"
] | is there a solution for batch insert via hibernate in partitioned postgresql table? currently i'm getting an error like this...
```
ERROR org.hibernate.jdbc.AbstractBatcher - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; e... | You might want to try using a custom Batcher by setting the hibernate.jdbc.factory\_class property. Making sure hibernate won't check the update count of batch operations might fix your problem, you can achieve that by making your custom Batcher extend the class BatchingBatcher, and then overriding the method doExecute... |
83,132 | <p>I thought I'd found the solution a while ago (see my <a href="https://tjrobinson.net/programming/technology/2006/09/03/cant-execute-code-from-a-freed-script.html" rel="noreferrer">blog</a>):</p>
<blockquote>
<p>If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed scrip... | [
{
"answer_id": 83570,
"author": "pcorcoran",
"author_id": 15992,
"author_profile": "https://Stackoverflow.com/users/15992",
"pm_score": 3,
"selected": false,
"text": "<p>This error can occur in MSIE when a child window tries to communicate with a parent window which is no longer open.</p... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12124/"
] | I thought I'd found the solution a while ago (see my [blog](https://tjrobinson.net/programming/technology/2006/09/03/cant-execute-code-from-a-freed-script.html)):
>
> If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed script" - try moving any meta tags in the head so tha... | You get this error when you call a function that was created in a window or frame that no longer exists.
If you don't know in advance if the window still exists, you can do a try/catch to detect it:
```
try
{
f();
}
catch(e)
{
if (e.number == -2146823277)
// f is no longer available
...
}
``` |
83,152 | <p>Is there an open source library that will help me with reading/parsing PDF documents in .NET/C#?</p>
| [
{
"answer_id": 83166,
"author": "Alex Fort",
"author_id": 12624,
"author_profile": "https://Stackoverflow.com/users/12624",
"pm_score": 1,
"selected": false,
"text": "<p>You could look into this:\n<a href=\"http://www.codeproject.com/KB/showcase/pdfrasterizer.aspx\" rel=\"nofollow norefe... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6777/"
] | Is there an open source library that will help me with reading/parsing PDF documents in .NET/C#? | Since this question was last answered in 2008, iTextSharp has improved their api dramatically. If you download the latest version of their api from <http://sourceforge.net/projects/itextsharp/>, you can use the following snippet of code to extract all text from a pdf into a string.
```
using iTextSharp.text.pdf;
using... |
83,156 | <p>Ok, I have been working with Solaris for a 10+ years, and have never seen this...</p>
<p>I have a directory listing which includes both a file and subdirectory with the same name:</p>
<pre><code>-rw-r--r-- 1 root other 15922214 Nov 29 2006 msheehan
drwxrwxrwx 12 msheehan sysadmin 2048 Mar 25 15:39 ms... | [
{
"answer_id": 83168,
"author": "Jonathan Bourke",
"author_id": 8361,
"author_profile": "https://Stackoverflow.com/users/8361",
"pm_score": 0,
"selected": false,
"text": "<p>And a quick answer to part 2 of my own question...</p>\n\n<p>I would imagine I could rename the directory, delete ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8361/"
] | Ok, I have been working with Solaris for a 10+ years, and have never seen this...
I have a directory listing which includes both a file and subdirectory with the same name:
```
-rw-r--r-- 1 root other 15922214 Nov 29 2006 msheehan
drwxrwxrwx 12 msheehan sysadmin 2048 Mar 25 15:39 msheehan
```
I use fi... | I would guess that these are in fact two different filenames that "look" the same, as the command file was able to distinguish them when the shell passed the expanded versions of the name in. Try piping ls into od or another hex/octal dump utility to see if they really have the same name, or if there are non-printing c... |
83,159 | <p>Some API returns me XmlCursor pointing on root of XML Document. I need to insert all of this into another org.w3c.DOM represented document.</p>
<p>At start:
XmlCursor poiting on
<code></p>
<p><a>
<b>
some text
</b>
</a>
</code></p>
<p>DOM Document:
<code></p>
<p><foo></p>
<... | [
{
"answer_id": 83256,
"author": "Sietse",
"author_id": 6400,
"author_profile": "https://Stackoverflow.com/users/6400",
"pm_score": 4,
"selected": true,
"text": "<p>Try something like this:</p>\n\n<pre><code>Node originalNode = cursor.getDomNode();\nNode importNode = document.importNode(o... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1128722/"
] | Some API returns me XmlCursor pointing on root of XML Document. I need to insert all of this into another org.w3c.DOM represented document.
At start:
XmlCursor poiting on
<a>
<b>
some text
</b>
</a>
DOM Document:
<foo>
</foo>
At the end I want to have original DOM document changed like this:
<foo>
<someOth... | Try something like this:
```
Node originalNode = cursor.getDomNode();
Node importNode = document.importNode(originalNode.getFirstChild());
Node otherNode = document.createElement("someOtherInsertedElement");
otherNode.appendChild(importNode);
document.appendChild(otherNode);
```
So in other words:
1. Get the DOM No... |
83,232 | <p>I'm looking for a key/value pair object that I can include in a web service.</p>
<p>I tried using .NET's <a href="http://msdn.microsoft.com/en-us/library/5tbh8a42.aspx" rel="noreferrer"><code>System.Collections.Generic.KeyValuePair<></code></a> class, but it does not properly serialize in a web service. In a ... | [
{
"answer_id": 83265,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 8,
"selected": true,
"text": "<p>Just define a struct/class.</p>\n\n<pre><code>[Serializable]\npublic struct KeyValuePair<K,V>\n{\n public K Key {ge... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] | I'm looking for a key/value pair object that I can include in a web service.
I tried using .NET's [`System.Collections.Generic.KeyValuePair<>`](http://msdn.microsoft.com/en-us/library/5tbh8a42.aspx) class, but it does not properly serialize in a web service. In a web service, the Key and Value properties are not seria... | Just define a struct/class.
```
[Serializable]
public struct KeyValuePair<K,V>
{
public K Key {get;set;}
public V Value {get;set;}
}
``` |
83,242 | <p>I have a RHEL 5 system with a fresh new hard drive I just dedicated to the MySQL server. To get things started, I used "mysqldump --host otherhost -A | mysql", even though I noticed the manpage never explicitly recommends trying this (mysqldump into a file is a no-go. We're talking 500G of database). </p>
<p>This ... | [
{
"answer_id": 83381,
"author": "VolkerK",
"author_id": 4833,
"author_profile": "https://Stackoverflow.com/users/4833",
"pm_score": 4,
"selected": true,
"text": "<p>mysqldump by default performs a per-table lock of all involved tables. If you have many tables that can exceed the amount o... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15910/"
] | I have a RHEL 5 system with a fresh new hard drive I just dedicated to the MySQL server. To get things started, I used "mysqldump --host otherhost -A | mysql", even though I noticed the manpage never explicitly recommends trying this (mysqldump into a file is a no-go. We're talking 500G of database).
This process fai... | mysqldump by default performs a per-table lock of all involved tables. If you have many tables that can exceed the amount of file descriptors of the mysql server process.
Try --skip-lock-tables or if locking is imperative --lock-all-tables.
<http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html>
>
> ```
> --lock-al... |
83,260 | <p>Say I've got this array:
MyArray(0)="aaa"
MyArray(1)="bbb"
MyArray(2)="aaa"</p>
<p>Is there a .net function which can give me the unique values? I would like something like this as an output of the function:
OutputArray(0)="aaa"
OutputArray(1)="bbb"</p>
| [
{
"answer_id": 83280,
"author": "Stormenet",
"author_id": 2090,
"author_profile": "https://Stackoverflow.com/users/2090",
"pm_score": 2,
"selected": false,
"text": "<p>You could use a dictionary to add them with a key, and when you add them check if the key already exists.</p>\n\n<pre><c... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15928/"
] | Say I've got this array:
MyArray(0)="aaa"
MyArray(1)="bbb"
MyArray(2)="aaa"
Is there a .net function which can give me the unique values? I would like something like this as an output of the function:
OutputArray(0)="aaa"
OutputArray(1)="bbb" | Assuming you have .Net 3.5/LINQ:
```
string[] OutputArray = MyArray.Distinct().ToArray();
``` |
83,279 | <p>I'm developing a 3-column website using a layout like this:</p>
<pre><code> <div id='left' style='left: 0; width: 150px; '> ... </div>
<div id='middle' style='left: 150px; right: 200px' > ... </div>
<div id='right' style='right: 0; width: 200px; '> ... </div... | [
{
"answer_id": 83294,
"author": "Joshua",
"author_id": 11981,
"author_profile": "https://Stackoverflow.com/users/11981",
"pm_score": 0,
"selected": false,
"text": "<p>Try floating the div's to the left, that will keep them all on the same line - assuming there is enough spacing.</p>\n"
... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15931/"
] | I'm developing a 3-column website using a layout like this:
```
<div id='left' style='left: 0; width: 150px; '> ... </div>
<div id='middle' style='left: 150px; right: 200px' > ... </div>
<div id='right' style='right: 0; width: 200px; '> ... </div>
```
But, considering the default CSS 'posit... | If you haven't already checked out [A List Apart](http://www.alistapart.com/) you should, as it contains some excellent tutorials and guidelines for website design.
[This article](http://alistapart.com/articles/holygrail) in particular should help you out. |
83,319 | <p>I'm trying to figure out why the control does not honor ZIndex.</p>
<p>Example 1 - which works fine</p>
<pre><code> <Canvas>
<Rectangle Canvas.ZIndex="1" Height="400" Width="600" Fill="Yellow"/>
<Rectangle Canvas.ZIndex="2" Height="100" Width="100" Fill="Red"/>
</Canvas>... | [
{
"answer_id": 83338,
"author": "Abe Heidebrecht",
"author_id": 9268,
"author_profile": "https://Stackoverflow.com/users/9268",
"pm_score": 5,
"selected": true,
"text": "<p>Unfortunately this is because the WebBrowser control is a wrapper around the Internet Explorer COM control. This m... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15921/"
] | I'm trying to figure out why the control does not honor ZIndex.
Example 1 - which works fine
```
<Canvas>
<Rectangle Canvas.ZIndex="1" Height="400" Width="600" Fill="Yellow"/>
<Rectangle Canvas.ZIndex="2" Height="100" Width="100" Fill="Red"/>
</Canvas>
```
Example 2 - which does not work
```
... | Unfortunately this is because the WebBrowser control is a wrapper around the Internet Explorer COM control. This means that it gets its own HWND and does not allow WPF to draw anything over it. It has the same restrictions as hosting any other Win32 or WinForms control in WPF.
[MSDN](http://msdn.microsoft.com/en-us/li... |
83,329 | <p>I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of this file (i.e. the data for a single database) and place it in a new file. I know both the start and end line numbers of the data that I want.</p>
<p>Does anyone know a Unix command (or series of comman... | [
{
"answer_id": 83344,
"author": "Mark Janssen",
"author_id": 15828,
"author_profile": "https://Stackoverflow.com/users/15828",
"pm_score": 5,
"selected": false,
"text": "<p>You could use 'vi' and then the following command:</p>\n\n<pre><code>:16224,16482w!/tmp/some-file\n</code></pre>\n\... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15676/"
] | I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of this file (i.e. the data for a single database) and place it in a new file. I know both the start and end line numbers of the data that I want.
Does anyone know a Unix command (or series of commands) to ext... | ```
sed -n '16224,16482p;16483q' filename > newfile
```
From the [sed manual](https://www.gnu.org/software/sed/manual/sed.html#Common-Commands):
>
> **p** -
> Print out the pattern space (to the standard output). This command is usually only used in conjunction with the -n command-line option.
>
>
> **n** -
> ... |
83,397 | <p>In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value.</p>
<p>Within the text file I have:</p>
<pre><code>...
$table_id = 'crs_class'; // table name
$screen = 'crs_class.detail.screen.inc'; // file ide... | [
{
"answer_id": 83424,
"author": "VolkerK",
"author_id": 4833,
"author_profile": "https://Stackoverflow.com/users/4833",
"pm_score": 4,
"selected": true,
"text": "<p>use !==false instead of ===true<br />\nstripos returns the position as an integer if the needle is found. And that's never ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10583/"
] | In php I have open a .php file and want to evaluate certain lines. Specifically when the $table\_id and $line variables are assigned a value.
Within the text file I have:
```
...
$table_id = 'crs_class'; // table name
$screen = 'crs_class.detail.screen.inc'; // file identifying screen stru... | use !==false instead of ===true
stripos returns the position as an integer if the needle is found. And that's never ===bool.
You might also be interested in PHP's [tokenizer module](http://de2.php.net/tokenizer) or the [lexer package](http://pear.php.net/package/PHP_LexerGenerator) in the pear repository. |
83,410 | <p>I have a large CSV file and I want to execute a stored procedure for each line.</p>
<p>What is the best way to execute a stored procedure from PowerShell?</p>
| [
{
"answer_id": 83425,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 2,
"selected": false,
"text": "<p>Consider calling osql.exe (the command line tool for SQL Server) passing as parameter a text file written for each ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12767/"
] | I have a large CSV file and I want to execute a stored procedure for each line.
What is the best way to execute a stored procedure from PowerShell? | This answer was pulled from <http://www.databasejournal.com/features/mssql/article.php/3683181>
This same example can be used for any adhoc queries. Let us execute the stored procedure “sp\_helpdb” as shown below.
```
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "S... |
83,439 | <p>What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way?</p>
| [
{
"answer_id": 83468,
"author": "rupello",
"author_id": 635,
"author_profile": "https://Stackoverflow.com/users/635",
"pm_score": 5,
"selected": false,
"text": "<p>From <a href=\"http://www.gamedev.net/community/forums/topic.asp?topic_id=359650\" rel=\"noreferrer\">gamedev</a></p>\n\n<pr... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15947/"
] | What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way? | The best thing to do is to use the algorithm [`remove_if`](http://en.cppreference.com/w/cpp/algorithm/remove) and isspace:
```
remove_if(str.begin(), str.end(), isspace);
```
Now the algorithm itself can't change the container(only modify the values), so it actually shuffles the values around and returns a pointer t... |
83,471 | <p>Working with a SqlCommand in C# I've created a query that contains a IN (list...) part in the where clause. Instead of looping through my string list generating the list I need for the query (dangerous if you think in sqlInjection). I thought that I could create a parameter like:</p>
<pre><code>SELECT blahblahblah ... | [
{
"answer_id": 83525,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>You want to think about where that list comes from. Generally that information is in the database somewhere. For e... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15987/"
] | Working with a SqlCommand in C# I've created a query that contains a IN (list...) part in the where clause. Instead of looping through my string list generating the list I need for the query (dangerous if you think in sqlInjection). I thought that I could create a parameter like:
```
SELECT blahblahblah WHERE blahblah... | What you are trying to do is possible but not using your current approach. This is a very common problem with all possible solutions prior to SQL Server 2008 having trade offs related to performance, security and memory usage.
[This link shows some approaches for SQL Server 2000/2005](http://www.sqlteam.com/article/s... |
83,531 | <p>I'm trying to write a stored procedure to select employees who have birthdays that are upcoming. </p>
<p><code>SELECT * FROM Employees WHERE Birthday > @Today AND Birthday < @Today + @NumDays</code></p>
<p>This will not work because the birth year is part of Birthday, so if my birthday was '09-18-1983' that... | [
{
"answer_id": 83559,
"author": "p4bl0",
"author_id": 12043,
"author_profile": "https://Stackoverflow.com/users/12043",
"pm_score": 0,
"selected": false,
"text": "<p>You could use <a href=\"http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html\" rel=\"nofollow noreferrer\">... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2460/"
] | I'm trying to write a stored procedure to select employees who have birthdays that are upcoming.
`SELECT * FROM Employees WHERE Birthday > @Today AND Birthday < @Today + @NumDays`
This will not work because the birth year is part of Birthday, so if my birthday was '09-18-1983' that will not fall between '09-18-2008'... | *Note: I've edited this to fix what I believe was a significant bug. The currently posted version works for me.*
This should work after you modify the field and table names to correspond to your database.
```
SELECT
BRTHDATE AS BIRTHDAY
,FLOOR(DATEDIFF(dd,EMP.BRTHDATE,GETDATE()) / 365.25) AS AGE_NOW
,FLOOR(DATED... |
83,547 | <p>I have a decimal number (let's call it <strong>goal</strong>) and an array of other decimal numbers (let's call the array <strong>elements</strong>) and I need to find all the combinations of numbers from <strong>elements</strong> which sum to goal.</p>
<p>I have a preference for a solution in C# (.Net 2.0) but may... | [
{
"answer_id": 83596,
"author": "Rob Dickerson",
"author_id": 7530,
"author_profile": "https://Stackoverflow.com/users/7530",
"pm_score": 2,
"selected": false,
"text": "<p>I think you've got a <a href=\"http://en.wikipedia.org/wiki/Bin_packing_problem\" rel=\"nofollow noreferrer\">bin pa... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16005/"
] | I have a decimal number (let's call it **goal**) and an array of other decimal numbers (let's call the array **elements**) and I need to find all the combinations of numbers from **elements** which sum to goal.
I have a preference for a solution in C# (.Net 2.0) but may the best algorithm win irrespective.
Your metho... | Interesting answers. Thank you for the pointers to Wikipedia - whilst interesting - they don't actually solve the problem as stated as I was looking for exact matches - more of an accounting/book balancing problem than a traditional bin-packing / knapsack problem.
I have been following the development of stack overflo... |
83,553 | <p>I need to write a program used internally where different users will have different abilities within the program.</p>
<p>Rather than making users have a new username and password, how do I tie into an existing domain server's login system?</p>
<p>Assume .NET (C#, VB, ASP, etc)</p>
<p>-Adam</p>
| [
{
"answer_id": 83587,
"author": "Matt Everson",
"author_id": 7300,
"author_profile": "https://Stackoverflow.com/users/7300",
"pm_score": 3,
"selected": true,
"text": "<p>For WinForms, use System.Threading.Thread.CurrentPrincipal with the IsInRole() method to check which groups they are a... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] | I need to write a program used internally where different users will have different abilities within the program.
Rather than making users have a new username and password, how do I tie into an existing domain server's login system?
Assume .NET (C#, VB, ASP, etc)
-Adam | For WinForms, use System.Threading.Thread.CurrentPrincipal with the IsInRole() method to check which groups they are a member of. You do need to set the principal policy of the AppDomain to WindowsPrincipal first.
Use this to get the current user name:
```
private string getWindowsUsername()
{
AppDomain.CurrentDo... |
83,653 | <p>The following returns </p>
<blockquote>
<p>Type of conditional expression cannot be determined because there is no implicit conversion between 'double' and '<null>'</p>
</blockquote>
<pre><code>aNullableDouble = (double.TryParse(aString, out aDouble) ? aDouble : null)
</code></pre>
<hr>
<p>The reason why... | [
{
"answer_id": 83664,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 1,
"selected": false,
"text": "<pre><code>aNullableDouble = (double.TryParse(aString, out aDouble)?new Nullable<double>(aDouble):null)\n</code>... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | The following returns
>
> Type of conditional expression cannot be determined because there is no implicit conversion between 'double' and '<null>'
>
>
>
```
aNullableDouble = (double.TryParse(aString, out aDouble) ? aDouble : null)
```
---
The reason why I can't just use aNullableBool instead of the roundtri... | ```
aNullableDouble = double.TryParse(aString, out aDouble) ? (double?)aDouble : null;
``` |
83,674 | <p>I want to find records on a combination of created_on >= some date AND name IN some list of names.</p>
<p>For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names.</p>
<p>Is there a way to combine the two?</p>
| [
{
"answer_id": 83736,
"author": "Laurie Young",
"author_id": 7473,
"author_profile": "https://Stackoverflow.com/users/7473",
"pm_score": 6,
"selected": true,
"text": "<p>You can use named scopes in rails 2.1 and above</p>\n\n<pre><code>Class Test < ActiveRecord::Base\n named_scope :c... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1167846/"
] | I want to find records on a combination of created\_on >= some date AND name IN some list of names.
For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names.
Is there a way to combine the two? | You can use named scopes in rails 2.1 and above
```
Class Test < ActiveRecord::Base
named_scope :created_after_2005, :conditions => "created_on > 2005-01-01"
named_scope :named_fred, :conditions => { :name => "fred"}
end
```
then you can do
```
Test.created_after_2005.named_fred
```
Or you can give named\_sco... |
83,770 | <p>I'm trying to create a server control, which inherits from TextBox, that will automatically have a <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx" rel="nofollow noreferrer">CalendarExtender</a> attached to it. Is it possible to do this, or does my new control need to inherit from ... | [
{
"answer_id": 83951,
"author": "Joseph Daigle",
"author_id": 507,
"author_profile": "https://Stackoverflow.com/users/507",
"pm_score": 3,
"selected": true,
"text": "<p>I accomplished this in a project a while back. To do it I created a CompositeControl that contains both the TextBox and... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13583/"
] | I'm trying to create a server control, which inherits from TextBox, that will automatically have a [CalendarExtender](http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx) attached to it. Is it possible to do this, or does my new control need to inherit from CompositeControl instead? I've tried the... | I accomplished this in a project a while back. To do it I created a CompositeControl that contains both the TextBox and the CalendarExtender.
In the `CreateChildControls` method of the CompositeControl I use code similar to this:
```
TextBox textbox = new TextBox();
textbox.ID = this.ID + "Textbox";
textbox.Text = th... |
83,807 | <p>All I know about the constraint is it's name (<code>SYS_C003415</code>), but I want to see it's definition.</p>
| [
{
"answer_id": 83811,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 5,
"selected": false,
"text": "<p>Looks like I should be querying <code>ALL_CONSTRAINTS</code>.</p>\n\n<pre><code>select OWNER, CONSTRAINT_NAME, CONSTRAINT... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4203/"
] | All I know about the constraint is it's name (`SYS_C003415`), but I want to see it's definition. | Another option would be to reverse engineer the DDL...
```
DBMS_METADATA.GET_DDL('CONSTRAINT', 'SYS_C003415')
```
Some examples here....
<http://www.psoug.org/reference/dbms_metadata.html> |
83,856 | <p>I have a string coming from a table like "can no pay{1},as your payment{2}due on {3}". I want to replace {1} with some value , {2} with some value and {3} with some value .</p>
<p>Is it Possible to replace all 3 in one replace function ? or is there any way I can directly write query and get replaced value ? I wa... | [
{
"answer_id": 83910,
"author": "hamishmcn",
"author_id": 3590,
"author_profile": "https://Stackoverflow.com/users/3590",
"pm_score": 5,
"selected": true,
"text": "<p>Although it is not one call, you can nest the <code>replace()</code> calls:</p>\n\n<pre><code>SET mycol = replace( replac... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14299/"
] | I have a string coming from a table like "can no pay{1},as your payment{2}due on {3}". I want to replace {1} with some value , {2} with some value and {3} with some value .
Is it Possible to replace all 3 in one replace function ? or is there any way I can directly write query and get replaced value ? I want to replac... | Although it is not one call, you can nest the `replace()` calls:
```
SET mycol = replace( replace(mycol, '{1}', 'myoneval'), '{2}', mytwoval)
``` |
83,863 | <p>I want to find a way to develop database projects quickly in Visual Studio. Any ideas?</p>
| [
{
"answer_id": 83888,
"author": "Chris Woodruff",
"author_id": 7001,
"author_profile": "https://Stackoverflow.com/users/7001",
"pm_score": 3,
"selected": true,
"text": "<p>I have a method of creating and updating database projects in Visual Studio 2005 that I thought was common knowledge... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7001/"
] | I want to find a way to develop database projects quickly in Visual Studio. Any ideas? | I have a method of creating and updating database projects in Visual Studio 2005 that I thought was common knowledge. After asking a few coworkers if they knew how to update their database projects with this method and receiving no's, I thought I would blog about it and pass along some helpful hints and best practices.... |
83,887 | <p>Below is an example class hierarchy and code. What I'm looking for is a way to determine if 'ChildClass1' or 'ChildClass2' had the static method whoAmI() called on it without re-implementing it in each child class.</p>
<pre><code><?php
abstract class ParentClass {
public static function whoAmI () {
... | [
{
"answer_id": 83902,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 3,
"selected": false,
"text": "<p>I believe what you're referring to is a known php bug. Php 5.3 is aiming to address this issue with a new Late Stat... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15872/"
] | Below is an example class hierarchy and code. What I'm looking for is a way to determine if 'ChildClass1' or 'ChildClass2' had the static method whoAmI() called on it without re-implementing it in each child class.
```
<?php
abstract class ParentClass {
public static function whoAmI () {
// NOT correct,... | Now that PHP 5.3 is widely available in the wild, I wanted to put together a summary answer to this question to reflect newly available techniques.
As mentioned in the other answers, PHP 5.3 has introduced [Late Static Binding](http://php.benscom.com/manual/en/language.oop5.late-static-bindings.php) via a new [`stati... |
83,914 | <p>I've got a new varchar(10) field in a database with 1000+ records. I'd like to update the table so I can have random data in the field. I'm looking for a SQL solution.</p>
<p>I know I can use a cursor, but that seems inelegant.</p>
<p>MS-SQL 2000,BTW</p>
| [
{
"answer_id": 83932,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>You might be able to adapt something <a href=\"http://www.mitchelsellers.com/blogs/articletype/articleview/artic... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4230/"
] | I've got a new varchar(10) field in a database with 1000+ records. I'd like to update the table so I can have random data in the field. I'm looking for a SQL solution.
I know I can use a cursor, but that seems inelegant.
MS-SQL 2000,BTW | ```
update MyTable Set RandomFld = CONVERT(varchar(10), NEWID())
``` |
83,918 | <p>We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate?</p>
<p>Thanks<BR>
Tom</p>
| [
{
"answer_id": 83998,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You could programmatically configure log4j when you initialize the job.</p>\n\n<p>You can also set the log4j.properties file... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5659/"
] | We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate?
Thanks
Tom | Can you pass a Java system property for each job? If so, you can parameterize like this:
```
java -Dmy_var=somevalue my.job.Classname
```
And then in your log4j.properties:
```
log4j.appender.A.File=${my_var}/A.log
```
You could populate the Java system property with a value from the host's environment (for examp... |
83,953 | <pre><code>foreach ($_GET as $field => $label)
{
$datarray[]=$_GET[$field];
echo "$_GET[$field]";
echo "<br>";
}
print_r($datarray);
</code></pre>
<hr>
<p>This is the output I am getting. I see the data is there in datarray but when
I <code>echo $_GET[$field]</code> </p>
<p>I only get "Array"</p>
... | [
{
"answer_id": 84040,
"author": "Fernando Barrocal",
"author_id": 2274,
"author_profile": "https://Stackoverflow.com/users/2274",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code><pre></code> tags before <code>print_r</code>, then you will have a tree printed (or just look a... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
foreach ($_GET as $field => $label)
{
$datarray[]=$_GET[$field];
echo "$_GET[$field]";
echo "<br>";
}
print_r($datarray);
```
---
This is the output I am getting. I see the data is there in datarray but when
I `echo $_GET[$field]`
I only get "Array"
But `print_r($datarray)` prints all the data. Any i... | EDIT: When I completed your test, here was the final URL:
<http://hofstrateach.org/Roberto/process.php?keys=Grade1&keys=Nathan&keys=North%20America&keys=5&keys=3&keys=no&keys=foo&keys=blat&keys=0%3A0%3A24>
This is probably a malformed URL. When you pass duplicate keys in a query, PHP makes them an array. The above UR... |
83,962 | <p>Test the following code:</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
main()
{
const char *yytext="0";
const float f=(float)atof(yytext);
size_t t = *((size_t*)&f);
printf("t should be 0 but is %d\n", t);
}
</code></pre>
<p>Compile it with:</p>
<pre><code>gcc -O3 test.c
</... | [
{
"answer_id": 83997,
"author": "Tobi",
"author_id": 5422,
"author_profile": "https://Stackoverflow.com/users/5422",
"pm_score": 5,
"selected": true,
"text": "<p>Use the compiler flag -fno-strict-aliasing.</p>\n\n<p>With strict aliasing enabled, as it is by default for at least -O3, in t... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6605/"
] | Test the following code:
```
#include <stdio.h>
#include <stdlib.h>
main()
{
const char *yytext="0";
const float f=(float)atof(yytext);
size_t t = *((size_t*)&f);
printf("t should be 0 but is %d\n", t);
}
```
Compile it with:
```
gcc -O3 test.c
```
The GOOD output should be:
```
"t should be 0 bu... | Use the compiler flag -fno-strict-aliasing.
With strict aliasing enabled, as it is by default for at least -O3, in the line:
```
size_t t = *((size_t*)&f);
```
the compiler assumes that the size\_t\* does NOT point to the same memory area as the float\*. As far as I know, this is standards-compliant behaviour (adhe... |
83,983 | <p>example:</p>
<pre><code>a_list = [1, 2, 3]
a_list.len() # doesn't work
len(a_list) # works
</code></pre>
<p>Python being (very) object oriented, I don't understand why the 'len' function isn't inherited by the object.
Plus I keep trying the wrong solution since it appears as the logical one to me</p>
| [
{
"answer_id": 84016,
"author": "Bill Barksdale",
"author_id": 16113,
"author_profile": "https://Stackoverflow.com/users/16113",
"pm_score": 2,
"selected": false,
"text": "<p>Maybe you're looking for <code>__len__</code>. If that method exists, then len(a) calls it:</p>\n\n<pre><code>&g... | 2008/09/17 | [
"https://Stackoverflow.com/questions/83983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16070/"
] | example:
```
a_list = [1, 2, 3]
a_list.len() # doesn't work
len(a_list) # works
```
Python being (very) object oriented, I don't understand why the 'len' function isn't inherited by the object.
Plus I keep trying the wrong solution since it appears as the logical one to me | Guido's explanation is [here](http://mail.python.org/pipermail/python-3000/2006-November/004643.html):
>
> First of all, I chose len(x) over x.len() for HCI reasons (def \_\_len\_\_() came much later). There are two intertwined reasons actually, both HCI:
>
>
> (a) For some operations, prefix notation just reads be... |
84,007 | <p>Do you guys know how I can use the Curl command line to POST SOAP to test a web service?</p>
<p>I have a file (soap.xml) which has all the soap message attached to it I just don't seem to be able to properly post it.</p>
<p>Thanks!</p>
| [
{
"answer_id": 84046,
"author": "lbz",
"author_id": 11530,
"author_profile": "https://Stackoverflow.com/users/11530",
"pm_score": 6,
"selected": true,
"text": "<p>Posting a string:</p>\n\n<pre><code>curl -d \"String to post\" \"http://www.example.com/target\"\n</code></pre>\n\n<p>Posting... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13469/"
] | Do you guys know how I can use the Curl command line to POST SOAP to test a web service?
I have a file (soap.xml) which has all the soap message attached to it I just don't seem to be able to properly post it.
Thanks! | Posting a string:
```
curl -d "String to post" "http://www.example.com/target"
```
Posting the contents of a file:
```
curl -d @soap.xml "http://www.example.com/target"
``` |
84,064 | <p>I'm trying to use <code>SQLBindParameter</code> to prepare my driver for input via <code>SQLPutData</code>. The field in the database is a <code>TEXT</code> field. My function is crafted based on MS's example here:
<a href="http://msdn.microsoft.com/en-us/library/ms713824(VS.85).aspx" rel="nofollow noreferrer">http... | [
{
"answer_id": 85102,
"author": "gbjbaanb",
"author_id": 13744,
"author_profile": "https://Stackoverflow.com/users/13744",
"pm_score": 2,
"selected": true,
"text": "<p>you're passing NULL as the buffer length, this is an in/out param that shoudl be the size of the col_num parameter. Also... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1625/"
] | I'm trying to use `SQLBindParameter` to prepare my driver for input via `SQLPutData`. The field in the database is a `TEXT` field. My function is crafted based on MS's example here:
<http://msdn.microsoft.com/en-us/library/ms713824(VS.85).aspx>.
I've setup the environment, made the connection, and prepared my statemen... | you're passing NULL as the buffer length, this is an in/out param that shoudl be the size of the col\_num parameter. Also, you should pass a value for the ColumnSize or DecimalDigits parameters.
<http://msdn.microsoft.com/en-us/library/ms710963(VS.85).aspx> |
84,096 | <p>ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location.</p>
<p>The workaround I'm using is to add the keys from the non-standard location to the agent:</p>
<pre><code>ssh-agent
ssh-add /path/to/where/keys/really/are/id_rsa
</code></pre>
<p>(on Linux and ... | [
{
"answer_id": 84212,
"author": "roo",
"author_id": 716,
"author_profile": "https://Stackoverflow.com/users/716",
"pm_score": 5,
"selected": false,
"text": "<p><code>man ssh</code> gives me this options would could be useful.</p>\n<blockquote>\n<p>-i identity_file\nSelects a file from wh... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6329/"
] | ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location.
The workaround I'm using is to add the keys from the non-standard location to the agent:
```
ssh-agent
ssh-add /path/to/where/keys/really/are/id_rsa
```
(on Linux and MingW32 shell on Windows) | If you are only looking to point to a different location for you identity file, the you can modify your ~/.ssh/config file with the following entry:
```
IdentityFile ~/.foo/identity
```
`man ssh_config` to find other config options. |
84,102 | <p>I'd be interested in some before-and-after c# examples, some non-idiomatic vs idiomatic examples. Non-c# examples would be fine as well if they get the idea across. Thanks.</p>
| [
{
"answer_id": 84140,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 4,
"selected": false,
"text": "<p>Idiomatic code is code that does a common task in the common way for your language. It's similar to a design patt... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13578/"
] | I'd be interested in some before-and-after c# examples, some non-idiomatic vs idiomatic examples. Non-c# examples would be fine as well if they get the idea across. Thanks. | Idiomatic means following the conventions of the language. You want to find the easiest and most common ways of accomplishing a task rather than porting your knowledge from a different language.
non-idiomatic python using a loop with append:
```
mylist = [1, 2, 3, 4]
newlist = []
for i in mylist:
newlist.append(i... |
84,149 | <p>What is a good way to render data produced by a Java process in the browser? </p>
<p>I've made extensive use of JSP and the various associated frameworks (<a href="http://java.sun.com/products/jsp/jstl/" rel="nofollow noreferrer">JSTL</a>, <a href="http://struts.apache.org/" rel="nofollow noreferrer">Struts</a>, <a... | [
{
"answer_id": 84203,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Perhaps you could generate the data as XML and render it using XSLT?</p>\n\n<p>I'm not sure PHP or Ruby are the answer if Ja... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12457/"
] | What is a good way to render data produced by a Java process in the browser?
I've made extensive use of JSP and the various associated frameworks ([JSTL](http://java.sun.com/products/jsp/jstl/), [Struts](http://struts.apache.org/), [Tapestry](http://tapestry.apache.org/), etc), as well as more comprehensive framework... | I personally use [Tapestry 5](http://tapestry.apache.org/tapestry5/) for creating webpages with Java, but I agree that it can sometimes be a bit overkill. I would look into using JAX-RS ([java.net project](https://jsr311.dev.java.net/), [jsr311](http://jcp.org/en/jsr/detail?id=311)) it is pretty simple to use, it suppo... |
84,163 | <p>Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea. </p>
<p>Using PHP and/or HTML, create a page that cycles through any number of other pages at a given interval.</p>
<p>For instance, we would load this page and it would take us to... | [
{
"answer_id": 84190,
"author": "Jason Cohen",
"author_id": 4926,
"author_profile": "https://Stackoverflow.com/users/4926",
"pm_score": 1,
"selected": false,
"text": "<p>Use a separate iframe for the content, then use Javascript to <code>delay()</code> a period of time and set the iframe... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13399/"
] | Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea.
Using PHP and/or HTML, create a page that cycles through any number of other pages at a given interval.
For instance, we would load this page and it would take us to google for 20 se... | ```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; }
</style>
<script type="text/javascri... |
84,174 | <p>I have been trying out <a href="http://www.codeplex.com/servicefactory" rel="nofollow noreferrer">Service Factory</a> and have run into some problems in regards to long filenames - surpassing the limit in Vista/XP. The problem is that when generating code from the models service factory prefixes everything with the ... | [
{
"answer_id": 84250,
"author": "Loofer",
"author_id": 5552,
"author_profile": "https://Stackoverflow.com/users/5552",
"pm_score": 2,
"selected": false,
"text": "<p>I have always been in the fortunate position to have Red Gate <a href=\"http://www.red-gate.com/products/SQL_Compare/index.... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15771/"
] | I have been trying out [Service Factory](http://www.codeplex.com/servicefactory) and have run into some problems in regards to long filenames - surpassing the limit in Vista/XP. The problem is that when generating code from the models service factory prefixes everything with the namespace specified. Making the folder s... | I have always been in the fortunate position to have Red Gate [Schema compare](http://www.red-gate.com/products/SQL_Compare/index.htm) which i think would do what you ask. Cheap at twice the price! |
84,178 | <p>I'm running in a windows environment with Trac / SVN and I want commits to the repository to integrate to Trac and close the bugs that were noted in the SVN Comment.</p>
<p>I know there's some post commit hooks to do that, but there's not much information about how to do it on windows.</p>
<p>Anyone done it succes... | [
{
"answer_id": 84301,
"author": "Benjamin W. Smith",
"author_id": 1068060,
"author_profile": "https://Stackoverflow.com/users/1068060",
"pm_score": 0,
"selected": false,
"text": "<p>Post commit hooks live in the \"hooks\" directory where ever you have the repository living on the server ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5462/"
] | I'm running in a windows environment with Trac / SVN and I want commits to the repository to integrate to Trac and close the bugs that were noted in the SVN Comment.
I know there's some post commit hooks to do that, but there's not much information about how to do it on windows.
Anyone done it successfully? And what ... | Alright, now that I've got some time to post my experience after figuring this all out, and thanks to Craig for getting me on the right track. Here's what you need to do (at least with SVN v1.4 and Trac v0.10.3):
1. Locate your SVN repository that you want to enable the Post Commit Hook for.
2. inside the SVN reposito... |
84,209 | <p><strong>Introduction</strong></p>
<p>I've always been searching for a way to make Visual Studio draw a line after a certain amount of characters.</p>
<p>Below is a guide to enable these so called <em>guidelines</em> for various versions of Visual Studio.</p>
<p><strong>Visual Studio 2013 or later</strong></p>
<p>Ins... | [
{
"answer_id": 84325,
"author": "Rory MacLeod",
"author_id": 1016,
"author_profile": "https://Stackoverflow.com/users/1016",
"pm_score": 2,
"selected": false,
"text": "<p>The registry path for Visual Studio 2008 is the same, but with 9.0 as the version number:</p>\n\n<pre><code>HKEY_CURR... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11387/"
] | **Introduction**
I've always been searching for a way to make Visual Studio draw a line after a certain amount of characters.
Below is a guide to enable these so called *guidelines* for various versions of Visual Studio.
**Visual Studio 2013 or later**
Install Paul Harrington's [Editor Guidelines extension](http://... | This is originally from Sara's [blog](https://web.archive.org/web/20160221095812/http://blogs.msdn.com:80/b/saraford/archive/2004/11/15/257953.aspx).
It also works with almost any version of Visual Studio, you just need to change the "8.0" in the registry key to the appropriate version number for your version of Visua... |
84,278 | <p>How do I use <code>RelativeSource</code> with WPF bindings and what are the different use-cases?</p>
| [
{
"answer_id": 84314,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 5,
"selected": false,
"text": "<p>Don't forget TemplatedParent:</p>\n\n<pre><code><Binding RelativeSource=\"{RelativeSource TemplatedParent}\"/>\n</c... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4918/"
] | How do I use `RelativeSource` with WPF bindings and what are the different use-cases? | If you want to bind to another property on the object:
```
{Binding Path=PathToProperty, RelativeSource={RelativeSource Self}}
```
If you want to get a property on an ancestor:
```
{Binding Path=PathToProperty,
RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}}
```
If you want to get a prop... |
84,290 | <p>How do I get a a complete list of all the urls that my rails application could generate? </p>
<p>I don't want the routes that I get get form rake routes, instead I want to get the actul URLs corrosponding to all the dynmically generated pages in my application...</p>
<p>Is this even possible?</p>
<p>(Background: ... | [
{
"answer_id": 84482,
"author": "Jeremiah Peschka",
"author_id": 11780,
"author_profile": "https://Stackoverflow.com/users/11780",
"pm_score": 1,
"selected": false,
"text": "<p>You could pretty quickly hack together a program that grabs the output of <code>rake routes</code> and then par... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] | How do I get a a complete list of all the urls that my rails application could generate?
I don't want the routes that I get get form rake routes, instead I want to get the actul URLs corrosponding to all the dynmically generated pages in my application...
Is this even possible?
(Background: I'm doing this because I... | I was able to produce useful output with the following command:
```
$ wget --spider -r -nv -nd -np http://localhost:3209/ 2>&1 | ack -o '(?<=URL:)\S+'
http://localhost:3209/
http://localhost:3209/robots.txt
http://localhost:3209/agenda/2008/08
http://localhost:3209/agenda/2008/10
http://localhost:3209/agenda/2008/09/0... |
84,310 | <p>I'm connecting to an AS/400 stored procedure layer using the IBM iSeries Access for Windows package. This provides a .NET DLL with classes similar to those in the <code>System.Data</code> namespace. As such we use their implementation of the connection class and provide it with a connection string.</p>
<p>Does anyo... | [
{
"answer_id": 84374,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 1,
"selected": false,
"text": "<p>Are you using the Catalog Library List parameter for OLE DB? This is what my connection string typically looks like:</p>\n\n<... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12277/"
] | I'm connecting to an AS/400 stored procedure layer using the IBM iSeries Access for Windows package. This provides a .NET DLL with classes similar to those in the `System.Data` namespace. As such we use their implementation of the connection class and provide it with a connection string.
Does anyone know how I can ame... | Snippet from some Delphi source code using the Client Access Express Driver. Probably not exactly what you are looking for, but it may help others that stumble upon this post. **The `DBQ` part is the default library, and the `System` part is the AS400/DB2 host name.**
```
ConnectionString :=
'Driver={Client Access O... |
84,322 | <p>It appears that using perldoc perl gives the list of, e.g. perlre, perlvar, etc.</p>
<p>Is this the best place to find the list of what's available as an overview or tutorial or reference manual section? Is there another, better list?</p>
| [
{
"answer_id": 84367,
"author": "szabgab",
"author_id": 11827,
"author_profile": "https://Stackoverflow.com/users/11827",
"pm_score": 1,
"selected": false,
"text": "<p>See also <a href=\"https://stackoverflow.com/questions/70573/best-online-source-to-learn-perl\">best online source to le... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8763/"
] | It appears that using perldoc perl gives the list of, e.g. perlre, perlvar, etc.
Is this the best place to find the list of what's available as an overview or tutorial or reference manual section? Is there another, better list? | ```
perldoc perltoc
```
is a bit more verbose about the various documentation files. If you want a list of core modules, try
```
perldoc perlmodlib
``` |
84,330 | <p><strong>Here is the updated question:</strong></p>
<p>the current query is doing something like:<br></p>
<pre><code>$sql1 = "TRUNCATE TABLE fubar";
$sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu";
</code></pre>
<p>The first time the method containing this is run, it generates an er... | [
{
"answer_id": 84396,
"author": "Ben",
"author_id": 11522,
"author_profile": "https://Stackoverflow.com/users/11522",
"pm_score": 2,
"selected": false,
"text": "<p>how about:</p>\n\n<pre><code>DROP TABLE IF EXISTS fubar;\nCREATE TABLE fubar;\n</code></pre>\n\n<p>Or did you mean you just ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16186/"
] | **Here is the updated question:**
the current query is doing something like:
```
$sql1 = "TRUNCATE TABLE fubar";
$sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu";
```
The first time the method containing this is run, it generates an error message on the truncate since the table does... | shmuel613, it would be better to update your original question rather than replying. It's best if there's a single place containing the complete question rather than having it spread out in a discussion.
Ben's answer is reasonable, except he seems to have a 'not' where he doesn't want one. Dropping the table only if i... |
84,331 | <p>Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003?</p>
<p>I'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for example, all July data from a Sh... | [
{
"answer_id": 84430,
"author": "RickL",
"author_id": 7261,
"author_profile": "https://Stackoverflow.com/users/7261",
"pm_score": -1,
"selected": false,
"text": "<p>If this is just a one-off exercise, as an easier alternative, you could apply filters to your source data, and then copy an... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003?
I'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for example, all July data from a SharePoint w... | This works: The way it's set up I called it from the immediate pane, but you can easily create a sub() that will call MoveData once for each month, then just invoke the sub.
You may want to add logic to sort your monthly data after it's all been copied
```
Public Sub MoveData(MonthNumber As Integer, SheetName As Stri... |
84,341 | <p>I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program.</p>
<p>I'd like to analyse this core dump in gdb.</p>
<p>For example:</p>
<pre><code>gdb path/to/executable p... | [
{
"answer_id": 84546,
"author": "Drew Frezell",
"author_id": 10954,
"author_profile": "https://Stackoverflow.com/users/10954",
"pm_score": 7,
"selected": true,
"text": "<p>Start gdb without specifying the executable or core file, then type the following commands:</p>\n\n<pre><code>set so... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13956/"
] | I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program.
I'd like to analyse this core dump in gdb.
For example:
```
gdb path/to/executable path/to/corefile
```
My libr... | Start gdb without specifying the executable or core file, then type the following commands:
```
set solib-absolute-prefix ./usr
file path/to/executable
core-file path/to/corefile
```
You will need to make sure to mirror your library path exactly from the target system. The above is meant for debugging targets that d... |
84,421 | <p>Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent?</p>
<p>Something like the opposite of <a href="http://ruby-doc.org/core-2.0.0/String.html#method-i-to_i" rel="noreferrer"><code>String#to_i</code></a>:</p>
<pre><code>"0A".to_i(16) #=>10
</code></pre>
<p>Like perhaps:</p>
<... | [
{
"answer_id": 84455,
"author": "flxkid",
"author_id": 13036,
"author_profile": "https://Stackoverflow.com/users/13036",
"pm_score": 6,
"selected": false,
"text": "<p>How about using <a href=\"http://ruby-doc.org/core-2.0.0/String.html#method-i-25\" rel=\"noreferrer\"><code>%</code></a>/... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6106/"
] | Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent?
Something like the opposite of [`String#to_i`](http://ruby-doc.org/core-2.0.0/String.html#method-i-to_i):
```
"0A".to_i(16) #=>10
```
Like perhaps:
```
"0A".hex #=>10
```
I know how to roll my own, but it's probably more effic... | You can give [`to_s`](http://www.ruby-doc.org/core/classes/Integer.html#method-i-to_s) a base other than 10:
```
10.to_s(16) #=> "a"
```
Note that in ruby 2.4 `FixNum` and `BigNum` were unified in the `Integer` class.
If you are using an older ruby check the documentation of [FixNum#`to_s`](https://ruby-doc.org/co... |
84,427 | <p>Specifically, is the following legal C++?</p>
<pre>class A{};
void foo(A*);
void bar(const A&);
int main(void)
{
foo(&A()); // 1
bar(A()); // 2
}</pre>
<p>It appears to work correctly, but that doesn't mean it's necessarily legal. Is it?</p>
<p><i>Edit - changed <code>A&</code> to <code>const A&a... | [
{
"answer_id": 84457,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "https://Stackoverflow.com/users/15955",
"pm_score": -1,
"selected": false,
"text": "<p>Perfectly legal.</p>\n\n<p>The object will exist on the stack during the function call, just like any other lo... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9530/"
] | Specifically, is the following legal C++?
```
class A{};
void foo(A*);
void bar(const A&);
int main(void)
{
foo(&A()); // 1
bar(A()); // 2
}
```
It appears to work correctly, but that doesn't mean it's necessarily legal. Is it?
*Edit - changed `A&` to `const A&`* | 1: Taking the address of a temporary is not allowed. Visual C++ allows it as a language extension (language extensions are on by default).
2: This is perfectly legal. |
84,449 | <p>The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}.
The following XML, for example, when deserialized, sets the boolean property "Emulate" to <code>true</code>.</p>
<pre><code><root>
<emulate>1</emula... | [
{
"answer_id": 84514,
"author": "mdb",
"author_id": 8562,
"author_profile": "https://Stackoverflow.com/users/8562",
"pm_score": 1,
"selected": false,
"text": "<p>No, not using the default System.Xml.XmlSerializer: you'd need to change the data type to an int to achieve that, or muck arou... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8205/"
] | The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}.
The following XML, for example, when deserialized, sets the boolean property "Emulate" to `true`.
```
<root>
<emulate>1</emulate>
</root>
```
However, when I serial... | You can implement IXmlSerializable which will allow you to alter the serialized output of your class however you want. This will entail creating the 3 methods GetSchema(), ReadXml(XmlReader r) and WriteXml(XmlWriter r). When you implement the interface, these methods are called instead of .NET trying to serialize the o... |
84,460 | <p>I've been using Destop.open() to launch a .pdf viewer on Windows machines, both Vista and XP, and most of them work just fine. However, on one XP machine the call does not work, simply returning without throwing any exceptions, and the viewer does not launch. On that machine the file association is properly set up... | [
{
"answer_id": 84529,
"author": "Martin Spamer",
"author_id": 15527,
"author_profile": "https://Stackoverflow.com/users/15527",
"pm_score": 2,
"selected": false,
"text": "<p>This is a known problem with early versions of XP SP2, the ShellExecute function stopped accepting URIs; bring the... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16213/"
] | I've been using Destop.open() to launch a .pdf viewer on Windows machines, both Vista and XP, and most of them work just fine. However, on one XP machine the call does not work, simply returning without throwing any exceptions, and the viewer does not launch. On that machine the file association is properly set up as f... | This is a known problem with early versions of XP SP2, the ShellExecute function stopped accepting URIs; bring the XP machines patches up to date.
To view the exceptions make sure the Java Console is turned on:
```
Control Panel->Java Control Panel->Advanced->Java Console.
``` |
84,463 | <p>For example I want to be able to programatically hit a line of code like the following where the function name is dynamically assigned without using Evaluate(). The code below of course doesn't work but represents what I would like to do.</p>
<pre><code>application.obj[funcName](argumentCollection=params)
</code></... | [
{
"answer_id": 84836,
"author": "Ben Doom",
"author_id": 12267,
"author_profile": "https://Stackoverflow.com/users/12267",
"pm_score": 4,
"selected": true,
"text": "<p>According to the docs, you can do something like this:</p>\n\n<pre><code><!--- Create the component instance. --->... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8345/"
] | For example I want to be able to programatically hit a line of code like the following where the function name is dynamically assigned without using Evaluate(). The code below of course doesn't work but represents what I would like to do.
```
application.obj[funcName](argumentCollection=params)
```
The only way I ca... | According to the docs, you can do something like this:
```
<!--- Create the component instance. --->
<cfobject component="tellTime2" name="tellTimeObj">
<!--- Invoke the methods. --->
<cfinvoke component="#tellTimeObj#" method="getLocalTime" returnvariable="localTime">
<cfinvoke component="#tellTimeObj#" method="getUT... |
84,486 | <p>I've spent far too much time trying to figure this out. This should be the simplest thing and everyone who distributes Java applications in jars must have to deal with it.</p>
<p>I just want to know the proper way to add versioning to my Java app so that I can access the version information when I'm testing, e.g. ... | [
{
"answer_id": 84606,
"author": "Juan Pablo Morales",
"author_id": 16238,
"author_profile": "https://Stackoverflow.com/users/16238",
"pm_score": 0,
"selected": false,
"text": "<p>Just don't use the manifest. Create a foo.properties.original file, with a content such as\nversion=@VERSION@... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16216/"
] | I've spent far too much time trying to figure this out. This should be the simplest thing and everyone who distributes Java applications in jars must have to deal with it.
I just want to know the proper way to add versioning to my Java app so that I can access the version information when I'm testing, e.g. debugging i... | You can get the manifest for an arbitrary class in an arbitrary jar without parsing the class url (which could be brittle). Just locate a resource that you know is in the jar you want, and then cast the connection to JarURLConnection.
If you want the code to work when the class is not bundled in a jar, add an instanc... |
84,506 | <p>I find from reading perldoc perlvar, about a thousand lines in is help for %ENV. Is there a way to find that from the command line directly?</p>
<p>On my Windows machine, I've tried the following</p>
<pre><code>perldoc ENV
perldoc %ENV
perldoc %%ENV
perldoc -r ENV (returns info about Use Env)
perldoc -r %ENV
perld... | [
{
"answer_id": 84741,
"author": "amoore",
"author_id": 7573,
"author_profile": "https://Stackoverflow.com/users/7573",
"pm_score": -1,
"selected": false,
"text": "<p>If you'd like to see the contents of your %ENV, you can use Data::Dumper to print it out in a rather readable format:</p>\... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8763/"
] | I find from reading perldoc perlvar, about a thousand lines in is help for %ENV. Is there a way to find that from the command line directly?
On my Windows machine, I've tried the following
```
perldoc ENV
perldoc %ENV
perldoc %%ENV
perldoc -r ENV (returns info about Use Env)
perldoc -r %ENV
perldoc -r %%%ENV
perldoc ... | perldoc doesn't have an option to search for a particular entry in perlvar (like -f does for perlfunc). General searching is dependent on your pager (specified in the PAGER environment variable). Personally, I like "less." You can get [less for windows](http://gnuwin32.sourceforge.net/packages/less.htm) from the [GnuWi... |
84,615 | <p>If one wants to paginate results from a data source that supports pagination we have to go to a process of:</p>
<ol>
<li>defining the page size - that is the number of results to show per page;</li>
<li>fetch each page requested by the user using an offset = page number (0 based) * page size</li>
<li>show the resul... | [
{
"answer_id": 84665,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 3,
"selected": true,
"text": "<p>There are a few schools of thought o this.</p>\n\n<ol>\n<li>data gets updated let it be</li>\n<li>You could imple... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6508/"
] | If one wants to paginate results from a data source that supports pagination we have to go to a process of:
1. defining the page size - that is the number of results to show per page;
2. fetch each page requested by the user using an offset = page number (0 based) \* page size
3. show the results of the fetched page.
... | There are a few schools of thought o this.
1. data gets updated let it be
2. You could implement some sort of caching method that will hold the
entire result set (This might not be
an option if working with really
large Datasets)
3. You could do a comparison on each page operation and notify the
user if the total reco... |
84,641 | <p>I have the following code:</p>
<pre><code>$bind = new COM("LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local");
</code></pre>
<p>When I execute it from a command-prompt, it runs fine. When it runs under IIS/PHP/ISAPI, it barfs.</p>
<pre><code>Fatal error: Uncaught exception 'com_exception' with messa... | [
{
"answer_id": 84808,
"author": "CodeRot",
"author_id": 14134,
"author_profile": "https://Stackoverflow.com/users/14134",
"pm_score": 3,
"selected": true,
"text": "<p>Since you're using Windows Authentication in IIS, you may have some security events in the Windows Event log. I would che... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2581/"
] | I have the following code:
```
$bind = new COM("LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local");
```
When I execute it from a command-prompt, it runs fine. When it runs under IIS/PHP/ISAPI, it barfs.
```
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `LDAP:... | Since you're using Windows Authentication in IIS, you may have some security events in the Windows Event log. I would check the Event log for Security Events as well as Application Events and see if you're hitting any sort of permissions issues.
Also, since you're basically just communicating to AD via LDAP...you mig... |
84,644 | <p>To make it short: hibernate doesn't support projections and query by example? I found this post:</p>
<p>The code is this:</p>
<pre><code>User usr = new User();
usr.setCity = 'TEST';
getCurrentSession().createCriteria(User.class)
.setProjection( Projections.distinct( Projections.projectionList()
.add( Projections.p... | [
{
"answer_id": 86752,
"author": "Arthur Thomas",
"author_id": 14009,
"author_profile": "https://Stackoverflow.com/users/14009",
"pm_score": 5,
"selected": true,
"text": "<p>Can I see your User class? This is just using restrictions below. I don't see why Restrictions would be really an... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | To make it short: hibernate doesn't support projections and query by example? I found this post:
The code is this:
```
User usr = new User();
usr.setCity = 'TEST';
getCurrentSession().createCriteria(User.class)
.setProjection( Projections.distinct( Projections.projectionList()
.add( Projections.property("name"), "nam... | Can I see your User class? This is just using restrictions below. I don't see why Restrictions would be really any different than Examples (I think null fields get ignored by default in examples though).
```
getCurrentSession().createCriteria(User.class)
.setProjection( Projections.distinct( Projections.projectionList... |
84,661 | <p>Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example:</p>
<pre><code>create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number
is
Result number(12,2);
begin
Result := 10000;
IF char ... | [
{
"answer_id": 84695,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 0,
"selected": false,
"text": "<p>Well, are you sure you have the name and the right in the correct order in that declaration?</p>\n\n<p>It complains... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16206/"
] | Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example:
```
create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number
is
Result number(12,2);
begin
Result := 10000;
IF char <> 'EUR' THEN
... | I believe that this is controlled by the parameter PLSQL\_WARNINGS, documented for 10gR2 here: <http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams166.htm#REFRN10249> |
84,680 | <p>I'm writing a Spring web application that requires users to login. My company has an Active Directory server that I'd like to make use of for this purpose. However, I'm having trouble using Spring Security to connect to the server.</p>
<p>I'm using Spring 2.5.5 and Spring Security 2.0.3, along with Java 1.6.</p>
... | [
{
"answer_id": 86367,
"author": "delfuego",
"author_id": 16414,
"author_profile": "https://Stackoverflow.com/users/16414",
"pm_score": 6,
"selected": true,
"text": "<p>I had the same banging-my-head-against-the-wall experience you did, and ended up writing a custom authentication provide... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13379/"
] | I'm writing a Spring web application that requires users to login. My company has an Active Directory server that I'd like to make use of for this purpose. However, I'm having trouble using Spring Security to connect to the server.
I'm using Spring 2.5.5 and Spring Security 2.0.3, along with Java 1.6.
If I change the... | I had the same banging-my-head-against-the-wall experience you did, and ended up writing a custom authentication provider that does an LDAP query against the Active Directory server.
So my security-related beans are:
```
<beans:bean id="contextSource"
class="org.springframework.security.ldap.DefaultSpringSecurity... |
84,716 | <p>I use the jQuery <a href="http://docs.jquery.com/Utilities/jQuery.extend" rel="nofollow noreferrer">extend</a> function to extend a class prototype.</p>
<p>For example:</p>
<pre><code>MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidget.prototype, {
// object variables
widget_name: '',... | [
{
"answer_id": 84824,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https://Stackoverflow.com/users/6760",
"pm_score": 6,
"selected": false,
"text": "<p>I quite like John Resig's <a href=\"http://ejohn.org/blog/simple-javascript-inheritance/\" rel=\"noreferrer\">Simpl... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13850/"
] | I use the jQuery [extend](http://docs.jquery.com/Utilities/jQuery.extend) function to extend a class prototype.
For example:
```
MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidget.prototype, {
// object variables
widget_name: '',
init: function(widget_name) {
// do initializati... | I quite like John Resig's [Simple JavaScript Inheritance](http://ejohn.org/blog/simple-javascript-inheritance/).
```
var MyWidget = Class.extend({
init: function(widget_name){
this.widget_name = widget_name;
},
doSomething: function() {
alert('my name is ' + this.widget_name);
}
});
```
NB: The "Cla... |
84,717 | <p>What are the best conventions of naming testing-assemblies in .NET (or any other language or platform)?</p>
<p>What I'm mainly split between are these options (please provide others!):</p>
<ul>
<li><strong>Company.Website</strong> - <em>the project</em></li>
<li><strong>Company.Website.Tests</strong></li>
</ul>
<... | [
{
"answer_id": 84742,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 4,
"selected": false,
"text": "<p>I personally would go with</p>\n\n<p>Company.Tests.Website</p>\n\n<p>That way you have a common tests namespace ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429/"
] | What are the best conventions of naming testing-assemblies in .NET (or any other language or platform)?
What I'm mainly split between are these options (please provide others!):
* **Company.Website** - *the project*
* **Company.Website.Tests**
*or*
* **Company.Website**
* **Company.WebsiteTests**
The problem with ... | I will go with
```
* Company.Website - the project
* Company.Website.Tests
```
The short reason and answer is simple, testing and project are linked in code, therefore it should share namespace.
If you want splitting of code and testing in a solution you have that option anyway. e.g. you can set up a solution with... |
84,759 | <p>This is an Eclipse question, and you can assume the Java package for all these Eclipse classes is <code>org.eclipse.core.resources</code>. </p>
<p>I want to get an <code>IFile</code> corresponding to a location <code>String</code> I have:</p>
<pre><code> "platform:/resource/Tracbility_All_Supported_lib/processes/... | [
{
"answer_id": 85074,
"author": "Paul Reiners",
"author_id": 7648,
"author_profile": "https://Stackoverflow.com/users/7648",
"pm_score": 2,
"selected": false,
"text": "<pre><code>String platformLocationString = portTypeContainer\n .getLocation();\nString locationString = platformL... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7648/"
] | This is an Eclipse question, and you can assume the Java package for all these Eclipse classes is `org.eclipse.core.resources`.
I want to get an `IFile` corresponding to a location `String` I have:
```
"platform:/resource/Tracbility_All_Supported_lib/processes/gastuff/globalht/GlobalHTInterface.wsdl"
```
I have t... | org.eclipse.core.runtime.Path implements IPath.
```
IPath p = new Path(locationString);
IWorkspaceRoot.getFileForLocation(p);
```
This would have worked had the location string not been a URL of type "platform:"
For this particular case, notes in org.eclipse.core.runtime.Platform javadoc indicate that the "correct"... |
84,782 | <p>I am writting JAVA programme using JDBC for database conntectivity , I am calling one stored procedure in that which is returning ORACLE REF CURSOR , IS there any way I can handle that without importing ORACLE PACKAGES ?</p>
| [
{
"answer_id": 85766,
"author": "jwiklund",
"author_id": 4208,
"author_profile": "https://Stackoverflow.com/users/4208",
"pm_score": 2,
"selected": true,
"text": "<p>I think I tried to do this a while ago and kind of gave up (I guess you could figure out what int value the OracleTypes.RE... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14299/"
] | I am writting JAVA programme using JDBC for database conntectivity , I am calling one stored procedure in that which is returning ORACLE REF CURSOR , IS there any way I can handle that without importing ORACLE PACKAGES ? | I think I tried to do this a while ago and kind of gave up (I guess you could figure out what int value the OracleTypes.REF\_CURSOR is and then use that int value, but that's a hack). If you got the patience you could define a record (or object) type and define the the cursor as a cursor with type since that can be cas... |
84,795 | <p>How can I optimize the following code, which currently takes over 2 minutes to retrieve and loop through 800+ records from a pool of over 100K records, returning 6 fields per record (adds approximately 20 seconds per additional field):</p>
<pre><code><cfset dllPath="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\S... | [
{
"answer_id": 85077,
"author": "x0n",
"author_id": 6920,
"author_profile": "https://Stackoverflow.com/users/6920",
"pm_score": 2,
"selected": false,
"text": "<p>It's been a long time since I touched CF, but I can give some hints in pseudo-code. For one thing, this expression is extremel... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16289/"
] | How can I optimize the following code, which currently takes over 2 minutes to retrieve and loop through 800+ records from a pool of over 100K records, returning 6 fields per record (adds approximately 20 seconds per additional field):
```
<cfset dllPath="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.DirectorySe... | How large is the list of items for the inner loop?
Switching to an array *might* be faster if there is a significantly large number of items.
I have implemented this alongside x0n's suggestions...
```
<cfset dllPath="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.DirectoryServices.dll" />
<cfset LDAPPath="LDAP:... |
84,800 | <p>I am looking for an efficient way to pull the data I want out of an array called $submission_info so I can easily auto-fill my form fields. The array size is about 120.</p>
<p>I want to find the field name and extract the content. In this case, the field name is <strong>loanOfficer</strong> and the content is <stro... | [
{
"answer_id": 85069,
"author": "Michael Brown",
"author_id": 14359,
"author_profile": "https://Stackoverflow.com/users/14359",
"pm_score": 0,
"selected": false,
"text": "<p>I'm assuming that php has an associative array (commonly called dictionary or hashtable). The most efficient routi... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16292/"
] | I am looking for an efficient way to pull the data I want out of an array called $submission\_info so I can easily auto-fill my form fields. The array size is about 120.
I want to find the field name and extract the content. In this case, the field name is **loanOfficer** and the content is **John Doe**.
```
Output o... | You're probably best off going through each entry and creating a new associative array out of it.
```
foreach($submission_info as $elem) {
$newarray[$elem["field_name"]] = $elem["content"];
}
```
Then you can just find the form fields by getting the value from $newarray[*<field you're filling in>*]. Otherwise, y... |
84,842 | <p>I'm programmatically adding ToolStripButton items to a context menu.</p>
<p>That part is easy.</p>
<pre><code>this.tsmiDelete.DropDownItems.Add("The text on the item.");
</code></pre>
<p>However, I also need to wire up the events so that when the user clicks the item something actually happens!</p>
<p>How do I d... | [
{
"answer_id": 84909,
"author": "Andy",
"author_id": 3857,
"author_profile": "https://Stackoverflow.com/users/3857",
"pm_score": 3,
"selected": true,
"text": "<p>Couldn't you just subscribe to the Click event? Something like this:</p>\n\n<pre><code>ToolStripButton btn = new ToolStripButt... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7837/"
] | I'm programmatically adding ToolStripButton items to a context menu.
That part is easy.
```
this.tsmiDelete.DropDownItems.Add("The text on the item.");
```
However, I also need to wire up the events so that when the user clicks the item something actually happens!
How do I do this? The method that handles the clic... | Couldn't you just subscribe to the Click event? Something like this:
```
ToolStripButton btn = new ToolStripButton("The text on the item.");
this.tsmiDelete.DropDownItems.Add(btn);
btn.Click += new EventHandler(OnBtnClicked);
```
And OnBtnClicked would be declared like this:
```
private void OnBtnClicked(object sen... |
84,847 | <p>How do I create a self-signed certificate for code signing using tools from the Windows SDK?</p>
| [
{
"answer_id": 201277,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 10,
"selected": true,
"text": "<h2>Updated Answer</h2>\n<p>If you are using the following Windows versions or later: Windows Server 2012, Windows S... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8446/"
] | How do I create a self-signed certificate for code signing using tools from the Windows SDK? | Updated Answer
--------------
If you are using the following Windows versions or later: Windows Server 2012, Windows Server 2012 R2, or Windows 8.1 then [MakeCert is now deprecated](https://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx), and Microsoft recommends using [the PowerShell Cmdlet *... |
84,882 | <p>This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.</p>
<p>There are a lot of times when I just want to append something to <code>/etc/hosts</code> or a similar file but end up not being able to because both <code>></code> and <code>>></code> are not allo... | [
{
"answer_id": 84898,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": false,
"text": "<pre><code>sudo sh -c \"echo 127.0.0.1 localhost >> /etc/hosts\"\n</code></pre>\n"
},
{
"answer_id": 84... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9908/"
] | This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.
There are a lot of times when I just want to append something to `/etc/hosts` or a similar file but end up not being able to because both `>` and `>>` are not allowed, even with root.
Is there someway to make this ... | Use `tee --append` or `tee -a`.
```
echo 'deb blah ... blah' | sudo tee -a /etc/apt/sources.list
```
Make sure to avoid quotes inside quotes.
To avoid printing data back to the console, redirect the output to /dev/null.
```
echo 'deb blah ... blah' | sudo tee -a /etc/apt/sources.list > /dev/null
```
Remember abo... |
84,885 | <p>Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality. I've been using it for a while (with a simple PInvoke, will post code later). I'm looking to see if there's a better and/or more robust way.</p>
<p>Thanks.</p>
| [
{
"answer_id": 154634,
"author": "Jon Dewees",
"author_id": 1365,
"author_profile": "https://Stackoverflow.com/users/1365",
"pm_score": 4,
"selected": true,
"text": "<p>As promised, here is the code for integrating with JDEdewards using XML. It's a webservice, but could be used as you se... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1365/"
] | Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality. I've been using it for a while (with a simple PInvoke, will post code later). I'm looking to see if there's a better and/or more robust way.
Thanks. | As promised, here is the code for integrating with JDEdewards using XML. It's a webservice, but could be used as you see fit.
```
namespace YourNameSpace
```
{
```
/// <summary>
/// This webservice allows you to submit JDE XML CallObject requests via a c# webservice
/// </summary>
[WebService(Namespace = "http://We... |
84,932 | <p>I have Perl script and need to determine the full path and filename of the script during execution. I discovered that depending on how you call the script <code>$0</code> varies and sometimes contains the <code>fullpath+filename</code> and sometimes just <code>filename</code>. Because the working directory can vary ... | [
{
"answer_id": 84952,
"author": "foxxtrot",
"author_id": 10369,
"author_profile": "https://Stackoverflow.com/users/10369",
"pm_score": -1,
"selected": false,
"text": "<p>On *nix, you likely have the \"whereis\" command, which searches your $PATH looking for a binary with a given name. I... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16331/"
] | I have Perl script and need to determine the full path and filename of the script during execution. I discovered that depending on how you call the script `$0` varies and sometimes contains the `fullpath+filename` and sometimes just `filename`. Because the working directory can vary as well I can't think of a way to re... | There are a few ways:
* [`$0`](http://perldoc.perl.org/perlvar.html#$0) is the currently executing script as provided by POSIX, relative to the current working directory if the script is at or below the CWD
* Additionally, `cwd()`, `getcwd()` and `abs_path()` are provided by the [`Cwd`](http://perldoc.perl.org/Cwd.htm... |
84,978 | <p>Excel usually treats Conditional Formatting formulas as if they are array formulas, <strong>except</strong> when loading them from an Excel 2002/2003 XML Spreadsheet file.</p>
<p>This is only an issue with the Excel 2002/2003 XML Spreadsheet format... the native Excel format works fine, as does the newer Excel 200... | [
{
"answer_id": 86251,
"author": "TMarshall",
"author_id": 8847,
"author_profile": "https://Stackoverflow.com/users/8847",
"pm_score": 2,
"selected": true,
"text": "<p>I tried to recreate the problem you describe. Here is what I found.</p>\n\n<ul>\n<li><p>Could consistently recreate the\n... | 2008/09/17 | [
"https://Stackoverflow.com/questions/84978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16306/"
] | Excel usually treats Conditional Formatting formulas as if they are array formulas, **except** when loading them from an Excel 2002/2003 XML Spreadsheet file.
This is only an issue with the Excel 2002/2003 XML Spreadsheet format... the native Excel format works fine, as does the newer Excel 2007 XML format (xlsx).
Af... | I tried to recreate the problem you describe. Here is what I found.
* Could consistently recreate the
problem using Excel 2003 on Windows
XP when saving as an XML
spreadsheet.
* Could **not** reproduce the problem
using Excel 2003 on Windows XP when
saving as a standard xls
spreadsheet.
* Could **not** reproduce the p... |
85,006 | <p>I have loaded image into a new, initialized Oracle ORDImage object and am processing it by PL/SQL. I can read its properties, but cannot process it with the process() method. </p>
<pre><code>vLocalImage ORDImage := ORDImage.init();
...
vLocalImage.source.localdata := PORTAL.wwdoc_admin.get_document_blob_content(pFi... | [
{
"answer_id": 91876,
"author": "Matthew Watson",
"author_id": 3839,
"author_profile": "https://Stackoverflow.com/users/3839",
"pm_score": 0,
"selected": false,
"text": "<p>Can you please show the select statement you use to get l_ordimage? The main cause of this error seems to be if you... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9363/"
] | I have loaded image into a new, initialized Oracle ORDImage object and am processing it by PL/SQL. I can read its properties, but cannot process it with the process() method.
```
vLocalImage ORDImage := ORDImage.init();
...
vLocalImage.source.localdata := PORTAL.wwdoc_admin.get_document_blob_content(pFile);
vLocalIma... | Even though the documentation states that it should be possible to edit an ORDImage "in-place", I was unable to make it work.
Instead, I created a new ORDImage object and used processCopy:
```
vNewImage ORDImage;
...
vLocalImage.processCopy('maxScale 534 401', vNewImage);
``` |
85,019 | <p>Google Maps used to do this bit where when you hit the "Print" link, what would be sent to the printer wasn't exactly what you had on the screen, but rather a differently-formatted version of mostly the same information.</p>
<p>It appears that they've largely moved away from this concept (I guess people di... | [
{
"answer_id": 85026,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 2,
"selected": false,
"text": "<p>You can do this with the css when you specify media as print.</p>\n"
},
{
"answer_id": 85039,
"author": "Jim"... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2577/"
] | Google Maps used to do this bit where when you hit the "Print" link, what would be sent to the printer wasn't exactly what you had on the screen, but rather a differently-formatted version of mostly the same information.
It appears that they've largely moved away from this concept (I guess people didn't understand it)... | You can achieve this effect by creating a css stylesheet which is targeted directly to printing, and another targeted directly for the screen.
Use the link tag:
```
<link rel="stylesheet" type="text/css" href="print.css" media="print, handheld" />
<link rel="stylesheet" type="text/css" href="screen.css" media="screen... |
85,033 | <p>I am wrapping a native C++ class, which has the following methods:</p>
<pre><code>class Native
{
public:
class Local
{
std::string m_Str;
int m_Int;
};
typedef std::vector<Local> LocalVec;
typedef LocalVec::iterator LocalIter;
LocalIter BeginLocals();
LocalIte... | [
{
"answer_id": 85402,
"author": "Philip Rieck",
"author_id": 12643,
"author_profile": "https://Stackoverflow.com/users/12643",
"pm_score": 4,
"selected": true,
"text": "<p>Iterators aren't exactly translatable to \"the .net way\", but they are roughly replaced by IEnumerable < T > and... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3114/"
] | I am wrapping a native C++ class, which has the following methods:
```
class Native
{
public:
class Local
{
std::string m_Str;
int m_Int;
};
typedef std::vector<Local> LocalVec;
typedef LocalVec::iterator LocalIter;
LocalIter BeginLocals();
LocalIter EndLocals();
... | Iterators aren't exactly translatable to "the .net way", but they are roughly replaced by IEnumerable < T > and IEnumerator < T >.
Rather than
```
vector<int> a_vector;
vector<int>::iterator a_iterator;
for(int i= 0; i < 100; i++)
{
a_vector.push_back(i);
}
int total = 0;
a_iterator = a_vector.be... |
85,034 | <p>I want to make a table in SqlServer that will add, on insert, a auto incremented primary key. This should be an autoincremented id similar to MySql auto_increment functionality. (Below)</p>
<pre><code>create table foo
(
user_id int not null auto_increment,
name varchar(50)
)
</code></pre>
<p>Is there a ... | [
{
"answer_id": 85038,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 2,
"selected": false,
"text": "<p>Just set the field as an <a href=\"http://msdn.microsoft.com/en-us/library/aa933196.aspx\" rel=\"nofollow noreferrer\">ide... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12942/"
] | I want to make a table in SqlServer that will add, on insert, a auto incremented primary key. This should be an autoincremented id similar to MySql auto\_increment functionality. (Below)
```
create table foo
(
user_id int not null auto_increment,
name varchar(50)
)
```
Is there a way of doing this with out... | Like this
```
create table foo
(
user_id int not null identity,
name varchar(50)
)
``` |
85,036 | <p>I need to manually migrate modified stored procedures from a DEV SQL Server 2005 database instance to a TEST instance. Except for the changes I'm migrating, the databases have the same schemas. How can I quickly identify which stored procedures have been modified in the DEV database for migration to the TEST insta... | [
{
"answer_id": 85075,
"author": "Craig",
"author_id": 7861,
"author_profile": "https://Stackoverflow.com/users/7861",
"pm_score": 2,
"selected": false,
"text": "<p>Although not free I have had good experience using Red-Gates <a href=\"http://www.red-gate.com/products/SQL_Compare/index.ht... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16137/"
] | I need to manually migrate modified stored procedures from a DEV SQL Server 2005 database instance to a TEST instance. Except for the changes I'm migrating, the databases have the same schemas. How can I quickly identify which stored procedures have been modified in the DEV database for migration to the TEST instance?
... | instead of using sysobjects which is not recommended anymore use sys.procedures
```
select name,create_date,modify_date
from sys.procedures
order by modify_date desc
```
you can do the where clause yourself but this will list it in order of modification date descending |
85,058 | <p>I see <a href="http://www.is-research.de/info/vmlanguages/index.html" rel="noreferrer">here</a> that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So:</p>
<p>What is the advantage in having other languages for the... | [
{
"answer_id": 85072,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>They do it to keep up with .Net. .Net allows C#, VB, J# (formerly), F#, Python, Ruby (coming soon), and c++. I'm p... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142/"
] | I see [here](http://www.is-research.de/info/vmlanguages/index.html) that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So:
What is the advantage in having other languages for the JVM?
What is required (in high level... | To address your three questions separately:
>
> What is the advantage in having other languages for the JVM?
>
>
>
There are two factors here. (1) Why have a language other than Java for the JVM, and (2) why have another language run on the JVM, instead of a different runtime?
1. Other languages can satisfy oth... |
85,085 | <p>I've got an RMI call defined as:</p>
<pre><code>public void remoteGetCustomerNameNumbers(ArrayList<String> customerNumberList, ArrayList<String> customerNameList) throws java.rmi.RemoteException;
</code></pre>
<p>The function does a database lookup and populates the two ArrayLists. The calling functio... | [
{
"answer_id": 85126,
"author": "ScArcher2",
"author_id": 1310,
"author_profile": "https://Stackoverflow.com/users/1310",
"pm_score": 1,
"selected": false,
"text": "<p>You lose your references when you make the remote call. You'll need to return the lists rather than expect them to be po... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16345/"
] | I've got an RMI call defined as:
```
public void remoteGetCustomerNameNumbers(ArrayList<String> customerNumberList, ArrayList<String> customerNameList) throws java.rmi.RemoteException;
```
The function does a database lookup and populates the two ArrayLists. The calling function gets nothing. I believe this works wi... | As Tom mentions, you can pass remote objects. You'd have to create a class to hold your list that implements Remote. Anytime you pass something that implements Remote as an argument, whenever the receiving side uses it, it turns around and makes a remote call *back* to the caller to work with that object. |
85,091 | <p>OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward, most of the code in the .aspx.vb, and a few classes in App_Code.</p>
<p>The problem, which has begun to occur only today (even though most of the code was already written), is that once in a while, I have this error message :</p>
... | [
{
"answer_id": 85333,
"author": "HaveThunk",
"author_id": 14515,
"author_profile": "https://Stackoverflow.com/users/14515",
"pm_score": 3,
"selected": false,
"text": "<p>Sounds like a pre compile issue, particularly because you mention that you get the error and then wait and it disappea... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6776/"
] | OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward, most of the code in the .aspx.vb, and a few classes in App\_Code.
The problem, which has begun to occur only today (even though most of the code was already written), is that once in a while, I have this error message :
>
> Error BC... | I think I found the problem.
My code was like that :
```
Imports CMS
Sub Whatever()
Dim a as new Arbo.MyObject() ' Arbo is a namespace inside CMS
Dim b as new Util.MyOtherObject() ' Util is a namespace inside Util
End Sub
```
I'm not sure why I wrote it like that, but it turns out the fact I was calling cl... |
85,116 | <p>I want the server to always serve dates in UTC in the HTML, and have JavaScript on the client site convert it to the user's local timezone.</p>
<p>Bonus if I can output in the user's locale date format.</p>
| [
{
"answer_id": 85161,
"author": "japollock",
"author_id": 1210318,
"author_profile": "https://Stackoverflow.com/users/1210318",
"pm_score": -1,
"selected": false,
"text": "<p>Don't know how to do locale, but javascript is a client side technology.</p>\n\n<pre><code>usersLocalTime = new D... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13989/"
] | I want the server to always serve dates in UTC in the HTML, and have JavaScript on the client site convert it to the user's local timezone.
Bonus if I can output in the user's locale date format. | Seems the most foolproof way to start with a UTC date is to create a new `Date` object and use the `setUTC…` methods to set it to the date/time you want.
Then the various `toLocale…String` methods will provide localized output.
### Example:
```js
// This would come from the server.
// Also, this whole block could p... |
85,119 | <p>I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish <code>if</code> and <code>elif</code> statements for every site as shown in the following code, which I would like to avoid.</p>
<pre class="lang-py prettyprint-override">... | [
{
"answer_id": 85134,
"author": "Jim",
"author_id": 8427,
"author_profile": "https://Stackoverflow.com/users/8427",
"pm_score": 5,
"selected": true,
"text": "<p>Django has this built in. See <a href=\"http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites\" rel=\"nore... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4919/"
] | I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish `if` and `elif` statements for every site as shown in the following code, which I would like to avoid.
```py
if site == 'site1':
...
elif site == 'site2:
...
```
W... | Django has this built in. See [the sites framework](http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites).
As a general technique, include a 'host' column in your database schema attached to the data you want to be host-specific, then include the `Host` HTTP header in the query when you are retrie... |
85,122 | <p>On Windows I have a problem I never encountered on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On Windows, however, there is only <em>Sleep</em> with millisecond granularity. </p>
<p>On Unix... | [
{
"answer_id": 85143,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": -1,
"selected": true,
"text": "<p>On Windows the use of <code>select</code> forces you to include the <a href=\"https://msdn.microsoft.com/en-us/libr... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6508/"
] | On Windows I have a problem I never encountered on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On Windows, however, there is only *Sleep* with millisecond granularity.
On Unix, I can use the u... | On Windows the use of `select` forces you to include the [Winsock](https://msdn.microsoft.com/en-us/library/windows/desktop/ms740673(v=vs.85).aspx) library which has to be initialized like this in your application:
```
WORD wVersionRequested = MAKEWORD(1,0);
WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData);
`... |
85,137 | <p>Say I have a class named Frog, it looks like:</p>
<pre><code>public class Frog
{
public int Location { get; set; }
public int JumpCount { get; set; }
public void OnJump()
{
JumpCount++;
}
}
</code></pre>
<p>I need help with 2 things:</p>
<ol>
<li>I want to create an event name... | [
{
"answer_id": 85188,
"author": "Quintin Robinson",
"author_id": 12707,
"author_profile": "https://Stackoverflow.com/users/12707",
"pm_score": 7,
"selected": true,
"text": "<pre><code>public event EventHandler Jump;\npublic void OnJump()\n{\n EventHandler handler = Jump;\n if (null... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368/"
] | Say I have a class named Frog, it looks like:
```
public class Frog
{
public int Location { get; set; }
public int JumpCount { get; set; }
public void OnJump()
{
JumpCount++;
}
}
```
I need help with 2 things:
1. I want to create an event named Jump in the class definition.
2. I ... | ```
public event EventHandler Jump;
public void OnJump()
{
EventHandler handler = Jump;
if (null != handler) handler(this, EventArgs.Empty);
}
```
then
```
Frog frog = new Frog();
frog.Jump += new EventHandler(yourMethod);
private void yourMethod(object s, EventArgs e)
{
Console.WriteLine("Frog has Jum... |
85,159 | <p>Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries?</p>
<p>I know that I can parse something like "9/17/2008 10:30" into a Date object using</p>
<pre><code>var date:Date = new Date(Date.parse("9/17/2008 10:30");
</code></pre>
<p>But I want to parse ju... | [
{
"answer_id": 85174,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 1,
"selected": false,
"text": "<p>Have you considered prepending \"01/01/2000 \" to the time string and then applying Date?</p>\n\n<p>Alternately there's... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1247/"
] | Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries?
I know that I can parse something like "9/17/2008 10:30" into a Date object using
```
var date:Date = new Date(Date.parse("9/17/2008 10:30");
```
But I want to parse just 10:30 by itself. The following... | To answer your specific question: no, there's no library function to do what you want to do, but then there's no library function for parsing dates on the ISO format, on the German format, on the Swedish format, dates where the years are in roman numerals etc.
Why not use regular expressions? That's what they are for. |
85,179 | <p>I've long been a fan of Stored Procedure Keyboard Accelerators, as described in <a href="http://blogs.msdn.com/irenak/archive/2006/10/27/sysk-228-get-table-columns-or-rows-with-single-key-press.aspx" rel="nofollow noreferrer">this article</a>. When we moved from SQL 2000 to 2005, though, and from Query Analyzer to ... | [
{
"answer_id": 85976,
"author": "Tim Lentine",
"author_id": 2833,
"author_profile": "https://Stackoverflow.com/users/2833",
"pm_score": 1,
"selected": false,
"text": "<p>I had never tried this until I read your question and then read the article you referenced, so take this with a grain ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1818/"
] | I've long been a fan of Stored Procedure Keyboard Accelerators, as described in [this article](http://blogs.msdn.com/irenak/archive/2006/10/27/sysk-228-get-table-columns-or-rows-with-single-key-press.aspx). When we moved from SQL 2000 to 2005, though, and from Query Analyzer to Management Studio, the handling of the ar... | Tim's suggestion didn't solve my problem on my development PC, but it did convince me to try again from a different PC. When using a different PC's SSMS to log into the development PC's database and trying exactly what Tim describes, I'm having the same behavior Tim describes.
I was also able to re-replicate the argum... |
85,181 | <p>This is pretty weird.</p>
<p>I have my Profiler open and it obviously shows that a stored procedure is called. I open the database and the SP list, but the SP doesn't exist. However, there's another SP whose name is the same except it has a prefix 'x'</p>
<p>Is SQL Server 2005 mapping the SP name to a different on... | [
{
"answer_id": 85245,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 1,
"selected": false,
"text": "<p>Possibly silly questions, but just in case... have you refreshed the SP list? Have you checked for a stored procedure ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10088/"
] | This is pretty weird.
I have my Profiler open and it obviously shows that a stored procedure is called. I open the database and the SP list, but the SP doesn't exist. However, there's another SP whose name is the same except it has a prefix 'x'
Is SQL Server 2005 mapping the SP name to a different one for security pu... | In general, when you know an object exists because it's been used in a query, and you can't find it in the object tree in Management Studio, you can do this to find it.
```
select *
from sys.objects
where name = 'THE_NAME_YOU_WANT'
```
I just checked, and it works with Synonyms. |
85,183 | <p>I have an object that implements IDisposable that is registered with the Windsor Container and I would like to dispose of it so it's Dispose method is called and next time Resolve is called it fetches a new instance.</p>
<p>Does </p>
<pre><code>container.Release(obj);
</code></pre>
<p>automatically call Dispose(... | [
{
"answer_id": 85498,
"author": "Philip Rieck",
"author_id": 12643,
"author_profile": "https://Stackoverflow.com/users/12643",
"pm_score": 2,
"selected": false,
"text": "<p>It depends on the lifestyle of the component you specified when you added it to the container.</p>\n\n<p>You would ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I have an object that implements IDisposable that is registered with the Windsor Container and I would like to dispose of it so it's Dispose method is called and next time Resolve is called it fetches a new instance.
Does
```
container.Release(obj);
```
automatically call Dispose() immediately? Or do I need to do... | This is something I think people aren't really aware of when working with the Windsor container - especially the often ***surprising*** behavior that disposable transient components are held onto by the container for the lifetime of the kernel until it's disposed unless you release them yourself - though it is document... |
85,190 | <p>Consider:</p>
<pre><code>List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
</code></pre>
<pre><code>for (String item : someList) {
System.out.println(item);
}
</code></pre>
<p>What would the equivalent <code>for</code> loop look like without u... | [
{
"answer_id": 85206,
"author": "nsayer",
"author_id": 13757,
"author_profile": "https://Stackoverflow.com/users/13757",
"pm_score": 11,
"selected": true,
"text": "<pre><code>for (Iterator<String> i = someIterable.iterator(); i.hasNext();) {\n String item = i.next();\n System... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5074/"
] | Consider:
```
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
```
```
for (String item : someList) {
System.out.println(item);
}
```
What would the equivalent `for` loop look like without using the *for each* syntax? | ```
for (Iterator<String> i = someIterable.iterator(); i.hasNext();) {
String item = i.next();
System.out.println(item);
}
```
Note that if you need to use `i.remove();` in your loop, or access the actual iterator in some way, you cannot use the `for ( : )` idiom, since the actual iterator is merely inferred.... |
85,282 | <p>In C# you can make a block inside of a method that is not attached to any other statement.</p>
<pre><code> public void TestMethod()
{
{
string x = "test";
string y = x;
{
int z = 42;
int zz = z;
}
}
}
</code>... | [
{
"answer_id": 85311,
"author": "junkforce",
"author_id": 2153,
"author_profile": "https://Stackoverflow.com/users/2153",
"pm_score": 1,
"selected": false,
"text": "<p>As far as I can see, it'd only be useful from an organizational standpoint. I can't really conceive of any logical value... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289/"
] | In C# you can make a block inside of a method that is not attached to any other statement.
```
public void TestMethod()
{
{
string x = "test";
string y = x;
{
int z = 42;
int zz = z;
}
}
}
```
This code compi... | Scope and garbage collection: When you leave the unattached block, any variables declared in it go out of scope. That lets the garbage collector clean up those objects.
[Ray Hayes](https://stackoverflow.com/users/7093/ray-hayes) points out that the .NET garbage collector will not immediately collect the out-of-scope o... |
85,353 | <p>What is the best (or as good as possible) general SVN ignore pattern to use? </p>
<p>There are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that "overlap" (i.e. desirable for some types projects and not for others). </p>
<p><strong>There are however, a lar... | [
{
"answer_id": 85371,
"author": "icelava",
"author_id": 2663,
"author_profile": "https://Stackoverflow.com/users/2663",
"pm_score": 3,
"selected": false,
"text": "<p>Used for my Visual Studio projects</p>\n\n<pre><code>*/bin */obj *.user *.suo\n</code></pre>\n\n<p>You can expand more fil... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2233/"
] | What is the best (or as good as possible) general SVN ignore pattern to use?
There are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that "overlap" (i.e. desirable for some types projects and not for others).
**There are however, a large number of file types... | I'll add my own two cents to this question:
I use the following SVN ignore pattern with TortoiseSVN and Subversion CLI for native C++, C#/VB.NET, and PERL projects on both Windows and Linux platforms. It works well for me!
Formatted for copy and paste:
```
*.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store thumbs... |
85,373 | <p>In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year?</p>
<p>Let's say that I have a date of <strong>2008-09-17 12:56:53.430</strong>, then the output of flooring should be:</p>
<ul>
<li>Year: 2008-01-01 00:00:00.000</li>
<li>Month: 2008-09-01 00:00:00.000</li>
<li>Day: 2008-09-17 00:00:0... | [
{
"answer_id": 85379,
"author": "Portman",
"author_id": 1690,
"author_profile": "https://Stackoverflow.com/users/1690",
"pm_score": 8,
"selected": true,
"text": "<p>The key is to use <a href=\"http://msdn.microsoft.com/en-us/library/ms186819.aspx\" rel=\"noreferrer\">DATEADD</a> and <a h... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1690/"
] | In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year?
Let's say that I have a date of **2008-09-17 12:56:53.430**, then the output of flooring should be:
* Year: 2008-01-01 00:00:00.000
* Month: 2008-09-01 00:00:00.000
* Day: 2008-09-17 00:00:00.000
* Hour: 2008-09-17 12:00:00.000
* Minute: 2... | The key is to use [DATEADD](http://msdn.microsoft.com/en-us/library/ms186819.aspx) and [DATEDIFF](http://msdn.microsoft.com/en-us/library/ms189794.aspx) along with the appropriate SQL timespan enumeration.
```
declare @datetime datetime;
set @datetime = getdate();
select @datetime;
select dateadd(year,datediff(year,0,... |
85,427 | <p>Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls.</p>
<p>It... | [
{
"answer_id": 85497,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 1,
"selected": false,
"text": "<p>Isn't there an import library (maybe riched20.lib) that you can link to. Then you won't have to load it \"manually\" at ... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16408/"
] | Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls.
It talks about... | Using MFC, RichEdit controls just work.
Loading with InitCommonControlsEx() - ICC\_USEREX\_CLASSES doesn't load RichEdit AFAIK, you don't need it as it only does the 'standard' common controls, which don't include richedit. Apparently you only need to call this to enable 'visual styles' in Windows, not to get RichEdit... |
85,450 | <p>I have a SQL Server 2005 machine with a JDE DB2 set up as a linked server.</p>
<p>For some reason the performance of any queries from this box to the db2 box are horrible.</p>
<p>For example. The following takes 7 mins to run from Management Studio</p>
<pre><code>SELECT *
FROM F42119
WHERE SDUPMJ &... | [
{
"answer_id": 88059,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 0,
"selected": false,
"text": "<p>My first thought would go to the drivers. Years ago I had to link DB2 to SQL Server 2000 and it was extremely difficult to... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a SQL Server 2005 machine with a JDE DB2 set up as a linked server.
For some reason the performance of any queries from this box to the db2 box are horrible.
For example. The following takes 7 mins to run from Management Studio
```
SELECT *
FROM F42119
WHERE SDUPMJ >= 107256
```
Whereas it ta... | In certain searches SQL Server will decide to pull the entire table down to itself and sort and search the data within SQL Server instead of sending the query to the remote server. This is usually a problem with collation settings.
Make sure the provider has the following options set:
Data Access,
Collation Compatibl... |
85,451 | <p>Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy?</p>
<p>for example:</p>
<pre><code>start = time.clock()
... do something
elapsed = (time.clock() - start)
</code></pre>
<p>vs.</p>
<pre><code>start = time.time()
... do something
elapsed = (time.time() - s... | [
{
"answer_id": 85480,
"author": "user15910",
"author_id": 15910,
"author_profile": "https://Stackoverflow.com/users/15910",
"pm_score": 4,
"selected": false,
"text": "<p>Depends on what you care about. If you mean WALL TIME (as in, the time on the clock on your wall), time.clock() provid... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16148/"
] | Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy?
for example:
```
start = time.clock()
... do something
elapsed = (time.clock() - start)
```
vs.
```
start = time.time()
... do something
elapsed = (time.time() - start)
``` | As of 3.3, [*time.clock()* is deprecated](https://docs.python.org/3/library/time.html#time.clock), and it's suggested to use **[time.process\_time()](https://docs.python.org/3/library/time.html#time.process_time)** or **[time.perf\_counter()](https://docs.python.org/3/library/time.html#time.perf_counter)** instead.
Pr... |
85,457 | <p>I am trying to inherit from my generated datacontext in LinqToSQL - something like this </p>
<pre><code>public class myContext : dbDataContext {
public System.Data.Linq.Table<User>() Users {
return (from x in base.Users() where x.DeletedOn.HasValue == false select x);
}
}
</code></pre>
<p>But my Linq sta... | [
{
"answer_id": 85507,
"author": "Scott Nichols",
"author_id": 4299,
"author_profile": "https://Stackoverflow.com/users/4299",
"pm_score": 1,
"selected": false,
"text": "<p>You could use discriminator column inheritance on the table, ie. a DeletedUsers table and ActiveUsers table where th... | 2008/09/17 | [
"https://Stackoverflow.com/questions/85457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16416/"
] | I am trying to inherit from my generated datacontext in LinqToSQL - something like this
```
public class myContext : dbDataContext {
public System.Data.Linq.Table<User>() Users {
return (from x in base.Users() where x.DeletedOn.HasValue == false select x);
}
}
```
But my Linq statement returns IQueryable which ... | Another approach would to be use views..
```
CREATE VIEW ActiveUsers as SELECT * FROM Users WHERE IsDeleted = 0
```
As far as linq to sql is concerned, that is just the same as a table. For any table that you needed the DeletedOn filtering, just create a view that uses the filter and use that in place of the table i... |