qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
129,560 | <p>What is the C# equivalent to the sql server 2005 real type?</p>
| [
{
"answer_id": 54152559,
"author": "George Nelson",
"author_id": 10902189,
"author_profile": "https://Stackoverflow.com/users/10902189",
"pm_score": 1,
"selected": false,
"text": "Single"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
129,605 | <p>How would one go about profiling a few queries that are being run from an ASP.NET application? There is some software where I work that runs extremely slow because of the database (I think). The tables have indexes but it still drags because it's working with so much data. How can I profile to see where I can make a few minor improvements that will hopefully lead to larger speed improvements?</p>
<p>Edit: I'd like to add that the webserver likes to timeout during these long queries.</p>
| [
{
"answer_id": 131006,
"author": "Tim",
"author_id": 10363,
"author_profile": "https://Stackoverflow.com/users/10363",
"pm_score": 1,
"selected": false,
"text": "SET STATISTICS TIME ON\nSET STATISTICS IO ON\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20471/"
] |
129,607 | <p>I am seeing both of them used in this script I am trying to debug and the literature is just not clear. Can someone demystify this for me?</p>
| [
{
"answer_id": 129652,
"author": "catfood",
"author_id": 12802,
"author_profile": "https://Stackoverflow.com/users/12802",
"pm_score": 3,
"selected": false,
"text": "man perlsub"
},
{
"answer_id": 129714,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https:... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] |
129,618 | <p>I've installed TFS 2008, but I can't seem to access the server. When I try to connect to it in Visual Studio, I can't. If I try by browser on a remote PC, I get a generic page cannot be displayed. On the server, I get a 403. Nothing was touched in IIS and the service is running as a Network Service. Any ideas?</p>
| [
{
"answer_id": 43316098,
"author": "Hassan Faghihi",
"author_id": 1260751,
"author_profile": "https://Stackoverflow.com/users/1260751",
"pm_score": 0,
"selected": false,
"text": "ERR_CONNECTION_TIMED_OUT"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21318/"
] |
129,628 | <p>I keep hearing this term tossed around in several different contexts. What is it?</p>
| [
{
"answer_id": 129823,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": -1,
"selected": false,
"text": "foreach (object item in MyList)\n{\n DoSomething(item);\n}\n"
},
{
"answer_id": 145148,
"author": "Jörg... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] |
129,642 | <p>With C#, How do I play (Pause, Forward...) a sound file (mp3, ogg)? The file could be on the hard disk, or on the internet.</p>
<p>Is there any library or Class out there that can ease me the work ?</p>
| [
{
"answer_id": 129750,
"author": "Ryan Lundy",
"author_id": 5486,
"author_profile": "https://Stackoverflow.com/users/5486",
"pm_score": 3,
"selected": false,
"text": "var audio = new Microsoft.VisualBasic.Devices.Audio();\naudio.Play(\"some file path\");\n"
},
{
"answer_id": 2172... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20709/"
] |
129,650 | <p>Let's say I have many-to-many relationship (using the ActiveRecord attribute HasAndBelongsToMany) between Posts and Tags (domain object names changed to protect the innocent), and I wanted a method like <pre>FindAllPostByTags(IList<Tag> tags)</pre> that returns all Posts that have all (not just some of) the Tags in the parameter. Any way I could accomplish this either with NHibernate Expressions or HQL? I've searched through the HQL documentation and couldn't find anything that suited my needs. I hope I'm just missing something obvious!</p>
| [
{
"answer_id": 130339,
"author": "Sander Rijken",
"author_id": 5555,
"author_profile": "https://Stackoverflow.com/users/5555",
"pm_score": 0,
"selected": false,
"text": "Junction c = Expression.Conjunction();\nforeach(Tag t in tags)\n c = c.Add( Expression.Eq(\"Tag\", t);\n\nreturn se... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14064/"
] |
129,651 | <p>In the following HTML, I'd like the frame around the image to be snug -- not to stretch out and take up all the available width in the parent container. I know there are a couple of ways to do this (including horrible things like manually setting its width to a particular number of pixels), but what is the <em>right</em> way?</p>
<p><strong>Edit:</strong> One answer suggests I turn off "display:block" -- but this causes the rendering to look malformed in every browser I've tested it in. Is there a way to get a nice-looking rendering with "display:block" off?</p>
<p><strong>Edit:</strong> If I add "float: left" to the pictureframe and "clear:both" to the P tag, it looks great. But I don't always want these frames floated to the left. Is there a more direct way to accomplish whatever "float" is doing?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.pictureframe {
display: block;
margin: 5px;
padding: 5px;
border: solid brown 2px;
background-color: #ffeecc;
}
#foo {
border: solid blue 2px;
float: left;
}
img {
display: block;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="foo">
<span class="pictureframe">
<img alt=''
src="http://stackoverflow.com/favicon.ico" />
</span>
<p>
Why is the beige rectangle so wide?
</p>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 129706,
"author": "Jim",
"author_id": 8427,
"author_profile": "https://Stackoverflow.com/users/8427",
"pm_score": 6,
"selected": true,
"text": ".pictureframe {\n display: inline-block;\n}\n"
},
{
"answer_id": 129798,
"author": "Keeth",
"author_id": 20588... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] |
129,677 | <p>Is there a catchall function somewhere that works well for sanitizing user input for SQL injection and XSS attacks, while still allowing certain types of HTML tags?</p>
| [
{
"answer_id": 129767,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 6,
"selected": false,
"text": "strip_tags()"
},
{
"answer_id": 130323,
"author": "troelskn",
"author_id": 18180,
"author_profile":... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10680/"
] |
129,693 | <p>I ruined several unit tests some time ago when I went through and refactored them to make them more <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="noreferrer">DRY</a>--the intent of each test was no longer clear. It seems there is a trade-off between tests' readability and maintainability. If I leave duplicated code in unit tests, they're more readable, but then if I change the <a href="http://en.wikipedia.org/wiki/System_Under_Test" rel="noreferrer">SUT</a>, I'll have to track down and change each copy of the duplicated code.</p>
<p>Do you agree that this trade-off exists? If so, do you prefer your tests to be readable, or maintainable?</p>
| [
{
"answer_id": 130038,
"author": "ddaa",
"author_id": 11549,
"author_profile": "https://Stackoverflow.com/users/11549",
"pm_score": 6,
"selected": false,
"text": "assertPegFitsInHole"
},
{
"answer_id": 143699,
"author": "spiv",
"author_id": 22701,
"author_profile": "h... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4766/"
] |
129,695 | <p>I need to serialize a huge amount of data (around 2gigs) of small objects into a single file in order to be processed later by another Java process. Performance is kind of important. Can anyone suggest a good method to achieve this?</p>
| [
{
"answer_id": 129751,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "Serializable"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16389/"
] |
129,740 | <p>Can someone suggest a good module in perl which can be used to store collection of objects?</p>
<p>Or is ARRAY a good enough substitute for most of the needs?</p>
<p><strong>Update:</strong>
I am looking for a collections class because I want to be able to do an operation like compute collection level property from each element.</p>
<p>Since I need to perform many such operations, I might as well write a class which can be extended by individual objects. This class will obviously work with arrays (or may be hashes).</p>
| [
{
"answer_id": 129763,
"author": "ethyreal",
"author_id": 18159,
"author_profile": "https://Stackoverflow.com/users/18159",
"pm_score": 0,
"selected": false,
"text": " @names = ('Paul','Michael','Jessica','Megan');\n"
},
{
"answer_id": 131003,
"author": "Sam Kington",
"au... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406/"
] |
129,746 | <p>I am trying to set up JBoss 4.2.2 and JConsole for remote monitoring. As per many of the how-to's I have found on the web to do this you need to enable jmxremote by setting the following options in run.conf. (I realize the other two opts disable authentication)</p>
<pre><code>JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=11099"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
</code></pre>
<p>Which results in the following exception:</p>
<pre><code>13:06:56,418 INFO [TomcatDeployer] performDeployInternal :: deploy, ctxPath=/services, warUrl=.../tmp/deploy/tmp34585xxxxxxxxx.ear-contents/mDate-Services-exp.war/
13:06:57,706 WARN [AbstractServerConfig] getWebServicePort :: Unable to calculate 'WebServicePort', using default '8080'
13:06:57,711 WARN [AbstractServerConfig] getWebServicePort :: Unable to calculate 'WebServicePort', using default '8080'
13:06:58,070 WARN [AbstractServerConfig] getWebServicePort :: Unable to calculate 'WebServicePort', using default '8080'
13:06:58,071 WARN [AbstractServerConfig] getWebServicePort :: Unable to calculate 'WebServicePort', using default '8080'
13:06:58,138 ERROR [MainDeployer] start :: Could not start deployment: file:/opt/jboss-4.2.2.GA/server/default/tmp/deploy/tmp34585xxxxxxxxx.ear-contents/xxxxx-Services.war
java.lang.NullPointerException
at org.jboss.wsf.stack.jbws.WSDLFilePublisher.getPublishLocation(WSDLFilePublisher.java:303)
at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:103)
at org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect.create(PublishContractDeploymentAspect.java:52)
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:115)
at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:97)
...
</code></pre>
<p>My application uses JWS which according to this bug:</p>
<p><a href="https://jira.jboss.org/jira/browse/JBWS-1943" rel="nofollow noreferrer">https://jira.jboss.org/jira/browse/JBWS-1943</a></p>
<p>Suggests this workaround:</p>
<pre><code>JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
</code></pre>
<p>(<a href="https://developer.jboss.org/wiki/JBossWS-FAQ#jive_content_id_How_to_use_JDK_JMX_JConsole_with_JBossWS" rel="nofollow noreferrer">https://developer.jboss.org/wiki/JBossWS-FAQ#jive_content_id_How_to_use_JDK_JMX_JConsole_with_JBossWS</a>)</p>
<p>I've tried that however that then throws the following exception while trying to deploy a sar file in my ear which only contains on class which implements Schedulable for a couple of scheduled jobs my application requires:</p>
<pre><code>Caused by: java.lang.NullPointerException
at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash(ConcurrentReaderHashMap.java:298)
at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:410)
at org.jboss.mx.server.registry.BasicMBeanRegistry.getMBeanMap(BasicMBeanRegistry.java:959)
at org.jboss.mx.server.registry.BasicMBeanRegistry.contains(BasicMBeanRegistry.java:577)
</code></pre>
<p>Any suggestions on where to go from here?</p>
<p>EDIT:</p>
<p>I have also tried the following variation:</p>
<pre><code>JAVA_OPTS="$JAVA_OPTS -DmbipropertyFile=../server/default/conf/mbi.properties -DpropertyFile=../server/default/conf/mdate.properties -Dwicket.configuration=DEVELOPMENT"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
</code></pre>
<p>I'm using JDK 1.6.0_01-b06</p>
| [
{
"answer_id": 129872,
"author": "Chris Vest",
"author_id": 13251,
"author_profile": "https://Stackoverflow.com/users/13251",
"pm_score": 2,
"selected": false,
"text": "ssh -XCA"
},
{
"answer_id": 830932,
"author": "anikitin",
"author_id": 102381,
"author_profile": "h... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4419/"
] |
129,773 | <p>When you create your mapping files, do you map your properties to fields or properties :</p>
<pre><code><hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Foo" namespace="Foo.Bar" >
<class name="Foo" table="FOOS" batch-size="100">
[...]
<property name="FooProperty1" access="field.camelcase" column="FOO_1" type="string" length="50" />
<property name="FooProperty2" column="FOO_2" type="string" length="50" />
[...]
</class>
</hibernate-mapping>
</code></pre>
<p>Of course, please explain why :)</p>
<p>Usually, I map to properties, but mapping to fields can enable to put some "logic" in the getters/setters of the properties.</p>
<p>Is it "bad" to map to fields ? Is there a best practice ?</p>
| [
{
"answer_id": 130199,
"author": "Matt Hinze",
"author_id": 2676,
"author_profile": "https://Stackoverflow.com/users/2676",
"pm_score": 1,
"selected": false,
"text": "set"
},
{
"answer_id": 212889,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https:/... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/971/"
] |
129,815 | <p>I am working on a geometry problem that requires finding the intersection of two parabolic arcs in any rotation. I was able to intesect a line and a parabolic arc by rotating the plane to align the arc with an axis, but two parabolas cannot both align with an axis. I am working on deriving the formulas, but I would like to know if there is a resource already available for this.</p>
| [
{
"answer_id": 129889,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "https://Stackoverflow.com/users/15955",
"pm_score": 4,
"selected": true,
"text": " x(t) = ax² + bx + c\n y(t) = t;\n"
},
{
"answer_id": 5440819,
"author": "Dr. belisarius",
"auth... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15032/"
] |
129,828 | <p>My workplace filters our internet traffic by forcing us to go through a proxy, and unfortunately sites such as IT Conversations and Libsyn are blocked. However, mp3 files in general are not filtered, if they come from sites not on the proxy's blacklist.</p>
<p>So is there a website somewhere that will let me give it a URL and then download the MP3 at that URL and send it my way, thus slipping through the proxy?</p>
<p>Alternatively, is there some other easy way for me to get the mp3 files for these podcasts from work?</p>
<p>EDIT and UPDATE: Since I've gotten downvoted a few times, perhaps I should explain/justify my situation. I'm a contractor working at a government facility, and we use some commercial filtering software which is very aggressive and overzealous. My boss is fine with me listening to podcasts at work and is fine with me circumventing the proxy filtering, and doesn't want to deal with the significant red tape (it's the government after all) associated with getting the IT department to make an exception for IT Conversations or the Java Posse, etc. So I feel that this is an important and relevant question for programmers.</p>
<p>Unfortunately, all of the proxy websites for bypassing web filters have also been blocked, so I may have to download the podcasts I like at home in advance and then bring them into work. If can tell me about a lesser-known service I can try which might not be blocked, I'd appreciate it.</p>
| [
{
"answer_id": 1383922,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 1,
"selected": true,
"text": "#!/usr/local/bin/python\n\nimport cgitb; cgitb.enable()\nimport cgi\nfrom urllib2 import urlopen\n\ndef tohex(data):... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] |
129,861 | <p>It is a bit of a "chicken or egg" kind of query, but can someone dreamup a query that can return the name of the current database instance in which the query executes? Believe me when I say I understand the paradox: why do you need to know the name of the database instance if you're already connected to execute the query? Auditing in a multi-database environment.</p>
<p>I've looked at all the @@ globals in Books Online. "<code>SELECT @@servername</code>" comes close, but I want the name of the database instance rather than the server.</p>
| [
{
"answer_id": 129879,
"author": "Dana",
"author_id": 7856,
"author_profile": "https://Stackoverflow.com/users/7856",
"pm_score": 6,
"selected": false,
"text": "SELECT DB_NAME()\n"
},
{
"answer_id": 129882,
"author": "Community",
"author_id": -1,
"author_profile": "ht... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470/"
] |
129,877 | <p>I'm writing a function to find <a href="http://projecteuler.net/index.php?section=problems&id=12" rel="noreferrer">triangle numbers</a> and the natural way to write it is recursively:</p>
<pre><code>function triangle (x)
if x == 0 then return 0 end
return x+triangle(x-1)
end
</code></pre>
<p>But attempting to calculate the first 100,000 triangle numbers fails with a stack overflow after a while. This is an ideal function to <a href="http://perl.plover.com/Memoize/" rel="noreferrer">memoize</a>, but I want a solution that will memoize any function I pass to it.</p>
| [
{
"answer_id": 129881,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 2,
"selected": false,
"text": "function memoize (f)\n local cache = {}\n return function (x)\n if cache[x] then\n return... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] |
129,884 | <p>I look for a tool/framework to make automatic acceptance-testing. The interface to create new tests should be so easy, that a non-programmer (customer, boss) will be able to add specifications for which will be tested automatically.</p>
<p>It should be some way to execute the tests from command-line, to include a run of the tests in automatic builds.</p>
<p>I prefer Java and Open-Source, but my question isn't restricted in that way.</p>
<p>What do you can recommend and please explain why your tool/framework is the best in the world.</p>
| [
{
"answer_id": 3330126,
"author": "Bryan Ash",
"author_id": 104219,
"author_profile": "https://Stackoverflow.com/users/104219",
"pm_score": 0,
"selected": false,
"text": "Feature: Acceptance testing framework\n\n Scenario: an example speaks volumes\n Given a text example\n When it... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] |
129,890 | <p>I'm getting lost in pointer land, I believe. I've got this (code syntax might be a little off, I am not looking at the machine with this code on it...but all the pertinent details are correct):</p>
<pre><code>NSMutableArray *tmp = [[NSMutableArray alloc] init];
</code></pre>
<p>I them pass that to a routine in another class</p>
<pre><code>- (BOOL)myRoutine: (NSMutableArray *)inArray
{
// Adds items to the array -- if I break at the end of this function, the inArray variable has a count of 10
}
</code></pre>
<p>But when the code comes back into the calling routine, [tmp count] is 0.</p>
<p>I must be missing something very simple and yet very fundamental, but for the life of me I can't see it. Can anyone point out what I'm doing wrong?</p>
<p>EDIT: www.stray-bits.com asked if I have retained a reference to it, and I said "maybe...we tried this: NSMutableArray *tmp = [[[NSMutableArray alloc] init] retain]; not sure if that is what you mean, or if I did it right.</p>
<p>EDIT2: Mike McMaster and Andy -- you guys are probably right, then. I don't have the code here (it's on a colleague's machine and they have left for the day), but to fill the array with values we were doing something along the lines of using a decoder(?) object. </p>
<p>The purpose of this function is to open a file from the iPhone, read that file into an array (it's an array of objects that we saved in a previous run of the program). That "decoder" thing has a method that puts data into the array. </p>
<p>Man, I've totally butchered this. I really hope you all can follow, and thanks for the advice. We'll look more closely at it.</p>
| [
{
"answer_id": 130310,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 2,
"selected": false,
"text": "NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:0];\n\narray = [foo bar];\n"
},
{
"answer_id": 1... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] |
129,898 | <p>I have a database that stores events in it and a page with a calendar object on it. When rendering the days it looks through the months events and if any match the current day being rendered it creates a linkbutton to represent the event in the day on the calendar and adds it to that cell. I add some javascript to the linkbutton to change the window.location to a page to view event details passing EventID in the querystring ( I tried setting the postbackurl of the newly created linkbutton but it wasnt causing a postback... no luck). I need to set a Session variable ie. Session("EditMode") = "Edit" So the new page will know it is to get an existing event info rather than prepare to create a new event? Any SUGGESTIONS?</p>
| [
{
"answer_id": 130646,
"author": "David Robbins",
"author_id": 19799,
"author_profile": "https://Stackoverflow.com/users/19799",
"pm_score": 1,
"selected": false,
"text": "<script>\nfunction OpenWindow(eventId, editMode)\n{\n var window = window.open(\"popup.aspx?eventId=\" + eventId ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16820/"
] |
129,915 | <p>What property in Netbeans to I need to change to set the name of my java swing app in the OS X menubar and dock? I found info.plist, but changing @PROJECTNAMEASIDENTIFIEER@ in multiple keys here had no effect.</p>
<p>Thanks,
hating netbeans.</p>
| [
{
"answer_id": 129931,
"author": "Jeremy",
"author_id": 4419,
"author_profile": "https://Stackoverflow.com/users/4419",
"pm_score": 2,
"selected": false,
"text": "nbproject/project.properties\n\nnbproject/project.xml\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10597/"
] |
129,917 | <p>It's common knowledge that using System.Diagnostics.Process.Start is the way to launch a url from a C# applicaiton:</p>
<p>System.Diagnostics.Process.Start("<a href="http://www.mywebsite.com" rel="nofollow noreferrer">http://www.mywebsite.com</a>");</p>
<p>However, if this url is invalid the application seems to have no way of knowing that the call failed or why. Is there a better way to launch a web browser? If not, what is my best option for url validation?</p>
| [
{
"answer_id": 129956,
"author": "Troels Thomsen",
"author_id": 20138,
"author_profile": "https://Stackoverflow.com/users/20138",
"pm_score": 4,
"selected": true,
"text": "try\n{\n var url = new Uri(\"http://www.example.com/\");\n\n Process.Start(url.AbsoluteUri);\n}\ncatch (UriFor... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9251/"
] |
129,920 | <p>I have developed a couple of extensions for Firefox, and am annoyed that it is so hard to get the extension signed. When an extension isn't signed, it says "Author not verified" when it is installed, and to me that just looks wrong.</p>
<p>I have a simple build script that builds my .xpi file from sources, and I have a licenced copy of PKZip (which according to a number of tutorials is required to build a signed xpi file that Firefox requires), but I haven't found a way to get a free/cheap certificate that actually works or a set of instructions that do the trick.</p>
<p>Since my extensions are free, I don't want to spend $400 on a commercial certificate, but I don't mind spending $50 or so to get it done. I have both Linux and Windows machines, although my build script currently uses Windows and that would be most convenient to use.</p>
<p>How have you solved this? What do I need to do to automatically and securely sign my extensions when they are built?</p>
<p>Edit: I appreciate the Google hits, but the steps they provide aren't complete enough on how to actually get a certificate that works. The feeling I get reminds me of this classic:</p>
<p><img src="https://i.stack.imgur.com/PIgLC.gif" alt="alt text" title="Then a miracle occurs..."></p>
| [
{
"answer_id": 27707675,
"author": "Joscha",
"author_id": 217357,
"author_profile": "https://Stackoverflow.com/users/217357",
"pm_score": 1,
"selected": false,
"text": "openssl pkcs12 -in key.p12 -nodes -out private.key -nocerts"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/129920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13394/"
] |
129,927 | <p>I have a page in my vb.net web application that needs to toss a bunch of data into a text file and then present it to the user for download. What's the best / most efficient way to build such a text file on a .net web server?</p>
<p>Edit: to answer a question down below, this is going to be a download once and then throw-away kind of file.</p>
<p>Update: I glued together the suggestions by John Rudy and DavidK, and it worked perfectly. Thanks, all!</p>
| [
{
"answer_id": 129953,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "private void Button1_Click(object sender, System.EventArgs e)\n{\n StringBuilder output = new StringBuilder;\n /... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
129,945 | <p>Can someone explain what exactly the string "0 but true" means in Perl? As far as I understand, it equals zero in an integer comparison, but evaluates to true when used as a boolean. Is this correct? Is this a normal behavior of the language or is this a special string treated as a special case in the interpreter?</p>
| [
{
"answer_id": 129970,
"author": "Daniel Papasian",
"author_id": 7548,
"author_profile": "https://Stackoverflow.com/users/7548",
"pm_score": 3,
"selected": false,
"text": "if (int(\"0 but true\")) { print \"zero\"; }"
},
{
"answer_id": 129986,
"author": "C. K. Young",
"au... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12523/"
] |
129,958 | <p>I have several different locations in a fairly wide area, each with a Linux server storing company data. This data changes every day in different ways at each different location. I need a way to keep this data up-to-date and synced between all these locations.</p>
<p>For example:</p>
<p>In one location someone places a set of images on their local server. In another location, someone else places a group of documents on their local server. A third location adds a handful of both images and documents to their server. In two other locations, no changes are made to their local servers at all. By the next morning, I need the servers at all five locations to have all those images and documents.</p>
<p>My first instinct is to use rsync and a cron job to do the syncing over night (1 a.m. to 6 a.m. or so), when none of the bandwidth at our locations is being used. It seems to me that it would work best to have one server be the "central" server, pulling in all the files from the other servers first. Then it would push those changes back out to each remote server? Or is there another, better way to perform this function?</p>
| [
{
"answer_id": 130736,
"author": "Dan Udey",
"author_id": 21450,
"author_profile": "https://Stackoverflow.com/users/21450",
"pm_score": 2,
"selected": false,
"text": "pyinotify"
},
{
"answer_id": 130795,
"author": "Jeremy Cantrell",
"author_id": 18866,
"author_profile... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21885/"
] |
129,968 | <p>Is it possible to convert a <code>com.vividsolutions.jts.geom.Geometry</code> (or a subclass of it) into a class that implements <code>java.awt.Shape</code>? Which library or method can I use to achieve that goal?</p>
| [
{
"answer_id": 129995,
"author": "tim_yates",
"author_id": 6509,
"author_profile": "https://Stackoverflow.com/users/6509",
"pm_score": 3,
"selected": true,
"text": "com.vividsolutions.jump.workbench.ui.renderer.java2D.Java2DConverter\n"
},
{
"answer_id": 30752409,
"author": "... | 2008/09/24 | [
"https://Stackoverflow.com/questions/129968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] |
130,015 | <p>I have a Rails 2.0.2 application running with a postgresql db. The machine will receive data on a TCP port. I already have coded a working ruby multithreaded tcp server to receive the requests, but I need this code to run alongside my Rails app.</p>
<p>So I guess I need to know how to span a new process inside Rails, or how to create a worker thread that will run my threaded tcp server loop. My ruby tcp server could have access to ActiveRecord, but it's not necessary (I can always create an http request, posting the received data to the original Rails server)</p>
| [
{
"answer_id": 130772,
"author": "Ian Terrell",
"author_id": 9269,
"author_profile": "https://Stackoverflow.com/users/9269",
"pm_score": 2,
"selected": true,
"text": "win32-service"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18879/"
] |
130,020 | <p>Can anyone recommend a dropdownlist control for asp.net (3.5) that can render option groups? Thanks</p>
| [
{
"answer_id": 130046,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 7,
"selected": true,
"text": "'This codes makes the dropdownlist control recognize items with \"--\"\n'for the label or items with an OptionGroup att... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] |
130,032 | <p>Is there a built-in editor for a multi-line string in a <code>PropertyGrid</code>.</p>
| [
{
"answer_id": 130168,
"author": "fryguybob",
"author_id": 4592,
"author_profile": "https://Stackoverflow.com/users/4592",
"pm_score": 7,
"selected": true,
"text": "System.Design.dll"
},
{
"answer_id": 35866566,
"author": "Sunil Kumar",
"author_id": 663741,
"author_pr... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4592/"
] |
130,074 | <p>python's time module seems a little haphazard. For example, here is a list of methods in there, from the docstring:</p>
<pre><code>time() -- return current time in seconds since the Epoch as a float
clock() -- return CPU time since process start as a float
sleep() -- delay for a number of seconds given as a float
gmtime() -- convert seconds since Epoch to UTC tuple
localtime() -- convert seconds since Epoch to local time tuple
asctime() -- convert time tuple to string
ctime() -- convert time in seconds to string
mktime() -- convert local time tuple to seconds since Epoch
strftime() -- convert time tuple to string according to format specification
strptime() -- parse string to time tuple according to format specification
tzset() -- change the local timezone
</code></pre>
<p>Looking at localtime() and its inverse mktime(), why is there no inverse for gmtime() ?</p>
<p>Bonus questions: what would you name the method ? How would you implement it ?</p>
| [
{
"answer_id": 130134,
"author": "Mark Roddy",
"author_id": 9940,
"author_profile": "https://Stackoverflow.com/users/9940",
"pm_score": 2,
"selected": false,
"text": "import time\ndef mkgmtime(t):\n \"\"\"Convert UTC tuple to seconds since Epoch\"\"\"\n return time.mktime(t)-time.t... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2900/"
] |
130,092 | <p>Rails uses the concept of migrations to deal with model changes using the ActiveRecord API.</p>
<p>CouchDB uses JSON (nested maps and arrays) to represent its model objects.</p>
<p>In working with CouchDB so far, I don't see good ways of recognizing when the document's structure has changed (other than being disciplined as a developer), or for migrating documents from an old to a new model.</p>
<p>Are there existing features or do you have best practices for handling model changes in CouchDB?</p>
| [
{
"answer_id": 141086,
"author": "Paul J. Davis",
"author_id": 129506,
"author_profile": "https://Stackoverflow.com/users/129506",
"pm_score": 4,
"selected": true,
"text": "{\n _id: \"foo-post\",\n _rev: \"23490AD\",\n type: \"post\",\n typevers: 0,\n moon_phase: \"full\"\n}\n"... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19784/"
] |
130,112 | <p>How can you get the directory of the script that was run and use it within the .cmd file?</p>
| [
{
"answer_id": 130118,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 7,
"selected": true,
"text": "%CD%"
},
{
"answer_id": 130136,
"author": "Landon",
"author_id": 1597,
"author_profile": "https://Stackoverflow... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
130,116 | <p>How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.</p>
| [
{
"answer_id": 130154,
"author": "Ross Fuhrman",
"author_id": 9431,
"author_profile": "https://Stackoverflow.com/users/9431",
"pm_score": 4,
"selected": false,
"text": "@echo off\n\nfor /f %%a in (sample.txt) do (\n echo %%a\n exit /b\n)\n"
},
{
"answer_id": 130209,
"author... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9822/"
] |
130,117 | <p>Most people say <em>never</em> throw an exception out of a destructor - doing so results in undefined behavior. Stroustrup makes the point that <em>"the vector destructor explicitly invokes the destructor for every element. This implies that if an element destructor throws, the vector destruction fails... There is really no good way to protect against exceptions thrown from destructors, so the library makes no guarantees if an element destructor throws" (from Appendix E3.2)</em>.</p>
<p><a href="http://www.kolpackov.net/projects/c++/eh/dtor-1.xhtml" rel="noreferrer">This article</a> seems to say otherwise - that throwing destructors are more or less okay.</p>
<p><em>So my question is this - if throwing from a destructor results in undefined behavior, how do you handle errors that occur during a destructor?</em></p>
<p>If an error occurs during a cleanup operation, do you just ignore it? If it is an error that can potentially be handled up the stack but not right in the destructor, doesn't it make sense to throw an exception out of the destructor?</p>
<p>Obviously these kinds of errors are rare, but possible.</p>
| [
{
"answer_id": 130123,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 9,
"selected": true,
"text": "#include <iostream>\n\nclass Bad\n{\n public:\n // Added the noexcept(false) so the code keeps its original m... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5963/"
] |
130,120 | <p>Has anyone worked with the StarTeam COM API (Specifically, intergrating with C#).</p>
<p>I need to write a helper function that returns a directory structure out of Starteam, but all I've been able to retrieve using this API has been a list of views.</p>
<p>Has anyone else tried this?</p>
| [
{
"answer_id": 131528,
"author": "Tim Jarvis",
"author_id": 10387,
"author_profile": "https://Stackoverflow.com/users/10387",
"pm_score": 2,
"selected": false,
"text": "void BtnFindClick(object sender, EventArgs e)\n{\n Borland.StarTeam.View v = StarTeamFinder.OpenView(\"username:pwd@... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
130,132 | <p>My form receives asynchronous callbacks from another object on random worker threads. I have been passing the data to the main thread (where it can be used to update onscreen controls) using delegates as shown below. Performance is dreadful -- once I reach 500 updates per second, the program completely locks up. My GUI processing itself is not the problem, as I can simulate this level of updating within the form and have no problems. Is there a more efficient mechanism I should be using to hand off the data from thread to thread?</p>
<pre><code>delegate void DStatus( MyStatus obj );
DStatus _status; // set to MainThreadOnStatus during construction
// this function only called on form's owner thread
void MainThreadOnStatus( MyStatus obj )
{
// screen updates here as needed
}
// this function called by arbitrary worker threads in external facility
void OnStatus( MyStatus obj )
{
this.BeginInvoke( _status, obj );
}
</code></pre>
| [
{
"answer_id": 130247,
"author": "Brian ONeil",
"author_id": 21371,
"author_profile": "https://Stackoverflow.com/users/21371",
"pm_score": 0,
"selected": false,
"text": "MyStatus"
},
{
"answer_id": 137922,
"author": "Community",
"author_id": -1,
"author_profile": "htt... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4540/"
] |
130,161 | <p>I've gotten used to the idea that if I want/need to use alpha-trans PNGs in a cross-browser manner, that I use a background image on a div and then, in IE6-only CSS, mark the background as "none" and include the proper "filter" argument.</p>
<p>Is there another way? A better way? Is there a way to do this with the img tag and not with background images?</p>
| [
{
"answer_id": 161860,
"author": "Ian Oxley",
"author_id": 1904,
"author_profile": "https://Stackoverflow.com/users/1904",
"pm_score": 1,
"selected": false,
"text": "/* for IE 6 */\n#banner {\n background:url(../images/banner.gif);\n}\n\n/* for other browsers */\nhtml > #banner {\n ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9414/"
] |
130,165 | <p>I have a form with some radio buttons that are disabled by default. </p>
<p>When a value gets entered into a text box, the radio buttons are enabled via javascript. The user then selects one of the radio buttons and clicks on a submit button which posts back to the server.</p>
<p>When I get back to the server, the radio button that user clicked is not showing as checked. I'll use 'rbSolid' as the radio button I'm focusing on.</p>
<p>I handle the 'onclick' event of the radio buttons, but I don't have the function doing anything yet other than firing:</p>
<blockquote>
<p>Me.rbSolid.Attributes.Add("onclick", "styleLookupChanged(this);")</p>
</blockquote>
<p>On the client, this enables the radio button when the textbox value is changed:</p>
<blockquote>
<p>document.getElementById("ctl00_MainLayoutContent_WebPanel4_rbSolid").disabled = false;</p>
</blockquote>
<p>I then click the radio button then post back via a button, but back on the server this is always false:</p>
<blockquote>
<p>If Me.rbSolid.Checked Then...</p>
</blockquote>
<p>If I have the radio button enabled by default, it shows as checked correctly.</p>
<p>Thanks for any help!</p>
| [
{
"answer_id": 130181,
"author": "Craig",
"author_id": 7861,
"author_profile": "https://Stackoverflow.com/users/7861",
"pm_score": 4,
"selected": true,
"text": "control.enabled = false"
},
{
"answer_id": 133262,
"author": "Chris Burgess",
"author_id": 6624,
"author_pr... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6624/"
] |
130,166 | <p>I am trying to write a macro that would "click" a command button that is in another workbook. Is that possible? Without changing any of the code within that other workbook?</p>
| [
{
"answer_id": 130325,
"author": "Ozgur Ozcitak",
"author_id": 976,
"author_profile": "https://Stackoverflow.com/users/976",
"pm_score": 1,
"selected": false,
"text": "Application.Run"
},
{
"answer_id": 130330,
"author": "Per Hornshøj-Schierbeck",
"author_id": 11619,
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
130,186 | <p>I'm having an unusual problem with an IE document with contentEditable set to true. Calling select() on a range that is positioned at the end of a text node that immediately precedes a block element causes the selection to be shifted to the right one character and appear where it shouldn't. I've submitted a bug to Microsoft against IE8. If you can, please vote for this issue so that it can be fixed.</p>
<p><a href="https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=390995" rel="nofollow noreferrer">https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=390995</a></p>
<p>I've written a test case to demonstrate the effect:</p>
<pre><code><html>
<body>
<iframe id="editable">
<html>
<body>
<div id="test">
Click to the right of this line -&gt;
<p id="par">Block Element</p>
</div>
</body>
</html>
</iframe>
<input id="mytrigger" type="button" value="Then Click here to Save and Restore" />
<script type="text/javascript">
window.onload = function() {
var iframe = document.getElementById('editable');
var doc = iframe.contentDocument || iframe.contentWindow.document;
// An IFRAME without a source points to a blank document. Here we'll
// copy the content we stored in between the IFRAME tags into that
// document. It's a hack to allow us to use only one HTML file for this
// test.
doc.body.innerHTML = iframe.textContent || iframe.innerHTML;
// Marke the IFRAME as an editable document
if (doc.body.contentEditable) {
doc.body.contentEditable = true;
} else {
var mydoc = doc;
doc.designMode = 'On';
}
// A function to demonstrate the bug.
var myhandler = function() {
// Step 1 Get the current selection
var selection = doc.selection || iframe.contentWindow.getSelection();
var range = selection.createRange ? selection.createRange() : selection.getRangeAt(0);
// Step 2 Restore the selection
if (range.select) {
range.select();
} else {
selection.removeAllRanges();
selection.addRange(range);
doc.body.focus();
}
}
// Set up the button to perform the test code.
var button = document.getElementById('mytrigger');
if (button.addEventListener) {
button.addEventListener('click', myhandler, false);
} else {
button.attachEvent('onclick', myhandler);
}
}
</script>
</body>
</html>
</code></pre>
<p>The problem is exposed in the myhandler function. This is all that I'm doing, there is no Step 3 in between the saving and restoring the selection, and yet the cursor moves. It doesn't seem to happen unless the selection is empty (ie. I have a blinking cursor, but no text), and it only seems to happen whenever the cursor is at the end of a text node that immediately precedes a block node.</p>
<p>It seems that the range is still in the correct position (if I call parentElement on the range it returns the div), but if I get a new range from the current selection, the new range is inside the paragraph tag, and that is its parentElement.</p>
<p><strong>How do I work around this and consistently save and restore the selection in internet explorer?</strong></p>
| [
{
"answer_id": 822802,
"author": "Alconja",
"author_id": 68727,
"author_profile": "https://Stackoverflow.com/users/68727",
"pm_score": 1,
"selected": false,
"text": "range.select()"
},
{
"answer_id": 827264,
"author": "Dan Eisenberg",
"author_id": 101887,
"author_prof... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8458/"
] |
130,187 | <p>I want to index this view but because it has subquery i cant index. Can anyone suggest how to change this view so that i can index it.</p>
<pre><code>ALTER VIEW [dbo].[Recon2]
WITH SCHEMABINDING
AS
SELECT
dbo.Transactions.CustomerCode,
dbo.Customer_Master.CustomerName,
dbo.Transactions.TransDate,
dbo.Transactions.PubCode,
dbo.Transactions.TransType,
dbo.Transactions.Copies,
SUM(dbo.Transactions.TotalAmount) AS TotalAmount,
'0' AS ReceiptNo,
'2008-01-01' AS PaymentDate,
0 AS Amount,
dbo.Transactions.Period,
dbo.Transactions.Year,
dbo.Publication_Master.PubName,
dbo.Customer_Master.SalesCode,
COUNT_BIG(*) AS COUNT
FROM
dbo.Publication_Master INNER JOIN
dbo.Customer_Master INNER JOIN
dbo.Transactions ON dbo.Customer_Master.CustomerCode = dbo.Transactions.CustomerCode ON
dbo.Publication_Master.PubCode = dbo.Transactions.PubCode
WHERE
(dbo.Customer_Master.CustomerCode NOT IN
(SELECT CustomerCode
FROM dbo.StreetSaleRcpt
WHERE (PubCode = dbo.Transactions.PubCode) AND
(TransactionDate = dbo.Transactions.TransDate) AND
(Updated = 1) AND
(PeriodMonth = dbo.Transactions.Period) AND
(PeriodYear = dbo.Transactions.Year)))
GROUP BY dbo.Transactions.CustomerCode, dbo.Customer_Master.CustomerName, dbo.Transactions.TransDate, dbo.Transactions.PubCode,
dbo.Publication_Master.PubName, dbo.Customer_Master.SalesCode, dbo.Transactions.[Update], dbo.Transactions.TransType,
dbo.Transactions.Copies, dbo.Transactions.Period, dbo.Transactions.Year, dbo.Transactions.TotalAmount
</code></pre>
| [
{
"answer_id": 130279,
"author": "Corbin March",
"author_id": 7625,
"author_profile": "https://Stackoverflow.com/users/7625",
"pm_score": 2,
"selected": false,
"text": "SELECT\ndbo.Transactions.CustomerCode, \ndbo.Customer_Master.CustomerName, \ndbo.Transactions.TransDate, \ndbo.Transact... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14752/"
] |
130,192 | <p>I was wondering if there is a clean way to represent an is-a relationship as illustrated by this example:</p>
<p>This DB stores recording times for three types of programs: movies, game shows, drama. In an object oriented sense each of these is-a program. Each of these subclasses have different properties. Here are the tables (fk prefix indicates a foreign key):</p>
<p><em>movie</em><br>
id<br>
name<br>
fkDirector<br></p>
<p><em>gameShow</em><br>
id<br>
name<br>
fkHost<br>
fkContestant<br></p>
<p><em>drama</em><br>
id<br>
name<br></p>
<p>In OO terms the record table would in sense look like this:<br><br>
<em>record</em><br>
id<br>
fkProgram<br>
startTime<br>
endTime<br></p>
<p>The only way I can think of doing this without violating the normal forms is to have three record tables namely <em>recordMovie</em>, <em>recordGameShow</em>, and <em>recordDrama</em>.</p>
<p>Is there a way to consolidate these tables into one without violating the principles of database normalization?</p>
<p>Here are some non-working examples to illustrate the idea:</p>
<p><em>program</em><br>
id<br>
fkMovie<br>
fkGameShow<br>
fkDrama<br></p>
<p>This table violates the first normal form because it will contain nulls. For each row only one of the 3 entries will be non null.</p>
<p><em>program</em><br>
id<br>
fkSpecific ← fkMovie OR fkGameShow OR fkDrama<br>
fkType ← would indicate what table to look into<br></p>
<p>Here I will not be able to enforce referential integrity because the fkSpecific could potentially point to one of three tables.</p>
<p>I'm just trying to save the overhead of having 3 tables here instead of one. Maybe this simply isn't applicable to an RDB.</p>
| [
{
"answer_id": 130211,
"author": "Ron Savage",
"author_id": 12476,
"author_profile": "https://Stackoverflow.com/users/12476",
"pm_score": 2,
"selected": false,
"text": "Programs:\n id,\n name,\n type_id,\n length,\n etc...\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21906/"
] |
130,193 | <p>Is it possible to modify a registry value (whether string or DWORD) via a .bat/.cmd script?</p>
| [
{
"answer_id": 130202,
"author": "Rui Vieira",
"author_id": 143732,
"author_profile": "https://Stackoverflow.com/users/143732",
"pm_score": 6,
"selected": true,
"text": "Syntax:\n\n REG QUERY [ROOT\\]RegKey /v ValueName [/s]\n REG QUERY [ROOT\\]RegKey /ve --This returns the (default... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
130,208 | <p>Assuming I have only the class name of a generic as a string in the form of "MyCustomGenericCollection(of MyCustomObjectClass)" and don't know the assembly it comes from, what is the easiest way to create an instance of that object? </p>
<p>If it helps, I know that the class implements IMyCustomInterface and is from an assembly loaded into the current AppDomain.</p>
<p>Markus Olsson gave an excellent example <a href="https://stackoverflow.com/questions/31238/c-instantiating-classes-from-xml">here</a>, but I don't see how to apply it to generics.</p>
| [
{
"answer_id": 130241,
"author": "Jonathan Rupp",
"author_id": 12502,
"author_profile": "https://Stackoverflow.com/users/12502",
"pm_score": 4,
"selected": true,
"text": "Type t1 = Type.GetType(\"MyCustomGenericCollection\");\nType t2 = Type.GetType(\"MyCustomObjectClass\");\nType t3 = t... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5287/"
] |
130,227 | <p>Suppose you have a large file made up of a bunch of fixed size blocks. Each of these blocks contains some number of variable sized records. Each record must fit completely within a single block and then such records by definition are never larger than a full block. Over time, records are added to and deleted from these blocks as records come and go from this "database".</p>
<p>At some point, especially after perhaps many records are added to the database and several are removed - many of the blocks may end up only partially filled.</p>
<p>What is a good algorithm to shuffle the records around in this database to compact out unnecessary blocks at the end of the file by better filling up the partially filled blocks?</p>
<p>Requirements of the algorithm:</p>
<ul>
<li>The compaction must happen in place of the original file without temporarily extending the file by more than a few blocks at most from its starting size</li>
<li>The algorithm should not unnecessarily disturb blocks that are already mainly full</li>
<li>Entire blocks must be read or written from/to the file at one time and one should assume the write operation is relatively expensive</li>
<li>If records are moved from one block to another they must be added at their new location before being removed from their starting position so that in case the operation is interrupted no records are lost as a result of the "failed" compaction. (Assume that this temporary duplication of such records can be detected at recovery).</li>
<li>The memory that can be used for this operation can only be on the order of perhaps several blocks which is a very small percentage of the overall file size</li>
<li>Assume that records are on the order of 10 bytes to 1K bytes with an average size of maybe 100 bytes. The fixed sized blocks are on the order of 4K or 8K and that the file is on the order of 1000's of blocks.</li>
</ul>
| [
{
"answer_id": 130321,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 2,
"selected": false,
"text": "// records should be sorted by size in memory (probably in a balanced BST)\nrecords = read last N blocks on disk;\n\nforeac... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553/"
] |
130,240 | <p>I have a bunch a values I would like to add together which are entered into a form. Right now, the form has 11 lines but it could get larger in the future. I can easily add all the values together with something like:</p>
<pre><code>$total = $value1 + $value2 + ... + $value11;
</code></pre>
<p>All the values I want to add together are coming from an <code>HTML</code> form. I want to avoid javascript.</p>
<p>But, I want to avoid having to manually do it, especially if it grows much larger. This is my attempt at adding all the values together using a loop but it returns an "undefined variable" error (it is just some test code to try out the idea):</p>
<pre><code><?php
$tempTotal = 0;
$pBalance1 = 5;
$pBalance2 = 5;
$pBalance3 = 5;
for ($i = 1 ; $i <= 3 ; $i++){
$tempTotal = $tempTotal + $pBalance.$i;
}
echo $tempTotal;
?>
</code></pre>
<p>Is what I want to do possible in PHP?</p>
| [
{
"answer_id": 130244,
"author": "Lasar",
"author_id": 9438,
"author_profile": "https://Stackoverflow.com/users/9438",
"pm_score": 4,
"selected": true,
"text": "for ($i = 1 ; $i <= 3 ; $i++){\n $varName = \"pBalance\".$i;\n $tempTotal += $$varName;\n}\n"
},
{
"answer_id": ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16292/"
] |
130,262 | <p>The Python list comprehension syntax makes it easy to filter values within a comprehension. For example:</p>
<pre><code>result = [x**2 for x in mylist if type(x) is int]
</code></pre>
<p>Will return a list of the squares of integers in mylist. However, what if the test involves some (costly) computation and you want to filter on the result? One option is:</p>
<pre><code>result = [expensive(x) for x in mylist if expensive(x)]
</code></pre>
<p>This will result in a list of non-"false" expensive(x) values, however expensive() is called twice for each x. Is there a comprehension syntax that allows you to do this test while only calling expensive once per x?</p>
| [
{
"answer_id": 130276,
"author": "Nick",
"author_id": 5222,
"author_profile": "https://Stackoverflow.com/users/5222",
"pm_score": 5,
"selected": false,
"text": "result = [y for y in (expensive(x) for x in mylist) if y]\n"
},
{
"answer_id": 130278,
"author": "Dan Udey",
"a... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5222/"
] |
130,268 | <h3>Background</h3>
<p>Normal rails eager-loading of collections works like this:</p>
<pre><code>Person.find(:all, :include=>:companies)
</code></pre>
<p>This generates some sql which does</p>
<pre><code>LEFT OUTER JOIN companies ON people.company_id = companies.id
</code></pre>
<h3>Question</h3>
<p>However, I need a custom join (this could also arise if I was using <code>find_by_sql</code>) so I can't use the vanilla <code>:include => :companies</code></p>
<p>The custom join/sql will get me all the data I need, but how can I tell activerecord that it belongs to the associated <code>Company</code> objects rather than just being a pile of extra rows?</p>
<h3>Update</h3>
<p>I need to put additional conditions in the join. Something like this:</p>
<pre><code>SELECT blah blah blah
LEFT OUTER JOIN companies ON people.company_id = companies.id AND people.magical_flag IS NULL
<Several other joins>
WHERE blahblahblah
</code></pre>
| [
{
"answer_id": 131247,
"author": "Toby Hede",
"author_id": 14971,
"author_profile": "https://Stackoverflow.com/users/14971",
"pm_score": 3,
"selected": false,
"text": "Contractors.find(\n :all, \n :include => {:council_areas => :suburbs},\n :conditions => [\"suburbs.postcode = ?\", cu... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] |
130,273 | <p>I'm trying to automate a program I made with a test suite via a .cmd file.</p>
<p>I can get the program that I ran's return code via %errorlevel%. </p>
<p>My program has certain return codes for each type of error.</p>
<p>For example: </p>
<p>1 - means failed for such and such a reason</p>
<p>2 - means failed for some other reason</p>
<p>...</p>
<p>echo FAILED: Test case failed, error level: %errorlevel% >> TestSuite1Log.txt</p>
<p>Instead I'd like to somehow say:</p>
<p>echo FAILED: Test case failed, error reason: lookupError(%errorlevel%) >> TestSuite1Log.txt</p>
<p>Is this possible with a .bat file? Or do I have to move to a scripting language like python/perl?</p>
| [
{
"answer_id": 130291,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 1,
"selected": false,
"text": "C:\\Users\\matt.MATTLANT>help call\nCalls one batch program from another.\n\nCALL [drive:][path]filename [batch-parameter... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
130,292 | <p>What is the proper way to inject a data access dependency when I do lazy loading?</p>
<p>For example I have the following class structure</p>
<pre><code>class CustomerDao : ICustomerDao
public Customer GetById(int id) {...}
class Transaction {
int customer_id; //Transaction always knows this value
Customer _customer = null;
ICustomerDao _customer_dao;
Customer GetCustomer() {
if(_customer == null)
_customer = _customer_dao.GetById(_customer_id);
return _customer
}
</code></pre>
<p>How do I get the reference to _customer_dao into the transaction object? Requiring it for the constructor seems like it wouldn't really make sense if I want the Transaction to at least look like a POCO. Is it ok to have the Transaction object reference the Inversion of Control Container directly? That also seems awkward too.</p>
<p>How do frameworks like NHibernate handle this?</p>
| [
{
"answer_id": 131059,
"author": "Toran Billups",
"author_id": 2701,
"author_profile": "https://Stackoverflow.com/users/2701",
"pm_score": 1,
"selected": false,
"text": "public class Product\n{\n private int mProductID;\n private Supplier mSupplier;\n private ISupplierService mS... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] |
130,322 | <p>I am trying to pass a member function within a class to a function that takes a member function class pointer. The problem I am having is that I am not sure how to properly do this within the class using the this pointer. Does anyone have suggestions?</p>
<p>Here is a copy of the class that is passing the member function:</p>
<pre><code>class testMenu : public MenuScreen{
public:
bool draw;
MenuButton<testMenu> x;
testMenu():MenuScreen("testMenu"){
x.SetButton(100,100,TEXT("buttonNormal.png"),TEXT("buttonHover.png"),TEXT("buttonPressed.png"),100,40,&this->test2);
draw = false;
}
void test2(){
draw = true;
}
};
</code></pre>
<p>The function x.SetButton(...) is contained in another class, where "object" is a template.</p>
<pre><code>void SetButton(int xPos, int yPos, LPCWSTR normalFilePath, LPCWSTR hoverFilePath, LPCWSTR pressedFilePath, int Width, int Height, void (object::*ButtonFunc)()) {
BUTTON::SetButton(xPos, yPos, normalFilePath, hoverFilePath, pressedFilePath, Width, Height);
this->ButtonFunc = &ButtonFunc;
}
</code></pre>
<p>If anyone has any advice on how I can properly send this function so that I can use it later.</p>
| [
{
"answer_id": 130402,
"author": "Matt Cruikshank",
"author_id": 8643,
"author_profile": "https://Stackoverflow.com/users/8643",
"pm_score": 4,
"selected": false,
"text": "boost::bind"
},
{
"answer_id": 130528,
"author": "Commodore Jaeger",
"author_id": 4659,
"author_... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20229/"
] |
130,328 | <p>How do I get the caller's IP address in a WebMethod?</p>
<pre><code>[WebMethod]
public void Foo()
{
// HttpRequest... ? - Not giving me any options through intellisense...
}
</code></pre>
<p>using C# and ASP.NET</p>
| [
{
"answer_id": 130343,
"author": "Troels Thomsen",
"author_id": 20138,
"author_profile": "https://Stackoverflow.com/users/20138",
"pm_score": 2,
"selected": false,
"text": "WebService"
},
{
"answer_id": 130345,
"author": "Aaron Powell",
"author_id": 11388,
"author_pro... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
130,354 | <p>I need to simulate a low bandwidth, high latency connection to a server in order to emulate the conditions of a VPN at a remote site. The bandwidth and latency should be tweakable so I can discover the best combination in order to run our software package.</p>
| [
{
"answer_id": 130465,
"author": "heckj",
"author_id": 19477,
"author_profile": "https://Stackoverflow.com/users/19477",
"pm_score": 5,
"selected": false,
"text": "/etc/rc.firewall.56k"
},
{
"answer_id": 37373648,
"author": "Sawan",
"author_id": 2608245,
"author_profi... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190298/"
] |
130,396 | <p>Is there a way to use constants in <strong>JavaScript</strong>?</p>
<p>If not, what's the common practice for specifying variables that are used as constants?</p>
| [
{
"answer_id": 130398,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 5,
"selected": false,
"text": "const"
},
{
"answer_id": 130399,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10708/"
] |
130,404 | <p>I'm trying to find a way to "pretty print" a JavaScript data structure in a human-readable form for debugging.</p>
<p>I have a rather big and complicated data structure being stored in JS and I need to write some code to manipulate it. In order to work out what I'm doing and where I'm going wrong, what I really need is to be able to see the data structure in its entirety, and update it whenever I make changes through the UI.</p>
<p>All of this stuff I can handle myself, apart from finding a nice way to dump a JavaScript data structure to a human-readable string. JSON would do, but it really needs to be nicely formatted and indented. I'd usually use Firebug's excellent DOM dumping stuff for this, but I really need to be able to see the entire structure at once, which doesn't seem to be possible in Firebug.</p>
| [
{
"answer_id": 130420,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 4,
"selected": false,
"text": "Firebug"
},
{
"answer_id": 130479,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile":... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17121/"
] |
130,427 | <p>Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a class inheriting from System.Web.Services.WebService. It contains a few methods, which all need to call a method that checks if they're authorized or not.</p>
<p>Basically something like this (pardon the architecture, this is purely as an example): </p>
<pre><code>public class ProductService : WebService
{
public AuthHeader AuthenticationHeader;
[WebMethod(Description="Returns true")]
[SoapHeader("AuthenticationHeader")]
public bool MethodWhichReturnsTrue()
{
if(Validate(AuthenticationHeader))
{
throw new SecurityException("Access Denied");
}
return true;
}
[WebMethod(Description="Returns false")]
[SoapHeader("AuthenticationHeader")]
public bool MethodWhichReturnsFalse()
{
if(Validate(AuthenticationHeader))
{
throw new SecurityException("Access Denied");
}
return false;
}
private bool Validate(AuthHeader authHeader)
{
return authHeader.Username == "gooduser" && authHeader.Password == "goodpassword";
}
}
</code></pre>
<p>As you can see, the method <code>Validate</code> has to be called in each method. I'm looking for a way to be able to call that method, while still being able to access the soap headers in a sane way. I've looked at the events in the <code>global.asax</code>, but I don't think I can access the headers in that class... Can I?</p>
| [
{
"answer_id": 130690,
"author": "Timothy Lee Russell",
"author_id": 12919,
"author_profile": "https://Stackoverflow.com/users/12919",
"pm_score": 4,
"selected": true,
"text": "public class ServiceAuthHeader : SoapHeader\n{\n public string SiteKey;\n public string Password;\n\n ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/909/"
] |
130,438 | <p>Okay. I know this looks like the typical <em>"Why didn't he just Google it or go to <a href="http://www.unicode.org/" rel="noreferrer">www.unicode.org</a> and look it up?"</em> question, but for such a simple question the answer still eludes me after checking both sources.</p>
<p>I am pretty sure that all three of these encoding systems support all of the Unicode characters, but I need to confirm it before I make that claim in a presentation. </p>
<p>Bonus question: Do these encodings differ in the number of characters they can be extended to support?</p>
| [
{
"answer_id": 280182,
"author": "Artelius",
"author_id": 31945,
"author_profile": "https://Stackoverflow.com/users/31945",
"pm_score": 6,
"selected": false,
"text": "\\"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30018/"
] |
130,467 | <p>How does AOP (<em>Aspect Oriented Programming</em>) work in Drupal?</p>
<p>I have learned about AOP in terms of using it for logging and security, but how does it apply to Drupal?</p>
| [
{
"answer_id": 11432384,
"author": "J-P",
"author_id": 327153,
"author_profile": "https://Stackoverflow.com/users/327153",
"pm_score": 2,
"selected": false,
"text": "mymodule_init()"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] |
130,486 | <p>Does a hash shrink in Perl as you delete elements. </p>
<p>More specifically I had a perl program that I inherited that would parse a huge file ( 1 GB ) and load up a hash of hashes. it would do that same for another file and then do a comparison of different elements. The memory consumption was huge during this process and even though I added deleting hash elements has they were used the memory consumption seemed to be unaffected.</p>
<p>The script was extremely slow and such a memory hog. I know it was not well designed but any ideas about the hash memory usage?</p>
| [
{
"answer_id": 130516,
"author": "Michael Carman",
"author_id": 8233,
"author_profile": "https://Stackoverflow.com/users/8233",
"pm_score": 4,
"selected": true,
"text": "tie"
},
{
"answer_id": 131102,
"author": "Eric Wilhelm",
"author_id": 11580,
"author_profile": "ht... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] |
130,492 | <p>I assume there must be a system and language independent way to just stick the "current" EOL character into a text file, but my MSDN-fu seems to be weak today. Bonus points if there is a way to do this in a web application that will put the correct EOL character for the current client's machine's OS, not the web server's.</p>
| [
{
"answer_id": 130503,
"author": "Adrian Clark",
"author_id": 148,
"author_profile": "https://Stackoverflow.com/users/148",
"pm_score": 1,
"selected": false,
"text": "Environment.NewLine"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
130,494 | <p>I use the commercial version of Jalopy for my Java projects but it doesn't work on Groovy files. IntelliJ has a serviceable formatter but I don't like requiring a particular IDE.</p>
| [
{
"answer_id": 41039877,
"author": "Gizmomogwai",
"author_id": 204070,
"author_profile": "https://Stackoverflow.com/users/204070",
"pm_score": 2,
"selected": false,
"text": "groovyc"
},
{
"answer_id": 43545532,
"author": "zsoobhan",
"author_id": 2299951,
"author_profi... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19113/"
] |
130,496 | <p>When running an old MFC application in Visual Studio's debugger I've seen a lot of warnings in the Output window like the following:</p>
<blockquote>
<p>Warning: skipping non-radio button in group.</p>
</blockquote>
<p>I understand that in MFC you put radio buttons in groups to indicate which sets of radio buttons go together. If I remember correctly you do this by setting the "group" property of the first radio button to true, and then set the rest of the radio buttons "group" property to false.</p>
<p>I have three questions about this warning.</p>
<ol>
<li><p>How do you get rid of this warning? Do
you have to set the "group" property of all
non-radio button controls to true to
avoid this, or should you just set
it for the first control after the
last radio button?</p></li>
<li><p>Is there an easy way to figure
out what controls or dialogs have this problem?
I could open each dialog and
fiddle with it until the warning
pops up. This application has a lot of
dialogs though, so it would be
nice if there was an easier way.</p></li>
<li><p>What negative behavior can occur if
you don't fix this warning? In other
words, does this even matter?</p></li>
</ol>
| [
{
"answer_id": 130571,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 4,
"selected": true,
"text": "WS_GROUP"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13728/"
] |
130,500 | <p>We use oracle as the back-end database for our product. I have been running series of stress tests on our system and I have started noticing that oracle is much faster right after the database was restarted. Over time (a couple hours or so) the database seems to get slower and slower and I will see the database machine under more stress.</p>
<p>Running the test right after an oracle restart, i will see a 1 min load average of 5 or so and average CPU around 10-15%. After a few hours, I see the load average at 13 and CPU at 40-70%. (This is red hat linux 2x Quad core xeon, Raid 10 10k rpm sas drives).</p>
<p>My first thought was wouldn't database transactions get faster because those queries are getting cached?</p>
<p>I can't seem to figure out the problem. </p>
<p>EDIT:
Turns out this was a problem on the connecting software side due to bad design. Every action on the system created a new insert, delete, and select. With all these unique queries being generated, what was cached was constantly changing. The spike I am talking about is when the query cache filled up.</p>
| [
{
"answer_id": 130514,
"author": "dacracot",
"author_id": 13930,
"author_profile": "https://Stackoverflow.com/users/13930",
"pm_score": 0,
"selected": false,
"text": "select\n username,\n osuser,\n lockwait,\n status,\n sql_text\nfrom\n v$session,\n v$sqltext\nwhere\n username is... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20134/"
] |
130,506 | <p>I recently inherited a small Java program that takes information from a large database, does some processing and produces a detailed image regarding the information. The original author wrote the code using a single thread, then later modified it to allow it to use multiple threads. </p>
<p>In the code he defines a constant;</p>
<pre><code>// number of threads
public static final int THREADS = Runtime.getRuntime().availableProcessors();
</code></pre>
<p>Which then sets the number of threads that are used to create the image.</p>
<p>I understand his reasoning that the number of threads cannot be greater than the number of available processors, so set it the the amount to get the full potential out of the processor(s). Is this correct? or is there a better way to utilize the full potential of the processor(s)?</p>
<p>EDIT: To give some more clarification, The specific algorithm that is being threaded scales to the resolution of the picture being created, (1 thread per pixel). That is obviously not the best solution though. The work that this algorithm does is what takes all the time, and is wholly mathematical operations, there are no locks or other factors that will cause any given thread to sleep. I just want to maximize the programs CPU utilization to decrease the time to completion.</p>
| [
{
"answer_id": 130541,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 2,
"selected": false,
"text": "availableProcessors()"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7613/"
] |
130,507 | <p>I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.</p>
| [
{
"answer_id": 130541,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 2,
"selected": false,
"text": "availableProcessors()"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16942/"
] |
130,511 | <p>How can I know what encoding will be used by PHP when sending data to the browser? I.e. with the Cotent-Type header, for instance: iso-8859-1.</p>
| [
{
"answer_id": 130517,
"author": "William Keller",
"author_id": 17095,
"author_profile": "https://Stackoverflow.com/users/17095",
"pm_score": 0,
"selected": false,
"text": "header('Content-type: xxx/yyy');"
},
{
"answer_id": 130566,
"author": "dirtside",
"author_id": 2090... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5295/"
] |
130,526 | <p>Probably a very stupid question but I can't figure how to rename an object in PowerPoint.. For example, all my Graphs are called by default "Graph 1" etc.
Could someone help me on that?
Thanks!</p>
| [
{
"answer_id": 130684,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "ActiveWindow.Selection.ShapeRange(1).Name = \"newname\"\n"
},
{
"answer_id": 223880,
"author": "KnomDeGuerre",
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
130,547 | <p>Ok I followed the steps for setting up ruby and rails on my Vista machine and I am having a problem connecting to the database.</p>
<h2>Contents of <code>database.yml</code></h2>
<pre><code>development:
adapter: sqlserver
database: APPS_SETUP
Host: WindowsVT06\SQLEXPRESS
Username: se
Password: paswd
</code></pre>
<p>Run <code>rake db:migrate</code> from myapp directory</p>
<pre><code>----------
rake aborted!
no such file to load -- deprecated
</code></pre>
<h2><strong>ADO</strong></h2>
<p>I have dbi 0.4.0 installed and have created the ADO folder in</p>
<p><code>C:\Ruby\lib\ruby\site_ruby\1.8\DBD\ADO</code></p>
<p>I got the ado.rb from the dbi 0.2.2</p>
<p>What else should I be looking at to fix the issue connecting to the database? Please don't tell me to use MySql or Sqlite or Postgres.</p>
<p>****UPDATE****</p>
<p>I have installed the activerecord-sqlserver-adapter gem from --source=<a href="http://gems.rubyonrails.org" rel="nofollow noreferrer">http://gems.rubyonrails.org</a></p>
<p>Still not working.</p>
<p>I have verified that I can connect to the database by logging into SQL Management Studio with the credentials.</p>
<hr>
<p><strong>rake db:migrate --trace</strong></p>
<hr>
<pre><code>PS C:\Inetpub\wwwroot\myapp> rake db:migrate --trace
(in C:/Inetpub/wwwroot/myapp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load -- deprecated
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:48
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnin
gs'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0.9250/lib/active_record/connection_adapters/sqlserver
_adapter.rb:29:in `sqlserver_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `send'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `connection='
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:260:in `retrieve_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:78:in `connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:408:in `initialize'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `up'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:356:in `migrate'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/tasks/databases.rake:99
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:582:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:575:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:568:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2031:in `invoke_task'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2003:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1982:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1979:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
PS C:\Inetpub\wwwroot\myapp>
</code></pre>
| [
{
"answer_id": 131501,
"author": "hectorsq",
"author_id": 14755,
"author_profile": "https://Stackoverflow.com/users/14755",
"pm_score": 2,
"selected": false,
"text": "gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org\n"
},
{
"answer_id": 1268226,
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/453046/"
] |
130,564 | <p>I am writing a page where I need an HTML table to maintain a set size. I need the headers at the top of the table to stay there at all times but I also need the body of the table to scroll no matter how many rows are added to the table. Think a mini version of excel. This seems like a simple task but almost every solution I have found on the web has some drawback. How can I solve this?</p>
| [
{
"answer_id": 130568,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 3,
"selected": false,
"text": "<html>\n <head>\n <title>Blah</title>\n <style type=\"text/css\">\n table { width:300px; }\n tbody { ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] |
130,570 | <p>We have recently moved back to InstallShield 2008 from rolling our own install. So, I am still trying to get up the learning curve on it. </p>
<p>We are using Firebird and a usb driver, that we couldn't find good msi install solutions. So, we have a cmd line to install firebird silently and the usb driver mostly silently.</p>
<p>We have put this code into the event handler DefaultFeatureInstalled. This works really well on the first time install. But, when I do an uninstall it trys to launch the firebird installer again, so it must be sending the DefaultFeatureInstalled event again.</p>
<p>Is their another event to use, or is there a way to detect whether its an install or uninstall in the DefaultFeatureInstalled event?</p>
| [
{
"answer_id": 144881,
"author": "Chris Tybur",
"author_id": 741,
"author_profile": "https://Stackoverflow.com/users/741",
"pm_score": 0,
"selected": false,
"text": "string sRemove;\nnumber nBuffer;\n\nnBuffer = 256;\nif (MsiGetProperty(ISMSI_HANDLE, \"REMOVE\", sRemove, nBuffer) = ERROR... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12425/"
] |
130,573 | <p>The <a href="http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx" rel="nofollow noreferrer"><code>FILETIME</code> structure</a> counts from January 1 1601 (presumably the start of that day) according to the Microsoft documentation, but does this include leap seconds?</p>
| [
{
"answer_id": 3603011,
"author": "Ian Boyd",
"author_id": 12597,
"author_profile": "https://Stackoverflow.com/users/12597",
"pm_score": 5,
"selected": true,
"text": "FILETIME"
},
{
"answer_id": 53015905,
"author": "Matt Johnson-Pint",
"author_id": 634824,
"author_pro... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10168/"
] |
130,574 | <p>I seek an algorithm that will let me represent an incoming sequence of bits as letters ('a' .. 'z' ), in a minimal matter such that the stream of bits can be regenerated from the letters, without ever holding the entire sequence in memory.</p>
<p>That is, given an external bit source (each read returns a practically random bit), and user input of a number of bits, I would like to print out the minimal number of characters that can represent those bits.</p>
<p>Ideally there should be a parameterization - how much memory versus maximum bits before some waste is necessary.</p>
<p>Efficiency Goal - The same number of characters as the base-26 representation of the bits. </p>
<p>Non-solutions: </p>
<ol>
<li><p>If sufficient storage was present, store the entire sequence and use a big-integer MOD 26 operation. </p></li>
<li><p>Convert every 9 bits to 2 characters - This seems suboptimal, wasting 25% of information capacity of the letters output.</p></li>
</ol>
| [
{
"answer_id": 130670,
"author": "Commodore Jaeger",
"author_id": 4659,
"author_profile": "https://Stackoverflow.com/users/4659",
"pm_score": 3,
"selected": false,
"text": "a 0000\nb 0001\nc 0010\nd 0011\ne 0100\nf 0101\ng 01100\nh 01101\ni 01110\nj 01111\nk 10000\nl 10001\nm 10010\nn 10... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
130,604 | <p>I use int.MaxValue as a penalty and sometimes I am computing the penalties together. Is there a function or how would you create one with the most grace and efficiency that does that. </p>
<p>ie. </p>
<p>50 + 100 = 150</p>
<p>int.Max + 50 = int.Max and not int.Min + 50 </p>
| [
{
"answer_id": 130660,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 3,
"selected": true,
"text": "int penaltySum(int a, int b)\n{\n return (int.MaxValue - a < b) ? int.MaxValue : a + b;\n}\n"
},
{
"answer_id": 1... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4694/"
] |
130,605 | <p>I have a table of Users that includes a bitmask of roles that the user belongs to. I'd like to select users that belong to one or more of the roles in a bitmask value. For example:</p>
<pre>select *
from [User]
where UserRolesBitmask | 22 = 22</pre>
<p>This selects all users that have the roles '2', '4' or '16' in their bitmask. Is this possible to express this in a LINQ query? Thanks.</p>
| [
{
"answer_id": 130691,
"author": "KevDog",
"author_id": 13139,
"author_profile": "https://Stackoverflow.com/users/13139",
"pm_score": 4,
"selected": true,
"text": "from u in DataContext.Users\nwhere UserRolesBitmask | 22 == 22\nselect u\n"
},
{
"answer_id": 130716,
"author": ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] |
130,614 | <p>I've got a dictionary, something like</p>
<pre><code>Dictionary<Foo,String> fooDict
</code></pre>
<p>I step through everything in the dictionary, e.g.</p>
<pre><code>foreach (Foo foo in fooDict.Keys)
MessageBox.show(fooDict[foo]);
</code></pre>
<p>It does that in the order the foos were added to the dictionary, so the first item added is the first foo returned.</p>
<p>How can I change the cardinality so that, for example, the third foo added will be the second foo returned? In other words, I want to change its "index."</p>
| [
{
"answer_id": 130816,
"author": "Asmor",
"author_id": 18210,
"author_profile": "https://Stackoverflow.com/users/18210",
"pm_score": 0,
"selected": false,
"text": " public void sortSections()\n {\n //OMG THIS IS UGLY!!!\n KeyValuePair<ListViewItem, TextSection>[] ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18210/"
] |
130,616 | <p>I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error).</p>
<p>Am I doing something wrong or is this "by design"?</p>
<p>The code to register this service:</p>
<pre><code> SC_HANDLE schService = CreateService(
schSCManager,
strNameNoSpaces,
strServiceName,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
szPath,
NULL,
NULL,
NULL,
strUser,
(strPassword.IsEmpty())?NULL:strPassword);
</code></pre>
| [
{
"answer_id": 130658,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 0,
"selected": false,
"text": "strPassword"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20208/"
] |
130,617 | <p>I got a program that writes some data to a file using a method like the one below.</p>
<pre><code>
public void ExportToFile(string filename)
{
using(FileStream fstream = new FileStream(filename,FileMode.Create))
using (TextWriter writer = new StreamWriter(fstream))
{
// try catch block for write permissions
writer.WriteLine(text);
}
}
</code></pre>
<p>When running the program I get an error:</p>
<blockquote>
<p>Unhandled Exception: System.UnauthorizedAccessException: Access to the path 'mypath' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access,
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolea
bFromProxy)</p>
</blockquote>
<p>Question: What code do I need to catch this and how do I grant the access?</p>
| [
{
"answer_id": 130641,
"author": "Josh",
"author_id": 11702,
"author_profile": "https://Stackoverflow.com/users/11702",
"pm_score": 7,
"selected": true,
"text": "public void ExportToFile(string filename)\n{\n var permissionSet = new PermissionSet(PermissionState.None); \n var wr... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1361/"
] |
130,618 | <p>I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to: </p>
<pre><code>if (datetime.now() - self.timestamp) > 100
# Where 100 is either seconds or minutes
</code></pre>
<p>This generates a type error. </p>
<p>What is the proper way to do date time comparison in python? I already looked at <a href="http://wiki.python.org/moin/WorkingWithTime" rel="noreferrer">WorkingWithTime</a> which is close but not exactly what I want. I assume I just want the datetime object represented in seconds so that I can do a normal int comparison. </p>
<p>Please post lists of datetime best practices.</p>
| [
{
"answer_id": 130623,
"author": "William Keller",
"author_id": 17095,
"author_profile": "https://Stackoverflow.com/users/17095",
"pm_score": 0,
"selected": false,
"text": "datetime.fromtimestamp"
},
{
"answer_id": 130647,
"author": "Jerub",
"author_id": 14648,
"autho... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20794/"
] |
130,636 | <p>When I try to compile the newest version of Clisp on Ubuntu 8.04 I always get this error after running configure:</p>
<pre><code>Configure findings:
FFI: no (user requested: default)
readline: yes (user requested: yes)
libsigsegv: no, consider installing GNU libsigsegv
./configure: libsigsegv was not detected, thus some features, such as
generational garbage collection and
stack overflow detection in interpreted Lisp code
cannot be provided.
Please do this:
mkdir tools; cd tools; prefix=`pwd`/i686-pc-linux-gnu
wget http://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-2.5.tar.gz
tar xfz libsigsegv-2.5.tar.gz
cd libsigsegv-2.5
./configure --prefix=${prefix} && make && make check && make install
cd ../..
./configure --with-libsigsegv-prefix=${prefix} --with-readline --with-unicode --with-module=i18n --with-module=gdbm --with-module=pcre --with-module=readline --with-module=regexp
If you insist on building without libsigsegv, please pass
--ignore-absence-of-libsigsegv
to this script:
./configure --ignore-absence-of-libsigsegv --with-readline --with-unicode --with-module=i18n --with-module=gdbm --with-module=pcre --with-module=readline --with-module=regexp
</code></pre>
<p>I've tried doing as requested, but it didn't help: it seems to ignore the <code>--with-libsigsegv-prefix</code> option. I also tried putting installing libsigsegv in a standard location (<code>/usr/local</code>). Oh, and of course, Ubuntu tells me that libsigsegv and libsigsegv-dev are installed in the system.</p>
<p>I'd really like to be able to compile this version of Clips, as it introduces some serious improvements over the version shipped with Ubuntu (I'd also like to have PCRE).</p>
| [
{
"answer_id": 130752,
"author": "Luís Oliveira",
"author_id": 2967,
"author_profile": "https://Stackoverflow.com/users/2967",
"pm_score": 3,
"selected": true,
"text": "sudo apt-get install libsigsegv-dev libreadline5-dev\n\n# as of 7.10, Ubuntu's libffcall1-dev is broken and I had to ge... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19922/"
] |
130,637 | <p>I am trying to figure out a crash in my application.
WinDbg tells me the following: (using dashes in place of underscores)</p>
<p><br><b>LAST-CONTROL-TRANSFER: from 005f5c7e to 6e697474
<br>DEFAULT-BUCKET-ID: BAD_IP
<br>BUGCHECK-STR: ACCESS-VIOLATION</b></p>
<p>It is obvious to me that 6e697474 is NOT a valid address.
<br><br>I have three questions:
<br>1) Does the "BAD_IP" bucket ID mean "Bad Instruction Pointer?"
<br>2) This is a multi-threaded application so one consideration was that the object whose function I was attempting to call went out of scope. Does anyone know if that would lead to the same error message?
<br>3) What else might cause an error like this? One of my co-workers suggested that it might be a <b>stack overflow</b> issue, but WinDBG in the past has proven rather reliable at detecting and pointing these out. (not that I'm sure about the voodoo it does in the background to diagnose that). </p>
| [
{
"answer_id": 133212,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 0,
"selected": false,
"text": "vfptr"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/130637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
130,640 | <p>I would like to be able to say things like</p>
<p><strong>cd [.fred]</strong> and have my default directory go there,
and my prompt change to indicate the full path to my current location.</p>
| [
{
"answer_id": 131275,
"author": "chimp",
"author_id": 18364,
"author_profile": "https://Stackoverflow.com/users/18364",
"pm_score": 3,
"selected": false,
"text": "cd:==set default"
},
{
"answer_id": 223455,
"author": "Luc M",
"author_id": 14673,
"author_profile": "ht... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7734/"
] |
130,664 | <p>I have a command line executable that alters some bits in a file that i want to use from my program.
Is it possible to create my own executable that uses this tool and distribute only one executable?</p>
<p>[edit] Clarification:</p>
<p>The command line tool takes an offset and some bits and changes the bits at this offset in a given file. So I want to create a patcher for an application that changes specific bits to a specific value, so what I can do i write something like a batch file to do it but i want to create an executable that does it, i.e. embed the tool into a wrapper program that calls it with specific values.</p>
<p>I can code wrapper in (windows) c\c++, asm but no .net please.</p>
| [
{
"answer_id": 130685,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://Stackoverflow.com/users/5324",
"pm_score": 2,
"selected": false,
"text": "Open destination file\nOpen main exe as a binary file\nCopy main exe to destination file\noffset = size of main exe\nOpe... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] |
130,698 | <p>I want to wrap a <a href="https://en.wikipedia.org/wiki/One-liner_program#Perl" rel="nofollow noreferrer">Perl one-liner</a> in a batch file. For a (trivial) example, in a Unix shell, I could quote up a command like this:</p>
<pre><code>perl -e 'print localtime() . "\n"'
</code></pre>
<p>But DOS chokes on that with this helpful error message:</p>
<blockquote>
<p>Can't find string terminator "'" anywhere before EOF at -e line 1.</p>
</blockquote>
<p>What's the best way to do this within a <a href="https://en.wikipedia.org/wiki/Batch_file" rel="nofollow noreferrer">.bat file</a>?</p>
| [
{
"answer_id": 130726,
"author": "brian d foy",
"author_id": 2766176,
"author_profile": "https://Stackoverflow.com/users/2766176",
"pm_score": 5,
"selected": true,
"text": "perl -e \"print scalar localtime() . qq(\\n)\"\n"
},
{
"answer_id": 130728,
"author": "tye",
"autho... | 2008/09/24 | [
"https://Stackoverflow.com/questions/130698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21938/"
] |
130,708 | <p>I am developing an ASP.NET Ajax form, and decided to make most of the site in one page, because it isn't a very involved site (it's more of a form). In the codebehind, I have been making my code more organized by adding regions to it (inside are the click events of the controls, etc).</p>
<p>When I expand a region, all the subroutines and child regions are expanded. Is there an option in Visual Studio to prevent this from happening? I'd like to be able to expand a region, and then expand the region or subroutine I'd like to edit, rather than contracting all the subroutines and child regions to prevent me from getting distracted by my fat code. :)</p>
| [
{
"answer_id": 130722,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 2,
"selected": false,
"text": "Ctrl + M, Ctrl + M Collapse or expand the block you?re currently in.\nCtrl + M, Ctrl + O Collapse all blocks in the ... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20900/"
] |
130,711 | <p>I wonder how long it would usually take for:</p>
<ol>
<li>Professional</li>
<li>Average</li>
<li>Beginner</li>
</ol>
<p>to setup and configure CI for a new project?</p>
| [
{
"answer_id": 131284,
"author": "Jörg W Mittag",
"author_id": 2988,
"author_profile": "https://Stackoverflow.com/users/2988",
"pm_score": 3,
"selected": true,
"text": "rake"
}
] | 2008/09/25 | [
"https://Stackoverflow.com/questions/130711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15396/"
] |
130,720 | <p>In certain cases, I can't seem to get components to receive events.</p>
<p>[edit] </p>
<p>To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispatch events to and from arbitrary objects.</p>
<p>I ended up using parentApplication to dispatch and receive the event I needed to handle.</p>
<p>[/edit]</p>
<p>If two components have differing parents, or as in the example below, one is a popup, it would seem the event never reaches the listener (See the method "popUp" for the dispatch that doesn't work):</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
initialize="init()">
<mx:Script>
<![CDATA[
import mx.controls.Menu;
import mx.managers.PopUpManager;
// Add listeners
public function init():void
{
this.addEventListener("child", handleChild);
this.addEventListener("stepchild", handleStepchild);
}
// Handle the no pop button event
public function noPop(event:Event):void
{
dispatchEvent(new Event("child"));
}
// Handle the pop up
public function popUp(event:Event):void
{
var menu:Menu = new Menu();
var btnMenu:Button = new Button();
btnMenu.label = "stepchild";
menu.addChild(btnMenu);
PopUpManager.addPopUp(menu, this);
// neither of these work...
this.callLater(btnMenu.dispatchEvent, [new Event("stepchild", true)]);
btnMenu.dispatchEvent(new Event("stepchild", true));
}
// Event handlers
public function handleChild(event:Event):void
{
trace("I handled child");
}
public function handleStepchild(event:Event):void {
trace("I handled stepchild");
}
]]>
</mx:Script>
<mx:VBox>
<mx:Button label="NoPop" id="btnNoPop" click="noPop(event)"/>
<mx:Button label="PopUp" id="btnPop" click="popUp(event)"/>
</mx:VBox>
</mx:Application>
</code></pre>
<p><strong>I can think of work-arounds, but it seems like there ought to be some central event bus...</strong> </p>
<p>Am I missing something?</p>
| [
{
"answer_id": 131046,
"author": "Antti",
"author_id": 6037,
"author_profile": "https://Stackoverflow.com/users/6037",
"pm_score": 0,
"selected": false,
"text": "this"
},
{
"answer_id": 133032,
"author": "Verdant",
"author_id": 450527,
"author_profile": "https://Stack... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16258/"
] |
130,721 | <p>My DBA requires all database access to be done through trusted domain account. This can be done if you set the web.config . This requires the user to login or to be on the domain for IE pass the credentials through. I want to impersonate a user by using code. I am using the code found in this knowledgebase article:</p>
<p><a href="http://support.microsoft.com/kb/306158" rel="nofollow noreferrer">http://support.microsoft.com/kb/306158</a></p>
<p>It works great, I pass in the credentials, impersonate the user, then make the call to the database and data is returned. </p>
<p>The problem is if I go to another page, I lose my impersonated credentials. This means every time I make a call to the database I have to run the impersonate code. </p>
<p>If IIS can impersonate a domain user for all pages, then why can I not impersonate a user while using code?</p>
<p>It seems to be something with thread context switching. I have tried setting the alwaysFlowImpersonatingPolicy in the Aspnet.config file and it did not work.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms229553.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms229553.aspx</a></p>
<p>Any suggestion? Is it even possible to do what I want?</p>
| [
{
"answer_id": 130808,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 1,
"selected": false,
"text": "<alwaysFlowImpersonationPolicy>"
}
] | 2008/09/25 | [
"https://Stackoverflow.com/questions/130721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/678/"
] |
130,730 | <p>I have an immutable class with some private fields that are set during the constructor execution. I want to unit test this constructor but I'm not sure the "best practice" in this case.</p>
<p><strong>Simple Example</strong></p>
<p>This class is defined in Assembly1:</p>
<pre><code>public class Class2Test
{
private readonly string _StringProperty;
public Class2Test()
{
_StringProperty = ConfigurationManager.AppSettings["stringProperty"];
}
}
</code></pre>
<p>This class is defined in Assembly2:</p>
<pre><code>[TestClass]
public class TestClass
{
[TestMethod]
public void Class2Test_Default_Constructor()
{
Class2Test x = new Class2Test();
//what do I assert to validate that the field was set properly?
}
}
</code></pre>
<p><strong>EDIT 1</strong>: I have answered this question with a potential solution but I'm not sure if it's the "right way to go". So if you think you have a better idea please post it.</p>
<p>This example isn't really worth testing, but assume the constructor has some more complex logic. Is the best approach to avoid testing the constructor and to just assume it works if all the tests for the methods on the class work?</p>
<p><strong>EDIT 2</strong>: Looks like I made the sample a little to simple. I have updated it with a more reasonable situation.</p>
| [
{
"answer_id": 130732,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 1,
"selected": false,
"text": "[InternalsVisibleTo]"
},
{
"answer_id": 130735,
"author": "Matt Hinze",
"author_id": 2676,
"auth... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3957/"
] |
130,734 | <p>It's been a while since I've had to do any HTML-like code in <code>Vim</code>, but recently I came across this again. Say I'm writing some simple <code>HTML</code>:</p>
<pre><code><html><head><title>This is a title</title></head></html>
</code></pre>
<p>How do I write those closing tags for title, head and html down quickly? I feel like I'm missing some really simple way here that does not involve me going through writing them all down one by one.</p>
<p>Of course I can use <kbd>Ctrl</kbd><kbd>P</kbd> to autocomplete the individual tag names but what gets me on my laptop keyboard is actually getting the brackets and slash right.</p>
| [
{
"answer_id": 130741,
"author": "Ian P",
"author_id": 10853,
"author_profile": "https://Stackoverflow.com/users/10853",
"pm_score": 6,
"selected": true,
"text": "Functions and mappings to close open HTML/XML tags\n"
},
{
"answer_id": 134990,
"author": "hakamadare",
"auth... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10098/"
] |
130,740 | <p>I have the following program:</p>
<pre><code>~/test> cat test.cc
int main()
{
int i = 3;
int j = __sync_add_and_fetch(&i, 1);
return 0;
}
</code></pre>
<p>I'm compiling this program using GCC 4.2.2 on Linux running on a multi-cpu 64-bit Intel machine:</p>
<pre><code>~/test> uname --all
Linux doom 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>
<p>When I compile the program in 64-bit mode, it compiles and links fine:</p>
<pre><code>~/test> /share/tools/gcc-4.2.2/bin/g++ test.cc
~/test>
</code></pre>
<p>When I compile it in 32-bit mode, I get the following error:</p>
<pre><code>~/test> /share/tools/gcc-4.2.2/bin/g++ -m32 test.cc
/tmp/ccEVHGkB.o(.text+0x27): In function `main':
: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
~/test>
</code></pre>
<p>Although I will never actually run on a 32-bit processor, I do need a 32-bit executable so I can link with some 32-bit libraries.</p>
<p>My 2 questions are:</p>
<ol>
<li><p>Why do I get a link error when I compile in 32-bit mode?</p></li>
<li><p>Is there some way to get the program to compile and link, while still being able to link with a 32-bit library?</p></li>
</ol>
| [
{
"answer_id": 130754,
"author": "Dan Udey",
"author_id": 21450,
"author_profile": "https://Stackoverflow.com/users/21450",
"pm_score": 5,
"selected": true,
"text": "__sync_add_and_fetch_4"
},
{
"answer_id": 130813,
"author": "Bruno Rijsman",
"author_id": 21435,
"auth... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21435/"
] |
130,748 | <p>I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user.</p>
<p>The way I'm doing this now is just loading both controls and setting up an OnRadioButtonSelectionChanged() method which gets called at form load (to set the initial state) and at any time the selection is changed. This method just sets the visible property on each control to the proper value.</p>
<p>This seems to work well enough, but I was curious as to if there was a better or more common way of doing it?</p>
| [
{
"answer_id": 130805,
"author": "Lloyd Cotten",
"author_id": 21807,
"author_profile": "https://Stackoverflow.com/users/21807",
"pm_score": 3,
"selected": true,
"text": "private void OnRadioButtonCheckedChanged(object sender, EventArgs e)\n{\n Control1.Visible = RadioButton1.Checked;\... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1512/"
] |
130,753 | <p>On Sql Server 2000, is there a way to find out the date and time when a stored procedure was last executed? </p>
| [
{
"answer_id": 130758,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 5,
"selected": false,
"text": "declare @proc_nm sysname\n\n-- select the procedure name here\nset @proc_nm = 'usp_test'\n\nselect s.last_execution_ti... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3294/"
] |
130,763 | <p>I want my Python script to copy files on Vista. When I run it from a normal <code>cmd.exe</code> window, no errors are generated, yet the files are NOT copied. If I run <code>cmd.exe</code> "as administator" and then run my script, it works fine.</p>
<p>This makes sense since User Account Control (UAC) normally prevents many file system actions.</p>
<p>Is there a way I can, from within a Python script, invoke a UAC elevation request (those dialogs that say something like "such and such app needs admin access, is this OK?")</p>
<p>If that's not possible, is there a way my script can at least detect that it is not elevated so it can fail gracefully?</p>
| [
{
"answer_id": 138970,
"author": "jfs",
"author_id": 4279,
"author_profile": "https://Stackoverflow.com/users/4279",
"pm_score": 0,
"selected": false,
"text": "runas /user:Administrator \"python your_script.py\"\n"
},
{
"answer_id": 11746382,
"author": "Jorenko",
"author_... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10559/"
] |
130,775 | <p>As far as variable naming conventions go, should iterators be named <code>i</code> or something more semantic like <code>count</code>? If you don't use <code>i</code>, why not? If you feel that <code>i</code> is acceptable, are there cases of iteration where it shouldn't be used?</p>
| [
{
"answer_id": 130807,
"author": "Ian P",
"author_id": 10853,
"author_profile": "https://Stackoverflow.com/users/10853",
"pm_score": 3,
"selected": false,
"text": "foreach (Product p in ProductList)\n{\n // Do something with p\n}\n"
},
{
"answer_id": 130810,
"author": "Jos... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13281/"
] |
130,789 | <p>I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well.
I was wondering if people today use decision tables within their relational databases?</p>
| [
{
"answer_id": 132483,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 2,
"selected": true,
"text": "def decision_table( aRow ):\n result= connection.execute( \"SELECT replacement_value FROM transformation WHERE old_value ... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19272/"
] |
130,790 | <p>I have some C# code in an ASP.Net application that does this:</p>
<p>Bitmap bmp = new Bitmap(1184, 1900);</p>
<p>And occasionally it throws an exception "Parameter is not valid". Now i've been googling around and apparently GDI+ is infamous for throwing random exceptions, and lots of people have had this problem, but nobody has a solution to it! I've checked the system and it has plenty of both RAM and swap space.
Now in the past if i do an 'iisreset' then the problem goes away, but it comes back in a few days. But i'm not convinced i've caused a memory leak, because as i say above there is plenty of ram+swap free.</p>
<p>Anyone have any solutions?</p>
| [
{
"answer_id": 170946,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 3,
"selected": false,
"text": "using System.Windows.Media.Imaging;\nclass Program {\n public static void Main(string[] args) {\n var bmp = ne... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
130,794 | <p>There have been several questions already posted with specific questions about <a href="http://en.wikipedia.org/wiki/Dependency_injection" rel="noreferrer">dependency injection</a>, such as when to use it and what frameworks are there for it. However,</p>
<p><strong>What is dependency injection and when/why should or shouldn't it be used?</strong></p>
| [
{
"answer_id": 130862,
"author": "wds",
"author_id": 10098,
"author_profile": "https://Stackoverflow.com/users/10098",
"pm_score": 12,
"selected": true,
"text": "SomeClass()"
},
{
"answer_id": 131766,
"author": "Adam Ness",
"author_id": 21973,
"author_profile": "https... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1354/"
] |
130,801 | <p>I'm using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type "make check" to have it automatically run these. My project is in C++, although I am still curious about writing automated tests for other languages as well.</p>
<p><em>Is this compatible with pretty much every unit testing framework out there (I was thinking of using cppunit)? How do I hook these unit testing frameworks into make check? Can I make sure that I don't require the unit test software to be installed to be able to configure and build the rest of the project?</em></p>
| [
{
"answer_id": 174142,
"author": "jonner",
"author_id": 78437,
"author_profile": "https://Stackoverflow.com/users/78437",
"pm_score": 6,
"selected": true,
"text": "make check"
},
{
"answer_id": 20277301,
"author": "Dongho Yoo",
"author_id": 1309262,
"author_profile": ... | 2008/09/25 | [
"https://Stackoverflow.com/questions/130801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5963/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.