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
166,239
<p>I am trying to remotely run a DTSX package from a bat file with this command:</p> <pre><code>DTEXEC /DTS "\File System\MY_PACKAGE_NAME" /SERVER MY_SERVER_NAME /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V </code></pre> <p>This is working fine locally but failing remotely (I do have admin rights on the mac...
[ { "answer_id": 170849, "author": "JohnIdol", "author_id": 1311500, "author_profile": "https://Stackoverflow.com/users/1311500", "pm_score": 3, "selected": true, "text": "<p>After a bit of research it looks like it is impossible to run DTEXEC remotely (it needs to be run locally - remote ...
2008/10/03
[ "https://Stackoverflow.com/questions/166239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1311500/" ]
I am trying to remotely run a DTSX package from a bat file with this command: ``` DTEXEC /DTS "\File System\MY_PACKAGE_NAME" /SERVER MY_SERVER_NAME /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V ``` This is working fine locally but failing remotely (I do have admin rights on the machine I am pointing to and ...
After a bit of research it looks like it is impossible to run DTEXEC remotely (it needs to be run locally - remote execution is not supported). To overcome this limitation the following method seems to be broadly implemented: 1. set up a SQL job to run the DTSX package 2. set up a Stored Procedure to run the job 3. u...
166,295
<pre><code>&lt;Grid.Triggers&gt; &lt;EventTrigger RoutedEvent="Border.Loaded"&gt; &lt;EventTrigger.Actions &gt; &lt;BeginStoryboard&gt; &lt;Storyboard x:Name="MyStoryboard" AutoReverse="True" RepeatBehavior="Forever"&gt; ...
[ { "answer_id": 166460, "author": "Bill Reiss", "author_id": 18967, "author_profile": "https://Stackoverflow.com/users/18967", "pm_score": 1, "selected": false, "text": "<p>The only trigger currently available in Silverlight is \"Loaded\", for all other events you'll have to write a bit o...
2008/10/03
[ "https://Stackoverflow.com/questions/166295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
``` <Grid.Triggers> <EventTrigger RoutedEvent="Border.Loaded"> <EventTrigger.Actions > <BeginStoryboard> <Storyboard x:Name="MyStoryboard" AutoReverse="True" RepeatBehavior="Forever"> <ColorAnimationUsingKeyFrames Be...
The only trigger currently available in Silverlight is "Loaded", for all other events you'll have to write a bit of code. To use this technique, Storyboards should go in the Resources section instead of Triggers, and you'll call Begin() on the Storyboard from the code. If you're doing templating of a control, then the...
166,321
<p>Is it possible to create a SQL query which will return one column which contains the dates from a given date range (e.g. all dates from last year till today). E.g.</p> <pre><code>dat ---- 2007-10-01 2007-10-02 2007-10-03 2007-10-04 ... </code></pre> <p>I am wondering if this is possible as an alternative to creati...
[ { "answer_id": 166345, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 2, "selected": false, "text": "<p>AFAIK you cannot do that with a single SQL query. However the following block of code will do the job.</p>\n\n<p>C...
2008/10/03
[ "https://Stackoverflow.com/questions/166321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21672/" ]
Is it possible to create a SQL query which will return one column which contains the dates from a given date range (e.g. all dates from last year till today). E.g. ``` dat ---- 2007-10-01 2007-10-02 2007-10-03 2007-10-04 ... ``` I am wondering if this is possible as an alternative to creating a table which holds all...
AFAIK you cannot do that with a single SQL query. However the following block of code will do the job. Currently in Transact-SQL (for SQL Server). I do not know how this translates to MySQL. ``` DECLARE @start datetime DECLARE @end datetime DECLARE @results TABLE ( val datetime not null ) set @start = '2008-10-01'...
166,347
<p>I have some simple shell scripting tasks that I want to do </p> <p>For example: Selecting a file in the working directory from a list of the files matching some regular expression.</p> <p>I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack quick scripts tha...
[ { "answer_id": 166357, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 3, "selected": false, "text": "<p>\"How do I write ruby\" is a little beyond the scope of SO.</p>\n\n<p>But to turn these ruby scripts into exec...
2008/10/03
[ "https://Stackoverflow.com/questions/166347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24773/" ]
I have some simple shell scripting tasks that I want to do For example: Selecting a file in the working directory from a list of the files matching some regular expression. I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack quick scripts that will work in wind...
By default, you already have access to [Dir](http://www.ruby-doc.org/core/classes/Dir.html) and [File](http://www.ruby-doc.org/core/classes/File.html), which are pretty useful by themselves. ``` Dir['*.rb'] #basic globs Dir['**/*.rb'] #** == any depth of directory, including current dir. #=> array of relative names F...
166,411
<p>I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it?</p> <p>I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spelled differently) in the web.xml...
[ { "answer_id": 167140, "author": "Ian McLaird", "author_id": 18796, "author_profile": "https://Stackoverflow.com/users/18796", "pm_score": 3, "selected": true, "text": "<p>As far as I know, there's no way do do this within the Servlet API. However, you can parse web.xml directly and ext...
2008/10/03
[ "https://Stackoverflow.com/questions/166411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18702/" ]
I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it? I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spelled differently) in the web.xml file.
As far as I know, there's no way do do this within the Servlet API. However, you can parse web.xml directly and extract the values yourself. I used dom4j below, but you can use whatever XML processing stuff you like: ``` protected List<String> getSecurityRoles() { List<String> roles = new ArrayList<String>(); ...
166,418
<p>I have asked our hosting provider to add mod_python to our httpd server. The server appears to be in an hsphere cluster and they appear to use yum to administer it. He is reporting some dependencies missing and I do't quite understand how that could have come about.</p> <p>versions (this is as much as I have been...
[ { "answer_id": 321653, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 0, "selected": false, "text": "<p>My first reaction would be to <code>yum update apache</code> (or just a <code>yum update</code>). </p>\n\n<p>Then try the ...
2008/10/03
[ "https://Stackoverflow.com/questions/166418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24039/" ]
I have asked our hosting provider to add mod\_python to our httpd server. The server appears to be in an hsphere cluster and they appear to use yum to administer it. He is reporting some dependencies missing and I do't quite understand how that could have come about. versions (this is as much as I have been given): Ce...
We have mod\_python 3.3 running on Apache 2.2 on a CentOS (forgot the version). All we did is download the tar.gz (from <http://httpd.apache.org/modules/python-download.cgi>) , extract it... ``` $ ./configure --with-apxs=/usr/local/apache2/bin/apxs $ ./make $ su $ make install ``` Everything works fine. We couldn't ...
166,431
<p>I find it annoying that I can't clear a list. In this example:</p> <pre><code>a = [] a.append(1) a.append(2) a = [] </code></pre> <p>The second time I initialize a to a blank list, it creates a new instance of a list, which is in a different place in memory, so I can't use it to reference the first, not to mentio...
[ { "answer_id": 166441, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 6, "selected": true, "text": "<p>You are looking for:</p>\n\n<pre><code>del L[:]\n</code></pre>\n" }, { "answer_id": 166462, "author":...
2008/10/03
[ "https://Stackoverflow.com/questions/166431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18909/" ]
I find it annoying that I can't clear a list. In this example: ``` a = [] a.append(1) a.append(2) a = [] ``` The second time I initialize a to a blank list, it creates a new instance of a list, which is in a different place in memory, so I can't use it to reference the first, not to mention it's inefficient. The o...
You are looking for: ``` del L[:] ```
166,438
<p>I have been looking for a logging framework for .net (c#) and decided to give log4net a go after reading up on a few question/answer threads here on stackoverflow. I see people mentioning over and over that they use a wrapper class for log4net and I am wonder what that would look like.</p> <p>I have my code split u...
[ { "answer_id": 166465, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 1, "selected": false, "text": "<p>My understanding is that a wrapper class for log4net would be a static class which takes care of initializing the logging...
2008/10/03
[ "https://Stackoverflow.com/questions/166438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15771/" ]
I have been looking for a logging framework for .net (c#) and decided to give log4net a go after reading up on a few question/answer threads here on stackoverflow. I see people mentioning over and over that they use a wrapper class for log4net and I am wonder what that would look like. I have my code split up into dif...
Essentially you create an interface and then a concrete implementation of that interface that wraps the classes and methods of Log4net directly. Additional logging systems can be wrapped by creating more concrete classes which wrap other classes and methods of those systems. Finally use a factory to create instances of...
166,474
<p>In a C++ file, I have a code like this:</p> <pre><code>#if ACTIVATE # pragma message( "Activated" ) #else # pragma message( "Not Activated") #endif </code></pre> <p>I want to set this ACTIVE define to 1 with the msbuild command line.</p> <p>It tried this but it doesn't work:</p> <pre><code>msbuild /p:DefineC...
[ { "answer_id": 166505, "author": "Matt Howells", "author_id": 16881, "author_profile": "https://Stackoverflow.com/users/16881", "pm_score": 4, "selected": false, "text": "<p>I think you want:</p>\n\n<pre><code>/p:DefineConstants=ACTIVATE\n</code></pre>\n" }, { "answer_id": 166524...
2008/10/03
[ "https://Stackoverflow.com/questions/166474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6605/" ]
In a C++ file, I have a code like this: ``` #if ACTIVATE # pragma message( "Activated" ) #else # pragma message( "Not Activated") #endif ``` I want to set this ACTIVE define to 1 with the msbuild command line. It tried this but it doesn't work: ``` msbuild /p:DefineConstants="ACTIVATE=1" ``` Any idea?
The answer is : YOU CANNOT
166,482
<p>I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages.<br> e.g. <a href="http://metachat.org/recent" rel="nofollow noreferrer">http://metachat.org/recent</a> </p> <p>I've a feeling this is a bad way of doing this, but it's code I inherited...</p> <p>Although the page dis...
[ { "answer_id": 166496, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 3, "selected": true, "text": "<p>There's no way other than using URL rewriting (mod_rewrite) or creating the missing pages. What's happening is tha...
2008/10/03
[ "https://Stackoverflow.com/questions/166482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1726/" ]
I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages. e.g. <http://metachat.org/recent> I've a feeling this is a bad way of doing this, but it's code I inherited... Although the page displays correctly on most browsers, I'm getting a situation where AVG Anti-Virus is h...
There's no way other than using URL rewriting (mod\_rewrite) or creating the missing pages. What's happening is that the client requests a page which doesn't exist. Apache is configured to serve a special page upon 404 errors, but it still sends the 404 status code, then AVG traps that. So, you could do something like...
166,491
<p>I have a .bat and inside the .bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).</p>
[ { "answer_id": 166514, "author": "Jonathan Lonowski", "author_id": 15031, "author_profile": "https://Stackoverflow.com/users/15031", "pm_score": 1, "selected": false, "text": "<p>Are you wanting this to be reactive? Or, on-demand?</p>\n\n<p>For reactive, see <a href=\"http://svnbook.red-...
2008/10/03
[ "https://Stackoverflow.com/questions/166491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6605/" ]
I have a .bat and inside the .bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).
For Win 2000 and later, this would assign the last output row from the svn status commmand to the svnOut variable and then test if the variable contains anything: ``` @echo off set svnOut= set svnDir=C:Your\path\to\svn\dir\to\check for /F "tokens=*" %%I in ('svn status %svnDir%') do set svnOut=%%I if "%svnOut%"=="" ...
166,493
<p>I have a Windows executable (say <code>program.exe</code>) and I want to provide users with 2 launchers that will pass different arguments to it.</p> <pre><code>program.exe -a program.exe -b </code></pre> <p>I can easily do this with 2 batch files, but I would rather provide users with 2 .exe files as they are mor...
[ { "answer_id": 166507, "author": "stevechol", "author_id": 2981, "author_profile": "https://Stackoverflow.com/users/2981", "pm_score": -1, "selected": false, "text": "<p>If you are using .Net you can read the information presented as parameters from another application or batch file. It...
2008/10/03
[ "https://Stackoverflow.com/questions/166493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18333/" ]
I have a Windows executable (say `program.exe`) and I want to provide users with 2 launchers that will pass different arguments to it. ``` program.exe -a program.exe -b ``` I can easily do this with 2 batch files, but I would rather provide users with 2 .exe files as they are more likely to be used correctly without...
Why create new executables? Why not just create desktop shortcuts to launch the single exe.
166,506
<p>How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?</p>
[ { "answer_id": 166520, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 10, "selected": true, "text": "<pre><code>import socket\nsocket.gethostbyname(socket.gethostname())\n</code></pre>\n\n<p>This won't work always (re...
2008/10/03
[ "https://Stackoverflow.com/questions/166506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?
``` import socket socket.gethostbyname(socket.gethostname()) ``` This won't work always (returns `127.0.0.1` on machines having the hostname in `/etc/hosts` as `127.0.0.1`), a paliative would be what gimel shows, use `socket.getfqdn()` instead. Of course your machine needs a resolvable hostname.
166,508
<p>Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed</p>
[ { "answer_id": 166520, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 10, "selected": true, "text": "<pre><code>import socket\nsocket.gethostbyname(socket.gethostname())\n</code></pre>\n\n<p>This won't work always (re...
2008/10/03
[ "https://Stackoverflow.com/questions/166508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24789/" ]
Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed
``` import socket socket.gethostbyname(socket.gethostname()) ``` This won't work always (returns `127.0.0.1` on machines having the hostname in `/etc/hosts` as `127.0.0.1`), a paliative would be what gimel shows, use `socket.getfqdn()` instead. Of course your machine needs a resolvable hostname.
166,545
<p>How can I find the public facing IP for my net work in Python?</p>
[ { "answer_id": 166552, "author": "UnkwnTech", "author_id": 115, "author_profile": "https://Stackoverflow.com/users/115", "pm_score": 5, "selected": true, "text": "<p>This will fetch your remote IP address</p>\n\n<pre><code>import urllib\nip = urllib.urlopen('http://automation.whatismyip....
2008/10/03
[ "https://Stackoverflow.com/questions/166545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
How can I find the public facing IP for my net work in Python?
This will fetch your remote IP address ``` import urllib ip = urllib.urlopen('http://automation.whatismyip.com/n09230945.asp').read() ``` If you don't want to rely on someone else, then just upload something like this PHP script: ``` <?php echo $_SERVER['REMOTE_ADDR']; ?> ``` and change the URL in the Python or i...
166,550
<p>This is a minor style question, but every bit of readability you add to your code counts.</p> <p>So if you've got:</p> <pre><code>if (condition) then { // do stuff } else { // do other stuff } </code></pre> <p>How do you decide if it's better like that, or like this:</p> <pre><code> if (!condition) then ...
[ { "answer_id": 166560, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": 2, "selected": false, "text": "<p>I prefer the first one. The condition should be as simple as possible and it should be fairly obvious which is simpler...
2008/10/03
[ "https://Stackoverflow.com/questions/166550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14663/" ]
This is a minor style question, but every bit of readability you add to your code counts. So if you've got: ``` if (condition) then { // do stuff } else { // do other stuff } ``` How do you decide if it's better like that, or like this: ``` if (!condition) then { // do other stuff { else ...
I prefer to put the most common path first, and I am a strong believer in nesting reduction so I will break, continue, or return instead of elsing whenever possible. I generally prefer to test against positive conditions, or invert [and name] negative conditions as a positive. ``` if (condition) return; DoSomethi...
166,600
<p>In java, when using SimpleDateFormat with the pattern:</p> <pre><code>yyyy-MM-dd'T'HH:mm:ss.SSSZ </code></pre> <p>the date is outputted as:</p> <pre><code>"2002-02-01T18:18:42.703-0700" </code></pre> <p>In xquery, when using the xs:dateTime function, it gives the error:</p> <pre><code>"Invalid lexical value [er...
[ { "answer_id": 166725, "author": "Sietse", "author_id": 6400, "author_profile": "https://Stackoverflow.com/users/6400", "pm_score": 0, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>static public String formatISO8601(Calendar cal) {\nMessageFormat format = new MessageFormat(\...
2008/10/03
[ "https://Stackoverflow.com/questions/166600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In java, when using SimpleDateFormat with the pattern: ``` yyyy-MM-dd'T'HH:mm:ss.SSSZ ``` the date is outputted as: ``` "2002-02-01T18:18:42.703-0700" ``` In xquery, when using the xs:dateTime function, it gives the error: ``` "Invalid lexical value [err:FORG0001]" ``` with the above date. In order for xquery ...
OK, the linked to forum post DID help, thank you. I did however find a simpler solution, which I include below: 1) Use Apache commons.lang java library 2) Use the following java code: ```java //NOTE: ZZ on end is not compatible with jdk, but allows for formatting //dates like so (note the : 3rd from last spot, ...
166,607
<p>I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can browse the install location via FTP.</p> <p>I have tried HEAD and do not get a version number repo...
[ { "answer_id": 166619, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 8, "selected": true, "text": "<h1>The method</h1>\n<p>Connect to port 80 on the host and send it</p>\n<pre><code>HEAD / HTTP/1.0\n</code></pre>\n<p>This...
2008/10/03
[ "https://Stackoverflow.com/questions/166607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24039/" ]
I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can browse the install location via FTP. I have tried HEAD and do not get a version number reported. If ...
The method ========== Connect to port 80 on the host and send it ``` HEAD / HTTP/1.0 ``` This needs to be followed by carriage-return + line-feed twice You'll get back something like this ``` HTTP/1.1 200 OK Date: Fri, 03 Oct 2008 12:39:43 GMT Server: Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.0 PHP/5.2.6-1ubuntu4 with ...
166,615
<p>I am currently plowing my way through <a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" rel="nofollow noreferrer">IBM's tutorial on CakePHP</a></p> <p>At one point I run into this snippet of code:</p> <pre><code>&lt;?php class Dealer extends AppModel { var $name = 'Dealer'; var $h...
[ { "answer_id": 166627, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 2, "selected": false, "text": "<p>It is legal, though as far as I'm aware, you have to explicitly say it's 'empty' by assigning null to it,</p>\...
2008/10/03
[ "https://Stackoverflow.com/questions/166615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24218/" ]
I am currently plowing my way through [IBM's tutorial on CakePHP](http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html) At one point I run into this snippet of code: ``` <?php class Dealer extends AppModel { var $name = 'Dealer'; var $hasMany = array ( 'Product' => array( 'cla...
Assign the value null instead of leaving anything out. The [manual says](http://php.net/isset) > > isset() will return FALSE if testing a variable that has been set to NULL > > > ``` <?php class Dealer extends AppModel { var $name = 'Dealer'; var $hasMany = array ('Product' => array( 'className' => 'Product', 'co...
166,617
<p>I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code follows:</p> <blockquote> <pre> FILE *input_file = fopen(curren...
[ { "answer_id": 166699, "author": "Jon Trauntvein", "author_id": 19674, "author_profile": "https://Stackoverflow.com/users/19674", "pm_score": 3, "selected": true, "text": "<p>After further investigation, I found that this error was due to a failure to initialise the openSSL library by ca...
2008/10/03
[ "https://Stackoverflow.com/questions/166617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19674/" ]
I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code follows: > > > ``` > > FILE *input_file = fopen(current->post_fil...
After further investigation, I found that this error was due to a failure to initialise the openSSL library by calling SSL\_library\_init().
166,623
<p>I have some problems comparing an array with Norwegian characters with a utf8 character.</p> <p>All characters except the special Norwegian characters(æ, ø, å) works fine.</p> <pre><code>function isNorwegianChar($Char) { $aNorwegianChars = array('a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', ...
[ { "answer_id": 166640, "author": "Gilles", "author_id": 10024, "author_profile": "https://Stackoverflow.com/users/10024", "pm_score": 2, "selected": false, "text": "<p>First of all, and I'll get to UTF-8 later if nobody else answers, iterating like you are is a very bad way to search thr...
2008/10/03
[ "https://Stackoverflow.com/questions/166623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24811/" ]
I have some problems comparing an array with Norwegian characters with a utf8 character. All characters except the special Norwegian characters(æ, ø, å) works fine. ``` function isNorwegianChar($Char) { $aNorwegianChars = array('a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', '...
First of all, and I'll get to UTF-8 later if nobody else answers, iterating like you are is a very bad way to search through an array. PHP has built-in functions just for that: <http://fr.php.net/array_search> So you might want to give that a try and see if it helps with your problem. Also make sure that the PHP file...
166,630
<p>I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there a direct way to do this using either std::strings or char* strings?</p> <p>E.g., in Python you could simply do</p> <pre><code>&gt;&gt;&gt; &quot;.&quot; * 5 + &quot;lolcat&quot; '.....lolcat' </code></pre>
[ { "answer_id": 166646, "author": "luke", "author_id": 16434, "author_profile": "https://Stackoverflow.com/users/16434", "pm_score": 8, "selected": false, "text": "<p>In the particular case of repeating a single character, you can use <a href=\"http://www.cppreference.com/wiki/string/stri...
2008/10/03
[ "https://Stackoverflow.com/questions/166630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there a direct way to do this using either std::strings or char\* strings? E.g., in Python you could simply do ``` >>> "." * 5 + "lolcat" '.....lolcat' ```
In the particular case of repeating a single character, you can use [`std::string(size_type count, CharT ch)`](http://www.cppreference.com/wiki/string/string_constructors): ``` std::string(5, '.') + "lolcat" ``` This can't be used to repeat multi-character strings.
166,641
<p>In the following example should I expect that <code>values.size()</code> will be called every time around the loop? In which case it might make sense to introduce a temporary <code>vectorSize</code> variable. Or should a modern compiler be able to optimize the calls away by recognising that the vector size cannot ch...
[ { "answer_id": 166654, "author": "Benoit", "author_id": 10703, "author_profile": "https://Stackoverflow.com/users/10703", "pm_score": 4, "selected": false, "text": "<p>It all depends on what the vector's size implementation is, how aggressive the compiler is and if it listen/uses to inli...
2008/10/03
[ "https://Stackoverflow.com/questions/166641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3229/" ]
In the following example should I expect that `values.size()` will be called every time around the loop? In which case it might make sense to introduce a temporary `vectorSize` variable. Or should a modern compiler be able to optimize the calls away by recognising that the vector size cannot change. ``` double sumVect...
Here's one way to do it that makes it explicit - size() is called only once. ``` for (size_t ii = 0, count = values.size(); ii < count; ++ii) ``` **Edit:** I've been asked to actually answer the question, so here's my best shot. A compiler generally won't optimize a function call, because it doesn't know if it wi...
166,658
<p>I am using <a href="http://nant.sourceforge.net/release/0.85-rc2/help/fundamentals/listeners.html#MailLogger" rel="nofollow noreferrer">MailLogger</a> to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks?<...
[ { "answer_id": 166654, "author": "Benoit", "author_id": 10703, "author_profile": "https://Stackoverflow.com/users/10703", "pm_score": 4, "selected": false, "text": "<p>It all depends on what the vector's size implementation is, how aggressive the compiler is and if it listen/uses to inli...
2008/10/03
[ "https://Stackoverflow.com/questions/166658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361/" ]
I am using [MailLogger](http://nant.sourceforge.net/release/0.85-rc2/help/fundamentals/listeners.html#MailLogger) to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks?
Here's one way to do it that makes it explicit - size() is called only once. ``` for (size_t ii = 0, count = values.size(); ii < count; ++ii) ``` **Edit:** I've been asked to actually answer the question, so here's my best shot. A compiler generally won't optimize a function call, because it doesn't know if it wi...
166,712
<p>I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is there a way to do the same thing in SDK apps, or is this an Apple only thing?</p>
[ { "answer_id": 166734, "author": "Stephen Darlington", "author_id": 2998, "author_profile": "https://Stackoverflow.com/users/2998", "pm_score": 9, "selected": true, "text": "<p>It's in UIApplication:</p>\n\n<p><strong>For Objective C:</strong></p>\n\n<p>Start:</p>\n\n<pre><code>[UIApplic...
2008/10/03
[ "https://Stackoverflow.com/questions/166712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6044/" ]
I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is there a way to do the same thing in SDK apps, or is this an Apple only thing?
It's in UIApplication: **For Objective C:** Start: ``` [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; ``` End: ``` [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; ``` **For swift :** Start ``` UIApplication.shared.isNetworkActivityIndicatorVisible = true ``` ...
166,718
<p><strong>Background</strong></p> <p>I am trying to create a copy of a business object I have created in VB.NET. I have implemented the ICloneable interface and in the Clone function, I create a copy of the object by serializing it with a BinaryFormatter and then de-serializing straight back out into another object ...
[ { "answer_id": 166773, "author": "FryHard", "author_id": 231, "author_profile": "https://Stackoverflow.com/users/231", "pm_score": 0, "selected": false, "text": "<p>An obvious question, but are you sure that you don't have a reference to MyControl from your Sheep object; be it an object ...
2008/10/03
[ "https://Stackoverflow.com/questions/166718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6165/" ]
**Background** I am trying to create a copy of a business object I have created in VB.NET. I have implemented the ICloneable interface and in the Clone function, I create a copy of the object by serializing it with a BinaryFormatter and then de-serializing straight back out into another object which I return from the ...
Do you have an event that the UI is subscribing to? A {Foo}Changed event if data-binding, or perhaps INotifyPropertyChanged? You might have to mark the event backing field as [NonSerialized] (or however attributes look in VB - I'm a C# person...). If you are using field-like-events (i.e. the abbreviated syntax without ...
166,722
<p>I know the name of the table I want to find. I'm using Microsoft SQL Server Management Studio 2005, and I want to search all databases in the database server that I'm attached to in the studio. Is this possible? Do I need to query the system tables?</p>
[ { "answer_id": 166825, "author": "Thad", "author_id": 24500, "author_profile": "https://Stackoverflow.com/users/24500", "pm_score": 2, "selected": false, "text": "<p>You can use the sp_MSforeacheachdb.</p>\n\n<p>sp_MSforeachdb 'IF EXISTS(SELECT * FROM sys.tables WHERE [Name] = ''TableNam...
2008/10/03
[ "https://Stackoverflow.com/questions/166722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5716/" ]
I know the name of the table I want to find. I'm using Microsoft SQL Server Management Studio 2005, and I want to search all databases in the database server that I'm attached to in the studio. Is this possible? Do I need to query the system tables?
As above but use system function not system tables ``` EXEC sp_MSForEachDB 'USE [?] IF OBJECT_ID(''dbo.mytable'') IS NOT NULL PRINT ''?''' ```
166,739
<p>I've got a byte() array returned as result of directx sound capture, but for other parts of my program I want to treat the results as single(). Is trundling down the array item by item the fastest way of doing it or is there a clever way to do it ? </p> <p>The code that gets it is</p> <pre><code>CType(Me._applicat...
[ { "answer_id": 166755, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": -1, "selected": false, "text": "<p>Try</p>\n\n<pre><code>float f = BitConverter.ToSingle(bytearray, 0);\n</code></pre>\n\n<p>In VB (I think):</p>\n\n...
2008/10/03
[ "https://Stackoverflow.com/questions/166739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2135219/" ]
I've got a byte() array returned as result of directx sound capture, but for other parts of my program I want to treat the results as single(). Is trundling down the array item by item the fastest way of doing it or is there a clever way to do it ? The code that gets it is ``` CType(Me._applicationBuffer.Read(Me._ne...
``` public float[] ByteArrayToFloatArray(byte[] byteArray) { float[] floatArray = new float[byteArray.Length / 4]; for (int i = 0; i < floatArray.Length; i++) { floatArray[i] = BitConverter.ToSingle(byteArray, i * 4); } return floatArray; } ``` The fastest way to do this (in terms of perfo...
166,752
<p>Does anyone know the full list of C# compiler number literal modifiers?</p> <p>By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this...</p> <pre><code>var x = 0; // x is ...
[ { "answer_id": 166762, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackoverflow.com/users/7116", "pm_score": 7, "selected": true, "text": "<pre><code>var y = 0f; // y is single\nvar z = 0d; // z is double\nvar r = 0m; // r is decimal\nvar i = 0U; // i is unsigned...
2008/10/03
[ "https://Stackoverflow.com/questions/166752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6276/" ]
Does anyone know the full list of C# compiler number literal modifiers? By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this... ``` var x = 0; // x is Int32 var y = 0f; /...
``` var y = 0f; // y is single var z = 0d; // z is double var r = 0m; // r is decimal var i = 0U; // i is unsigned int var j = 0L; // j is long (note capital L for clarity) var k = 0UL; // k is unsigned long (note capital L for clarity) ``` From the [C# specification](https://stackoverflow.com/questions/127776/where-...
166,772
<p>I am trying to update a custom firefox extension that I created for some tasks at work. Basically it is a sidebar that pulls up one of our webpages in an iframe for various purposes. When moving to Firefox 3 the iframe won't appear at all.</p> <p>Below is an example of the XUL files that contains extension specific...
[ { "answer_id": 166878, "author": "Zach", "author_id": 9128, "author_profile": "https://Stackoverflow.com/users/9128", "pm_score": 1, "selected": false, "text": "<p>I would try setting flex=\"1\" on the iframe. If that's not working, perhaps try it with the <a href=\"http://developer.mozi...
2008/10/03
[ "https://Stackoverflow.com/questions/166772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8345/" ]
I am trying to update a custom firefox extension that I created for some tasks at work. Basically it is a sidebar that pulls up one of our webpages in an iframe for various purposes. When moving to Firefox 3 the iframe won't appear at all. Below is an example of the XUL files that contains extension specific code incl...
1. Set flex="1" on the iframe 2. The XUL code for sidebar is not an overlay, it's a document loaded inside an iframe (look at the Firefox main window in the DOM inspector). So the root element should be <page>, not <overlay>. This, combined with the flex="1", should make the page display. 3. You usually want to put typ...
166,823
<p>Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it returns an object of type D; meanwhile, the implementati...
[ { "answer_id": 166849, "author": "Garth Gilmour", "author_id": 2635682, "author_profile": "https://Stackoverflow.com/users/2635682", "pm_score": 2, "selected": false, "text": "<p>As long as each class has a default constructor:</p>\n\n<pre><code> public B instance() throws Exception {...
2008/10/03
[ "https://Stackoverflow.com/questions/166823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it returns an object of type D; meanwhile, the implementation re...
Don't. Make the "foo" method abstract. ``` abstract class B { public abstract B foo(); } ``` Or receive an abstract factory through the base class constructor: ``` abstract class B { private final BFactory factory; protected B(BFactory factory) { this.factory = factory; } public B foo() ...
166,844
<p>I'm working on an integration testing project in .NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation.</p> <p>What is the best approach for the exe to wait on the service to complete its task (the service itself will not exit upon task completion)?<...
[ { "answer_id": 166890, "author": "Max Schmeling", "author_id": 3226, "author_profile": "https://Stackoverflow.com/users/3226", "pm_score": 0, "selected": false, "text": "<p>You could use IPC Channels: <a href=\"https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-1...
2008/10/03
[ "https://Stackoverflow.com/questions/166844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683/" ]
I'm working on an integration testing project in .NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation. What is the best approach for the exe to wait on the service to complete its task (the service itself will not exit upon task completion)? Both proc...
You can pass a `Semaphore` name to the service on the command line (or via some other mechanism, like *hard coding*), and then wait on the service to `Release()` it, by calling `WaitOne()` in your exe. App code: ``` Semaphore s = new Semaphore(1, 1, "MyNamedSemaphore"); // start service, passing the string "MyNamedSe...
166,855
<p>What is the PHP preg_replace in C#?</p> <p>I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using .Replace("old","new").</p> <pre><code>$patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'...
[ { "answer_id": 166889, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 2, "selected": false, "text": "<p>You are looking for <code>System.Text.RegularExpressions</code>;</p>\n\n<pre><code>using System.Text.RegularEx...
2008/10/03
[ "https://Stackoverflow.com/questions/166855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
What is the PHP preg\_replace in C#? I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using .Replace("old","new"). ``` $patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'; $replacements[0] ...
``` public static class StringManipulation { public static string PregReplace(string input, string[] pattern, string[] replacements) { if (replacements.Length != pattern.Length) throw new ArgumentException("Replacement and Pattern Arrays must be balanced"); for (int i = 0; i < patte...
166,895
<p>Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles?</p> <p>e.g.</p> <pre><code>mvn -P debug mvn -P release </code></pre> <p>I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same ...
[ { "answer_id": 167284, "author": "Aleksandar Dimitrov", "author_id": 11797, "author_profile": "https://Stackoverflow.com/users/11797", "pm_score": 9, "selected": true, "text": "<p>To quote the <a href=\"http://maven.apache.org/pom.html#Profiles\" rel=\"noreferrer\">Maven documentation on...
2008/10/03
[ "https://Stackoverflow.com/questions/166895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974/" ]
Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. ``` mvn -P debug mvn -P release ``` I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same interfaces.
To quote the [Maven documentation on this](http://maven.apache.org/pom.html#Profiles): > A profile element contains both an optional activation (a profile trigger) and the set of changes to be made to the POM if that profile has been activated. For example, a project built for a test environment may point to a differe...
166,897
<p>I have a problem similar to the one found here : <a href="https://stackoverflow.com/questions/86531/jsf-selectitem-label-formatting">JSF selectItem label formatting</a>. </p> <p>What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? </p> <p>I'v...
[ { "answer_id": 168092, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 5, "selected": true, "text": "<p>If I'm not misunderstanding your requirement, I was able to achieve formatting of the value in the input box during t...
2008/10/03
[ "https://Stackoverflow.com/questions/166897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24828/" ]
I have a problem similar to the one found here : [JSF selectItem label formatting](https://stackoverflow.com/questions/86531/jsf-selectitem-label-formatting). What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? I've tried using but that seems ...
If I'm not misunderstanding your requirement, I was able to achieve formatting of the value in the input box during the rendering of the view with: ``` <h:inputText id="text1" value="#{...}"> <f:convertNumber pattern="#,###,##0.00"/> </h:inputText> ``` I was using the Standard Faces Components in my vendor-brand...
166,941
<p>I am trying to get <a href="http://selenium-rc.openqa.org/tutorial.html" rel="nofollow noreferrer">Selenium RC</a> working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done:</p> <ul> <li>I have installed the Firefox Selenium-IDE extension.</li> <li>On the web server (which...
[ { "answer_id": 168964, "author": "Peter Howe", "author_id": 24106, "author_profile": "https://Stackoverflow.com/users/24106", "pm_score": 5, "selected": true, "text": "<p>I'm not sure of the etiquette of answering your own question... but having experimented in a trial-and-error way, her...
2008/10/03
[ "https://Stackoverflow.com/questions/166941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24106/" ]
I am trying to get [Selenium RC](http://selenium-rc.openqa.org/tutorial.html) working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done: * I have installed the Firefox Selenium-IDE extension. * On the web server (which in my case is actually the same machine running Firefox), ...
I'm not sure of the etiquette of answering your own question... but having experimented in a trial-and-error way, here's how I've managed to get Selenium working with PHP/Firefox3 on Ubuntu. 1. I downloaded RC and copied the php client directory to /usr/share/php as 'Selenium' 2. I navigated to the Selenium Server dir...
166,944
<p>I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac.</p> <p>I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just going to do a system() or popen(...
[ { "answer_id": 167200, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 8, "selected": true, "text": "<p>Depending on what you are doing, <a href=\"http://php.net/manual/en/function.system.php\" rel=\"noreferrer\">system()...
2008/10/03
[ "https://Stackoverflow.com/questions/166944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2999/" ]
I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through the minor trouble of installing mod\_python or mod\_wsgi on my Mac, so I was just going to do a system() or popen() from P...
Depending on what you are doing, [system()](http://php.net/manual/en/function.system.php) or [popen()](http://php.net/manual/en/function.popen.php) may be perfect. Use system() if the Python script has no output, or if you want the Python script's output to go directly to the browser. Use popen() if you want to write d...
167,003
<p>I generally stay away from <code>regular expressions</code> because I seldom find a good use for them. But in this case, I don't think I have choice. </p> <p>I need a regex for the following situation. I will be looking at three character strings. It will be a match if the first character is <code>1-9 or the lett...
[ { "answer_id": 167005, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 3, "selected": false, "text": "<pre><code>[1-9ondOND][123][0-9]\n</code></pre>\n\n<p>I omitted the <code>^</code> and <code>$</code> (beginning and en...
2008/10/03
[ "https://Stackoverflow.com/questions/167003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19038/" ]
I generally stay away from `regular expressions` because I seldom find a good use for them. But in this case, I don't think I have choice. I need a regex for the following situation. I will be looking at three character strings. It will be a match if the first character is `1-9 or the letters o,n,d (lower or upper)` ...
Slight variation on a few other answers. Restrict the input to be exactly the matched text. ``` ^[1-9ondOND][123][0-9]$ ```
167,004
<p>I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported.</p> <p><a href="http://www.balsamiq.com/blog/?p=231" rel="nofol...
[ { "answer_id": 631724, "author": "David Pokluda", "author_id": 223, "author_profile": "https://Stackoverflow.com/users/223", "pm_score": 0, "selected": false, "text": "<p>Will this work for you? Put this in MAKEFILE.:</p>\n\n<pre><code>export : *.bmml\n \"C:\\Program Files\\Balsamiq M...
2008/10/03
[ "https://Stackoverflow.com/questions/167004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/267/" ]
I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported. [This page](http://www.balsamiq.com/blog/?p=231) details the comm...
NMAKE pattern rules are a lot like GNU make old-school suffix rules. In your case, you had it almost right to begin with, but you were missing the .SUFFIXES declaration. For example: ``` .SUFFIXES: .bmml .png .bmml.png: @echo Building $@ from $< ``` I think this is only part of your solution though, because you ...
167,018
<p>I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel.</p> <pre> insert(triangle, bspnode) { .... else if(triangle spans bspnode) { (frontpie...
[ { "answer_id": 167036, "author": "Philip Rieck", "author_id": 12643, "author_profile": "https://Stackoverflow.com/users/12643", "pm_score": 5, "selected": true, "text": "<p>Threads are great if some part of the processing is waiting on something external (user input, I/O, some other proc...
2008/10/03
[ "https://Stackoverflow.com/questions/167018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel. ``` insert(triangle, bspnode) { .... else if(triangle spans bspnode) { (frontpiece, backp...
Threads are great if some part of the processing is waiting on something external (user input, I/O, some other processing) - the thread that's waiting can continue to wait, while a thread that isn't waiting forges on ahead. However, for processing-intensive tasks, more threads than processors actually creates overhead...
167,027
<p>I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be nice if when the user is entering data for it to ...
[ { "answer_id": 167037, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 8, "selected": true, "text": "<p>Did you try setting the style:</p>\n\n<pre><code>input {\n text-align:right;\n}\n</code></pre>\n\n<p>Just teste...
2008/10/03
[ "https://Stackoverflow.com/questions/167027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16292/" ]
I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be nice if when the user is entering data for it to sta...
Did you try setting the style: ``` input { text-align:right; } ``` Just tested, this works fine (in FF3 at least): ``` <html> <head> <title>Blah</title> <style type="text/css"> input { text-align:right; } </style> </head> <body> <input type="text" value="2"> ...
167,031
<p>Does anyone know the API call I can use to change the keyboard layout on a windows machine to Dvorak? Doing it through the UI is easy but I'd like to have a script that I can run on new VM's to automate the process. </p>
[ { "answer_id": 167052, "author": "pkaeding", "author_id": 4257, "author_profile": "https://Stackoverflow.com/users/4257", "pm_score": 3, "selected": false, "text": "<p>You can do this via the registry. Just save it as a .reg file, and open it on the new VM. I believe this should do it ...
2008/10/03
[ "https://Stackoverflow.com/questions/167031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23283/" ]
Does anyone know the API call I can use to change the keyboard layout on a windows machine to Dvorak? Doing it through the UI is easy but I'd like to have a script that I can run on new VM's to automate the process.
I may be four years late to the party, but did you ever find this: [Intlcfg Command-Line Options](http://technet.microsoft.com/en-us/library/cc722068%28v=WS.10%29.aspx) I don't have Windows Vista (very bad habit, Windows), but looking at this page and also at [Available Language Packs](http://technet.microsoft.com/en...
167,053
<p>I'm trying to understand the best way to get the connection to my databases.</p> <p>At the moment I've got a method which parses the URL (depending on the URL called the application has to connect to a different database, like customer1.example.com will connect to the customer1 database) and calls </p> <pre><code>...
[ { "answer_id": 167244, "author": "Thorsten79", "author_id": 19734, "author_profile": "https://Stackoverflow.com/users/19734", "pm_score": 0, "selected": false, "text": "<p>I'm not a Ruby programmer, but generally speaking a connection pool is a good idea. You can make that connection poo...
2008/10/03
[ "https://Stackoverflow.com/questions/167053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22083/" ]
I'm trying to understand the best way to get the connection to my databases. At the moment I've got a method which parses the URL (depending on the URL called the application has to connect to a different database, like customer1.example.com will connect to the customer1 database) and calls ``` ActiveRecord::Base.es...
Are the databases on the same server? I have a application where some of the model objects are from one database and others are from a different database. I override the table\_name function to specify the database. Won't work if they are different servers but will work for different databases in the same server. ```...
167,067
<p>Given a SCHEMA for implementing tags</p> <p>ITEM ItemId, ItemContent</p> <p>TAG TagId, TagName</p> <p>ITEM_TAG ItemId, TagId</p> <p>What is the best way to limit the number of ITEMS to return when selecting with tags?</p> <pre><code>SELECT i.ItemContent, t.TagName FROM item i INNER JOIN ItemTag it ON i.id = it...
[ { "answer_id": 167156, "author": "GSerg", "author_id": 11683, "author_profile": "https://Stackoverflow.com/users/11683", "pm_score": 1, "selected": false, "text": "<p>Maybe something like</p>\n\n<pre><code>select i.ItemContent, t.TagName from (SELECT ItemId, ItemContent FROM item limit 1...
2008/10/03
[ "https://Stackoverflow.com/questions/167067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22277/" ]
Given a SCHEMA for implementing tags ITEM ItemId, ItemContent TAG TagId, TagName ITEM\_TAG ItemId, TagId What is the best way to limit the number of ITEMS to return when selecting with tags? ``` SELECT i.ItemContent, t.TagName FROM item i INNER JOIN ItemTag it ON i.id = it.ItemId INNER JOIN tag t ON t.id = it.Ta...
My second solution uses a MySQL function GROUP\_CONCAT() to combine all tags matching the item into a comma-separated string in the result set. ``` SELECT i.ItemContent, GROUP_CONCAT(t.TagName ORDER BY t.TagName) AS TagList FROM item AS i INNER JOIN ItemTag AS it ON i.id = it.ItemId INNER JOIN tag AS t ON t.id =...
167,074
<p>I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with the exception of the name and timeout a...
[ { "answer_id": 167264, "author": "Ian Oxley", "author_id": 1904, "author_profile": "https://Stackoverflow.com/users/1904", "pm_score": 1, "selected": false, "text": "<p>I haven't used ASP.NET MVC yet myself, but you could try using <a href=\"http://msdn.microsoft.com/en-us/library/system...
2008/10/03
[ "https://Stackoverflow.com/questions/167074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24841/" ]
I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with the exception of the name and timeout attr...
Thanks Ian Oxley. The problem wasn't solved with the ResolveClientUrl though. It had to deal with the web.config file. I had code that looked like this: ``` <authorization> <deny users="?" /> <allow users="*" /> </authorization> ``` I added a location element below the main one and said that anybody could view...
167,084
<p>What is the the best of detecting and later altering the screen resolution and multiple desktop within .net</p> <p>I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the application to that (main object...
[ { "answer_id": 167102, "author": "Bob King", "author_id": 6897, "author_profile": "https://Stackoverflow.com/users/6897", "pm_score": 3, "selected": true, "text": "<p>I would never suggest altering a user's resolution unless you're doing something like a full-screen game, you can use</p>...
2008/10/03
[ "https://Stackoverflow.com/questions/167084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11802/" ]
What is the the best of detecting and later altering the screen resolution and multiple desktop within .net I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the application to that (main objective) and a...
I would never suggest altering a user's resolution unless you're doing something like a full-screen game, you can use ``` System.Windows.Forms.Screen.PrimaryScreen ``` to give you metrics about that main monitor.
167,109
<p>Consider these two C++ header cases:</p> <p>Case 1:</p> <pre><code>class Test { public: static int TEST_DATA[]; }; int Test::TEST_DATA[] = { 1, 2, 3, 4 }; </code></pre> <p>Case 2:</p> <pre><code>class Test { public: static int const TEST_DATA[]; }; int const Test::TEST_DATA[] = { 1, 2, 3, 4 }; </code...
[ { "answer_id": 167150, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 2, "selected": false, "text": "<p>The compiler may put the data into a different section of the binary depending on whether it's const or not - that's ...
2008/10/03
[ "https://Stackoverflow.com/questions/167109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18721/" ]
Consider these two C++ header cases: Case 1: ``` class Test { public: static int TEST_DATA[]; }; int Test::TEST_DATA[] = { 1, 2, 3, 4 }; ``` Case 2: ``` class Test { public: static int const TEST_DATA[]; }; int const Test::TEST_DATA[] = { 1, 2, 3, 4 }; ``` Is const in the latter case only for self-im...
The compiler may put the data into a different section of the binary depending on whether it's const or not - that's entirely at the discretion of the compiler.
167,120
<p>This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this:</p> <pre><code>a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var in a.iterkeys(): if var...
[ { "answer_id": 167134, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 5, "selected": true, "text": "<p>Consider <a href=\"http://docs.python.org/library/stdtypes.html#dict.pop\" rel=\"noreferrer\">dict.pop</a>:</p>\n\n<p...
2008/10/03
[ "https://Stackoverflow.com/questions/167120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18909/" ]
This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: ``` a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var in a.iterkeys(): if var in exclusion:...
Consider [dict.pop](http://docs.python.org/library/stdtypes.html#dict.pop): ``` for key in exclusion: a.pop(key, None) ``` The `None` keeps pop from raising an exception when `key` isn't a key.
167,129
<p>What is the functional programming approach to convert an <code>IEnumerable&lt;string&gt;</code> to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. </p> <p>Here's my example: </p> <pre><code>var selectedValues = from ListItem item in checkboxL...
[ { "answer_id": 167141, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 5, "selected": false, "text": "<pre><code>string.Join(\", \", string[] enumerable)\n</code></pre>\n" }, { "answer_id": 167142, "author": "yf...
2008/10/03
[ "https://Stackoverflow.com/questions/167129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10693/" ]
What is the functional programming approach to convert an `IEnumerable<string>` to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. Here's my example: ``` var selectedValues = from ListItem item in checkboxList.Items where item.Selected select item.Value; v...
``` var delimitedString = selectedValues.Aggregate((x,y) => x + ", " + y); ```
167,152
<p>How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column?</p> <p>I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily with using SQL Server 2005.</p>
[ { "answer_id": 167231, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 2, "selected": false, "text": "<p>If this is a web application, you could probably get your webserver to use UTF8 as it's default encoding. That way...
2008/10/03
[ "https://Stackoverflow.com/questions/167152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6244/" ]
How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column? I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily with using SQL Server 2005.
The `N` syntax is how you specify a unicode string literal in SQL Server. ``` N'Unicode string' 'ANSI string' ``` SQL Server will auto convert between the two when possible, using either a column's collation or the database's collation. So if your string literals don't actually contain unicode characters, you do no...
167,154
<p>This is a specific version of <a href="https://stackoverflow.com/questions/119540/business-logic-database-or-application-layer">this question</a>.<br/> I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer:</p> <pre><code>if (exists(obj)) { throw new Dupli...
[ { "answer_id": 167176, "author": "wcm", "author_id": 2173, "author_profile": "https://Stackoverflow.com/users/2173", "pm_score": 1, "selected": false, "text": "<p>In general, I try to avoid coding that relies on errors being thrown because I did something wrong. Sometimes, though, that'...
2008/10/03
[ "https://Stackoverflow.com/questions/167154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4690/" ]
This is a specific version of [this question](https://stackoverflow.com/questions/119540/business-logic-database-or-application-layer). I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer: ``` if (exists(obj)) { throw new DuplicateObjectException(); } Hi...
First, you **must** have a primary key or unique constraint on the database to enforce this uniqueness properly - no question. Given that the constraint exists, which way should you code in the application? My preference would be to try the insert and catch the exceptions. Because presumably most inserts will succeed,...
167,165
<p>I've been asked to maintain a large C++ codebase full of memory leaks. While poking around, I found out that we have a lot of buffer overflows that lead to the leaks (how it got this bad, I don't ever want to know). </p> <p>I've decided to removing the buffer overflows first, starting with the dangerous functions. ...
[ { "answer_id": 167166, "author": "MrValdez", "author_id": 1599, "author_profile": "https://Stackoverflow.com/users/1599", "pm_score": 2, "selected": false, "text": "<p>Here's some functions that I found that are dangerous:</p>\n\n<ul>\n<li>gets() - It doesn't check the length of the vari...
2008/10/03
[ "https://Stackoverflow.com/questions/167165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1599/" ]
I've been asked to maintain a large C++ codebase full of memory leaks. While poking around, I found out that we have a lot of buffer overflows that lead to the leaks (how it got this bad, I don't ever want to know). I've decided to removing the buffer overflows first, starting with the dangerous functions. What C/C++...
In general, any function that does not check bounds in the arguments. A list would be * gets() * scanf() * strcpy() * strcat() You should use size limited versions like stncpy, strncat, fgets, etc. Then be careful while giving the size limit; take into consideration the '\0' terminating the string. Also, arrays are ...
167,193
<p>I have 2 tables:</p> <pre><code>A s_id(key) name cli type B sa_id(key) s_id user pwd </code></pre> <p>So in Jpa I have:</p> <pre><code>@Entity class A...{ @OneToMany(fetch=FetchType.EAGER) @JoinTable( name="A_B", joinColumns={@JoinColumn(name="a_id", table="a",unique=false)}, inverseJoinColumns=...
[ { "answer_id": 167213, "author": "Paul Whelan", "author_id": 3050, "author_profile": "https://Stackoverflow.com/users/3050", "pm_score": 2, "selected": false, "text": "<p>No you do not need a join table for OneToMany. Look at the @mappedBy annoatation</p>\n" }, { "answer_id": 167...
2008/10/03
[ "https://Stackoverflow.com/questions/167193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22763/" ]
I have 2 tables: ``` A s_id(key) name cli type B sa_id(key) s_id user pwd ``` So in Jpa I have: ``` @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) @JoinTable( name="A_B", joinColumns={@JoinColumn(name="a_id", table="a",unique=false)}, inverseJoinColumns={@JoinColumn(name="b_id", table="b", ...
You do not need a JoinTable for this. If the class B has no reference to class A then the following will suffice ``` @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) Collection getB(){...} } ``` In most cases though you may want a bidirectional relationship in which case B has a reference to A. In that ca...
167,206
<p>Is there a PHP module that you can use to programmatically read a torrent to find out information about it, Seeders for instance?</p>
[ { "answer_id": 167256, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 3, "selected": false, "text": "<p>Google comes up with this <a href=\"http://sourceforge.net/projects/torrentflux/\" rel=\"noreferrer\">PHP client<...
2008/10/03
[ "https://Stackoverflow.com/questions/167206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
Is there a PHP module that you can use to programmatically read a torrent to find out information about it, Seeders for instance?
I have used these functions in a small website I made once. Think I found them with a php bittorrent tracker called OpenTracker or something, but can't find the website... You wont find the seeders in the torrent file though. The torrent file just contain info about the files, hash codes and lengths etc. And some trac...
167,224
<p>I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this:</p> <pre><code>var sign = Math.abs(n) / n; </code></pre> <p>But, there is any other way? Better than this?</p>
[ { "answer_id": 167255, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 5, "selected": true, "text": "<p>You'll be in trouble if n == 0... how about this:</p>\n\n<pre><code>var sign = n &lt; 0 ? -1 : 1;\n</code></pre>\n" ...
2008/10/03
[ "https://Stackoverflow.com/questions/167224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20601/" ]
I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this: ``` var sign = Math.abs(n) / n; ``` But, there is any other way? Better than this?
You'll be in trouble if n == 0... how about this: ``` var sign = n < 0 ? -1 : 1; ```
167,232
<p>Is there a way to configure a Visual Studio 2005 Web Deployment Project to install an application into a named Application Pool rather than the default app pool for a given web site?</p>
[ { "answer_id": 168362, "author": "Zachary Yates", "author_id": 8360, "author_profile": "https://Stackoverflow.com/users/8360", "pm_score": 5, "selected": true, "text": "<p>There is a good article describing custom actions here:\n<a href=\"http://weblogs.asp.net/scottgu/archive/2007/06/15...
2008/10/03
[ "https://Stackoverflow.com/questions/167232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7872/" ]
Is there a way to configure a Visual Studio 2005 Web Deployment Project to install an application into a named Application Pool rather than the default app pool for a given web site?
There is a good article describing custom actions here: [ScottGu's Blog](http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx) The question you asked is answered about halfway through the comments by 'Ryan', unfortunately it's in VB, but it shouldn't be...
167,233
<pre><code>rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm </code></pre> <p>I run this command without the --backup-dir option and when it copies the file over, it creates a backup with a current timestamp. When I include the --backup-dir option, it ma...
[ { "answer_id": 167248, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 2, "selected": false, "text": "<p>the manual says:</p>\n<blockquote>\n<p>--backup make backups (see --suffix &amp; --backup-dir)</p>\n<p>...
2008/10/03
[ "https://Stackoverflow.com/questions/167233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3404/" ]
``` rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm ``` I run this command without the --backup-dir option and when it copies the file over, it creates a backup with a current timestamp. When I include the --backup-dir option, it makes the backup into...
the manual says: > > --backup make backups (see --suffix & --backup-dir) > > > --backup-dir=DIR make backups into hierarchy based in DIR > > > --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir) > > > so it seems that you can use one or the other, not both (as I guess you want a way to determine what's...
167,238
<p>The question is not how to tell in a oneliner. If you're writing the code in a one-liner, <em>you know</em> you are. But how does a module, included by <code>-MMy::Module::Name</code> know that it all started from a oneliner. </p> <p>This is mine. It's non-portable though and relies on UNIX standard commands (altho...
[ { "answer_id": 167267, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 6, "selected": true, "text": "<p><code>$0</code> is set to <code>\"-e\"</code> if you're running from <code>-e</code>.</p>\n" }, { "answer_id": 16730...
2008/10/03
[ "https://Stackoverflow.com/questions/167238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11289/" ]
The question is not how to tell in a oneliner. If you're writing the code in a one-liner, *you know* you are. But how does a module, included by `-MMy::Module::Name` know that it all started from a oneliner. This is mine. It's non-portable though and relies on UNIX standard commands (although, it can be made portable...
`$0` is set to `"-e"` if you're running from `-e`.
167,247
<p>How do I stop a function/procedure in a superclass from been overridden in a subclass in Delphi (2007)?</p> <p>I want to mark it so it can not be altered, I believe there is a final keyword but can not for the life of me find the documentation for it, so I am not 100% sure that's what I need.</p>
[ { "answer_id": 167295, "author": "Lars Truijens", "author_id": 1242, "author_profile": "https://Stackoverflow.com/users/1242", "pm_score": 5, "selected": true, "text": "<p>The keyword is <code>final</code> as you thought. See <a href=\"http://dn.codegear.com/article/34324\" rel=\"norefer...
2008/10/03
[ "https://Stackoverflow.com/questions/167247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2098/" ]
How do I stop a function/procedure in a superclass from been overridden in a subclass in Delphi (2007)? I want to mark it so it can not be altered, I believe there is a final keyword but can not for the life of me find the documentation for it, so I am not 100% sure that's what I need.
The keyword is `final` as you thought. See <http://dn.codegear.com/article/34324> and <http://blogs.teamb.com/rudyvelthuis/2005/05/13/4311>. Also you can mark your class as sealed to prevent anyone from inheriting from it. You need a Delphi version higher than 7. ``` type TSomeClass = class protected procedure...
167,302
<p>I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr_accessor data persist and be available to the rake task? W...
[ { "answer_id": 168174, "author": "Matthias Winkelmann", "author_id": 4494, "author_profile": "https://Stackoverflow.com/users/4494", "pm_score": -1, "selected": false, "text": "<p>Of course it'll be lost, where do you think data goes when it dies? To a data h(e)aven from where it can alw...
2008/10/03
[ "https://Stackoverflow.com/questions/167302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13710/" ]
I have an application in which attr\_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr\_accessor data persist and be available to the rake task? What...
I assume you are asking whether data that is stored in attributes of ActiveRecord objects stemming from Web requests will be available when accessing them via a Rake task? No. They won't. That data won't even be available to the next web request. That data won't even be there if you load the same record twice. ``` cl...
167,304
<p>I am wondering if it is possible to use LINQ to pivot data from the following layout:</p> <pre><code>CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 </code></pre> <p>into something like t...
[ { "answer_id": 167331, "author": "mattlant", "author_id": 14642, "author_profile": "https://Stackoverflow.com/users/14642", "pm_score": -1, "selected": false, "text": "<p>Group your data on month, and then project it into a new datatable with columns for each month. The new table would b...
2008/10/03
[ "https://Stackoverflow.com/questions/167304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2833/" ]
I am wondering if it is possible to use LINQ to pivot data from the following layout: ``` CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 ``` into something like this: ``` CustID | Jan- 2...
Something like this? ``` List<CustData> myList = GetCustData(); var query = myList .GroupBy(c => c.CustId) .Select(g => new { CustId = g.Key, Jan = g.Where(c => c.OrderDate.Month == 1).Sum(c => c.Qty), Feb = g.Where(c => c.OrderDate.Month == 2).Sum(c => c.Qty), March = g.Where(...
167,316
<p>I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field?</p>
[ { "answer_id": 167338, "author": "Shaun Bowe", "author_id": 1514, "author_profile": "https://Stackoverflow.com/users/1514", "pm_score": 4, "selected": false, "text": "<pre><code>SELECT DATEADD(ms, -2, DATEADD(dd, 1, DATEDIFF(dd, 0, GetDate())))\n</code></pre>\n\n<p>I thought you had c# a...
2008/10/03
[ "https://Stackoverflow.com/questions/167316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21004/" ]
I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field?
The answer is `SELECT DATEADD(ms, -3, '2008-01-24')`, the explanation is below. From [Marc's blog](http://musingmarc.blogspot.com/2006/07/more-on-dates-and-sql.html): > > But wait, Marc... you said you like to use `BETWEEN`, but that query doesn't have one... that's because `BETWEEN` [is inclusive](http://www.techon...
167,323
<p>I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed <a href="https://stackoverflow.com/questions/164789/winforms-implementation-question-for-having-my-ui-run-independently-of-my-bll-l">here</a>.</p> <p>In trying to figure this out I wrote the following simple...
[ { "answer_id": 167377, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 5, "selected": true, "text": "<p>On a new thread, call Application.Run passing the form object, this will make the thread run its own message loop w...
2008/10/03
[ "https://Stackoverflow.com/questions/167323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed [here](https://stackoverflow.com/questions/164789/winforms-implementation-question-for-having-my-ui-run-independently-of-my-bll-l). In trying to figure this out I wrote the following simple test program. I simp...
On a new thread, call Application.Run passing the form object, this will make the thread run its own message loop while the window is open. Then you can call .Join on that thread to make your main thread wait until the UI thread has terminated, or use a similar trick to wait for that thread to complete. Example: ```...
167,343
<p>I have quickly read over the <a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx" rel="noreferrer">Microsoft Lambda Expression</a> documentation.</p> <p>This kind of example has helped me to understand better, though: </p> <pre><code>delegate int del(int i); del myDelegate = x =&gt; x * x; int j = myDel...
[ { "answer_id": 167359, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "<p>A lot of the times, you are only using the functionality in one place, so making a method just clutters up the class.</p>...
2008/10/03
[ "https://Stackoverflow.com/questions/167343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I have quickly read over the [Microsoft Lambda Expression](http://msdn.microsoft.com/en-us/library/bb397687.aspx) documentation. This kind of example has helped me to understand better, though: ``` delegate int del(int i); del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 ``` Still, I don't understand w...
[Lambda expressions](http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx) are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true; lambda expressions can be converted to expression trees...
167,371
<p>I just want to see what files were modded/added/deleted between 2 arbitrary revisions. How do I do this?</p> <p>Can I do this in tortoise as well?</p>
[ { "answer_id": 167378, "author": "Max Cantor", "author_id": 16034, "author_profile": "https://Stackoverflow.com/users/16034", "pm_score": 6, "selected": true, "text": "<pre><code>svn log -v -rX:Y .\n</code></pre>\n\n<p>The -v for \"verbose\" switch will give you detailed output on which ...
2008/10/03
[ "https://Stackoverflow.com/questions/167371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
I just want to see what files were modded/added/deleted between 2 arbitrary revisions. How do I do this? Can I do this in tortoise as well?
``` svn log -v -rX:Y . ``` The -v for "verbose" switch will give you detailed output on which files were affected on that revision. Note that "." assumes you are currently in a working copy directory, but you can also use a URL such as "<http://svn.myawesomesoftwareproject.com/trunk/lib/foo.c>". This information ca...
167,426
<p>I wrote small Python+Ajax programs (listed at the end) with socket module to study the COMET concept of asynchronous communications.<br/></p> <p>The idea is to allow browsers to send messages real time each others via my python program.<br/></p> <p>The trick is to let the "GET messages/..." connection opened waiti...
[ { "answer_id": 167997, "author": "Milen A. Radev", "author_id": 15785, "author_profile": "https://Stackoverflow.com/users/15785", "pm_score": 0, "selected": false, "text": "<p>I would recommend using a JS/Ajax library on the client-side just to eliminate the possibility of cross-browser ...
2008/10/03
[ "https://Stackoverflow.com/questions/167426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I wrote small Python+Ajax programs (listed at the end) with socket module to study the COMET concept of asynchronous communications. The idea is to allow browsers to send messages real time each others via my python program. The trick is to let the "GET messages/..." connection opened waiting for a message to ans...
The problem you have is that * your tcp socket handling isn't reading as much as it should * your http handling is not complete I recommend the following lectures: * [rfc2616](http://www.w3.org/Protocols/rfc2616/rfc2616.html) * [The sockets Networking API](http://www.kohala.com/start/unpv12e.html) by Stevens See th...
167,432
<p>Example</p> <p>G76 I0.4779 J270 K7 C90</p> <p>X20 Y30 </p> <p>If a number begins with I J K C X Y and it doesn't have a decimal then add decimal. Above example should look like:</p> <p>G76 I0.4779 J270 K7. C90.</p> <p>X20. Y30.</p> <p>Purpose of this code is to convert CNC code for an older Fanuc OPC controlle...
[ { "answer_id": 167530, "author": "tloach", "author_id": 14092, "author_profile": "https://Stackoverflow.com/users/14092", "pm_score": 2, "selected": false, "text": "<p><pre><code><code>Set RegEx = New RegExp\nRegEx.Global = True\nRegEx.Pattern = \"([IJKCXY]\\d+)([^\\.]|$)\"\nnewVar = Reg...
2008/10/03
[ "https://Stackoverflow.com/questions/167432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Example G76 I0.4779 J270 K7 C90 X20 Y30 If a number begins with I J K C X Y and it doesn't have a decimal then add decimal. Above example should look like: G76 I0.4779 J270 K7. C90. X20. Y30. Purpose of this code is to convert CNC code for an older Fanuc OPC controller
``` `Set RegEx = New RegExp RegEx.Global = True RegEx.Pattern = "([IJKCXY]\d+)([^\.]|$)" newVar = RegEx.Replace (oldString, "$1.$2")` ``` Where oldString is the original string, and newVar is the string with the decimals added.
167,439
<p><strong>Update:</strong> Thanks for the suggestions guys. After further research, I’ve reformulated the question here: <a href="https://stackoverflow.com/questions/217020/pythoneditline-on-os-x-163-sign-seems-to-be-bound-to-ed-prev-word">Python/editline on OS X: £ sign seems to be bound to ed-prev-word</a></p> <p>O...
[ { "answer_id": 167465, "author": "Fire Lancer", "author_id": 6266, "author_profile": "https://Stackoverflow.com/users/6266", "pm_score": 0, "selected": false, "text": "<p>Must be your setup, I can use the £ (Also european keyboard) under IDLE or the python command line just fine. (python...
2008/10/03
[ "https://Stackoverflow.com/questions/167439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20578/" ]
**Update:** Thanks for the suggestions guys. After further research, I’ve reformulated the question here: [Python/editline on OS X: £ sign seems to be bound to ed-prev-word](https://stackoverflow.com/questions/217020/pythoneditline-on-os-x-163-sign-seems-to-be-bound-to-ed-prev-word) On Mac OS X I can’t enter a pound s...
I'd imagine that the terminal emulator is eating the keystroke as a control code. Maybe see if it has a config file you can mess around with?
167,453
<p>I'm exploring the XML -> XSLT -> HTML meme for producing web content. I have very little XSLT experience.</p> <p>I'm curious what mechanisms are available in XSLT to handle abstractions or "refactoring".</p> <p>For example, with generic HTML and a service side include, many pages can be templated and decomposed to...
[ { "answer_id": 167468, "author": "Andre Bossard", "author_id": 21027, "author_profile": "https://Stackoverflow.com/users/21027", "pm_score": 3, "selected": false, "text": "<p>Templates, Includes.</p>\n\n<p>Xsl is very different from any other programming language. <code>Its rule based.</...
2008/10/03
[ "https://Stackoverflow.com/questions/167453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13663/" ]
I'm exploring the XML -> XSLT -> HTML meme for producing web content. I have very little XSLT experience. I'm curious what mechanisms are available in XSLT to handle abstractions or "refactoring". For example, with generic HTML and a service side include, many pages can be templated and decomposed to where there are,...
For my own project, this is how I divided up my pages. There was a template.xsl file which was imported by each of my XSLs. Most pages just had template.xsl, but some pages such as cart, etc. needed their own because of the different kind of data they were parsing. ``` <page title="Home"> <navigation> <!-...
167,464
<p>I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windows Authentication instead of SQL Server authentication. I am running this app off of Tomcat 6.0, and am utilizing the Microsoft JDBC driver. My connection properties file looks as follows:</p> <...
[ { "answer_id": 171038, "author": "Kevin Day", "author_id": 10973, "author_profile": "https://Stackoverflow.com/users/10973", "pm_score": 3, "selected": false, "text": "<p>Unless you have some really compelling reason not to, I suggest ditching the MS JDBC driver.</p>\n\n<p>Instead, use t...
2008/10/03
[ "https://Stackoverflow.com/questions/167464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/318/" ]
I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windows Authentication instead of SQL Server authentication. I am running this app off of Tomcat 6.0, and am utilizing the Microsoft JDBC driver. My connection properties file looks as follows: ``` dbDr...
I do not think one can push the user credentials from the browser to the database (and does it makes sense ? I think not) But if you want to use the credentials of the user running Tomcat to connect to SQL Server then you can use Microsoft's JDBC Driver. Just build your JDBC URL like this: ``` jdbc:sqlserver://localh...
167,471
<p>In Oracle, given a simple data table:</p> <pre><code>create table data ( id VARCHAR2(255), key VARCHAR2(255), value VARCHAR2(511)); </code></pre> <p>suppose I want to "insert or update" a value. I have something like:</p> <pre><code>merge into data using dual on (id='someid' and key...
[ { "answer_id": 167518, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 3, "selected": false, "text": "<p>I would hide the MERGE inside a PL/SQL API and then call that via JDBC:</p>\n\n<pre><code>data_pkg.merge_data ('so...
2008/10/03
[ "https://Stackoverflow.com/questions/167471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5309/" ]
In Oracle, given a simple data table: ``` create table data ( id VARCHAR2(255), key VARCHAR2(255), value VARCHAR2(511)); ``` suppose I want to "insert or update" a value. I have something like: ``` merge into data using dual on (id='someid' and key='testKey') when matched then up...
I don't consider using dual to be a hack. To get rid of binding/typing twice, I would do something like: ``` merge into data using ( select 'someid' id, 'testKey' key, 'someValue' value from dual ) val on ( data.id=val.id and data.key=val.key ) when matched then upd...
167,485
<p>Is it possible to have a HasMany relationship of a basic type such as String, on an ActiveRecord class, without the need for creating another entity such as (TodoListItem) to hold the value.</p> <pre><code>[ActiveRecord] public class TodoList { [PrimaryKey] public int Id { get { return _id; } set { _...
[ { "answer_id": 167591, "author": "akmad", "author_id": 1314, "author_profile": "https://Stackoverflow.com/users/1314", "pm_score": -1, "selected": false, "text": "<p>In ActiveRecord, your types map to a record in a table (by default). It seems like you are confusing how this type should...
2008/10/03
[ "https://Stackoverflow.com/questions/167485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4642/" ]
Is it possible to have a HasMany relationship of a basic type such as String, on an ActiveRecord class, without the need for creating another entity such as (TodoListItem) to hold the value. ``` [ActiveRecord] public class TodoList { [PrimaryKey] public int Id { get { return _id; } set { _id = value; } ...
Yes, you can do this. You can map a one-to-many relation to a built-in or simple type (value type or string) rather than a persisted type. You'll need to specify the `ColumnKey`, `Table` and `Element` params in the `HasMany` attribute declaration to get it to wire up properly. You have to have a surrogate key column ...
167,487
<p>If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this...</p> <p>(a) not working</p> <pre><code>-(void)myCallbackInThread { // move on... UIApplication* app = [UIApplication sharedApplication]; [app changeView]; } </code></pre> <p>then ...
[ { "answer_id": 167493, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 2, "selected": false, "text": "<p>Just found this in the iPhone threading docs</p>\n\n<blockquote>\n <p>If your application has a graphical\n use...
2008/10/03
[ "https://Stackoverflow.com/questions/167487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18017/" ]
If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this... (a) not working ``` -(void)myCallbackInThread { // move on... UIApplication* app = [UIApplication sharedApplication]; [app changeView]; } ``` then I find that the view appears, but...
In your case, it really depends on what's happening in [app changeView], but the reason it stops responding is most likely that you have no run loop dispatching events on your new, secondary thread (more on this below). In general, however, it is a very bad idea to update the GUI from a secondary thread. As you've alre...
167,491
<p>How do I in SQL Server 2005 use the DateAdd function to add a day to a date</p>
[ { "answer_id": 167501, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 5, "selected": false, "text": "<pre><code>DECLARE @MyDate datetime\n\n-- ... set your datetime's initial value ...'\n\nDATEADD(d, 1, @MyDate)\n</code...
2008/10/03
[ "https://Stackoverflow.com/questions/167491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21004/" ]
How do I in SQL Server 2005 use the DateAdd function to add a day to a date
Use the following function: ``` DATEADD(type, value, date) ``` * **date** is the date you want to manipulate * **value** is the integere value you want to add (or subtract if you provide a negative number) * **type** is one of: * yy, yyyy: year * qq, q: quarter * mm, m: month * dy, y: day of year * dd, d: day * wk, ...
167,502
<p>This is the page that I'm having. But the resize part in the section does not seem to be working. I copied most of the code from the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx" rel="nofollow noreferrer">Ajax site</a>. I placed a alert() in the tag (li...
[ { "answer_id": 167501, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 5, "selected": false, "text": "<pre><code>DECLARE @MyDate datetime\n\n-- ... set your datetime's initial value ...'\n\nDATEADD(d, 1, @MyDate)\n</code...
2008/10/03
[ "https://Stackoverflow.com/questions/167502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2894/" ]
This is the page that I'm having. But the resize part in the section does not seem to be working. I copied most of the code from the [Ajax site](http://www.asp.net/ajax/ajaxcontroltoolkit/samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx). I placed a alert() in the tag (line 108) to find the value of 'b.\_original...
Use the following function: ``` DATEADD(type, value, date) ``` * **date** is the date you want to manipulate * **value** is the integere value you want to add (or subtract if you provide a negative number) * **type** is one of: * yy, yyyy: year * qq, q: quarter * mm, m: month * dy, y: day of year * dd, d: day * wk, ...
167,509
<p>I have a GridView where one column is bound to an object property containing a nullable integer. I set SortExpression to the name of the property, and sorting works perfectly as long as all rows contain a value. If any rows contain null, however, I get an exception:</p> <p>System.InvalidOperationException : Failed ...
[ { "answer_id": 167519, "author": "Seth Petry-Johnson", "author_id": 23632, "author_profile": "https://Stackoverflow.com/users/23632", "pm_score": 3, "selected": true, "text": "<p>The Nullable type exposes a comparison method for comparing nullable types, so the solution is to override th...
2008/10/03
[ "https://Stackoverflow.com/questions/167509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23632/" ]
I have a GridView where one column is bound to an object property containing a nullable integer. I set SortExpression to the name of the property, and sorting works perfectly as long as all rows contain a value. If any rows contain null, however, I get an exception: System.InvalidOperationException : Failed to compare...
The Nullable type exposes a comparison method for comparing nullable types, so the solution is to override the gridview sorting logic and manually specify a comparison: ``` gridview.Sorting += new GridViewSortEventHandler(gridView_Sorting); protected void gridView_Sorting(object sender, GridViewSortEventArgs e) { ...
167,542
<p>I'm trying to create a table with two columns comprising the primary key in MySQL, but I can't figure out the syntax. I understand single-column PKs, but the syntax isn't the same to create a primary key with two columns.</p>
[ { "answer_id": 167553, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 1, "selected": false, "text": "<p>Example:</p>\n\n<pre><code> CREATE TABLE `synthesis`.`INV_MasterItemList` (\n `MasterItemList_ID` INTEGER UNSIGNED NO...
2008/10/03
[ "https://Stackoverflow.com/questions/167542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
I'm trying to create a table with two columns comprising the primary key in MySQL, but I can't figure out the syntax. I understand single-column PKs, but the syntax isn't the same to create a primary key with two columns.
``` CREATE TABLE table_name ( c1 INT NOT NULL, c2 INT NOT NULL, PRIMARY KEY (c1, c2) ) ```
167,562
<p>How can I know if a device is supported on a running Linux and if so, which device driver controls it? For instance, <code>lspci</code> on a server (PowerEdge 2900) gives:</p> <pre class="lang-none prettyprint-override"><code>00:00.0 Host bridge: Intel Corporation 5000X Chipset Memory Controller Hub (rev 12) 00:02....
[ { "answer_id": 167606, "author": "Alex B", "author_id": 23643, "author_profile": "https://Stackoverflow.com/users/23643", "pm_score": 2, "selected": false, "text": "<p>I don't think you can get a 100% clear-cut answer that you can get in Windows device manager.</p>\n\n<ul>\n<li>A device ...
2008/10/03
[ "https://Stackoverflow.com/questions/167562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8013/" ]
How can I know if a device is supported on a running Linux and if so, which device driver controls it? For instance, `lspci` on a server (PowerEdge 2900) gives: ```none 00:00.0 Host bridge: Intel Corporation 5000X Chipset Memory Controller Hub (rev 12) 00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Expr...
I don't think you can get a 100% clear-cut answer that you can get in Windows device manager. * A device may be controlled by several kernel modules (say `nvidia` + `agpgart`). * A kernel module may control more than one device (`usbhid`). * You can also have many-to-many relationship (`usbcore` + `usbhid`).
167,567
<p>I have been asked to write a testing application that needs to test a new stored procedure on multiple rows in a database, in essence I want to do something like this:</p> <pre><code>[Test] public void TestSelect() { foreach(id in ids) { DataTable old = Database.call(&quot;old_stored_proc&quot;,id); ...
[ { "answer_id": 167579, "author": "DKATDT", "author_id": 678, "author_profile": "https://Stackoverflow.com/users/678", "pm_score": 0, "selected": false, "text": "<p>Well you could declare a counter and then assert the value of the counter to determine pass/fail</p>\n\n<p>Also, you could d...
2008/10/03
[ "https://Stackoverflow.com/questions/167567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
I have been asked to write a testing application that needs to test a new stored procedure on multiple rows in a database, in essence I want to do something like this: ``` [Test] public void TestSelect() { foreach(id in ids) { DataTable old = Database.call("old_stored_proc",id); DataTable new_ ...
1) If the id's are constant and not looked up at test run time, create a separate unit test fixture for each id. That way you will know which id's are actually failing. See here for a write up on the problems with data driven tests: <http://googletesting.blogspot.com/2008/09/tott-data-driven-traps.html> 2) If you n...
167,576
<p>I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements.</p> <p>Here are two possible ways of doing it. Which one is the standard/best way of doing it?</p> <p>First way:</p> <pre><code>IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLE...
[ { "answer_id": 167599, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": false, "text": "<p>Using the Information Schema is the SQL Standard way to do it, so it should be used by all databases that support...
2008/10/03
[ "https://Stackoverflow.com/questions/167576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements. Here are two possible ways of doing it. Which one is the standard/best way of doing it? First way: ``` IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE...
For queries like this it is always best to use an `INFORMATION_SCHEMA` view. These views are (mostly) standard across many different databases and rarely change from version to version. To check if a table exists use: ``` IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TA...
167,577
<p>I am working on a project that requires reliable access to historic feed entries which are not necessarily available in the current feed of the website. I have found several ways to access such data, but none of them give me all the characteristics I need.</p> <p>Look at this as a brainstorm. I will tell you how mu...
[ { "answer_id": 167599, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": false, "text": "<p>Using the Information Schema is the SQL Standard way to do it, so it should be used by all databases that support...
2008/10/03
[ "https://Stackoverflow.com/questions/167577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24461/" ]
I am working on a project that requires reliable access to historic feed entries which are not necessarily available in the current feed of the website. I have found several ways to access such data, but none of them give me all the characteristics I need. Look at this as a brainstorm. I will tell you how much I have ...
For queries like this it is always best to use an `INFORMATION_SCHEMA` view. These views are (mostly) standard across many different databases and rarely change from version to version. To check if a table exists use: ``` IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TA...
167,587
<p>I'm trying to load assemblies in a separate app domain, but am running into a very strange problem. Here's some code:</p> <pre><code> public static void LoadAssembly(string assemblyPath) { string pathToDll = Assembly.GetCallingAssembly().CodeBase; AppDomainSetup domainSetup = new AppDomainSe...
[ { "answer_id": 167658, "author": "TheXenocide", "author_id": 8543, "author_profile": "https://Stackoverflow.com/users/8543", "pm_score": 0, "selected": false, "text": "<p>I don't believe the PrivateBinPath configuration is necessary, beyond that you don't need to use the Path to the DLL,...
2008/10/03
[ "https://Stackoverflow.com/questions/167587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15861/" ]
I'm trying to load assemblies in a separate app domain, but am running into a very strange problem. Here's some code: ``` public static void LoadAssembly(string assemblyPath) { string pathToDll = Assembly.GetCallingAssembly().CodeBase; AppDomainSetup domainSetup = new AppDomainSetup { ...
*(EDIT: after reading the exception given, changing answer completely)* It appears the problem is the CreateInstanceFromAndUnwrap call, which uses the LoadFrom semantics of 'pathToDll'. [Suzanne Cook detailed the possible sticking point](http://blogs.msdn.com/suzcook/archive/2003/05/29/choosing-a-binding-context.aspx#...
167,602
<p>I have a class which implements UserControl. In .NET 2005, a Dispose method is automatically created in the MyClass.Designer.cs partial class file that looks like this:</p> <pre><code> protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components....
[ { "answer_id": 167621, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 3, "selected": false, "text": "<p>I believe in this case the code-generator honors your code. It should be safe to put it in the codebehind.</p>\n" }, ...
2008/10/03
[ "https://Stackoverflow.com/questions/167602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22252/" ]
I have a class which implements UserControl. In .NET 2005, a Dispose method is automatically created in the MyClass.Designer.cs partial class file that looks like this: ``` protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } ...
In such a case I move the generated `Dispose` method to the main file and extend it. Visual Studio respects this. An other approach would be using a partial method (C# 3.0).
167,622
<p>What are the major difference between bindable LINQ and continuous LINQ?</p> <p>•Bindable LINQ: www.codeplex.com/bindablelinq</p> <p>•Continuous LINQ: www.codeplex.com/clinq</p> <p>One more project was added basing on the provided feedback:</p> <p>•Obtics: obtics.codeplex.com</p>
[ { "answer_id": 174924, "author": "KyleLanser", "author_id": 12923, "author_profile": "https://Stackoverflow.com/users/12923", "pm_score": 6, "selected": true, "text": "<p>Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. The...
2008/10/03
[ "https://Stackoverflow.com/questions/167622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19268/" ]
What are the major difference between bindable LINQ and continuous LINQ? •Bindable LINQ: www.codeplex.com/bindablelinq •Continuous LINQ: www.codeplex.com/clinq One more project was added basing on the provided feedback: •Obtics: obtics.codeplex.com
Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. There is one additional problem bindable solves, additional automatic event triggers. --- **The First Problem** both packages aim to solve is this: > > Objects returned by a LINQ query do > not provid...
167,628
<p>We are managing our development with Subversion over HTTPS, Bugzilla, and Mediawiki. Some of our developers have expressed an interest in migrating to Trac, so I have to evaluate what the cost of doing so would be. </p> <p>For both the wiki and bugzilla, we would need to either migrate the existing data into Trac...
[ { "answer_id": 174924, "author": "KyleLanser", "author_id": 12923, "author_profile": "https://Stackoverflow.com/users/12923", "pm_score": 6, "selected": true, "text": "<p>Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. The...
2008/10/03
[ "https://Stackoverflow.com/questions/167628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
We are managing our development with Subversion over HTTPS, Bugzilla, and Mediawiki. Some of our developers have expressed an interest in migrating to Trac, so I have to evaluate what the cost of doing so would be. For both the wiki and bugzilla, we would need to either migrate the existing data into Trac or a way to...
Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. There is one additional problem bindable solves, additional automatic event triggers. --- **The First Problem** both packages aim to solve is this: > > Objects returned by a LINQ query do > not provid...
167,657
<p>When IE8 is released, will the following code work to add a conditional stylesheet?</p> <pre><code>&lt;!--[if IE 8]&gt; &lt;link rel="stylesheet" type="text/css" href="ie-8.0.css" /&gt; &lt;![endif]--&gt; </code></pre> <p>I've read conflicting reports as to whether this works with the beta. I'm hoping someone c...
[ { "answer_id": 167691, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": true, "text": "<p>It worked for me – both in quirks mode and in standards compliance mode. However, it does <em>not</em> work when sw...
2008/10/03
[ "https://Stackoverflow.com/questions/167657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13850/" ]
When IE8 is released, will the following code work to add a conditional stylesheet? ``` <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="ie-8.0.css" /> <![endif]--> ``` I've read conflicting reports as to whether this works with the beta. I'm hoping someone can share their experience. Thanks.
It worked for me – both in quirks mode and in standards compliance mode. However, it does *not* work when switching to IE8 compatibility mode.
167,667
<p>Some of my users are complaining about some odd errors my installers had after downloading them from my web server.</p> <p>This are NSIS installer that when downloaded came crippled or incomplete (usually because of slow Internet connections), the message is very clear "The installer you are trying to use is corrup...
[ { "answer_id": 167711, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 0, "selected": false, "text": "<p>I haven't done an NSIS package since it was referred to as Super Pimp (great name). See if this helps:\n<a href=\"http://...
2008/10/03
[ "https://Stackoverflow.com/questions/167667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7946/" ]
Some of my users are complaining about some odd errors my installers had after downloading them from my web server. This are NSIS installer that when downloaded came crippled or incomplete (usually because of slow Internet connections), the message is very clear "The installer you are trying to use is corrupted or inc...
The CRC check runs before you/nsis can access the langstrings, so the only way to change this message is to recompile the source code. The message was changed several versions ago and now includes a URL to the NSIS wiki, one would think your users would be able to run a translator on that page
167,670
<p>I have a multi-column text file ( tab delimited ) that I use for localized text in my project. </p> <p>I picked this format since it can easily be edited by anyone in most text editors (and excel too). </p> <p>My makefile processes it into a bunch of defines and binary data for including directly into my app. </p>...
[ { "answer_id": 167722, "author": "Alex B", "author_id": 23643, "author_profile": "https://Stackoverflow.com/users/23643", "pm_score": 3, "selected": true, "text": "<p>It is line by line.</p>\n\n<ol>\n<li>The person who tries to commit later will get 'out of date' error, and when they try...
2008/10/03
[ "https://Stackoverflow.com/questions/167670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13676/" ]
I have a multi-column text file ( tab delimited ) that I use for localized text in my project. I picked this format since it can easily be edited by anyone in most text editors (and excel too). My makefile processes it into a bunch of defines and binary data for including directly into my app. Do you know if SVN ...
It is line by line. 1. The person who tries to commit later will get 'out of date' error, and when they try to update it, they will get a conflict in changed lines. 2. Same with the merge. The one who merges later will have to sort out conflicts manually.
167,697
<p>We're working with a semi-centralized git repository here where I work. Each developer has their own subtree in the central git repository, so it looks something like this:</p> <pre>master alice/branch1 alice/branch2 bob/branch1 michael/feature release/1.0 release/1.1</pre> <p>Working locally in my tree I have <co...
[ { "answer_id": 169110, "author": "webmat", "author_id": 6349, "author_profile": "https://Stackoverflow.com/users/6349", "pm_score": 2, "selected": false, "text": "<p>In your [remote \"origin\"] section, add one line per mapping. Including master to master.</p>\n\n<pre><code>push = refs/h...
2008/10/03
[ "https://Stackoverflow.com/questions/167697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17688/" ]
We're working with a semi-centralized git repository here where I work. Each developer has their own subtree in the central git repository, so it looks something like this: ``` master alice/branch1 alice/branch2 bob/branch1 michael/feature release/1.0 release/1.1 ``` Working locally in my tree I have `topic/feature`,...
If you can, I suggest you use the same branch names locally & remotely. Then `git push` will push all of your local branches to corresponding branches in the central repository. To use different prefixes in local and remote repos, you need to add a mapping to your config file each time you create a new feature branch....
167,735
<p>I am looking for a pseudo random number generator which would be specialized to work fast when it is given a seed before generating each number. Most generators I have seen so far assume you set seed once and then generate a long sequence of numbers. The only thing which looks somewhat similar to I have seen so far ...
[ { "answer_id": 167764, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "<p>Seems like you're asking for a hash-function rather than a PRNG. Googling 'fast hash function' yields several promising-look...
2008/10/03
[ "https://Stackoverflow.com/questions/167735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16673/" ]
I am looking for a pseudo random number generator which would be specialized to work fast when it is given a seed before generating each number. Most generators I have seen so far assume you set seed once and then generate a long sequence of numbers. The only thing which looks somewhat similar to I have seen so far is ...
Seems like you're asking for a hash-function rather than a PRNG. Googling 'fast hash function' yields several promising-looking results. [For example](http://burtleburtle.net/bob/hash/integer.html): ``` uint32_t hash( uint32_t a) a = (a ^ 61) ^ (a >> 16); a = a + (a << 3); a = a ^ (a >> 4); a = a * 0x...
167,740
<p>I recently began profiling an osgi java application that I am writing using VisualVM. One thing I have noticed is that when the application starts sending data to a client (over JMS), the number of loaded classes starts increasing at a steady rate. The Heap size and the PermGen size remains constant, however. The...
[ { "answer_id": 167779, "author": "Bill K", "author_id": 12943, "author_profile": "https://Stackoverflow.com/users/12943", "pm_score": 0, "selected": false, "text": "<p>Yes, it's usually a memory leak (since we don't really deal with memory directly, it's more of a class instance leak). ...
2008/10/03
[ "https://Stackoverflow.com/questions/167740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3335/" ]
I recently began profiling an osgi java application that I am writing using VisualVM. One thing I have noticed is that when the application starts sending data to a client (over JMS), the number of loaded classes starts increasing at a steady rate. The Heap size and the PermGen size remains constant, however. The numbe...
> > Are you dynamically creating new classes on the fly somehow? > > > Thanks for your help. I figured out what the problem is. In one of my classes, I was using Jaxb to create an XML string. In doing this, JAXB ueses reflection to create a new class. ``` JAXBContext context = JAXBContext.newInstance(this.getClas...
167,752
<p>I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form.</p> <p>It should display the average speed while typing and keep the last average when the keystrokes are idle...
[ { "answer_id": 167799, "author": "Kent Brewster", "author_id": 1151280, "author_profile": "https://Stackoverflow.com/users/1151280", "pm_score": 1, "selected": false, "text": "<p>Typing speed is generally computed in words per minute minus a penalty for typos. To do this it seems like yo...
2008/10/03
[ "https://Stackoverflow.com/questions/167752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form. It should display the average speed while typing and keep the last average when the keystrokes are idle. When the...
Here's a tested implementation,which seems ok, but I don't guarantee the math. A Demo: <http://jsfiddle.net/iaezzy/pLpx5oLf/> And the code: ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns...
167,760
<p>I have a class holding complex scientific computations. It is set up to only allow a user to create a properly instantiated case. To properly test the code, however, requires setting internal state variables directly, since the reference documents supply this data in their test cases. Done improperly, however, it...
[ { "answer_id": 167767, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 4, "selected": false, "text": "<p>You can use <a href=\"http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute...
2008/10/03
[ "https://Stackoverflow.com/questions/167760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10722/" ]
I have a class holding complex scientific computations. It is set up to only allow a user to create a properly instantiated case. To properly test the code, however, requires setting internal state variables directly, since the reference documents supply this data in their test cases. Done improperly, however, it can i...
Suppose you want to test this object by manipulating its fields. ``` public class ComplexCalculation { protected int favoriteNumber; public int FavoriteNumber { get { return favoriteNumber; } } } ``` Place this object in your test assembly/namespace: ``` public class ComplexCalculationTest :...
167,827
<p>Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?</p>
[ { "answer_id": 167840, "author": "ConcernedOfTunbridgeWells", "author_id": 15401, "author_profile": "https://Stackoverflow.com/users/15401", "pm_score": 0, "selected": false, "text": "<p>The guy who makes sure that what gets deployed is what's meant to get deployed.</p>\n" }, { "...
2008/10/03
[ "https://Stackoverflow.com/questions/167827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24881/" ]
Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?
Surprising they know what a software developer does! Anwyay, this sounds like a challenge for Haiku enthusiasts: in 5-7-5 (I'm lazy when doing english haiku and my seasonal reference is flakey - try a 3-5-3 if you like) ``` from many good parts: one programme on your PC; lose track, get winter ``` (hmm, 13 words)
167,852
<p>I am hosting a WCF service in a Windows Service on one of our servers. After making it work in basicHttpBinding and building a test client in .NET (which finally worked) I went along and try to access it from PHP using the SoapClient class. The final consumer will be a PHP site so I need to make it consumable in PHP...
[ { "answer_id": 167965, "author": "DaveK", "author_id": 4244, "author_profile": "https://Stackoverflow.com/users/4244", "pm_score": 1, "selected": false, "text": "<p>Please see this link:</p>\n\n<p><a href=\"http://keithelder.net/blog/archive/2008/01/17/Exposing-a-WCF-Service-With-Multipl...
2008/10/03
[ "https://Stackoverflow.com/questions/167852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1796/" ]
I am hosting a WCF service in a Windows Service on one of our servers. After making it work in basicHttpBinding and building a test client in .NET (which finally worked) I went along and try to access it from PHP using the SoapClient class. The final consumer will be a PHP site so I need to make it consumable in PHP. ...
This might help: <http://msdn.microsoft.com/en-us/library/ms734765.aspx> In a nutshell you need to configure your service endpoints and behaviour. Here is a minimal example: ``` <system.serviceModel> <services> <service <!-- Namespace.ServiceClass implementation --> name="WcfService1.Service1" ...
167,858
<p>I need to do some communications over a serial port in Ruby. From my research, it appears that there aren't many modern libraries for serial communications and the newest material I can find is from 2006. Are there any gems that I'm not aware of?</p> <p>I ultimately need to maintain communications with a serial d...
[ { "answer_id": 168132, "author": "AShelly", "author_id": 10396, "author_profile": "https://Stackoverflow.com/users/10396", "pm_score": 3, "selected": true, "text": "<p>The serial port specification has not changed in forever, I wouldn't worry about how old the libraries are.</p>\n\n<p>I'...
2008/10/03
[ "https://Stackoverflow.com/questions/167858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23909/" ]
I need to do some communications over a serial port in Ruby. From my research, it appears that there aren't many modern libraries for serial communications and the newest material I can find is from 2006. Are there any gems that I'm not aware of? I ultimately need to maintain communications with a serial device attach...
The serial port specification has not changed in forever, I wouldn't worry about how old the libraries are. I'm assuming you saw [this](http://www.rubyinside.com/cross-platform-ruby-serial-port-library-328.html) article from 2006 about ruby and serial ports [Here's](http://www.openlogic.com/blogs/2008/04/access-seri...
167,862
<p>One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... </p> <pre><code>using namespace xyzzy </code></pre> <p>...statements in them, which impact on my code when I least want or expect it.</p> <p>Is there a way I can somehow cancel/overrid...
[ { "answer_id": 168007, "author": "jk.", "author_id": 21284, "author_profile": "https://Stackoverflow.com/users/21284", "pm_score": 6, "selected": false, "text": "<p>No you can't <em>unuse</em> a namespace. The only thing you can do is putting the <code>using namespace</code>-statement a ...
2008/10/03
[ "https://Stackoverflow.com/questions/167862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... ``` using namespace xyzzy ``` ...statements in them, which impact on my code when I least want or expect it. Is there a way I can somehow cancel/override a previous "using" statement to...
Nope. But there's a potential solution: if you enclose your include directive in a namespace of its own, like this... ``` namespace codegear { #include "codegear_header.h" } // namespace codegear ``` ...then the effects of any using directives within that header are neutralized. That might be problematic in som...
167,909
<p>I hate Physics, but I love software development. When I go back to school after Thanksgiving, I'll be taking two more quarters of Physics before I'm done with the horrid thing. I am currently reading postings on the F# units of measurement feature, but I've never used a language like F#. Would it be suitable to writ...
[ { "answer_id": 167933, "author": "Ian Hopkinson", "author_id": 19172, "author_profile": "https://Stackoverflow.com/users/19172", "pm_score": -1, "selected": false, "text": "<p>Learning any computer language won't teach you physics, and you can learn physics by writing programs in any lan...
2008/10/03
[ "https://Stackoverflow.com/questions/167909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
I hate Physics, but I love software development. When I go back to school after Thanksgiving, I'll be taking two more quarters of Physics before I'm done with the horrid thing. I am currently reading postings on the F# units of measurement feature, but I've never used a language like F#. Would it be suitable to write a...
In my biased opinion, F# is ideal for physics. It has a feature called Units of Measure which does dimensional analysis for you, providing errors if you get it wrong. For example if you write: ``` let distance : float<meters> = gravity * 3.0<seconds> ``` That would **yield a compile-error**, since gravity is < meter...
167,923
<p>This is a pretty straight forward attempt. I haven't been using python for too long. Seems to work but I am sure I have much to learn. Someone let me know if I am way off here. Needs to find patterns, write the first line which matches, and then add a summary message for remaining consecutive lines which match patte...
[ { "answer_id": 168009, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 2, "selected": true, "text": "<p>The rematcher function seems to do what you want:</p>\n\n<pre><code>def rematcher(re_str, iterable):\n\n matcher= re.compi...
2008/10/03
[ "https://Stackoverflow.com/questions/167923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4527/" ]
This is a pretty straight forward attempt. I haven't been using python for too long. Seems to work but I am sure I have much to learn. Someone let me know if I am way off here. Needs to find patterns, write the first line which matches, and then add a summary message for remaining consecutive lines which match pattern ...
The rematcher function seems to do what you want: ``` def rematcher(re_str, iterable): matcher= re.compile(re_str) in_match= 0 for item in iterable: if matcher.match(item): if in_match == 0: yield item in_match+= 1 else: if in_match > 1: ...
167,954
<p>So I build an array of various dates. Birthdays, anniversaries, and holidays. I'd like to order the array by which one is happening next, essentially sort October to September (wrapping to next year)</p> <p>so if my array is </p> <pre><code>$a = ([0]=&gt;"1980-04-14", [1]=&gt;"2007-06-08", [2]=&gt;"2008-12-25",...
[ { "answer_id": 167995, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": -1, "selected": false, "text": "<p>Don't compare strings, instead use seconds since 1970 (ints):</p>\n\n<pre><code>$date1 = split(\"-\", $a);\n$date2 = spl...
2008/10/03
[ "https://Stackoverflow.com/questions/167954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3800/" ]
So I build an array of various dates. Birthdays, anniversaries, and holidays. I'd like to order the array by which one is happening next, essentially sort October to September (wrapping to next year) so if my array is ``` $a = ([0]=>"1980-04-14", [1]=>"2007-06-08", [2]=>"2008-12-25", [3]=>"1978-11-03") ``` I'd ...
``` function relative_year_day($date) { $value = date('z', strtotime($date)) - date('z'); if ($value < 0) $value += 365; return $value; } function cmp($a, $b) { $aValue = relative_year_day($a); $bValue = relative_year_day($b); if ($aValue == $bValue) return 0; return ($a...