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
469,902
<p>I have a sample string:</p> <pre><code>&lt;num&gt;1.&lt;/num&gt; &lt;Ref&gt;véase anomalía de Ebstein&lt;/Ref&gt; &lt;num&gt;2.&lt;/num&gt; &lt;Ref&gt;-&gt; vascularización&lt;/Ref&gt; </code></pre> <p>I wish to make a comma seperated string with the values inside ref tags.</p> <p>I have tried the following:</p> ...
[ { "answer_id": 469928, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 3, "selected": true, "text": "<p>You want to be using Matches rather than match to get all matches that occur, something like:</p>\n\n<pre><code>Regex r...
2009/01/22
[ "https://Stackoverflow.com/questions/469902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
I have a sample string: ``` <num>1.</num> <Ref>véase anomalía de Ebstein</Ref> <num>2.</num> <Ref>-> vascularización</Ref> ``` I wish to make a comma seperated string with the values inside ref tags. I have tried the following: ``` Regex r = new Regex("<ref>(?<match>.*?)</ref>"); Match m = ...
You want to be using Matches rather than match to get all matches that occur, something like: ``` Regex r = new Regex("<ref>(?<match>.*?)</ref>"); foreach (Match m in r.Matches(csv[4])) { if (m.Groups.Count > 0) { if (m.Groups["match"].Captures.Count > 0) { foreach (Capture c in m.G...
469,906
<p>For some reason I can't save a Time to MySQL. My Column is a datetime and I've also tried using a timestamp when I was testing. Here's my console session below:</p> <pre> $ ./script/console Loading development environment (Rails 2.1.0) >> Event.find 1 # Event id: 1, name: "Meeting at XXX", start_date: "2009-01-17" ...
[ { "answer_id": 469995, "author": "Mladen Prajdic", "author_id": 31345, "author_profile": "https://Stackoverflow.com/users/31345", "pm_score": 3, "selected": true, "text": "<p>CDC is only available in SQL Server Enterprise edition. so if you have express you can't use it and you'll have t...
2009/01/22
[ "https://Stackoverflow.com/questions/469906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For some reason I can't save a Time to MySQL. My Column is a datetime and I've also tried using a timestamp when I was testing. Here's my console session below: ``` $ ./script/console Loading development environment (Rails 2.1.0) >> Event.find 1 # Event id: 1, name: "Meeting at XXX", start_date: "2009-01-17" >> e.sta...
CDC is only available in SQL Server Enterprise edition. so if you have express you can't use it and you'll have to remain with triggers.
469,917
<p>What is the easiest way to alternate row colors in an HTML table (a.ka. striping). Most of my tables are created in XSL templates like the following, with the table, thead, etc.. defined in another template.</p> <pre><code>&lt;xsl:template match="typ:info"&gt; &lt;tr&gt; &lt;td&gt; &lt;xsl:value-of sele...
[ { "answer_id": 469968, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 6, "selected": true, "text": "<p>If you must produce hard-coded colors in HTML:</p>\n\n<pre><code>&lt;xsl:template match=\"typ:info\"&gt;\n &lt;xsl:vari...
2009/01/22
[ "https://Stackoverflow.com/questions/469917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2650/" ]
What is the easiest way to alternate row colors in an HTML table (a.ka. striping). Most of my tables are created in XSL templates like the following, with the table, thead, etc.. defined in another template. ``` <xsl:template match="typ:info"> <tr> <td> <xsl:value-of select="typ:dateAccessed" /> </td> ...
If you must produce hard-coded colors in HTML: ``` <xsl:template match="typ:info"> <xsl:variable name="css-class"> <xsl:choose> <xsl:when test="position() mod 2 = 0">even</xsl:when> <xsl:otherwise>odd</xsl:otherwise> </xsl:choose> </xsl:variable> <tr class="{$css-class}"> <td> <xsl:...
469,931
<p>let's say I have a bi-dimensional array like that</p> <pre><code>numpy.array( [[0,1,1.2,3], [1,5,3.2,4], [3,4,2.8,4], [2,6,2.3,5]]) </code></pre> <p>I want to have an array formed eliminating whole rows based on uniqueness of values of last column, selecting the row to keep based on value of third...
[ { "answer_id": 469963, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": -1, "selected": false, "text": "<p>The discrepancy is odd, but since SQL CE is a plugged-in item, it may well be that the team didn't test every possible ...
2009/01/22
[ "https://Stackoverflow.com/questions/469931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
let's say I have a bi-dimensional array like that ``` numpy.array( [[0,1,1.2,3], [1,5,3.2,4], [3,4,2.8,4], [2,6,2.3,5]]) ``` I want to have an array formed eliminating whole rows based on uniqueness of values of last column, selecting the row to keep based on value of third column. e.g. in this case...
I believe only Professional and above may create MSSQL CE databases. SQL CE is installed with 2008 studio, I was surprised to see it myself and didn't see an option to exclude it. Personally I use VS 2008 to add items to my project databases. Since it's open anyway I just use it. It provides most of the same function...
469,941
<p>As I understand (Perl is new to me) Perl can be used to script against a Unix command line. What I want to do is run (hardcoded) command line calls, and search the output of these calls for RegEx matches. Is there a way to do this simply in Perl? How?</p> <p>EDIT: Sequence here is: -Call another program. -Run a reg...
[ { "answer_id": 469957, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<pre><code>#!/usr/bin/perl\n\nsub my_action() {\n print \"Implement some action here\\n\";\n}\n\nopen PROG, \"/pat...
2009/01/22
[ "https://Stackoverflow.com/questions/469941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55484/" ]
As I understand (Perl is new to me) Perl can be used to script against a Unix command line. What I want to do is run (hardcoded) command line calls, and search the output of these calls for RegEx matches. Is there a way to do this simply in Perl? How? EDIT: Sequence here is: -Call another program. -Run a regex against...
``` my $command = "ls -l /"; my @output = `$command`; for (@output) { print if /^d/; } ``` The `qx//` quasi-quoting operator (for which backticks are a shortcut) is stolen from shell syntax: run the string as a command in a new shell, and return its output (as a string or a list, depending on context). See `perlo...
469,964
<p>I am using the current code in attempt to access a msSQL 2005 db:</p> <pre><code>&lt;?php $myServer = "[server]"; $myUser = "[username]"; $myPass = "[password]"; $myDB = "[db]"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer...
[ { "answer_id": 470006, "author": "savageguy", "author_id": 52555, "author_profile": "https://Stackoverflow.com/users/52555", "pm_score": 0, "selected": false, "text": "<p>Invalid credentials, if your not using localhost be sure you add the server's ip to the safe list. </p>\n" }, { ...
2009/01/22
[ "https://Stackoverflow.com/questions/469964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using the current code in attempt to access a msSQL 2005 db: ``` <?php $myServer = "[server]"; $myUser = "[username]"; $myPass = "[password]"; $myDB = "[db]"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a d...
It sounds to me like one of your DLLs is the wrong version. There was an issue of some sort with the move from SQL2000 to SQL2005 that the creators of PHP didn't resolve themselves. There are a variety of posts about it here: [the following link](http://ca3.php.net/manual/en/function.mssql-connect.php) I believe the D...
469,982
<p>I've written a class with a single static method that copies property values from one object to another. It doesn't care what type each object is, only that they have identical properties. It does what I need, so I'm not engineering it further, but what improvements would you make?</p> <p>Here's the code:</p> <p...
[ { "answer_id": 469988, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 2, "selected": false, "text": "<p>A new method that created a new instance of <code>To</code> and called the <code>Copy()</code> method before retu...
2009/01/22
[ "https://Stackoverflow.com/questions/469982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26414/" ]
I've written a class with a single static method that copies property values from one object to another. It doesn't care what type each object is, only that they have identical properties. It does what I need, so I'm not engineering it further, but what improvements would you make? Here's the code: ``` public class S...
Are your DTOs serializable? I would expect so, in which case: ``` MemberInfo[] sm = FormatterServices.GetSerializableMembers(typeof(From)); object[] data = FormatterServices.GetObjectData(from, sm); FormatterServices.PopulateObjectMembers(to, sm, data); ``` But note that I don't really agree with this general approa...
469,991
<p>I have this syntax which works (since it's from the API, pretty much)</p> <pre><code> &lt;% form_tag :action =&gt; "whatever" do -%&gt; &lt;div&gt;&lt;%= submit_tag 'Save' %&gt;&lt;/div&gt; &lt;% end -%&gt; </code></pre> <p>and this, which works</p> <pre><code>&lt;%= form_tag({:action =&gt; "whatever"}, {...
[ { "answer_id": 470003, "author": "DanSingerman", "author_id": 43965, "author_profile": "https://Stackoverflow.com/users/43965", "pm_score": 4, "selected": true, "text": "<pre><code>&lt;% form_tag({:action =&gt; 'whatever'}, :method =&gt; \"get\") do -%&gt;\n &lt;div&gt;&lt;%= submi...
2009/01/22
[ "https://Stackoverflow.com/questions/469991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8047/" ]
I have this syntax which works (since it's from the API, pretty much) ``` <% form_tag :action => "whatever" do -%> <div><%= submit_tag 'Save' %></div> <% end -%> ``` and this, which works ``` <%= form_tag({:action => "whatever"}, {:method => "get"})%> ``` Now I have tried to combine them, guessing the sy...
``` <% form_tag({:action => 'whatever'}, :method => "get") do -%> <div><%= submit_tag 'Save' %></div> <% end -%> ``` Looking at the [API docs](http://apidock.com/rails/ActionView/Helpers/FormTagHelper/form_tag), the issue is that `:method` needs to go in the `options` hash, and the `:action` in the `url_for_op...
469,993
<p>How do I find out which thread is the owner of my Event handle in windbg:</p> <p>I'm running</p> <pre><code>!handle 00003aec f </code></pre> <p>and get</p> <pre><code>Handle 00003aec Type Event Attributes 0 GrantedAccess 0x1f0003: Delete,ReadControl,WriteDac,WriteOwner,Synch QueryStat...
[ { "answer_id": 470148, "author": "deemok", "author_id": 23713, "author_profile": "https://Stackoverflow.com/users/23713", "pm_score": 0, "selected": false, "text": "<p>You can dig that out of a kernel dump.\n<p>Now, as far as kernel debugging goes, livekd from sysinternals should be suff...
2009/01/22
[ "https://Stackoverflow.com/questions/469993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5472/" ]
How do I find out which thread is the owner of my Event handle in windbg: I'm running ``` !handle 00003aec f ``` and get ``` Handle 00003aec Type Event Attributes 0 GrantedAccess 0x1f0003: Delete,ReadControl,WriteDac,WriteOwner,Synch QueryState,ModifyState HandleCount 2 PointerCou...
Looking at the callstack it appears that the stack in question is using a ReaderWriterLock locking mechanism. ``` 1130e410 00f24557 mscorwks!CRWLock::StaticAcquireWriterLockPublic+0xc9 ``` Change to thread 9 and using **sos.dll** run **!dso** to dump out the managed ReaderWriterLock object. Then run !do on that the ...
470,001
<p>I have the following java class with the JAXB @XMLRootElement annotation</p> <pre><code>@XmlRootElement(name="ClientData") public class ClientData { /** * The first address field of the person */ private String address1 = null; } </code></pre> <p>which produces this xml fragment when i generate the xsd schema</...
[ { "answer_id": 470095, "author": "dlinsin", "author_id": 198, "author_profile": "https://Stackoverflow.com/users/198", "pm_score": 2, "selected": false, "text": "<p>I don't know if it's possible, since I've never used it. But as far as I can tell the API doesn't support the documentation...
2009/01/22
[ "https://Stackoverflow.com/questions/470001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
I have the following java class with the JAXB @XMLRootElement annotation ``` @XmlRootElement(name="ClientData") public class ClientData { /** * The first address field of the person */ private String address1 = null; } ``` which produces this xml fragment when i generate the xsd schema ``` <xs:complexType name="...
Simple answer: no it's not possible with builtin JAXB.
470,008
<p>As the title suggests, I'm using Google App Engine and Django.</p> <p>I have quite a bit of identical code across my templates and would like to reduce this by including template files. So, in my main application directory I have the python handler file, the main template, and the template I want to include in my m...
[ { "answer_id": 470233, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 2, "selected": false, "text": "<p>First, you should consider using <a href=\"http://docs.djangoproject.com/en/dev/topics/templates/#template-inheri...
2009/01/22
[ "https://Stackoverflow.com/questions/470008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As the title suggests, I'm using Google App Engine and Django. I have quite a bit of identical code across my templates and would like to reduce this by including template files. So, in my main application directory I have the python handler file, the main template, and the template I want to include in my main templa...
I found that it works "out of the box" if I don't load Templates first and render them with a Context object. Instead, I use the standard method shown in the [AppEngine tutorial](http://code.google.com/appengine/docs/python/gettingstarted/templates.html).
470,009
<p>this subquery works in SQL Server:</p> <pre><code>select systemUsers.name, (select count(id) from userIncidences where idUser = systemUsers.id ) from systemUsers </code></pre> <p>How can It be made in SQL Compact?</p> <p>Thanks!</p>
[ { "answer_id": 470037, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>SELECT su.Name, COUNT(ui.ID)\nFROM systemUsers su\nLEFT JOIN userIncidences ui ON ui.idU...
2009/01/22
[ "https://Stackoverflow.com/questions/470009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4264/" ]
this subquery works in SQL Server: ``` select systemUsers.name, (select count(id) from userIncidences where idUser = systemUsers.id ) from systemUsers ``` How can It be made in SQL Compact? Thanks!
Try this: ``` SELECT su.Name, COUNT(ui.ID) FROM systemUsers su LEFT JOIN userIncidences ui ON ui.idUser = su.ID GROUP BY su.Name ``` [Edit:] I originally had an INNER JOIN just like Tomalak, but I realized that this would exclude users with no incidents, rather than show them with a 0 count. That might even be wh...
470,020
<p>I have a console application (<code>MyProgram.EXE</code>) that references a Utilities assembly.</p> <p>In my Utilities assembly, I have code that does:</p> <pre><code>Dim asm As Assembly = Assembly.GetExecutingAssembly() Dim location As String = asm.Location Dim appName As String = System.IO.Path.GetDirectoryName(...
[ { "answer_id": 470038, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": false, "text": "<p>Use <code>GetEntryAssembly()</code> instead to get the assembly containing the entry point.</p>\n\n<p>The better way to do ...
2009/01/22
[ "https://Stackoverflow.com/questions/470020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a console application (`MyProgram.EXE`) that references a Utilities assembly. In my Utilities assembly, I have code that does: ``` Dim asm As Assembly = Assembly.GetExecutingAssembly() Dim location As String = asm.Location Dim appName As String = System.IO.Path.GetDirectoryName(location) Conole.WriteLine("AppN...
Use `GetEntryAssembly()` instead to get the assembly containing the entry point. The better way to do it is using `System.Environment.CommandLine` property instead. Specifically: ``` Dim location As String = System.Environment.GetCommandLineArgs()(0) Dim appName As String = System.IO.Path.GetFileName(location) Conol...
470,041
<p>Is it possible to test a string with IsNumeric() and for it to return true, but when you cast that same string to an integer using CInt() and assign it to a variable of type integer that it will give a type mismatch error?</p> <p>I ask because I was getting a type mismatch error, so I used IsNumeric() to check the ...
[ { "answer_id": 470054, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": 2, "selected": false, "text": "<p>Yes, \"3.41\" would be numeric but not an integer.</p>\n" }, { "answer_id": 470060, "author": "Bryan Oakle...
2009/01/22
[ "https://Stackoverflow.com/questions/470041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to test a string with IsNumeric() and for it to return true, but when you cast that same string to an integer using CInt() and assign it to a variable of type integer that it will give a type mismatch error? I ask because I was getting a type mismatch error, so I used IsNumeric() to check the string was...
You may have an overflow due the maximum integer size; the currency type actually does very well for large numbers (but beware of any regional issues). See edits below for Int64 discussion. According to MSDN documentation on [IsNumeric](http://msdn.microsoft.com/en-us/library/6cd3f6w1.aspx): * IsNumeric returns True ...
470,045
<p>How-to break a for-each loop in XSLT?</p>
[ { "answer_id": 470103, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": true, "text": "<p>XSLT is written in a very functional style, and in this style there is no equivalent of a <code>break</code> statement....
2009/01/22
[ "https://Stackoverflow.com/questions/470045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
How-to break a for-each loop in XSLT?
XSLT is written in a very functional style, and in this style there is no equivalent of a `break` statement. What you can do is something like this: ``` <xsl:for-each select="...nodes..."> <xsl:if test="...some condition..."> ...body of loop... </xsl:if> </xsl:for-each> ``` That way the `for-each` wi...
470,074
<p>I have a Drupal module page where I am populating a form with a drop-down that contains a list of available parts of a set of files that the user can upload. Once the user uploads a file of a certain type, it removes that option from the list, and when all the available files are uploaded the form will not be rende...
[ { "answer_id": 470089, "author": "EricSchaefer", "author_id": 8976, "author_profile": "https://Stackoverflow.com/users/8976", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>The problem is that Drupal is drawing the form before it carries out the submit action, so it appear...
2009/01/22
[ "https://Stackoverflow.com/questions/470074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19513/" ]
I have a Drupal module page where I am populating a form with a drop-down that contains a list of available parts of a set of files that the user can upload. Once the user uploads a file of a certain type, it removes that option from the list, and when all the available files are uploaded the form will not be rendered....
You modify your form so that it saves some information on the state of the form. Then you add a new case to the beginning of the submit function that returns immediately if you're not done uploading all the files, and it will redraw the form. ``` function modulename_uploader_form(&$form_stuff=null) { //the function t...
470,084
<p>I have a 100 classes that have some similar elements and some unique. I've created an interface that names those similar items eg: interface IAnimal. What i would normally do is:</p> <pre><code>class dog : IAnimal </code></pre> <p>But there are 100 classes and i don't feel like going though them all and looking fo...
[ { "answer_id": 470099, "author": "Adam Ralph", "author_id": 49241, "author_profile": "https://Stackoverflow.com/users/49241", "pm_score": 2, "selected": false, "text": "<p>The solution is to modify the code generator. Currently it's too simplistic for your needs. It should add the inter...
2009/01/22
[ "https://Stackoverflow.com/questions/470084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46706/" ]
I have a 100 classes that have some similar elements and some unique. I've created an interface that names those similar items eg: interface IAnimal. What i would normally do is: ``` class dog : IAnimal ``` But there are 100 classes and i don't feel like going though them all and looking for the ones that i can appl...
You might solve this problem with **partial classes**: let the machine-generated/regenerated code be in one source file of each class, and the hand-coded part (defining the subclassing from IAnimal) in another.
470,111
<p>My WCF serice seems to be using the computer-name instead of the domain name. When I view the <code>MyService.svc?wsdl</code> link it is showing my computer name.</p> <p>Where do I add my domain name in the web.config? Endpoint address, baseaddress or identity?</p> <p>Note: I am using SSL so it has to be <code>htt...
[ { "answer_id": 891846, "author": "Aleksander Belov", "author_id": 70908, "author_profile": "https://Stackoverflow.com/users/70908", "pm_score": 2, "selected": false, "text": "<p>We're using <a href=\"http://wcfextras.codeplex.com/\" rel=\"nofollow noreferrer\">WCFExtras</a> to change the...
2009/01/22
[ "https://Stackoverflow.com/questions/470111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
My WCF serice seems to be using the computer-name instead of the domain name. When I view the `MyService.svc?wsdl` link it is showing my computer name. Where do I add my domain name in the web.config? Endpoint address, baseaddress or identity? Note: I am using SSL so it has to be `https://www.example.com/myservice.sv...
WCF 4.0 has solved this issue in some instances with a new config option that use Request Headers: ``` <behaviors> <serviceBehaviors> <behavior name="AutoVaultUploadBehavior"> <useRequestHeadersForMetadataAddress> <defaultPorts> <add s...
470,135
<p>I'm attempting to call a 3rd-party DLL from C#, and I'm having trouble marshalling some string data. The DLL was written with Clarion, and I'm not very familiar with the data types being used. Specifically, the spec has this signature for a function that I can't get to work: </p> <pre><code>Bool QuerySoftwareVersi...
[ { "answer_id": 470176, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": -1, "selected": false, "text": "<p>Try with a StringBuilder:</p>\n\n<pre><code>[DllImport(\"mylibrary.dll\")]\nstatic extern bool QuerySoftwareVer...
2009/01/22
[ "https://Stackoverflow.com/questions/470135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1245/" ]
I'm attempting to call a 3rd-party DLL from C#, and I'm having trouble marshalling some string data. The DLL was written with Clarion, and I'm not very familiar with the data types being used. Specifically, the spec has this signature for a function that I can't get to work: ``` Bool QuerySoftwareVersion( cstring* ve...
I've never called into Clarion, but I've got a DLL (in C) that is called from both Clarion and C#, and I'd interop that as: ``` [DllImport("clarionlib.dll", CharSet=CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, ExactSpelling=true, EntryPoint="QuerySoftwareVersion")] static extern bool QuerySof...
470,136
<p>I've inherited some aspx (including the web.config file) and am getting the following error. I've created a virtual directory for it but I'm not sure how would I "configure it as an application"?</p> <pre><code>Configuration Error Description: An error occurred during the processing of a configuration file require...
[ { "answer_id": 470152, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 4, "selected": true, "text": "<p>Go into the properties of the virtual directory, click the 'Virtual Directory' tab and click 'Create' button under 'A...
2009/01/22
[ "https://Stackoverflow.com/questions/470136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685/" ]
I've inherited some aspx (including the web.config file) and am getting the following error. I've created a virtual directory for it but I'm not sure how would I "configure it as an application"? ``` Configuration Error Description: An error occurred during the processing of a configuration file required to service t...
Go into the properties of the virtual directory, click the 'Virtual Directory' tab and click 'Create' button under 'Application Settings', then set 'Execute permissions' to 'Scripts only' Also check the ASP.NET tab to make sure it is set to the correct version for your app. Lastly, make sure the application pool bein...
470,139
<p>How does Python evaluate the expression <code>1+++2</code>?</p> <p>How many ever <code>+</code> I put in between, it is printing <code>3</code> as the answer. Please can anyone explain this behavior</p> <p>And for <code>1--2</code> it is printing <code>3</code> and for <code>1---2</code> it is printing <code>-1</c...
[ { "answer_id": 470156, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 7, "selected": true, "text": "<p>Your expression is the same as:</p>\n\n<pre><code>1+(+(+2))\n</code></pre>\n\n<p>Any numeric expression can be preceded...
2009/01/22
[ "https://Stackoverflow.com/questions/470139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16163/" ]
How does Python evaluate the expression `1+++2`? How many ever `+` I put in between, it is printing `3` as the answer. Please can anyone explain this behavior And for `1--2` it is printing `3` and for `1---2` it is printing `-1`
Your expression is the same as: ``` 1+(+(+2)) ``` Any numeric expression can be preceded by `-` to make it negative, or `+` to do nothing (the option is present for symmetry). With negative signs: ``` 1-(-(2)) = 1-(-2) = 1+2 = 3 ``` and ``` 1-(-(-2)) = 1-(2) = -1 ``` I see you clari...
470,167
<p>My application runs on a pSOS operating system. The code is compiled with Diab C compiler.</p> <p>The application defines a number of counters which have been declared as </p> <pre><code>unsigned int call_count; </code></pre> <p>As there are chances of some of these overflowing in a small time frame, I have decid...
[ { "answer_id": 470180, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>I doubt there is a performance issue, at least if you use a 64 bit processor, since the variable is almost always in the ca...
2009/01/22
[ "https://Stackoverflow.com/questions/470167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44111/" ]
My application runs on a pSOS operating system. The code is compiled with Diab C compiler. The application defines a number of counters which have been declared as ``` unsigned int call_count; ``` As there are chances of some of these overflowing in a small time frame, I have decided to declare the counters as `...
Is your code assuming that incrementing a 32-bit variable is an atomic operation? Incrementing a 64-bit variable on a 32-bit CPU probably won't be atomic unless you go out of your way to make it so. Example: 1. `call_count` equals `0x00000005FFFFFFFF` when a call comes in. 2. The lower half of `call_count` is increm...
470,174
<p>I have a web service setup for on a small part of a website and while the site overall gets a good amount of traffic this particular service does not. Once a day when I go to send a request through the web service it will fail on the first attempt, but retrying the request a second time works just fine. It's as if...
[ { "answer_id": 470684, "author": "rip747", "author_id": 31278, "author_profile": "https://Stackoverflow.com/users/31278", "pm_score": 1, "selected": false, "text": "<p>Try increasing the requesttimeout and see if that helps.</p>\n" }, { "answer_id": 471786, "author": "Justin ...
2009/01/22
[ "https://Stackoverflow.com/questions/470174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24284/" ]
I have a web service setup for on a small part of a website and while the site overall gets a good amount of traffic this particular service does not. Once a day when I go to send a request through the web service it will fail on the first attempt, but retrying the request a second time works just fine. It's as if it w...
You can try to use following method on a webservice client side. CF7+ got built-in coldfusion.server.ServiceFactory Java service. Code can look like ``` <cftry> <!--- here goes attempt to invoke service method, maybe dummy "ping" ---> <cfcatch type="any"> <!--- trying to refresh WSDL ---> <cfset createOb...
470,198
<p>What's the explanation for the following:</p> <pre><code>public class GenericsTest { //statement 1 public ArrayList&lt;Integer&gt;[] lists; public GenericsTest() { //statement 2 lists = new ArrayList&lt;Integer&gt;[4]; } } </code></pre> <p>The compiler accepts statement 1. ...
[ { "answer_id": 470276, "author": "Sven Lilienthal", "author_id": 57010, "author_profile": "https://Stackoverflow.com/users/57010", "pm_score": 3, "selected": false, "text": "<p>It's because you can't create, but you can <strong>use</strong> them:</p>\n\n<pre><code>public class GenericsTe...
2009/01/22
[ "https://Stackoverflow.com/questions/470198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19479/" ]
What's the explanation for the following: ``` public class GenericsTest { //statement 1 public ArrayList<Integer>[] lists; public GenericsTest() { //statement 2 lists = new ArrayList<Integer>[4]; } } ``` The compiler accepts statement 1. Statement 2 is flagged by the compiler...
There seems to be obscure cases where you could inadvertently cause a ClassCastException as explained here <http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf> (section 7.3) an intersting discussion on this topic could be found here <http://courses.csail.mit.edu/6.170/old-www/2006-Spring/forum/index.php%3Ftopic=...
470,201
<p>EDIT: It is not a listbox. My mistake. It is a list view.</p> <p>I have a list view control that's driving me nuts. It is a multi-select list box, so if the user selects 5000 rows, then de-selects them by selecting a single row, the SelectedIndexChanged fires 5001 times. This causes my app to hang.</p> <p>I'm tryi...
[ { "answer_id": 470252, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 0, "selected": false, "text": "<p>First, while you are properly synchronizing access to PaintQueue, I feel it was more by chance in this situation as o...
2009/01/22
[ "https://Stackoverflow.com/questions/470201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53531/" ]
EDIT: It is not a listbox. My mistake. It is a list view. I have a list view control that's driving me nuts. It is a multi-select list box, so if the user selects 5000 rows, then de-selects them by selecting a single row, the SelectedIndexChanged fires 5001 times. This causes my app to hang. I'm trying to use threads...
I remember solving this issue [before](http://bytes.com/groups/net-c/723916-c-listview-selection-change): > > A better way perhaps for you would be > to put a minimal delay in your > ItemSelectionChange Handler. Say -- > 50ms. Use a timer, Once the selection > changes, restart the timer. If the > selection chang...
470,208
<p>I have an app (let's just call it MyApp) that dynamically creates source code for a class and then compiles it. When it compiles the source code I also reference another DLL (that is the base class for this newly created class) that already exists in another folder. I do the following to compile and output the DLL:<...
[ { "answer_id": 470227, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 0, "selected": false, "text": "<p>Are you sure that when it was compiling, it referenced the instance of the DLL you think it is referencing? It might...
2009/01/22
[ "https://Stackoverflow.com/questions/470208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an app (let's just call it MyApp) that dynamically creates source code for a class and then compiles it. When it compiles the source code I also reference another DLL (that is the base class for this newly created class) that already exists in another folder. I do the following to compile and output the DLL: ``...
If you manually load an external DLL (Assembly) IT WILL NOT AUTOMATICALLY LOAD WHAT YOU REFERENCED. So you will have to create a AssemblyLoader. A code that checks the Referenced assemblies for your assembly and load them yourself. For complications regarding the references assemblies residing in odd folders on your...
470,222
<p>I need to create a Web-based Dashboard tool for a LOB application. Essentially users need to be able to log in to a web-site which will allow them to view stats for various bits of data, as well as see any notifications that pertain to them. Our primary application is built for the desktop using WPF. We also need to...
[ { "answer_id": 470431, "author": "Yordan Pavlov", "author_id": 54968, "author_profile": "https://Stackoverflow.com/users/54968", "pm_score": 6, "selected": true, "text": "<p>You can host a web page in a WPF application using the WebBrowser controls that was added in .NET 3.5 SP1:</p>\n\n...
2009/01/22
[ "https://Stackoverflow.com/questions/470222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
I need to create a Web-based Dashboard tool for a LOB application. Essentially users need to be able to log in to a web-site which will allow them to view stats for various bits of data, as well as see any notifications that pertain to them. Our primary application is built for the desktop using WPF. We also need to pr...
You can host a web page in a WPF application using the WebBrowser controls that was added in .NET 3.5 SP1: ``` <Grid> <WebBrowser Name="browser" /> </Grid> ``` And in the code-behind you have to set the Uri to your page and an object (which should be com-visible) that is to be called from the java script: ``` p...
470,230
<p>Since actionscript 3.0 is based on ECMAscript it shares some similarities with javascript. One such similarity that I have been playing around with is creating Objects from functions. </p> <p>In javascript to create an object,</p> <pre><code>var student = new Student( 33 ); document.write( student.age ); function...
[ { "answer_id": 470379, "author": "James Hay", "author_id": 47339, "author_profile": "https://Stackoverflow.com/users/47339", "pm_score": 1, "selected": false, "text": "<p>You need to declare Student in its own class within the file. That way Student is accessible anywhere within Main.</p...
2009/01/22
[ "https://Stackoverflow.com/questions/470230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48728/" ]
Since actionscript 3.0 is based on ECMAscript it shares some similarities with javascript. One such similarity that I have been playing around with is creating Objects from functions. In javascript to create an object, ``` var student = new Student( 33 ); document.write( student.age ); function Student( age ){ t...
Syntactically, this is one area (among many) where the two diverge. ;) You can create an object using a function: ``` private var studentName:String = "Joe"; private function init():void { var s = new Student("Chris"); trace(s.studentName); trace(this.studentName); trace(typeof s); trace(typ...
470,232
<p>I store the SQL script for a particular release in a subdirectory of 'scripts' named after the release version, e.g.</p> <pre><code>... ./scripts/1.8.3/script-1.8.3.sql ./scripts/1.8.4/script-1.8.4.sql ./scripts/1.8.4.1/script-1.8.4.1.sql ./scripts/1.8.4.2/script-1.8.4.2.sql ./scripts/1.8.4.3/script-1.8.4.3.sql ./s...
[ { "answer_id": 470264, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<pre><code>echo 1.2.3 | awk -F'.' '{ ver=1000000*$1 + 1000*$2 + $3; if (ver &gt; 1002001) print $_ }'\n</code></pre>\n" ...
2009/01/22
[ "https://Stackoverflow.com/questions/470232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I store the SQL script for a particular release in a subdirectory of 'scripts' named after the release version, e.g. ``` ... ./scripts/1.8.3/script-1.8.3.sql ./scripts/1.8.4/script-1.8.4.sql ./scripts/1.8.4.1/script-1.8.4.1.sql ./scripts/1.8.4.2/script-1.8.4.2.sql ./scripts/1.8.4.3/script-1.8.4.3.sql ./scripts/1.9.0/s...
``` echo 1.2.3 | awk -F'.' '{ ver=1000000*$1 + 1000*$2 + $3; if (ver > 1002001) print $_ }' ```
470,242
<p>I'm using a string builder to build some SQL Scripts. I have a few Boolean Properties that I would like to test and then output different text based on true/false. I've you the C# syntax below when assigning a value to a variable, but it isn't working for this particular situation. Any ideas?</p> <p>What I'm use...
[ { "answer_id": 470246, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 4, "selected": true, "text": "<p>Add parentheses:</p>\n\n<pre><code>script.Append(\"sometext\" + ((dbInfo.IsIdentity) ? \" IDENTITY(1,1)\" : \"...
2009/01/22
[ "https://Stackoverflow.com/questions/470242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37347/" ]
I'm using a string builder to build some SQL Scripts. I have a few Boolean Properties that I would like to test and then output different text based on true/false. I've you the C# syntax below when assigning a value to a variable, but it isn't working for this particular situation. Any ideas? What I'm used to doing: ...
Add parentheses: ``` script.Append("sometext" + ((dbInfo.IsIdentity) ? " IDENTITY(1,1)" : "")); ```
470,272
<p>I have <code>ControlA</code> which accepts an <code>IInterfaceB</code> which has a property of type <code>List&lt;unknownType&gt;</code></p> <p>In an event of <code>ControlA</code> i need to add a new instance of <code>unknownType</code> to the List in <code>IInterfaceB</code>...</p> <p><code>unknownType</code> n...
[ { "answer_id": 470283, "author": "Adam Ralph", "author_id": 49241, "author_profile": "https://Stackoverflow.com/users/49241", "pm_score": 0, "selected": false, "text": "<p>Would a restriction on the type work?</p>\n\n<pre><code>List&lt;T&gt; where T : IInterface\n</code></pre>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17540/" ]
I have `ControlA` which accepts an `IInterfaceB` which has a property of type `List<unknownType>` In an event of `ControlA` i need to add a new instance of `unknownType` to the List in `IInterfaceB`... `unknownType` needs specific properties so i immediately thought it could be an interface, but quickly realised int...
If I'm interpreting this correctly, you could add a constraint on unknownType to be of some interface that contains the properties you need: ``` class ControlA { void Frob<T>(IInterfaceB<T> something) where T : IHasSomeProperties, new() { something.ListOfT.Add(new T() { SomeProperty = 5 }); som...
470,275
<p>I have some ASP.NET page and webservice WebMethod() methods that I'd like to add some common code to. For example:</p> <pre><code>&lt;WebMethod()&gt; _ Public Function AddressLookup(ByVal zipCode As String) As Address #If DEBUG Then ' Simulate a delay System.Threading.Thread.Sleep(2000) #En...
[ { "answer_id": 470283, "author": "Adam Ralph", "author_id": 49241, "author_profile": "https://Stackoverflow.com/users/49241", "pm_score": 0, "selected": false, "text": "<p>Would a restriction on the type work?</p>\n\n<pre><code>List&lt;T&gt; where T : IInterface\n</code></pre>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698/" ]
I have some ASP.NET page and webservice WebMethod() methods that I'd like to add some common code to. For example: ``` <WebMethod()> _ Public Function AddressLookup(ByVal zipCode As String) As Address #If DEBUG Then ' Simulate a delay System.Threading.Thread.Sleep(2000) #End If Return New A...
If I'm interpreting this correctly, you could add a constraint on unknownType to be of some interface that contains the properties you need: ``` class ControlA { void Frob<T>(IInterfaceB<T> something) where T : IHasSomeProperties, new() { something.ListOfT.Add(new T() { SomeProperty = 5 }); som...
470,286
<p>In native programming the IXMLDOMDocument2 object had a <a href="http://msdn.microsoft.com/en-us/library/ms896487.aspx" rel="nofollow noreferrer"><code>tranformNode()</code></a> method:</p> <pre><code>public BSTR transformNode(IXMLDOMNode stylesheet); </code></pre> <p>So in the end I could transform an XML documen...
[ { "answer_id": 470353, "author": "Wolf5", "author_id": 37643, "author_profile": "https://Stackoverflow.com/users/37643", "pm_score": 0, "selected": false, "text": "<p>First load the XSL and the XML doc.</p>\n\n<pre><code>XmlDocument xsldoc = new XmlDocument();\nxsldoc.Load(xslfile);\n\nX...
2009/01/22
[ "https://Stackoverflow.com/questions/470286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
In native programming the IXMLDOMDocument2 object had a [`tranformNode()`](http://msdn.microsoft.com/en-us/library/ms896487.aspx) method: ``` public BSTR transformNode(IXMLDOMNode stylesheet); ``` So in the end I could transform an XML document using: ``` public string TransformDocument(IXMLDOMDocument2 doc, IXMLDO...
The functions take IXPathNavigable objects as input (and XmlDoucment/XmlNode classes implement IXPathNavigable). Here's how it would work: ``` public string TransformDocument(XmlDocument doc, XmlDocument stylesheet) { XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(stylesheet); // co...
470,302
<p>I got a class let's call it Blah. I use ObjectDataSource to get the data from the database and the value is bind it to Blah's property for example, Column Foo is Blah.Foo in my class. I can bind ObjectDataSource with a list of Blah to a gridview but i can't make it sortable since the datasource is not datatable. Doe...
[ { "answer_id": 470334, "author": "hova", "author_id": 2170, "author_profile": "https://Stackoverflow.com/users/2170", "pm_score": 0, "selected": false, "text": "<p>You need to implement the IComparable interfaces. There may be other interfaces you need to implement, but they will all be...
2009/01/22
[ "https://Stackoverflow.com/questions/470302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
I got a class let's call it Blah. I use ObjectDataSource to get the data from the database and the value is bind it to Blah's property for example, Column Foo is Blah.Foo in my class. I can bind ObjectDataSource with a list of Blah to a gridview but i can't make it sortable since the datasource is not datatable. Does a...
First you could use the AllowSorting property of the gridview with SortExpression on your fields. Here is a [tutorial](http://www.eggheadcafe.com/tutorials/aspnet/e07f0f1a-4243-4050-8278-00d32b2e5121/aspnet--sorting-a-gridv.aspx) Second, you could made a generic list of Blah and then call .Sort() ``` List<Blah> test ...
470,313
<p>I have an XML file with no DOCTYPE declaration that I would like to validate with an external DTD upon reading.</p> <pre><code>Dim x_set As Xml.XmlReaderSettings = New Xml.XmlReaderSettings() x_set.XmlResolver = Nothing x_set.CheckCharacters = False x_set.ProhibitDtd = False x = XmlTextReader.Create(sChemin, x_set)...
[ { "answer_id": 535708, "author": "Jim Counts", "author_id": 36737, "author_profile": "https://Stackoverflow.com/users/36737", "pm_score": 1, "selected": false, "text": "<p>Could you create an Xml.XmlDocument with the DTD you want, then append the XML file data to the in-memory Xml.XmlDoc...
2009/01/22
[ "https://Stackoverflow.com/questions/470313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
I have an XML file with no DOCTYPE declaration that I would like to validate with an external DTD upon reading. ``` Dim x_set As Xml.XmlReaderSettings = New Xml.XmlReaderSettings() x_set.XmlResolver = Nothing x_set.CheckCharacters = False x_set.ProhibitDtd = False x = XmlTextReader.Create(sChemin, x_set) ``` How do ...
I have used the following function successfully before, which should be easy to adapt. How ever this relies on creating a XmlDocument as magnifico mentioned. This can be achieved by: ``` XmlDocument doc = new XmlDocument(); doc.Load( filename ); doc.InsertBefore( doc.CreateDocumentType( "doc_type_name", null, DtdFileP...
470,315
<p>I've got a ListView which binds to a LinqDataSource and displays selected locations. The insert item Contains a dropdownlist that pulls from another LinqDataSource to give all the unselected locations.</p> <p>The problem is that I get the following error when loading the page:</p> <p>Databinding methods such as E...
[ { "answer_id": 629285, "author": "stefann", "author_id": 75426, "author_profile": "https://Stackoverflow.com/users/75426", "pm_score": 2, "selected": false, "text": "<p>Take a look at this thread <a href=\"http://forums.asp.net/t/1187425.aspx\" rel=\"nofollow noreferrer\">http://forums.a...
2009/01/22
[ "https://Stackoverflow.com/questions/470315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17145/" ]
I've got a ListView which binds to a LinqDataSource and displays selected locations. The insert item Contains a dropdownlist that pulls from another LinqDataSource to give all the unselected locations. The problem is that I get the following error when loading the page: Databinding methods such as Eval(), XPath(), an...
As explained on [Joteke's Blog](http://aspadvice.com/blogs/joteke/archive/2008/08/24/Is-_2200_Databinding-methods-such-as-Eval_280029002C00_-XPath_280029002C00_-and-Bind_28002900_-can-only-be-used-in-the-context-of-a-databound-control_2E002200_-causing-you-grief_3F00_.aspx) here is a quoted solution. > > Are you usin...
470,321
<p>I have a page that is pulling in via an iframe a page of html content from a pre-existing content management system, whose content I can not directly change. I want to use jquery to alter some of the links and button locations dynamically.</p> <p>For links within the page I was able to change the href attr values o...
[ { "answer_id": 470329, "author": "Sampson", "author_id": 54680, "author_profile": "https://Stackoverflow.com/users/54680", "pm_score": -1, "selected": false, "text": "<p>Attributes are changed with the <a href=\"http://docs.jquery.com/Attributes/attr#keyvalue\" rel=\"nofollow noreferrer\...
2009/01/22
[ "https://Stackoverflow.com/questions/470321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a page that is pulling in via an iframe a page of html content from a pre-existing content management system, whose content I can not directly change. I want to use jquery to alter some of the links and button locations dynamically. For links within the page I was able to change the href attr values of ``` <a...
Not very proud of this solution, but it works.... ``` var getid = /id_Product=(\d+)/; $('input[type="button"]').each(function() { var onclick = String(this.onclick); var id = onclick.match(getid); if(id) { this.onclick = function() { window.location = "/shopping-basket2.asp?mode=add&id_...
470,323
<p>I have a Linq to SQL DataContext with SQL functions into it. While the retrieve object is good, I would like to add a property to the object and same time shortens the object name. So I made an object Reminder that inherits from the Linq to SQL object fnRTHU_ReminderByTaskResult with the property I wanted.</p> <pre...
[ { "answer_id": 470337, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": -1, "selected": false, "text": "<p>Unfortunately you are attempting to downcast which C# does not support. You are not able to cast from a parent ty...
2009/01/22
[ "https://Stackoverflow.com/questions/470323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47109/" ]
I have a Linq to SQL DataContext with SQL functions into it. While the retrieve object is good, I would like to add a property to the object and same time shortens the object name. So I made an object Reminder that inherits from the Linq to SQL object fnRTHU\_ReminderByTaskResult with the property I wanted. ``` public...
Since the Linq to Sql function returns that base class, your object was never that of your derived class. Therefore, when trying to cast down, it can't do it. You can however provide implicit and explicit casting implementations within your class that would allow this cast to work. [See here](http://msdn.microsoft.co...
470,331
<p><strong>Is there a way to portably determine the upper and lower bound on void-pointer values in ANSI C89/ISO C90?</strong> (I currently do not have a copy of the standard with me (I have one at home). Of course if void-pointer values are guaranteed to be unsigned this task is trivial (via sizeof(void *)); however,...
[ { "answer_id": 470341, "author": "JSBձոգչ", "author_id": 8078, "author_profile": "https://Stackoverflow.com/users/8078", "pm_score": 0, "selected": false, "text": "<p>Pointers are guaranteed by spec to be unsigned. But why on earth do you want to find the bounds? \"Everything between 0x0...
2009/01/22
[ "https://Stackoverflow.com/questions/470331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Is there a way to portably determine the upper and lower bound on void-pointer values in ANSI C89/ISO C90?** (I currently do not have a copy of the standard with me (I have one at home). Of course if void-pointer values are guaranteed to be unsigned this task is trivial (via sizeof(void \*)); however, I cannot recall...
There is no portable way to determine if a given pointer is valid or not. You have to know what kind of memory system you're dealing with. Depending on the operating system and processor, there may or may not be a way to query the virtual memory manager's page tables to determine the valid ranges of pointers. For exam...
470,339
<p>Is there a way to perform a top (Take) linq query using percentage? The T-SQL would have been:</p> <pre><code>SELECT TOP 20 PERCENT ... </code></pre> <p>But LINQ seems to only want an int.</p> <p>It seems that I would have to do a count and then a take. Any suggestions?</p>
[ { "answer_id": 470370, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 3, "selected": true, "text": "<p>You would have to perform the query twice, in essence. You would have to perform it once to get a count, and then aga...
2009/01/22
[ "https://Stackoverflow.com/questions/470339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52165/" ]
Is there a way to perform a top (Take) linq query using percentage? The T-SQL would have been: ``` SELECT TOP 20 PERCENT ... ``` But LINQ seems to only want an int. It seems that I would have to do a count and then a take. Any suggestions?
You would have to perform the query twice, in essence. You would have to perform it once to get a count, and then again to figure out the percentage (because you will pass the number that corresponds to the count that will equal 20%).
470,356
<p>I have Apache setup to serve requests for <a href="http://www.mysite.com" rel="nofollow noreferrer">http://www.mysite.com</a> from this directory:</p> <p>/var/www/html/www.mysite.com</p> <p>The Django site is in /var/www/html/www.mysite.com/mysite.</p> <p>I get this error when I make a request for /mysite/app/foo...
[ { "answer_id": 470447, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 1, "selected": false, "text": "<p>Does your <code>mysite</code> directory contain a <code>__init__.py</code> file? It should, to <a href=\"http://docs.pytho...
2009/01/22
[ "https://Stackoverflow.com/questions/470356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have Apache setup to serve requests for <http://www.mysite.com> from this directory: /var/www/html/www.mysite.com The Django site is in /var/www/html/www.mysite.com/mysite. I get this error when I make a request for /mysite/app/foo: (big stack trace) AttributeError: 'module' object has no attribute 'common' 'mya...
Does your `mysite` directory contain a `__init__.py` file? It should, to [mark it as a package](http://docs.python.org/tutorial/modules.html#packages).
470,390
<p>Ok..here is the problem</p> <p>I have a main UI form that has a control container that i can add some buttons item to it,and also i have a backgroundworker object that starts up a listner. When the listner events fire, i would like to create a button in that control container on the main UI form. Everything seems t...
[ { "answer_id": 470519, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 0, "selected": false, "text": "<p>You have to use the <a href=\"http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.run...
2009/01/22
[ "https://Stackoverflow.com/questions/470390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Ok..here is the problem I have a main UI form that has a control container that i can add some buttons item to it,and also i have a backgroundworker object that starts up a listner. When the listner events fire, i would like to create a button in that control container on the main UI form. Everything seems to work fin...
Assuming you moved all UI operations into the RunWorkerCompleted method, it looks like a bug: <http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=116930> <http://thedatafarm.com/devlifeblog/archive/2005/12/21/39532.aspx> I suggest using the bullet-proof (pseudocode): ``` if(control.Invok...
470,399
<p>I'm trying to implement some kind of caching in a PHP script that will go out to many different clients/sites, which will be deployed by fairly non-technical users, using a variety of web hosts. Due to the non-technical nature of the users, I'd like to avoid asking them to tweak file permissions. The caching need...
[ { "answer_id": 470428, "author": "JDrago", "author_id": 29060, "author_profile": "https://Stackoverflow.com/users/29060", "pm_score": 0, "selected": false, "text": "<p>I vote for \"Cache the data on a server I control, and have the client download new data from there on each hit.\"</p>\n...
2009/01/22
[ "https://Stackoverflow.com/questions/470399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30529/" ]
I'm trying to implement some kind of caching in a PHP script that will go out to many different clients/sites, which will be deployed by fairly non-technical users, using a variety of web hosts. Due to the non-technical nature of the users, I'd like to avoid asking them to tweak file permissions. The caching needs to b...
Okay, I figured out how to do this by emulating ASP-style application variables using a shared/global session state. Two key changes from my non-working code in the relevant update: 1. To switch session state, we must end the current session, switch to the new one, then start it. I've encapsulated this process in swit...
470,430
<p>In plain Java SE 6 environment:</p> <pre><code>Logger l = Logger.getLogger("nameless"); l.setLevel(Level.ALL); l.fine("somemessage"); </code></pre> <p>Nothing shows up in Eclipse console. <em>l.info("")</em> and above works just fine, but anything below <em>fine</em> just doesn't seem to work. What's could be wron...
[ { "answer_id": 470492, "author": "Kevin", "author_id": 26620, "author_profile": "https://Stackoverflow.com/users/26620", "pm_score": 7, "selected": true, "text": "<p>Even though the Logger level is set to ALL, the ConsoleHandler (the default Handler on the logger) still has a default lev...
2009/01/22
[ "https://Stackoverflow.com/questions/470430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15187/" ]
In plain Java SE 6 environment: ``` Logger l = Logger.getLogger("nameless"); l.setLevel(Level.ALL); l.fine("somemessage"); ``` Nothing shows up in Eclipse console. *l.info("")* and above works just fine, but anything below *fine* just doesn't seem to work. What's could be wrong? TIA.
Even though the Logger level is set to ALL, the ConsoleHandler (the default Handler on the logger) still has a default level of INFO. This comes from the default logging.properties in *JAVA\_HOME/jre/lib*
470,440
<p>I have a table, 'lasttraces', with the following fields.</p> <pre><code>Id, AccountId, Version, DownloadNo, Date </code></pre> <p>The data looks like this:</p> <pre><code>28092|15240000|1.0.7.1782|2009040004731|2009-01-20 13:10:22.000 28094|61615000|1.0.7.1782|2009040007696|2009-01-20 13:11:38.000 28095|95317000|...
[ { "answer_id": 470511, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 9, "selected": true, "text": "<p>If you just want the last date for each account, you'd use this:</p>\n\n<pre><code>var q = from n in table\n group n ...
2009/01/22
[ "https://Stackoverflow.com/questions/470440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1997188/" ]
I have a table, 'lasttraces', with the following fields. ``` Id, AccountId, Version, DownloadNo, Date ``` The data looks like this: ``` 28092|15240000|1.0.7.1782|2009040004731|2009-01-20 13:10:22.000 28094|61615000|1.0.7.1782|2009040007696|2009-01-20 13:11:38.000 28095|95317000|1.0.7.1782|2009040007695|2009-01-20 1...
If you just want the last date for each account, you'd use this: ``` var q = from n in table group n by n.AccountId into g select new {AccountId = g.Key, Date = g.Max(t=>t.Date)}; ``` If you want the whole record: ``` var q = from n in table group n by n.AccountId into g select g.Ord...
470,459
<p>Paths are relative to current directory. I've tried tons of combinations of quoting, unquoting, changing to a parent directory and removing the <code>..</code>, but I always get a FileNotFound error when I try to launch a process.</p> <pre><code>bridge_process = System.Diagnostics.Process.Start( @"../Tools/RunH...
[ { "answer_id": 470511, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 9, "selected": true, "text": "<p>If you just want the last date for each account, you'd use this:</p>\n\n<pre><code>var q = from n in table\n group n ...
2009/01/22
[ "https://Stackoverflow.com/questions/470459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20003/" ]
Paths are relative to current directory. I've tried tons of combinations of quoting, unquoting, changing to a parent directory and removing the `..`, but I always get a FileNotFound error when I try to launch a process. ``` bridge_process = System.Diagnostics.Process.Start( @"../Tools/RunHidden", @"../My-Bridg...
If you just want the last date for each account, you'd use this: ``` var q = from n in table group n by n.AccountId into g select new {AccountId = g.Key, Date = g.Max(t=>t.Date)}; ``` If you want the whole record: ``` var q = from n in table group n by n.AccountId into g select g.Ord...
470,468
<p>Please list GUI programming libraries, toolkits, frameworks which allow to write GUI apps <em>quickly</em>. I mean in such a way, that</p> <ul> <li>GUI is described entirely in a human-readable (and human-writable) plain text file (code)</li> <li>code is terse (1 or 2 lines of code per widget/event pair), suitable f...
[ { "answer_id": 470692, "author": "rampion", "author_id": 9859, "author_profile": "https://Stackoverflow.com/users/9859", "pm_score": 4, "selected": false, "text": "<p>Not to kid, but HTML.</p>\n\n<p>It's cross-platform, and sums up the gui-layout in a simple textfile. It's definitely ma...
2009/01/22
[ "https://Stackoverflow.com/questions/470468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25450/" ]
Please list GUI programming libraries, toolkits, frameworks which allow to write GUI apps *quickly*. I mean in such a way, that * GUI is described entirely in a human-readable (and human-writable) plain text file (code) * code is terse (1 or 2 lines of code per widget/event pair), suitable for scripting * structure an...
Not to kid, but HTML. It's cross-platform, and sums up the gui-layout in a simple textfile. It's definitely mature, as well as well-understood and well documented. There's a bunch of ways to template HTML files for dynamic content, and other ways to convert custom syntaxes to HTML if you dislike angle-brackets. Clie...
470,495
<p>Suppose I have a list of tickets. When the user first goes to the tickets/index page I want to show all the open tickets and check the radio button with the name ticketStatus and value of Open.</p> <p>If the user checks the Closed radio button with value Closed and name of ticketStatus I want to do a submit and ge...
[ { "answer_id": 470692, "author": "rampion", "author_id": 9859, "author_profile": "https://Stackoverflow.com/users/9859", "pm_score": 4, "selected": false, "text": "<p>Not to kid, but HTML.</p>\n\n<p>It's cross-platform, and sums up the gui-layout in a simple textfile. It's definitely ma...
2009/01/22
[ "https://Stackoverflow.com/questions/470495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9938/" ]
Suppose I have a list of tickets. When the user first goes to the tickets/index page I want to show all the open tickets and check the radio button with the name ticketStatus and value of Open. If the user checks the Closed radio button with value Closed and name of ticketStatus I want to do a submit and get the list ...
Not to kid, but HTML. It's cross-platform, and sums up the gui-layout in a simple textfile. It's definitely mature, as well as well-understood and well documented. There's a bunch of ways to template HTML files for dynamic content, and other ways to convert custom syntaxes to HTML if you dislike angle-brackets. Clie...
470,528
<p>The .NET framework provides a few handy general-use delegates for common tasks, such as <a href="http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx" rel="nofollow noreferrer"><code>Predicate&lt;T&gt;</code></a> and <a href="http://msdn.microsoft.com/en-us/library/system.eventhandler(VS.71).aspx" rel="nofollow nor...
[ { "answer_id": 470537, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 0, "selected": false, "text": "<p>Look for: <a href=\"http://msdn.microsoft.com/en-us/library/cfttsh47.aspx\" rel=\"nofollow noreferrer\"><code>System....
2009/01/22
[ "https://Stackoverflow.com/questions/470528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26414/" ]
The .NET framework provides a few handy general-use delegates for common tasks, such as [`Predicate<T>`](http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx) and [`EventHandler<T>`](http://msdn.microsoft.com/en-us/library/system.eventhandler(VS.71).aspx). Is there a built-in delegate for the equivalent of CompareTo(...
You even got the names right :) See [`System.Comparison<T>`](http://msdn.microsoft.com/en-us/library/tfakywbh.aspx)
470,542
<p>Is there a way to make an <code>Oracle</code> query behave like it contains a MySQL <code>limit</code> clause?</p> <p>In MySQL, I can do this:</p> <pre><code>select * from sometable order by name limit 20,10 </code></pre> <p>to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are select...
[ { "answer_id": 470571, "author": "Kosi2801", "author_id": 57601, "author_profile": "https://Stackoverflow.com/users/57601", "pm_score": 11, "selected": true, "text": "<p>You can use a subquery for this like</p>\n<pre><code>select *\nfrom \n( select * \n from emp \n order by sal desc )...
2009/01/22
[ "https://Stackoverflow.com/questions/470542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54320/" ]
Is there a way to make an `Oracle` query behave like it contains a MySQL `limit` clause? In MySQL, I can do this: ``` select * from sometable order by name limit 20,10 ``` to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are selected after the `order by`, so it really starts on the ...
You can use a subquery for this like ``` select * from ( select * from emp order by sal desc ) where ROWNUM <= 5; ``` Have also a look at the topic [On ROWNUM and limiting results](https://blogs.oracle.com/oraclemagazine/post/on-rownum-and-limiting-results) at Oracle/AskTom for more information. **Update**...
470,544
<p>I am getting a compilation error when trying to build a C++ project which previously worked.</p> <p>The code follows:</p> <pre><code>const wchar_t* pdest; pdest = _tcsstr(ConnStr, Name); </code></pre> <p>The error follows: Error 10 error C2440: '=' : cannot convert from 'const char *' to 'const wchar_t </p> <...
[ { "answer_id": 470563, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 4, "selected": true, "text": "<p>Your code is dangerous. _tcsstr is a TCHAR macro, so it's definition can change depending on whether or not UNICODE is d...
2009/01/22
[ "https://Stackoverflow.com/questions/470544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8852/" ]
I am getting a compilation error when trying to build a C++ project which previously worked. The code follows: ``` const wchar_t* pdest; pdest = _tcsstr(ConnStr, Name); ``` The error follows: Error 10 error C2440: '=' : cannot convert from 'const char \*' to 'const wchar\_t I'm using Visual Studio 2008. The error...
Your code is dangerous. \_tcsstr is a TCHAR macro, so it's definition can change depending on whether or not UNICODE is defined. wchar\_t is fixed. The error you're seeing is due to this exact problem - the environment is using the single-byte version of \_tcsstr (likely becasue UNICODE is not defined). Don't just def...
470,554
<p>I'm having trouble with something that (I think) should be simple, but can't find any clear info.</p> <p>In the scenario where I have three tables, describing a domain where a person can have more than one job: </p> <p>Person - has PersonId, Name<br> Job - has JobId, JobName<br> PersonJob - has PersonId, JobId,...
[ { "answer_id": 470653, "author": "joshua.ewer", "author_id": 28664, "author_profile": "https://Stackoverflow.com/users/28664", "pm_score": 4, "selected": true, "text": "<p>Well, I answered my own question. I think posting your problem is almost as cathartic as talking it out with someon...
2009/01/22
[ "https://Stackoverflow.com/questions/470554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28664/" ]
I'm having trouble with something that (I think) should be simple, but can't find any clear info. In the scenario where I have three tables, describing a domain where a person can have more than one job: Person - has PersonId, Name Job - has JobId, JobName PersonJob - has PersonId, JobId, YearsOfEmployment No...
Well, I answered my own question. I think posting your problem is almost as cathartic as talking it out with someone. If I were to make the composite-id of PersonJob a component or class, i.e. ``` <class name="PersonJob" table="dbo.PersonJob" lazy="true"> <composite-id name="PersonJobKey" class="PersonJobKey"> ...
470,592
<p>I have a project that uses the serial port, and it requires two files to run, the win32.dll file (which is in the java runtime environment bin folder) and the javax.comm.properties file (which is in the java runtime environment lib folder). When I run the project from eclipse it works, but when I try to build a jar ...
[ { "answer_id": 470636, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 0, "selected": false, "text": "<p>A jar file is just a normal zip file. If you want to add files to it, just use a tool such as winzip.</p>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1585/" ]
I have a project that uses the serial port, and it requires two files to run, the win32.dll file (which is in the java runtime environment bin folder) and the javax.comm.properties file (which is in the java runtime environment lib folder). When I run the project from eclipse it works, but when I try to build a jar fil...
You generally don't put dll and properties files inside the jar. Properties files as well other jar files need to be added to the classpath. The jar file has a manifest file that defines the classpath used. You can't edit this with eclipse. You need to define an ant build.xml file and do something like this: ``` <jar ...
470,605
<p>I have a sorted array of 5000 integers. How fast can I tell if a random integer is a member of the array? An answer in general, C and Ruby would be nice. </p> <p>The array values are of the form</p> <pre><code>c * c + 1 </code></pre> <p>where <code>c</code> can be any integer from 1 to 5000.</p> <p>For exampl...
[ { "answer_id": 470611, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 4, "selected": false, "text": "<p>log(n) for binary search on c</p>\n" }, { "answer_id": 470613, "author": "raupach", "author_id": 132162, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38593/" ]
I have a sorted array of 5000 integers. How fast can I tell if a random integer is a member of the array? An answer in general, C and Ruby would be nice. The array values are of the form ``` c * c + 1 ``` where `c` can be any integer from 1 to 5000. For example: ``` [2, 5, 10, 17, 26, 37, 50 ...] ```
Binary search, as others have mentioned, is O(log2N), and can be coded either recursively: ``` BinarySearch(A[0..N-1], value, low, high) { if (high < low) return -1 // not found mid = (low + high) / 2 if (A[mid] > value) return BinarySearch(A, value, low, mid-1) el...
470,608
<p>This is a followup to <a href="https://stackoverflow.com/questions/262448/replace-non-numeric-with-empty-string#262466">this question</a></p> <p>The first two answers are both correct and complete and at the end of the day, produce exactly the same result. However, one uses a Regex object and calls the aRegex.Repl...
[ { "answer_id": 470620, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 1, "selected": false, "text": "<p>Using the regex object means the regex is compiled only once, so you get better performance (you need to save the regex ob...
2009/01/22
[ "https://Stackoverflow.com/questions/470608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18907/" ]
This is a followup to [this question](https://stackoverflow.com/questions/262448/replace-non-numeric-with-empty-string#262466) The first two answers are both correct and complete and at the end of the day, produce exactly the same result. However, one uses a Regex object and calls the aRegex.Replace(...) method (Joel'...
Using the static instance will create a new `Regex` object each time so it is better to instantiate it yourself. Here is what I found using Reflector on System.dll: ``` public static string Replace(string input, string pattern, string replacement) { return new Regex(pattern, RegexOptions.None, true).Replace(input,...
470,612
<p>I am using LINQ for the first time and I am running into some behavior I don't fully understand with the DataContext. Hopefully StackOverflow can help.</p> <p>Basically, it seems like once my DataContext encounters an exception, it either caches that exception or never fully recovers. In my specific case, once I tr...
[ { "answer_id": 470635, "author": "Ken Henderson", "author_id": 52136, "author_profile": "https://Stackoverflow.com/users/52136", "pm_score": 1, "selected": false, "text": "<p>Create a new context everytime you need it instead of reusing a global/static context member. The problem is you...
2009/01/22
[ "https://Stackoverflow.com/questions/470612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27689/" ]
I am using LINQ for the first time and I am running into some behavior I don't fully understand with the DataContext. Hopefully StackOverflow can help. Basically, it seems like once my DataContext encounters an exception, it either caches that exception or never fully recovers. In my specific case, once I try to pass ...
If you observe the [GetChangeSet method](http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getchangeset.aspx) of your DataContext, you'll observe that it still wants to insert the first string. This is why it doesn't recover.
470,617
<p>Which PHP function can return the current date/time?</p>
[ { "answer_id": 470625, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 6, "selected": false, "text": "<p>You can either use the <a href=\"http://docs.php.net/manual/en/reserved.variables.server.php\" rel=\"noreferrer\"><code>$...
2009/01/22
[ "https://Stackoverflow.com/questions/470617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Which PHP function can return the current date/time?
The time would go by your server time. An easy workaround for this is to manually set the timezone by using [`date_default_timezone_set`](http://php.net/manual/en/function.date-default-timezone-set.php) before the [`date()`](http://www.php.net/manual/en/function.date.php) or [`time()`](http://www.php.net/manual/en/func...
470,647
<p>I'm trying to create an audio captcha system for the visually impaired. I have a system that will glue several wave files together, but I'm having trouble embedding them in ie and firefox.</p> <pre><code>&lt;script type="text/javascript"&gt; function EvalSound(soundobj) { var thissound=document.getElementById...
[ { "answer_id": 470680, "author": "Phil.Wheeler", "author_id": 15609, "author_profile": "https://Stackoverflow.com/users/15609", "pm_score": 2, "selected": false, "text": "<p>There's an audio service that essentially does this exact thing called ReCaptcha (<a href=\"http://recaptcha.net/\...
2009/01/22
[ "https://Stackoverflow.com/questions/470647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to create an audio captcha system for the visually impaired. I have a system that will glue several wave files together, but I'm having trouble embedding them in ie and firefox. ``` <script type="text/javascript"> function EvalSound(soundobj) { var thissound=document.getElementById(soundobj); thiss...
There's an audio service that essentially does this exact thing called ReCaptcha (<http://recaptcha.net/>). You can read a review of the service on [ReadWriteWeb](http://www.readwriteweb.com/archives/recaptcha_enhanced_audio_captchas.php) if you would like to know more about it. Google also offers an audio captcha. ...
470,664
<p>I tried changing a default parameter value with this:</p> <pre><code>ALTER PROCEDURE [dbo].[my_sp] @currentDate datetime = GETDATE() </code></pre> <p>and all the SQL pre-compiler gave me was this error:</p> <blockquote> <p>Msg 102, Level 15, State 1, Procedure my_sp, Line 8 Incorrect syntax near '('.</p> </bloc...
[ { "answer_id": 470670, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 5, "selected": false, "text": "<p>I don't think that is possible, you have to use a literal (constant) value as the default.</p>\n\n<p>However you c...
2009/01/22
[ "https://Stackoverflow.com/questions/470664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58044/" ]
I tried changing a default parameter value with this: ``` ALTER PROCEDURE [dbo].[my_sp] @currentDate datetime = GETDATE() ``` and all the SQL pre-compiler gave me was this error: > > Msg 102, Level 15, State 1, Procedure my\_sp, Line 8 Incorrect syntax near '('. > > > I have already created the procedure. (I'm...
Default value for stored procedures parameter have to be ***constants***. You'd need to do the following... ``` ALTER Procedure [dbo].[my_sp] @currentDate datetime = null AS IF @currentDate is null SET @currentDate = getdate() ```
470,690
<p>I wrote the two methods below to automatically select N distinct colors. It works by defining a piecewise linear function on the RGB cube. The benefit of this is you can also get a progressive scale if that's what you want, but when N gets large the colors can start to look similar. I can also imagine evenly subdivi...
[ { "answer_id": 470717, "author": "mqp", "author_id": 55943, "author_profile": "https://Stackoverflow.com/users/55943", "pm_score": 0, "selected": false, "text": "<p>If N is big enough, you're going to get some similar-looking colors. There's only so many of them in the world.</p>\n\n<p>...
2009/01/22
[ "https://Stackoverflow.com/questions/470690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43665/" ]
I wrote the two methods below to automatically select N distinct colors. It works by defining a piecewise linear function on the RGB cube. The benefit of this is you can also get a progressive scale if that's what you want, but when N gets large the colors can start to look similar. I can also imagine evenly subdividin...
You can use the [HSL color model](http://en.wikipedia.org/wiki/HSL_and_HSV) to create your colors. If all you want is differing hues (likely), and slight variations on lightness or saturation, you can distribute the hues like so: ``` // assumes hue [0, 360), saturation [0, 100), lightness [0, 100) for(i = 0; i < 360...
470,696
<p>So I have a TMenuItem attached to a TAction on a TPopupMenu for a TDBGrid (actually 3rd party, but you get the idea). Based on the selected row in the grid, the TAction is enabled or disabled. What I want is to be able to display a hint to the user explaining why the item is disabled. </p> <p>As far as why I wan...
[ { "answer_id": 470753, "author": "Drejc", "author_id": 6482, "author_profile": "https://Stackoverflow.com/users/6482", "pm_score": 2, "selected": false, "text": "<p>Not sure if it helps, but I have created my own multi-line hint window (for Delphi7) to be able to show more then just one ...
2009/01/22
[ "https://Stackoverflow.com/questions/470696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/255/" ]
So I have a TMenuItem attached to a TAction on a TPopupMenu for a TDBGrid (actually 3rd party, but you get the idea). Based on the selected row in the grid, the TAction is enabled or disabled. What I want is to be able to display a hint to the user explaining why the item is disabled. As far as why I want a hint on a...
WM\_MENUSELECT is indeed handled for menu items in popup menus also, but not by the windows proc of the form containing the (popup) menu, but by an invisible helper window created by Menus.PopupList. Luckily you can (at least under Delphi 5) get at this HWND via Menus.PopupList.Window. Now you can use the old-fashione...
470,702
<p>Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I'm setting the background color for text boxes, but I don't want my checkboxes to get that color. </p> <p>I know I can do this with seperate classes but I'd rather use CSS if pos...
[ { "answer_id": 470719, "author": "Phil.Wheeler", "author_id": 15609, "author_profile": "https://Stackoverflow.com/users/15609", "pm_score": 0, "selected": false, "text": "<p>Sorry, the short answer is no. CSS (2.1) will only mark up the elements of a DOM, not their attributes. You'd ha...
2009/01/22
[ "https://Stackoverflow.com/questions/470702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26160/" ]
Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I'm setting the background color for text boxes, but I don't want my checkboxes to get that color. I know I can do this with seperate classes but I'd rather use CSS if possible. I'm...
Yes. IE7+ supports attribute selectors: ``` input[type=radio] input[type^=ra] input[type*=d] input[type$=io] ``` Element input with attribute type which contains a value that is equal to, begins with, contains or ends with a certain value. Other safe (IE7+) selectors are: * Parent > child that has: `p > span { fon...
470,711
<p>How do I go about testing a function or module that is machine or platform dependent? For example, something that looks at/depends on <code>$^O</code> or a module like <a href="http://search.cpan.org/dist/Net-Ifconfig-Wrapper" rel="nofollow noreferrer">Net::Ifconfig::Wrapper</a>? I don't need to test that Net::Ifc...
[ { "answer_id": 470780, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "<p>Generally you use <a href=\"http://en.wikipedia.org/wiki/Mock_object\" rel=\"nofollow noreferrer\">mock objects</a> t...
2009/01/22
[ "https://Stackoverflow.com/questions/470711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45978/" ]
How do I go about testing a function or module that is machine or platform dependent? For example, something that looks at/depends on `$^O` or a module like [Net::Ifconfig::Wrapper](http://search.cpan.org/dist/Net-Ifconfig-Wrapper)? I don't need to test that Net::Ifconfig::Wrapper is returning the correct values, but I...
To follow up on Jason's [mock objects](http://en.wikipedia.org/wiki/Mock_object) suggestion, you should take a look at the article ["Interfacing with hard-to-test third party controls" by Misko Hevery](http://misko.hevery.com/2009/01/04/interfacing-with-hard-to-test-third-party-code/). It directly addresses testing thi...
470,718
<p>Let's assume that we have a <code>Model</code> with several properties on it and we want to create a decorator class of this model to enhance it with some extra properties. Now we want to create a new instance of the <code>DecoratedModel</code> populated with all the property values of <code>Model</code>, perhaps us...
[ { "answer_id": 470738, "author": "Matt Jordan", "author_id": 50957, "author_profile": "https://Stackoverflow.com/users/50957", "pm_score": 2, "selected": false, "text": "<p>While it does require the Model class to have a copy constructor to copy the Model data in the Decorator class, doi...
2009/01/22
[ "https://Stackoverflow.com/questions/470718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822/" ]
Let's assume that we have a `Model` with several properties on it and we want to create a decorator class of this model to enhance it with some extra properties. Now we want to create a new instance of the `DecoratedModel` populated with all the property values of `Model`, perhaps using a constructor with `Model` as a ...
Well, you should be able to use reflection to reflect over the base classes properties, and then use that to set the child classes properties. I haven't tested this extensively, but something like this might work: ``` public DecoratedModel(Model m) { foreach (var prop in typeof(Model).GetPr...
470,726
<p>My application has 2 "services", let's say one is a basic (integer) calculator, and one is a floating point calculator. I express these as interfaces like so:</p> <pre><code>public interface IBasicCalculator { int Add( int a, int b ); } public interface IFloatingPointCalculator { double Add( double a, doub...
[ { "answer_id": 470781, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>I would say generally, no. Remember, you are dealing with a distributed application technology, not a distributed ob...
2009/01/22
[ "https://Stackoverflow.com/questions/470726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234/" ]
My application has 2 "services", let's say one is a basic (integer) calculator, and one is a floating point calculator. I express these as interfaces like so: ``` public interface IBasicCalculator { int Add( int a, int b ); } public interface IFloatingPointCalculator { double Add( double a, double b ); } ```...
I just worked out that you can expose multiple endpoints (each using a different interface) to the same service, and you still only need generate ONE proxy lib on the client which gives access to all of them, which solves my problem entirely.
470,739
<p>In doing a MVC project I got the following 2 compile errors:</p> <ol> <li>The type <code>System.Web.Mvc.ViewPage</code> is defined in an assembly that is not referenced. You must add a reference to assembly:</li> </ol> <blockquote> <p>System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. </p> </...
[ { "answer_id": 470995, "author": "Captain Sensible", "author_id": 54101, "author_profile": "https://Stackoverflow.com/users/54101", "pm_score": 0, "selected": false, "text": "<p>Because you are referencing all the right assemblies and I cannot see anything wrong with your Web.Config file...
2009/01/22
[ "https://Stackoverflow.com/questions/470739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32240/" ]
In doing a MVC project I got the following 2 compile errors: 1. The type `System.Web.Mvc.ViewPage` is defined in an assembly that is not referenced. You must add a reference to assembly: > > System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. > > > 2. The call is ambiguous between the followi...
I downloaded the latest source of mvc off of CodePlex and built it. I fixed the first error by referencing the System.Web.Mvc.dll to my downloaded version and the other 2 dlls to reference the dlls in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC Beta\Assemblies folder. Now that the first error is not there, but ...
470,756
<p>I'm using Yui to build a "popup" menu that works a bit differently with the mouse than usual. This is <em>not</em> a ContextMenu, because I want it to respond to <em>left</em> clicks, and the ContextMenu seems bent on responding to right clicks.</p> <p>Following the examples, if I do this, the menu comes up and eve...
[ { "answer_id": 471301, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>The problem is that the MenuManager class listens for the mousedown event at the document level and hides all visible Menu ...
2009/01/22
[ "https://Stackoverflow.com/questions/470756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using Yui to build a "popup" menu that works a bit differently with the mouse than usual. This is *not* a ContextMenu, because I want it to respond to *left* clicks, and the ContextMenu seems bent on responding to right clicks. Following the examples, if I do this, the menu comes up and everything is close to how ...
The problem is that the MenuManager class listens for the mousedown event at the document level and hides all visible Menu instances. So, since you are building a unique sort of Menu implementation, you'll need to stop the propagation of the mousedown event inside your handler so that the MenuManager doesn't handle the...
470,759
<p>is it a good practice to have an interface that has no methods but just properties?</p>
[ { "answer_id": 470764, "author": "chills42", "author_id": 23855, "author_profile": "https://Stackoverflow.com/users/23855", "pm_score": 1, "selected": false, "text": "<p>This would make sense if you were intending to have a set of data objects with a similar base structure.</p>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41685/" ]
is it a good practice to have an interface that has no methods but just properties?
Imagine that we have two different classes that don't derive from the same base: Users and Businesses. At some point in our project, we decide that Users and Businesses both need to have a reference to elements of an address, such as Street1, Street2, City, State, and Zip. We also have a proxy class of some sort that n...
470,761
<p>Do you have a naming convention for APIs or Classes that are being phased in to replace an older version that performed the same function / filled the same role?</p> <p>E.g. Windows does this by adding "Ex" to the end of the function: </p> <pre><code>ShellExecute // old ShellExecuteEx // new </code></pre> <p>Wha...
[ { "answer_id": 470787, "author": "Jason Punyon", "author_id": 6212, "author_profile": "https://Stackoverflow.com/users/6212", "pm_score": 0, "selected": false, "text": "<p>Why change it at all? Interfaces being the contracts that they are, why would you break the interface after everyth...
2009/01/22
[ "https://Stackoverflow.com/questions/470761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701/" ]
Do you have a naming convention for APIs or Classes that are being phased in to replace an older version that performed the same function / filled the same role? E.g. Windows does this by adding "Ex" to the end of the function: ``` ShellExecute // old ShellExecuteEx // new ``` What do you prefer, and what are you ...
Much of the time you can get away with changing the package name, rather than the class name itself.
470,768
<p>Our AJAX framework works such that it sends back a snippet of HTML that might contain a tag. We then take that snippet of HTML and set it to be the innerHTML of an element. In IE 6/7 it appears to ignore the tags and so the returned HTML isn't styled properly.</p> <p>I'm wondering if other people have run into ...
[ { "answer_id": 470817, "author": "TJ L", "author_id": 12605, "author_profile": "https://Stackoverflow.com/users/12605", "pm_score": 1, "selected": false, "text": "<p>Of course the best method is a pure DOM solution, ie use <code>document.createElement</code> to generate all the elements ...
2009/01/22
[ "https://Stackoverflow.com/questions/470768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2484/" ]
Our AJAX framework works such that it sends back a snippet of HTML that might contain a tag. We then take that snippet of HTML and set it to be the innerHTML of an element. In IE 6/7 it appears to ignore the tags and so the returned HTML isn't styled properly. I'm wondering if other people have run into similar proble...
Of course the best method is a pure DOM solution, ie use `document.createElement` to generate all the elements returned by the server. However, there is (of course) an IE hack to work around some of the problems presented by `innertHTML`. Instead of sticking the response straight into the DOM, first create an element...
470,772
<p>Is there a built in method or defacto default plugin that will let you automatically assign an unique ID to an element in jQuery, or do you need to implement something like this yourself? I'm looking for the jQuery equivalent to <a href="http://prototypejs.org/api/element/identify" rel="nofollow noreferrer">Prototyp...
[ { "answer_id": 470785, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "<p>Not that I know of, but you could do this yourself by adding the <code>id</code> attribute and supplying a GUID.</p>\...
2009/01/22
[ "https://Stackoverflow.com/questions/470772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4668/" ]
Is there a built in method or defacto default plugin that will let you automatically assign an unique ID to an element in jQuery, or do you need to implement something like this yourself? I'm looking for the jQuery equivalent to [Prototype's identify method](http://prototypejs.org/api/element/identify) Here's an exam...
``` jQuery.fn.identify = function(prefix) { var i = 0; return this.each(function() { if(this.id) return; do { i++; var id = prefix + '_' + i; } while($('#' + id).length > 0); $(this).attr('id', id); }); }; $('span').identify('...
470,779
<p>I'm new to LINQ expressions and trying to get the following to work:</p> <pre><code>public IQueryable&lt;Models.Powerups.Powerup&gt; GetPowerups(Guid userid) { return from p in dc.Powerups where p.UserId == userid select (Models.Powerups.Powerup) new DataContractSerializer(Type.GetType(p.T...
[ { "answer_id": 470785, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "<p>Not that I know of, but you could do this yourself by adding the <code>id</code> attribute and supplying a GUID.</p>\...
2009/01/22
[ "https://Stackoverflow.com/questions/470779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm new to LINQ expressions and trying to get the following to work: ``` public IQueryable<Models.Powerups.Powerup> GetPowerups(Guid userid) { return from p in dc.Powerups where p.UserId == userid select (Models.Powerups.Powerup) new DataContractSerializer(Type.GetType(p.Type, true)).ReadObje...
``` jQuery.fn.identify = function(prefix) { var i = 0; return this.each(function() { if(this.id) return; do { i++; var id = prefix + '_' + i; } while($('#' + id).length > 0); $(this).attr('id', id); }); }; $('span').identify('...
470,786
<p>Is there a way in Java to programmatically import a class given its full name as a String (i.e. like <code>"com.mydummypackage.MyClass"</code>)?</p>
[ { "answer_id": 470797, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 5, "selected": true, "text": "<p>If by \"import\" you mean \"load a <code>Class</code> object so you can run reflection methods,\" then use:</p>\n\n<pr...
2009/01/22
[ "https://Stackoverflow.com/questions/470786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35520/" ]
Is there a way in Java to programmatically import a class given its full name as a String (i.e. like `"com.mydummypackage.MyClass"`)?
If by "import" you mean "load a `Class` object so you can run reflection methods," then use: ``` Class<?> clazz = Class.forName( "com.mypackage.MyClass" ); ``` (The reason we readers were confused by your word "import" is that typically this refers to the `import` keyword used near the top of Java class files to tel...
470,789
<p>I'm designing a new application and I'm undecided if I should fill my object properties on the constructor</p> <pre><code>Public Sub New(UserId as integer) ' get database values dr = DataReader Me.FirstName = dr.fields(0) Me.LastName = dr.fields(1) End Sub </code></pre> <p>Or create a factory with ...
[ { "answer_id": 470811, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>I like types to be immutable where that doesn't create other problems. For a \"person\" type it may not be suitable, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4230/" ]
I'm designing a new application and I'm undecided if I should fill my object properties on the constructor ``` Public Sub New(UserId as integer) ' get database values dr = DataReader Me.FirstName = dr.fields(0) Me.LastName = dr.fields(1) End Sub ``` Or create a factory with a method for each object t...
My opinion: A constructor *creates* an object. The constructor of a `User` class should *create* a new user. Static member functions like your `getUser` *retrieve* an object which already exists. I would use the latter form.
470,806
<p>I am trying to split a PDF into 2 smaller PDF's using gs (Ghostscript version 8.62 on Debian Lenny). I only have Debian Linux on hand, so please don't offer Windows or Mac solutions.</p> <p>When specifying <code>-dLastPage=740</code>, I receive the error:</p> <pre><code>GPL Ghostscript 8.62: ERROR: A pdfmark dest...
[ { "answer_id": 471845, "author": "Chris Dolan", "author_id": 14783, "author_profile": "https://Stackoverflow.com/users/14783", "pm_score": 1, "selected": false, "text": "<p>Give <a href=\"http://search.cpan.org/dist/CAM-PDF/\" rel=\"nofollow noreferrer\">CAM::PDF</a> a try (note: I'm the...
2009/01/22
[ "https://Stackoverflow.com/questions/470806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161/" ]
I am trying to split a PDF into 2 smaller PDF's using gs (Ghostscript version 8.62 on Debian Lenny). I only have Debian Linux on hand, so please don't offer Windows or Mac solutions. When specifying `-dLastPage=740`, I receive the error: ``` GPL Ghostscript 8.62: ERROR: A pdfmark destination page 1203 points beyond t...
As it turns out, the error is not fatal. The pdf is generated anyhow, and since I do not care about pdf links or bookmarks functioning, this problem is solved for me. In general, though, it would be good to know why pdfmark or ghostscript is failing, and how to generate a valid pdf with functioning links. If anyone ha...
470,815
<p>Say I have a phone-number validator in flex and I have two TextInput controls for phone numbers. I don't want to have two separate validator controls defined that have essentially the same attributes... but each validator has only one "source" attribute. How can I use the same validator on multiple control? (or any ...
[ { "answer_id": 471587, "author": "Christian Nunciato", "author_id": 32129, "author_profile": "https://Stackoverflow.com/users/32129", "pm_score": 3, "selected": true, "text": "<p>Not inline, but you can perform the validation programmatically, say, on submission of a form, or when a user...
2009/01/22
[ "https://Stackoverflow.com/questions/470815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11208/" ]
Say I have a phone-number validator in flex and I have two TextInput controls for phone numbers. I don't want to have two separate validator controls defined that have essentially the same attributes... but each validator has only one "source" attribute. How can I use the same validator on multiple control? (or any equ...
Not inline, but you can perform the validation programmatically, say, on submission of a form, or when a user tabs out of a control, etc. Here's an example using a single PhoneNumberValidator to validate two form fields; the validation happens when the Submit button gets clicked: ``` <mx:Script> <![CDATA[ ...
470,832
<p>I'm currently using the following function to 'convert' a relative URL to an absolute one:</p> <pre><code>function qualifyURL(url) { var a = document.createElement('a'); a.href = url; return a.href; } </code></pre> <p>This works quite well in most browsers but IE6 insists on returning the relative URL ...
[ { "answer_id": 470903, "author": "geowa4", "author_id": 50214, "author_profile": "https://Stackoverflow.com/users/50214", "pm_score": 0, "selected": false, "text": "<p><em>If <code>url</code> does not begin with '/'</em></p>\n\n<p>Take the current page's url, chop off everything past the...
2009/01/22
[ "https://Stackoverflow.com/questions/470832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21677/" ]
I'm currently using the following function to 'convert' a relative URL to an absolute one: ``` function qualifyURL(url) { var a = document.createElement('a'); a.href = url; return a.href; } ``` This works quite well in most browsers but IE6 insists on returning the relative URL still! It does the same if...
How strange! IE does, however, understand it when you use innerHTML instead of DOM methods. ``` function escapeHTML(s) { return s.split('&').join('&amp;').split('<').join('&lt;').split('"').join('&quot;'); } function qualifyURL(url) { var el= document.createElement('div'); el.innerHTML= '<a href="'+escapeH...
470,833
<p>So far i've collected the following:</p> <pre> *.iws *.war .classpath .DS_Store .project .settings /*.launch /*.tmproj /out/** stacktrace.log test/reports </pre> <p>Any other suggestions?</p>
[ { "answer_id": 471171, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 5, "selected": true, "text": "<p>Update 5 years later (April 2014):</p>\n\n<p>As mentioned in the other answers below, two sites are now able to provide good ...
2009/01/22
[ "https://Stackoverflow.com/questions/470833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58061/" ]
So far i've collected the following: ``` *.iws *.war .classpath .DS_Store .project .settings /*.launch /*.tmproj /out/** stacktrace.log test/reports ``` Any other suggestions?
Update 5 years later (April 2014): As mentioned in the other answers below, two sites are now able to provide good default .gitignore files, including for a Grails project. * GitHub, when creating a new repo (based on the [github/gitignore project](https://github.com/github/gitignore)). => [`Grails.gitignore`](htt...
470,835
<p>Having toyed with this I suspect it isn't remotely possible, but I thought I'd ask the experts. I have the following C++ code:</p> <pre> class IInterface { virtual void SomeMethod() = 0; }; class Object { IInterface* GetInterface() { ... } }; class Container { private: struct Item { Object...
[ { "answer_id": 470855, "author": "rmeador", "author_id": 10861, "author_profile": "https://Stackoverflow.com/users/10861", "pm_score": 1, "selected": false, "text": "<p>I see no reason why you can't implement this exactly as you've laid it out... am I missing something?</p>\n\n<p>To clar...
2009/01/22
[ "https://Stackoverflow.com/questions/470835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58063/" ]
Having toyed with this I suspect it isn't remotely possible, but I thought I'd ask the experts. I have the following C++ code: ``` class IInterface { virtual void SomeMethod() = 0; }; class Object { IInterface* GetInterface() { ... } }; class Container { private: struct Item { Object* pObjec...
I've now found a solution which is fitter for my original purpose. I still don't like it though :) The solution involves MagicIterator being templated on IInterface\* and being constructed with both a void\* to an iterator, the byte size of said iterator, and a table of pointers to functions which perform standard ite...
470,836
<p>I'm trying to use boundschecker to analyze a rather complex program. Running the program with boundschecker is almost too slow for it to be of any use since it takes me almost a day to run the program to the point in the code where I suspect the issue exists. Can anyone give me some ideas for how to inspect only c...
[ { "answer_id": 473313, "author": "Joe", "author_id": 12567, "author_profile": "https://Stackoverflow.com/users/12567", "pm_score": 3, "selected": true, "text": "<p>I last used BoundsChecker a few years ago, and had the same problems. With large projects, it makes everything run so slowly...
2009/01/22
[ "https://Stackoverflow.com/questions/470836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
I'm trying to use boundschecker to analyze a rather complex program. Running the program with boundschecker is almost too slow for it to be of any use since it takes me almost a day to run the program to the point in the code where I suspect the issue exists. Can anyone give me some ideas for how to inspect only certai...
I last used BoundsChecker a few years ago, and had the same problems. With large projects, it makes everything run so slowly that it is useless. We ended up ditching it. But, we still needed some of it's functionality, but like you, not for the whole program. So we had to do it ourselves. In our case, we mainly used...
470,840
<p>I am having trouble getting my project to link to the Boost (version 1.37.0) Filesystem lib file in Microsoft Visual C++ 2008 Express Edition. The Filesystem library is <b>not</b> a header-only library. I have been following the <i><a href="http://www.boost.org/doc/libs/1_37_0/more/getting_started/windows.html" re...
[ { "answer_id": 470848, "author": "Reunanen", "author_id": 19254, "author_profile": "https://Stackoverflow.com/users/19254", "pm_score": 1, "selected": false, "text": "<p>The error you have posted complains about file libboost_system-vc90-mt-gd-1_37.lib, but in the directory you have only...
2009/01/22
[ "https://Stackoverflow.com/questions/470840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48096/" ]
I am having trouble getting my project to link to the Boost (version 1.37.0) Filesystem lib file in Microsoft Visual C++ 2008 Express Edition. The Filesystem library is **not** a header-only library. I have been following the *[Getting Started on Windows](http://www.boost.org/doc/libs/1_37_0/more/getting_started/window...
Ferruccio's answer contains most of the insight. However, Pukku made me realize my mistake. I am posting my own answer to give a full explanation. As Ferruccio explained, Filesystem relies on two libraries. For me, these are: * libboost\_system-vc90-mt-gd-1\_37.lib * libboost\_filesystem-vc90-mt-gd-1\_37.lib I must n...
470,846
<p>I have a WinForm that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the WinForm chrome to whatever is beneath. Resizing the window gets the WPF content to show up.</p> <p>Is this a known issue? Can anyone suggest a...
[ { "answer_id": 470856, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 0, "selected": false, "text": "<p>Maybe call Invalidate on the ElementHost?</p>\n" }, { "answer_id": 597055, "author": "cplotts", "auth...
2009/01/22
[ "https://Stackoverflow.com/questions/470846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38309/" ]
I have a WinForm that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the WinForm chrome to whatever is beneath. Resizing the window gets the WPF content to show up. Is this a known issue? Can anyone suggest a workaroun...
We have fought these types of issues before. See this WPF forum [post](http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a8a5eebc-3d9e-44bb-abe3-8ce0d4e48263/) for more info on our particular flavor (I don't know if it is the same issue or not). The only thing that we found to work was to **change the size of t...
470,851
<p>My m-file opens figures depending on parameters. Sometimes is one figure, sometimes it opens 2 figures.</p> <p>If the user call the function, the figures appear. If he calls the function again, with other parameters, I'm clearing figures with clf before the new plots.</p> <p>If the second call is set to draw only ...
[ { "answer_id": 470905, "author": "Andrea Ambu", "author_id": 21384, "author_profile": "https://Stackoverflow.com/users/21384", "pm_score": 0, "selected": false, "text": "<p>To close figure there is the \"close\" function. I'm still looking one to check if a figure is open.</p>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/470851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21384/" ]
My m-file opens figures depending on parameters. Sometimes is one figure, sometimes it opens 2 figures. If the user call the function, the figures appear. If he calls the function again, with other parameters, I'm clearing figures with clf before the new plots. If the second call is set to draw only one figure, the s...
``` close all ``` Will close all open figures. You can use `findobj()` to find objects that may exist by specifying search parameters. For example: ``` figure('name','banana') ``` Creates a figure with the name banana. ``` close(findobj('type','figure','name','orange')) ``` Does nothing because there are no fi...
470,857
<p>Consider the code below:</p> <pre><code>this.usedIds = 0; this.SendData = function(data) { var id = this.usedIds; this.usedIds++; this.xmlHttpThing.open(&quot;POST&quot;, &quot;/Upload.aspx&quot;, true); this.xmlHttpThing.setRequestHeader(&quot;Content-type&quot;, &quot;application/x-www-form-urlen...
[ { "answer_id": 471138, "author": "Chris Lundie", "author_id": 20685, "author_profile": "https://Stackoverflow.com/users/20685", "pm_score": 3, "selected": true, "text": "<p>Here's one:</p>\n\n<ul>\n<li><a href=\"http://www.pinchmedia.com/\" rel=\"nofollow noreferrer\">Pinch Media</a></li...
2009/01/22
[ "https://Stackoverflow.com/questions/470857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Consider the code below: ``` this.usedIds = 0; this.SendData = function(data) { var id = this.usedIds; this.usedIds++; this.xmlHttpThing.open("POST", "/Upload.aspx", true); this.xmlHttpThing.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); var currentObject = this; this...
Here's one: * [Pinch Media](http://www.pinchmedia.com/) I'm making this Community Wiki so anyone can add to this list.
470,863
<p>I'm trying to make an <code>ImageListBox</code> kind of control that will display a large numbers of thumbnails, like the one that Picasa uses.</p> <p>This is my design:</p> <p>I have a <code>FlowLayoutPanel</code> that is populated with a lot of <code>UserControl</code> objects, for example 4,000. Each <code>User...
[ { "answer_id": 470883, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>I wouldn't add that many user controls. Rather, I'd have a series of data structures that stores information about w...
2009/01/22
[ "https://Stackoverflow.com/questions/470863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to make an `ImageListBox` kind of control that will display a large numbers of thumbnails, like the one that Picasa uses. This is my design: I have a `FlowLayoutPanel` that is populated with a lot of `UserControl` objects, for example 4,000. Each `UserControl` is assigned a delegate for the `Paint` event. ...
To improve the speed of populating the FlowLayoutPanel with your user controls, disable layout updating while you add the controls. Immediately before your loop, call [`SuspendLayout()`](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout.aspx) and then at the end call [`ResumeLayout()`]...
470,875
<p>Is it possible to run a select on a table to quickly find out if <strong>any</strong> (one or more) of the fields contain a certain value?</p> <p>Or would you have to write out all of the column names in the where clause?</p>
[ { "answer_id": 470899, "author": "Kevin Tighe", "author_id": 39461, "author_profile": "https://Stackoverflow.com/users/39461", "pm_score": 0, "selected": false, "text": "<p>I think you'd need to list all the columns in the where clause. I'm far from a SQL wizard though...maybe someone e...
2009/01/22
[ "https://Stackoverflow.com/questions/470875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56506/" ]
Is it possible to run a select on a table to quickly find out if **any** (one or more) of the fields contain a certain value? Or would you have to write out all of the column names in the where clause?
Dig this... It will search on all the tables in the db, but you can mod it down to just one table. ``` /*This script will find any text value in the database*/ /*Output will be directed to the Messages window. Don't forget to look there!!!*/ SET NOCOUNT ON DECLARE @valuetosearchfor varchar(128), @objectOwner varchar...
470,876
<p>For one client, I have to deliver a build they use in QA and production. The checksum of the build file has to match - it cannot change at all between QA and production. The configuration for each environment is different, so I have a build that contains just the code and then a separate build for each environment...
[ { "answer_id": 471353, "author": "Rob McCready", "author_id": 47525, "author_profile": "https://Stackoverflow.com/users/47525", "pm_score": 0, "selected": false, "text": "<p>Assuming:</p>\n\n<p>1) XML config files</p>\n\n<p>2) Total number of changes between builds are few (even if copie...
2009/01/22
[ "https://Stackoverflow.com/questions/470876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4555/" ]
For one client, I have to deliver a build they use in QA and production. The checksum of the build file has to match - it cannot change at all between QA and production. The configuration for each environment is different, so I have a build that contains just the code and then a separate build for each environment that...
Not sure if your setup is more complicated, but we have a similar problem and we added a custom actions class that updates the config files based on the environment (which the user selects during installation), then you add this custom actions project to your setup project. That way you use one setup exe no matter what...
470,880
<p>How can you use ModRewrite to check if a cache file exists, and if it does, rewrite to the cache file and otherwise rewrite to a dynamic file. </p> <p>For example I have the following folder structure:</p> <pre> pages.php cache/ pages/ 1.html 2.html textToo.html etc. </pre> <p>How would you setup th...
[ { "answer_id": 471994, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 5, "selected": true, "text": "<pre><code>RewriteRule ^pages/([^/\\.]+) cache/pages/$1.html [NC,QSA]\n\n# At this point, we would have already re-writ...
2009/01/22
[ "https://Stackoverflow.com/questions/470880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35197/" ]
How can you use ModRewrite to check if a cache file exists, and if it does, rewrite to the cache file and otherwise rewrite to a dynamic file. For example I have the following folder structure: ``` pages.php cache/ pages/ 1.html 2.html textToo.html etc. ``` How would you setup the RewriteRules for t...
``` RewriteRule ^pages/([^/\.]+) cache/pages/$1.html [NC,QSA] # At this point, we would have already re-written pages/4 to cache/pages/4.html RewriteCond %{REQUEST_FILENAME} !-f # If the above RewriteCond succeeded, we don't have a cache, so rewrite to # the pages.php URI, otherwise we fall off the end and go with t...
470,892
<p>I am working with a third-party framework, and the code is pretty bad, and I'm getting exceptions that I can't figure out. I was able to decompile using <a href="http://en.wikipedia.org/wiki/.NET_Reflector" rel="nofollow noreferrer">.NET Reflector</a>, and now I'm trying to debug using <a href="http://deblector.code...
[ { "answer_id": 763611, "author": "Fionn", "author_id": 21566, "author_profile": "https://Stackoverflow.com/users/21566", "pm_score": 4, "selected": true, "text": "<p>Maybe this will help you:</p>\n\n<p>First of all, I am using the <em>DeblectorAddin-1.01-Alpha</em> from (I don't know if ...
2009/01/22
[ "https://Stackoverflow.com/questions/470892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5255/" ]
I am working with a third-party framework, and the code is pretty bad, and I'm getting exceptions that I can't figure out. I was able to decompile using [.NET Reflector](http://en.wikipedia.org/wiki/.NET_Reflector), and now I'm trying to debug using [Deblector](http://deblector.codeplex.com/), but I can't even figure o...
Maybe this will help you: First of all, I am using the *DeblectorAddin-1.01-Alpha* from (I don't know if it works like this in older versions too) from <http://www.codeplex.com/deblector>. With this version, it is quite simple with the following procedure: * Attach to a process + With the **a[ttach]** command in ...
470,930
<p>First, a little bit of context (cause I know you all love it!):</p> <p>I have a model called <strong>Note</strong>. It has a field called <strong>Type</strong> which, in the database, is an integer value that designates which type of object this note belongs to (1 = Customer, 2 = Sales Lead, etc). A second field ca...
[ { "answer_id": 471055, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 1, "selected": false, "text": "<p>I would suspect Session Management. Are you intentionally or unintentionally reusing session ids?</p>\n" }, { "a...
2009/01/22
[ "https://Stackoverflow.com/questions/470930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31516/" ]
First, a little bit of context (cause I know you all love it!): I have a model called **Note**. It has a field called **Type** which, in the database, is an integer value that designates which type of object this note belongs to (1 = Customer, 2 = Sales Lead, etc). A second field called **Source** designates the ID of...
I would suspect Session Management. Are you intentionally or unintentionally reusing session ids?
470,934
<p>I've found the following code for parsing through RSS but it does not seem to allow for nested elements:</p> <pre><code>- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ NSLog(@"ended element: %@", elementName);...
[ { "answer_id": 471751, "author": "August", "author_id": 30966, "author_profile": "https://Stackoverflow.com/users/30966", "pm_score": 4, "selected": true, "text": "<p>You need to get the attributes (including the URL) when the element starts:</p>\n\n<pre><code>parser:didStartElement:name...
2009/01/22
[ "https://Stackoverflow.com/questions/470934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58068/" ]
I've found the following code for parsing through RSS but it does not seem to allow for nested elements: ``` - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ NSLog(@"ended element: %@", elementName); if ([elem...
You need to get the attributes (including the URL) when the element starts: ``` parser:didStartElement:namespaceURI:qualifiedName:attributes: ```
470,942
<p>Here is the setup:</p> <p>I have a Silverlight Control Library "Controls", in which I have a customer control defined for presenting dialogs:</p> <pre><code>public class Dialog : ContentControl { public Dialog() : base() { DefaultStyleKey = typeof(Dialog); } &lt;...normal custom contro...
[ { "answer_id": 481941, "author": "caryden", "author_id": 313, "author_profile": "https://Stackoverflow.com/users/313", "pm_score": 2, "selected": true, "text": "<p>After much, much research and frustration, I believe it to be related to this: <a href=\"http://blogs.msdn.com/silverlight_...
2009/01/22
[ "https://Stackoverflow.com/questions/470942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313/" ]
Here is the setup: I have a Silverlight Control Library "Controls", in which I have a customer control defined for presenting dialogs: ``` public class Dialog : ContentControl { public Dialog() : base() { DefaultStyleKey = typeof(Dialog); } <...normal custom control stuff...> } ``` also...
After much, much research and frustration, I believe it to be related to this: <http://blogs.msdn.com/silverlight_sdk/archive/2008/10/24/loaded-event-timing-in-silverlight.aspx> The Loaded event in Silverlight does not match the definition of (a) what it is in WPF and consequently (b) the definition that they pasted i...
470,944
<p>In web app I am splitting strings and assigning to link names or to collections of strings. Is there a significant performance benefit to using stringbuilder for a web application?</p> <p>EDIT: 2 functions: splitting up a link into 5-10 strings. THen repackaging into another string. Also I append one string at a t...
[ { "answer_id": 470964, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 2, "selected": false, "text": "<p>Yes, concatenating regular strings is expensive (really appending on string on to the end of another). Each time a ...
2009/01/22
[ "https://Stackoverflow.com/questions/470944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49632/" ]
In web app I am splitting strings and assigning to link names or to collections of strings. Is there a significant performance benefit to using stringbuilder for a web application? EDIT: 2 functions: splitting up a link into 5-10 strings. THen repackaging into another string. Also I append one string at a time to a li...
How many strings will you be concatenating? Do you know for sure how many there will be, or does it depend on how many records are in the database etc? See [my article on this subject](http://pobox.com/~skeet/csharp/stringbuilder.html) for more details and guidelines - but basically, being in a web app makes no differ...
470,960
<p><strong>Background</strong></p> <p>I would like to simulate the "active" behavior that most browsers support for links when they are clicked. For any element and event I would like to be able to add a css class to the element for the duration of the event. So in psuedo jQuery code I'd like to do this:</p> <pre><co...
[ { "answer_id": 471175, "author": "gizmo", "author_id": 9396, "author_profile": "https://Stackoverflow.com/users/9396", "pm_score": 0, "selected": false, "text": "<p>Well, for the bonus point, it comes for free as you can as many handler you want to the same event. \nNo regarding your ini...
2009/01/22
[ "https://Stackoverflow.com/questions/470960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Background** I would like to simulate the "active" behavior that most browsers support for links when they are clicked. For any element and event I would like to be able to add a css class to the element for the duration of the event. So in psuedo jQuery code I'd like to do this: ``` $(".button").click(function() {...
The problem is there is no general way to determine when an asynchronous call is done. You would need to set some kind of flag after the AJAX call (for example) is done and poll it with setInterval. With synchronous functions, the browser probably won't update the display until the click handler is done anyways, so yo...
470,961
<p>I've got apache2.2 on windows. I'm trying to serve both subversion (/svn) and redmine (/redmine). I have svn running fine with this config:</p> <pre><code>&lt;Location /svn&gt; DAV svn SVNParentPath C:/svn_repository ... &lt;/Location&gt; </code></pre> <p>This is working great--my svn users can hit <a href="...
[ { "answer_id": 470973, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 5, "selected": true, "text": "<p>Here's what I had to change:</p>\n\n<p>I removed the trailing slash:</p>\n\n<pre><code>&lt;Location /redmine&gt;\n Prox...
2009/01/22
[ "https://Stackoverflow.com/questions/470961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29/" ]
I've got apache2.2 on windows. I'm trying to serve both subversion (/svn) and redmine (/redmine). I have svn running fine with this config: ``` <Location /svn> DAV svn SVNParentPath C:/svn_repository ... </Location> ``` This is working great--my svn users can hit <http://mybox/svn> just fine. Now I want to ad...
Here's what I had to change: I removed the trailing slash: ``` <Location /redmine> ProxyPass http://localhost:3000 ProxyPassReverse http://localhost:3000/ </Location> ``` And in my rails app: ``` # added to end of file C:\redmine\config\environment.rb ActionController::AbstractRequest.relative_url_root = "/red...
470,982
<p>I recently was quickly shortening some method names in a JavaScript file and ran into a problem when I converted one method name:</p> <p>Before:</p> <pre class="lang-js prettyprint-override"><code>RefreshSevenDayGrid(){ // some stuff } </code></pre> <p>After:</p> <pre class="lang-js prettyprint-override"><code>7...
[ { "answer_id": 470996, "author": "Jeffrey Hantin", "author_id": 55637, "author_profile": "https://Stackoverflow.com/users/55637", "pm_score": 3, "selected": false, "text": "<p>It tends to cause fits for language parsers. It sees a leading digit, so expects to begin reading a numeric lit...
2009/01/22
[ "https://Stackoverflow.com/questions/470982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35585/" ]
I recently was quickly shortening some method names in a JavaScript file and ran into a problem when I converted one method name: Before: ```js RefreshSevenDayGrid(){ // some stuff } ``` After: ```js 7Day() { // some stuff } ``` I quickly discovered that the javascript no longer worked. I heard from ...
Besides what Jeffrey Hantin said, there are numeric constants such as ``` 3e7 // 3x10^7 40L // C, C++, etc for a long integer 0x88 // hexadecimal ``` The general convention for identifiers which is used widely in most languages, is `[S except for 0-9][S]*` where S is some set of valid characters (A-Z, a-z, 0-9, so...
470,984
<ol> <li>When dealing with MySQL, I typically use the BOOLEAN type, which is equivalent to TINYINT(1), or 1/0</li> <li>In most languages I work with, true/false is preferred</li> <li>When displaying forms, sometimes "Yes / No" makes more sense</li> </ol>
[ { "answer_id": 470993, "author": "Ed S.", "author_id": 1053, "author_profile": "https://Stackoverflow.com/users/1053", "pm_score": 3, "selected": false, "text": "<p>In code: true/false.</p>\n\n<p>In the UI: Yes/No or OK/Cancel</p>\n" }, { "answer_id": 471001, "author": "TJ L...
2009/01/22
[ "https://Stackoverflow.com/questions/470984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16435/" ]
1. When dealing with MySQL, I typically use the BOOLEAN type, which is equivalent to TINYINT(1), or 1/0 2. In most languages I work with, true/false is preferred 3. When displaying forms, sometimes "Yes / No" makes more sense
``` enum Bool { True, False, FileNotFound }; ``` <http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx>
470,987
<p>How do you get the name of the current virtual directory using ASP Classic? In ASP.NET you can use <code>Request.ApplicationPath</code> to find this.</p> <p>For example, let's say you have a URL like this:</p> <pre>http://localhost/virtual_directory/subdirectory/file.asp</pre> <p>In ASP.NET, <code>Request.Applica...
[ { "answer_id": 471081, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 0, "selected": false, "text": "<p>Try using: Request.ServerVariables(\"SCRIPT_NAME\")</p>\n\n<p>or try using Request.ServerVariables(\"INSTANCE_META_PATH\")...
2009/01/22
[ "https://Stackoverflow.com/questions/470987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8432/" ]
How do you get the name of the current virtual directory using ASP Classic? In ASP.NET you can use `Request.ApplicationPath` to find this. For example, let's say you have a URL like this: ``` http://localhost/virtual_directory/subdirectory/file.asp ``` In ASP.NET, `Request.ApplicationPath` would return **/virtual\_d...
You can get the virtual path to the file from one of several server variables - try either: * `Request.ServerVariables("PATH_INFO")` * `Request.ServerVariables("SCRIPT_NAME")` (but not `INSTANCE_META_PATH` as previously suggested - this gives you the meta base path, not the virtual path you're expecting). Either ser...
470,992
<p>Database structure:</p> <pre><code>Clubs: ID, ClubName Teams: ID, TeamName, ClubID Players: ID, Name Registrations: PlayerID, TeamID, Start_date, End_date, SeasonID </code></pre> <p>Clubs own several teams. Players may get registered into several teams (inside same club or into different club) during one year. I h...
[ { "answer_id": 471022, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 0, "selected": false, "text": "<p>Here's a list of players for one season.</p>\n\n<pre><code>SELECT sub.PlayerId\nFROM\n(\n SELECT\n r.PlayerId,\n (SE...
2009/01/22
[ "https://Stackoverflow.com/questions/470992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44715/" ]
Database structure: ``` Clubs: ID, ClubName Teams: ID, TeamName, ClubID Players: ID, Name Registrations: PlayerID, TeamID, Start_date, End_date, SeasonID ``` Clubs own several teams. Players may get registered into several teams (inside same club or into different club) during one year. I have to generate a query to...
This is a second try at this answer, simplifying it to merely count the distinct clubs, not report a list of club names. ``` SELECT p.surname, r.start_date, r.end_date, COUNT(DISTINCT c.id) AS counter FROM ejl_players p JOIN ejl_registration r ON (r.player_id = p.id) JOIN ejl_teams t ON (r.team_id = t.id) JOIN ejl_...
471,000
<p>I've just started using the <code>PythonInterpreter</code> from within my Java classes, and it works great! However, if I try to include python modules (<code>re</code>, <code>HTMLParser</code>, etc.), I'm receiving the following exception (for <code>re</code>):</p> <pre> Exception in thread "main" Traceback (inner...
[ { "answer_id": 471143, "author": "Michael Myers", "author_id": 13531, "author_profile": "https://Stackoverflow.com/users/13531", "pm_score": 3, "selected": false, "text": "<p>According to the <a href=\"http://www.jython.org/Project/userfaq.html#jython-modules\" rel=\"nofollow noreferrer\...
2009/01/22
[ "https://Stackoverflow.com/questions/471000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31610/" ]
I've just started using the `PythonInterpreter` from within my Java classes, and it works great! However, if I try to include python modules (`re`, `HTMLParser`, etc.), I'm receiving the following exception (for `re`): ``` Exception in thread "main" Traceback (innermost last): File "", line 1, in ? ImportError: no ...
You embed jython and you will use some Python-Modules somewere: if you want to set the path (sys.path) in your Java-Code : ``` public void init() { interp = new PythonInterpreter(null, new PySystemState()); PySystemState sys = Py.getSystemState(); sys.path.append(new PyString(rootPath)); ...