qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
355,084
<p>I have a <code>ListBox</code> that scrolls images horizontally.</p> <p>I have the following XAML I used blend to create it. It originally had a x:Key on the <code>Style TaregetType</code> line, MSDN said to remove it, as I was getting errors on that. Now I'm getting this error:</p> <p><code>Error 3 Operation is...
[ { "answer_id": 358106, "author": "Jobi Joy", "author_id": 8091, "author_profile": "https://Stackoverflow.com/users/8091", "pm_score": 5, "selected": true, "text": "<p>Wrap the Style Tag with an ItemContainerStyle as below:</p>\n\n<pre><code>&lt;ListBox ItemsSource=\"{Binding Source={Stat...
2008/12/10
[ "https://Stackoverflow.com/questions/355084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22451/" ]
I have a `ListBox` that scrolls images horizontally. I have the following XAML I used blend to create it. It originally had a x:Key on the `Style TaregetType` line, MSDN said to remove it, as I was getting errors on that. Now I'm getting this error: `Error 3 Operation is not valid while ItemsSource is in use. Access ...
Wrap the Style Tag with an ItemContainerStyle as below: ``` <ListBox ItemsSource="{Binding Source={StaticResource WPFApparelCollection}}" Grid.Row="1" Margin="2,26,2,104" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Selection...
355,087
<p>related to:</p> <ul> <li><a href="https://stackoverflow.com/questions/21265/">comparing ieee floats and doubles for equality</a></li> <li><a href="https://stackoverflow.com/questions/328475/">Should we compare floating point numbers for equality against a <em>relative</em> error</a></li> <li><a href="https://stacko...
[ { "answer_id": 355197, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 0, "selected": false, "text": "<p>My current solution is</p>\n\n<pre><code>bool Near(real a, real b, int count = 5)\n{\n // Returns the number of mantissa b...
2008/12/10
[ "https://Stackoverflow.com/questions/355087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
related to: * [comparing ieee floats and doubles for equality](https://stackoverflow.com/questions/21265/) * [Should we compare floating point numbers for equality against a *relative* error](https://stackoverflow.com/questions/328475/) * [Most effective way for float and double comparison](https://stackoverflow.com/q...
Since D has 80-bit reals built in (as far as I can tell), why would you not just use the standard approach of comparing with an epsilon value. This can be a fixed value if you know the rough range in advance, such as US currency: ``` if (abs (a - b) < 1e-6) // effectively equal ``` or an acceptable relative error, s...
355,098
<p>I have noticed in phpMyAdmin you can click 'optimise' on tables, and it runs:</p> <pre><code>OPTIMIZE TABLE table_name </code></pre> <p>What does this actually do?</p> <p>Should I have some cron job running daily that runs OPTIMIZE TABLE on my tables?</p> <p>Thank you</p>
[ { "answer_id": 355108, "author": "Stefan Mai", "author_id": 13257, "author_profile": "https://Stackoverflow.com/users/13257", "pm_score": 4, "selected": true, "text": "<p>From <a href=\"http://www.informit.com/articles/article.aspx?p=29406&amp;seqNum=3\" rel=\"noreferrer\">InformIT</a></...
2008/12/10
[ "https://Stackoverflow.com/questions/355098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31671/" ]
I have noticed in phpMyAdmin you can click 'optimise' on tables, and it runs: ``` OPTIMIZE TABLE table_name ``` What does this actually do? Should I have some cron job running daily that runs OPTIMIZE TABLE on my tables? Thank you
From [InformIT](http://www.informit.com/articles/article.aspx?p=29406&seqNum=3) > > An optimized table structure is > different than a well-designed table. > Table structure optimization has to do > with reclaiming unused space after > deletions and basically cleaning up > the table after structural > modificat...
355,099
<p>I have been able to copy the raw data from an otherwise inaccessible USB drive into a monolithic file of about 250MB. Somewhere in that blob of bytes are about 40 Word documents. </p> <ol> <li><p>Where do I find documentation about the internal structure of Word documents such that I can parse the byte-stream, reco...
[ { "answer_id": 355107, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 2, "selected": false, "text": "<p>The <a href=\"http://poi.apache.org/\" rel=\"nofollow noreferrer\">Apache POI</a> project has a library for reading and w...
2008/12/10
[ "https://Stackoverflow.com/questions/355099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426/" ]
I have been able to copy the raw data from an otherwise inaccessible USB drive into a monolithic file of about 250MB. Somewhere in that blob of bytes are about 40 Word documents. 1. Where do I find documentation about the internal structure of Word documents such that I can parse the byte-stream, recognise where a Wo...
Two approaches: You can mount files as volumes in linux. Provided your binary blob isn't too corrupted, you'll probably be able to break down the filesystem to find out where you files are located. Is (was) it a FAT partition or NTFS? If that doesn't work, I'd look for [this string of bytes](http://www.garykessler.ne...
355,135
<p>Here is the problem: </p> <p>for your reference:</p> <p><img src="https://i.stack.imgur.com/mmrNH.jpg" alt="http://i.stack.imgur.com/mmrNH.jpg"></p> <p>database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2. database entry 4 is made using vb the old to be replace program using odbc.</p> <p>We have ...
[ { "answer_id": 355117, "author": "LeJeune", "author_id": 37955, "author_profile": "https://Stackoverflow.com/users/37955", "pm_score": 0, "selected": false, "text": "<p>You can use code behind as well. It is only a matter of style preference.</p>\n" }, { "answer_id": 355156, ...
2008/12/10
[ "https://Stackoverflow.com/questions/355135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21537/" ]
Here is the problem: for your reference: ![http://i.stack.imgur.com/mmrNH.jpg](https://i.stack.imgur.com/mmrNH.jpg) database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2. database entry 4 is made using vb the old to be replace program using odbc. We have found that if I copy and paste both jython an...
OK, chalk up another for the learning curve. I think I might have found the answer to my own question... ASP MVC lets you install your own custom view engines which you can use (instead of the default ASP.NET view engine). So you can control the html generation. Once you know what to search for, its easy :) Here's a ...
355,165
<p>In my knowledge, the RESTful WCF still has ".svc" in its URL.</p> <p>For example, if the service interface is like</p> <pre><code>[OperationContract] [WebGet(UriTemplate = "/Value/{value}")] string GetDataStr(string value); </code></pre> <p>The access URI is like "<a href="http://machinename/Service.svc/Value/2" ...
[ { "answer_id": 355471, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 6, "selected": true, "text": "<p>In IIS 7 you can use the <a href=\"http://learn.iis.net/page.aspx/460/using-url-rewrite-module/\" rel=\"noreferre...
2008/12/10
[ "https://Stackoverflow.com/questions/355165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26349/" ]
In my knowledge, the RESTful WCF still has ".svc" in its URL. For example, if the service interface is like ``` [OperationContract] [WebGet(UriTemplate = "/Value/{value}")] string GetDataStr(string value); ``` The access URI is like "<http://machinename/Service.svc/Value/2>". In my understanding, part of REST advan...
In IIS 7 you can use the [Url Rewrite Module](http://learn.iis.net/page.aspx/460/using-url-rewrite-module/) as explained in this blog [post](http://blogs.msdn.com/endpoint/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx). In IIS 6 you could write an [http module](http://msdn.microsoft.com/en-us/librar...
355,167
<p>What is the use of anonymous classes in Java? Can we say that usage of anonymous class is one of the advantages of Java?</p>
[ { "answer_id": 355175, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 3, "selected": false, "text": "<p>You use it in situations where you need to create a class for a specific purpose inside another function, e.g., as a listen...
2008/12/10
[ "https://Stackoverflow.com/questions/355167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40933/" ]
What is the use of anonymous classes in Java? Can we say that usage of anonymous class is one of the advantages of Java?
By an "anonymous class", I take it you mean [anonymous inner class](http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html). An anonymous inner class can come useful when making an instance of an object with certain "extras" such as overriding methods, without having to actually subclass a class. I tend...
355,171
<p>I would like to know how I can refer to a list item object if I had for example the following html list </p> <pre><code>&lt;div id="subdiv_2"&gt; &lt;div id="subdiv_3"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=""&gt;Item1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=""&gt;Item2&lt;/a&gt;&lt;/li&gt; &l...
[ { "answer_id": 355188, "author": "Benry", "author_id": 28408, "author_profile": "https://Stackoverflow.com/users/28408", "pm_score": 3, "selected": true, "text": "<p>You could get all the children elements of <code>subdiv_3</code> that are <code>&lt;li&gt;</code>. Then iterate through t...
2008/12/10
[ "https://Stackoverflow.com/questions/355171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36076/" ]
I would like to know how I can refer to a list item object if I had for example the following html list ``` <div id="subdiv_2"> <div id="subdiv_3"> <ul> <li><a href="">Item1</a></li> <li><a href="">Item2</a></li> <li><a href="">Item3</a></li> </ul> </div> </div> ``` How is it poss...
You could get all the children elements of `subdiv_3` that are `<li>`. Then iterate through that loop adding the functions as you go. ``` div = document.getElementById('subdiv_3'); els = div.getElementsByTagName('li'); for (var i=0, len=els.length; i<len; i++) { alert(i); // add your functions here } ``` Lo...
355,172
<p>I'm learning about DDD, and have come across the statement that "value-objects" should be immutable. I understand that this means that the objects state should not change after it has been created. This is kind of a new way of thinking for me, but it makes sense in many cases.</p> <p>Ok, so I start creating immutab...
[ { "answer_id": 355186, "author": "Andrew Kennan", "author_id": 22506, "author_profile": "https://Stackoverflow.com/users/22506", "pm_score": 6, "selected": true, "text": "<p>Use a builder:</p>\n\n<pre><code>public class Entity\n{\n public class Builder\n {\n private int _field1;\...
2008/12/10
[ "https://Stackoverflow.com/questions/355172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22621/" ]
I'm learning about DDD, and have come across the statement that "value-objects" should be immutable. I understand that this means that the objects state should not change after it has been created. This is kind of a new way of thinking for me, but it makes sense in many cases. Ok, so I start creating immutable value-o...
Use a builder: ``` public class Entity { public class Builder { private int _field1; private int _field2; private int _field3; public Builder WithField1(int value) { _field1 = value; return this; } public Builder WithField2(int value) { _field2 = value; return this; } public Builde...
355,185
<p>I am trying to access XMLHTTPRequest.open Method I have even included netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");</p> <p>but still its not working. </p> <p>I am using javascript and HTML to access the WebService.</p> <p>Any Help would be really great</p> <p>Code</p> <p><pre><code...
[ { "answer_id": 355230, "author": "Strelok", "author_id": 2788, "author_profile": "https://Stackoverflow.com/users/2788", "pm_score": 1, "selected": false, "text": "<p>There is a pretty concise example <a href=\"http://www.codeproject.com/KB/webservices/WebServiceFromHTMLPage.aspx\" rel=\...
2008/12/10
[ "https://Stackoverflow.com/questions/355185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42070/" ]
I am trying to access XMLHTTPRequest.open Method I have even included netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); but still its not working. I am using javascript and HTML to access the WebService. Any Help would be really great Code <html> <Head> <Title>Calling A WebService fro...
Browser Independent code for XML HTTPRequest -------------------------------------------- I use the following code to create an XML object. It has been designed to handle all browsers (esp. IE and non IE) ``` /* Function to create an XMLHTTP object for all browsers */ function getXMLHTTPObject(){ var xmlHttp; ...
355,202
<p>I want to connect and execute one (or sometimes several) SQL statements, and NOT have those replicated to the slaves.</p> <p>I have no replicate-do or replicate-ignore configs, so I can't <code>use</code> some non-replicated database to send the commands from. And I know about:</p> <pre><code>set global sql_slave...
[ { "answer_id": 355268, "author": "derobert", "author_id": 27727, "author_profile": "https://Stackoverflow.com/users/27727", "pm_score": 5, "selected": true, "text": "<p><code>SET sql_log_bin=0</code> is what you're looking for. Requires SUPER priv., and will turn off logging of commands ...
2008/12/10
[ "https://Stackoverflow.com/questions/355202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11044/" ]
I want to connect and execute one (or sometimes several) SQL statements, and NOT have those replicated to the slaves. I have no replicate-do or replicate-ignore configs, so I can't `use` some non-replicated database to send the commands from. And I know about: ``` set global sql_slave_skip_counter = 1 ``` But that'...
`SET sql_log_bin=0` is what you're looking for. Requires SUPER priv., and will turn off logging of commands from your session until you set it back to 1. See <http://dev.mysql.com/doc/refman/5.0/en/server-session-variables.html#sysvar_sql_log_bin> ``` SET sql_log_bin=0; UPDATE ... ; INSERT ... ; DELETE ... ; SET sql_l...
355,212
<p>After returning to an old Rails project I found none of the destroy/delete links worked and clicking cancel on the confirmation popup would still submit the link.</p> <p>Example of my code is:</p> <pre><code>&lt;%= link_to 'Delete', admin_user_path(@user), :confirm =&gt; 'Are you sure?', :method =&gt; :delete %&gt...
[ { "answer_id": 3187042, "author": "mjnissim", "author_id": 348931, "author_profile": "https://Stackoverflow.com/users/348931", "pm_score": 0, "selected": false, "text": "<p>Chris, Hi. I had the same problem. I deleted Firebug and the problem persisted. I read from another user that he ne...
2008/12/10
[ "https://Stackoverflow.com/questions/355212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31810/" ]
After returning to an old Rails project I found none of the destroy/delete links worked and clicking cancel on the confirmation popup would still submit the link. Example of my code is: ``` <%= link_to 'Delete', admin_user_path(@user), :confirm => 'Are you sure?', :method => :delete %> ```
This problem occurs if you are using jQuery, and if not, then look for something like that: In my case, I was using: javascript\_include\_tag :all %> And it was not working, but when I put it like: javascript\_include\_tag :defaults %> It worked!
355,248
<p>Is there a way to change several textbox's readonly attribute programatically in .net.</p>
[ { "answer_id": 355253, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>You could load them as an array and change them with a loop</p>\n" }, { "answer_id": 355257, "author": "Tarik",...
2008/12/10
[ "https://Stackoverflow.com/questions/355248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there a way to change several textbox's readonly attribute programatically in .net.
Assuming your textboxes all begin with the same prefix and exist in the page controls collection: ``` string commonTextBoxPrefix = "txt"; foreach (Control c in this.Controls) { if (c.GetType() == typeof(TextBox) && c.Name.StartsWith(commonTextBoxPrefix)) { ((TextBox)c).ReadOnly = True; } } ...
355,261
<p>Every time I have to add a handler or module for ASP.NET with IIS7, the instructions always tell me to incorporate it into two sections: <code>system.web</code> and <code>system.webserver</code>.</p> <pre><code>&lt;system.web&gt; &lt;httpHandlers&gt; &lt;/httpHandlers&gt; &lt;httpModules&gt; &lt;/ht...
[ { "answer_id": 355296, "author": "Chris", "author_id": 34942, "author_profile": "https://Stackoverflow.com/users/34942", "pm_score": 7, "selected": false, "text": "<p>The system.web section is for configuring IIS 6.0, while the system.webserver version is used to configure IIS 7.0. IIS 7...
2008/12/10
[ "https://Stackoverflow.com/questions/355261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
Every time I have to add a handler or module for ASP.NET with IIS7, the instructions always tell me to incorporate it into two sections: `system.web` and `system.webserver`. ``` <system.web> <httpHandlers> </httpHandlers> <httpModules> </httpModules> </system.web> ``` And this: ``` <system.webServer...
The system.web section is for configuring IIS 6.0, while the system.webserver version is used to configure IIS 7.0. IIS 7.0 includes a new ASP.NET pipeline and some configuration differences, hence the extra config sections. However... If you're running IIS 7.0 in integrated mode only, you shouldn't need to add the...
355,299
<pre> <code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Calling a Web Service Using XmlHttpRequest&lt;/title&gt; &lt;script type="text/javascrip...
[ { "answer_id": 355303, "author": "Chris", "author_id": 34942, "author_profile": "https://Stackoverflow.com/users/34942", "pm_score": 3, "selected": false, "text": "<p>XmlHttpRequest can only be used to call services local to the domain/server from where the page is being served.</p>\n\n<...
2008/12/10
[ "https://Stackoverflow.com/questions/355299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42070/" ]
``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Calling a Web Service Using XmlHttpRequest</title> <script type="text/javascript" language="javascript"> var xmlhttp; ...
XmlHttpRequest can only be used to call services local to the domain/server from where the page is being served. Thus, if you're serving a page from: ``` http://www.example.com/page1 ``` You cannot make an XmlHttpRequest to: ``` http://www.sample.com/webservice ```
355,311
<p>We have a Perl program to validate XML which is invoked from a Java program. It is not able to write to standard error and hanging in the print location. </p> <p>Perl is writing to STDERR and a java program is reading the STDERR using getErrorStream() function. But the Perl program is hanging to write to STDERR. I ...
[ { "answer_id": 355347, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": "<p>An additional factor to consider is the buffering that occurs with piped processes. </p>\n\n<p>There is by default...
2008/12/10
[ "https://Stackoverflow.com/questions/355311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18657/" ]
We have a Perl program to validate XML which is invoked from a Java program. It is not able to write to standard error and hanging in the print location. Perl is writing to STDERR and a java program is reading the STDERR using getErrorStream() function. But the Perl program is hanging to write to STDERR. I suspect Ja...
getErrorStream does not *read* the error stream, it just obtains a handle to it. As it's a pipe, if you never actually read it, it will fill up and force the Perl program to block. You need something like: ``` Inputstream errors = getErrorStream(); while (errors.read(buffer) > 0) { SOP buffer; } ```
355,312
<p>Let's say I have a generic pointer in objective-c. This pointer could either be a <code>Class</code> object, or it could be an <i>instance</i> of that class. Is there any way to tell the difference between the two?</p> <p>Example:</p> <pre><code> id pointerA = [someClass class]; id pointerB = [[someClass alloc] in...
[ { "answer_id": 355361, "author": "Ashley Clark", "author_id": 4556, "author_profile": "https://Stackoverflow.com/users/4556", "pm_score": 2, "selected": false, "text": "<p>I don't see a better way, and this isn't foolproof, but this should work:</p>\n\n<pre><code>BOOL pointer_isClass(id ...
2008/12/10
[ "https://Stackoverflow.com/questions/355312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33686/" ]
Let's say I have a generic pointer in objective-c. This pointer could either be a `Class` object, or it could be an *instance* of that class. Is there any way to tell the difference between the two? Example: ``` id pointerA = [someClass class]; id pointerB = [[someClass alloc] init]; bool pointerAIsAClass = is_this...
The most correct way is to check the class of the object, and see if it's a metaclass: ``` BOOL object_isClass(id object) { return class_isMetaClass(object_getClass(object)); } ``` There are more answers here: [Check if object is Class type](https://stackoverflow.com/questions/6536244/check-if-object-is-class-ty...
355,313
<p>I have a link on my webpage to print the webpage. However, the link is also visible in the printout itself.</p> <p>Is there javascript or HTML code which would hide the link button when I click the print link?</p> <p>Example:</p> <pre class="lang-none prettyprint-override"><code> "Good Evening" Print (click Here...
[ { "answer_id": 355335, "author": "Justin Scott", "author_id": 44883, "author_profile": "https://Stackoverflow.com/users/44883", "pm_score": 4, "selected": false, "text": "<p>You could place the link within a div, then use JavaScript on the anchor tag to hide the div when clicked. Example...
2008/12/10
[ "https://Stackoverflow.com/questions/355313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a link on my webpage to print the webpage. However, the link is also visible in the printout itself. Is there javascript or HTML code which would hide the link button when I click the print link? Example: ```none "Good Evening" Print (click Here To Print) ``` I want to hide this "Print" label when it prin...
In your stylesheet add: ``` @media print { .no-print, .no-print * { display: none !important; } } ``` Then add `class='no-print'` (or add the no-print class to an existing class statement) in your HTML that you don't want to appear in the printed version, such as your button.
355,355
<p>I am using <a href="http://www.svnkit.com" rel="nofollow noreferrer">SVNKit</a> in my application. I have a scenario wherein certain files should be ignored when doing svn operations. i.e. I need to set the svn:ignore property for certain patterns.</p> <p>How do I do that using SVNKit?</p>
[ { "answer_id": 355363, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": "<p>You could use the <a href=\"http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/ISVNOptions.html\" rel=\"nofollow noreferr...
2008/12/10
[ "https://Stackoverflow.com/questions/355355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35392/" ]
I am using [SVNKit](http://www.svnkit.com) in my application. I have a scenario wherein certain files should be ignored when doing svn operations. i.e. I need to set the svn:ignore property for certain patterns. How do I do that using SVNKit?
You could use the [ISVNOptions](http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/ISVNOptions.html) class. It has a [`addIgnorePattern()`](http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/ISVNOptions.html#addIgnorePattern%28java.lang.String%29) function which should allow you to ignore file based on a given...
355,365
<p>The Java AtomicInteger class has a method -</p> <pre><code>boolean weakCompareAndSet(int expect,int update) </code></pre> <p>Its documnentation says:</p> <blockquote> <p>May fail spuriously.</p> </blockquote> <p>What does 'failing spuriously' here mean?</p>
[ { "answer_id": 355374, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 3, "selected": false, "text": "<p>It means it might return false (and will not set the new value) even if it currently contains the expected value.<...
2008/12/10
[ "https://Stackoverflow.com/questions/355365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14316/" ]
The Java AtomicInteger class has a method - ``` boolean weakCompareAndSet(int expect,int update) ``` Its documnentation says: > > May fail spuriously. > > > What does 'failing spuriously' here mean?
spuriously: for no apparent reason According to [`atomic`](http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/atomic/package-summary.html) package javadoc: > > The atomic classes also support method weakCompareAndSet, which has limited applicability. > > > On some platforms, the weak version may be ...
355,386
<p>Please let me know why there is lot of white space below the page content and also why horizontal scroll bar is displayed. Attaching link to zip folder below. Unzip and open index.html.<br /> <a href="http://shivanand.in/tmp/Basic_Profile.zip" rel="nofollow noreferrer">link text</a></p>
[ { "answer_id": 355421, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": "<p>First lead:</p>\n\n<p>The rule <code>div#content</code> almost works in IE, and does put extra width in FireFox:</p>\n\n<p>Th...
2008/12/10
[ "https://Stackoverflow.com/questions/355386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34642/" ]
Please let me know why there is lot of white space below the page content and also why horizontal scroll bar is displayed. Attaching link to zip folder below. Unzip and open index.html. [link text](http://shivanand.in/tmp/Basic_Profile.zip)
First lead: The rule `div#content` almost works in IE, and does put extra width in FireFox: The extra width is applied to your div class "`content`" ``` div#content { margin: 3px 3px 3px 188px; background: rgb(255, 255, 255) none repeat; min-height: 392px; } ``` within the div class "`container`" ``` div#con...
355,408
<p>I started to use silverlight/flex and immediately bumped into the asynchronous service calling. I'm used to solving the data access problems in an OO-way with one server fetch mechanism or another.</p> <p>I have the following trivial code example:</p> <pre><code>public double ComputeOrderTotal(Order order) { ...
[ { "answer_id": 362478, "author": "DaniCE", "author_id": 19046, "author_profile": "https://Stackoverflow.com/users/19046", "pm_score": 0, "selected": false, "text": "<p>Silverlight is a client technology and the Object - Relational mapping happens completely in the server. So you have to ...
2008/12/10
[ "https://Stackoverflow.com/questions/355408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I started to use silverlight/flex and immediately bumped into the asynchronous service calling. I'm used to solving the data access problems in an OO-way with one server fetch mechanism or another. I have the following trivial code example: ``` public double ComputeOrderTotal(Order order) { double total = 0; ...
C# 5 async / await construct will almost exactly what I want.. [watch presentation by anders hejlsberg](http://player.microsoftpdc.com/Session/1b127a7d-300e-4385-af8e-ac747fee677a)
355,425
<p>I need to write a script to change a filename from aDate.txt to bDate.txt where:</p> <ul> <li>aDate is the current system date in <em>yyyymmdd</em> format and </li> <li>bDate is the current system date - 1 in <em>yyyymmdd</em> format.</li> </ul> <p>I currently have:</p> <pre><code>set yy=%date:~6,2% set mm=%date:...
[ { "answer_id": 355561, "author": "wimh", "author_id": 33499, "author_profile": "https://Stackoverflow.com/users/33499", "pm_score": 3, "selected": false, "text": "<p>You have to do it the difficult way. I suggest to use <a href=\"http://www.experts-exchange.com/OS/Microsoft_Operating_Sys...
2008/12/10
[ "https://Stackoverflow.com/questions/355425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/939/" ]
I need to write a script to change a filename from aDate.txt to bDate.txt where: * aDate is the current system date in *yyyymmdd* format and * bDate is the current system date - 1 in *yyyymmdd* format. I currently have: ``` set yy=%date:~6,2% set mm=%date:~3,2% set dd=%date:~0,2% if "%date:~6,1%"==" " set yy=0%yy:~1...
You have to do it the difficult way. I suggest to use [this](http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_21316459.html) solution by SteveGTR. I copy the text below, because at least at least I cannot always see the solution on that site. --- Here's a batch file I developed to subtract any...
355,447
<p>I have some documentation written in OpenOffice, and I would like to include some of it as PDF files in the final build deliveries. I would like to do this with the automated build script.</p> <p>Is there a way to create a PDF file from OpenOffice with a command line command?</p>
[ { "answer_id": 355470, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 5, "selected": true, "text": "<p><a href=\"http://www.artofsolving.com/opensource/jodconverter\" rel=\"nofollow noreferrer\">Art of Solving</a> has also...
2008/12/10
[ "https://Stackoverflow.com/questions/355447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6482/" ]
I have some documentation written in OpenOffice, and I would like to include some of it as PDF files in the final build deliveries. I would like to do this with the automated build script. Is there a way to create a PDF file from OpenOffice with a command line command?
[Art of Solving](http://www.artofsolving.com/opensource/jodconverter) has also a very good API to perform the conversion in Java. It is a little slow but it is simple enough. This is how I use it: ``` File inputFile = new File("C:\\oreyes\\hola.doc"); File outputFile = new File("C:\\oreyes\\hola.pdf")...
355,449
<p>Hey folks - I'm writing a pretty simple iPhone application. The data comes from a plist file (NSDictionary basically), that I'm trying to load into a singleton class and use across my various view controllers to access the data.</p> <p>Here's the implementation for my singleton (heavily modeled after <a href="http...
[ { "answer_id": 355461, "author": "Ashley Clark", "author_id": 4556, "author_profile": "https://Stackoverflow.com/users/4556", "pm_score": 5, "selected": true, "text": "<p>In your <code>-init</code> method you are directly accessing your instance variables and you are not retaining them. ...
2008/12/10
[ "https://Stackoverflow.com/questions/355449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44858/" ]
Hey folks - I'm writing a pretty simple iPhone application. The data comes from a plist file (NSDictionary basically), that I'm trying to load into a singleton class and use across my various view controllers to access the data. Here's the implementation for my singleton (heavily modeled after [this thread](https://st...
In your `-init` method you are directly accessing your instance variables and you are not retaining them. They're getting deallocated and their memory is being used up by other objects later on in your application's lifetime. Either retain your objects that you're creating there or use the non-convenience methods to g...
355,456
<p>Is it possible to get the current source line number in Perl? The equivalent in C++ is <code>__LINE__</code>.</p>
[ { "answer_id": 355464, "author": "Eugene Yokota", "author_id": 3827, "author_profile": "https://Stackoverflow.com/users/3827", "pm_score": 7, "selected": true, "text": "<p>The <code>__LINE__</code> literal is documented in the <a href=\"https://perldoc.perl.org/perldata#Special-Literals\...
2008/12/10
[ "https://Stackoverflow.com/questions/355456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259/" ]
Is it possible to get the current source line number in Perl? The equivalent in C++ is `__LINE__`.
The `__LINE__` literal is documented in the [Special Literals](https://perldoc.perl.org/perldata#Special-Literals) section of the [perldata man page](https://perldoc.perl.org/perldata). ``` print "File: ", __FILE__, " Line: ", __LINE__, "\n"; ``` or ``` warn("foo"); ```
355,459
<p>I have a big red button and I'm trying to use javascript to perform the following: -</p> <ol> <li>OnMouseDown change image so the button looks depressed</li> <li>OnMouseUp return to the initial image AND reveal a hidden div</li> </ol> <p>I can get the onMouse Down and onMouseUp image changes part to work.</p> <p>...
[ { "answer_id": 355467, "author": "Justin Scott", "author_id": 44883, "author_profile": "https://Stackoverflow.com/users/44883", "pm_score": 0, "selected": false, "text": "<p>Without seeing your code, it's hard to say, but I suspect a missing 'return true;' statement at the end of either ...
2008/12/10
[ "https://Stackoverflow.com/questions/355459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a big red button and I'm trying to use javascript to perform the following: - 1. OnMouseDown change image so the button looks depressed 2. OnMouseUp return to the initial image AND reveal a hidden div I can get the onMouse Down and onMouseUp image changes part to work. I can also get the hidden div to reveal ...
You can use semicolons to separate multiple script statements in an event: ``` <img src="..." alt="..." onmousedown="depressed();" onmouseup="undepressed(); revealDiv();" /> ``` Also, I believe most browsers support the onclick event: ``` <img src="..." alt="..." onmousedown="depressed();" onmouseup="undepr...
355,473
<p>I want to handle different types of docs the same way in my application Therefore: I have a generic interface like this.</p> <pre><code>public interface IDocHandler&lt;T&gt;where T: class { T Document { get;set;} void Load(T doc); void Load(string PathToDoc); void Execute(); void Execute(T doc); } </code></pr...
[ { "answer_id": 355525, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 1, "selected": false, "text": "<p>You need to use a non-generic interface on the left side.</p>\n\n<p>Try:</p>\n\n<pre><code>public interface IDocum...
2008/12/10
[ "https://Stackoverflow.com/questions/355473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to handle different types of docs the same way in my application Therefore: I have a generic interface like this. ``` public interface IDocHandler<T>where T: class { T Document { get;set;} void Load(T doc); void Load(string PathToDoc); void Execute(); void Execute(T doc); } ``` And for different types o...
I think that with your current design, you are creating a "dependency" between `IDocumentHandler` and a specific Document (`ReportDocument` or `MediaDocument`) and so if you want to use `IDocumentHandler<ReportDocument or MediaDocument>` directly in your code you must assume that your container will give you just that....
355,486
<p>I've got a Core Data application that has an Event class, which has a start date and a finish date. It's trivial to bind these to a pair of NSDatePicker widgets, but I wanted to make it work with the NSRangeDateMode available in Leopard.</p> <p>The NSDatePicker has a pair of methods that deal with timeInterval, bu...
[ { "answer_id": 357758, "author": "Ashley Clark", "author_id": 4556, "author_profile": "https://Stackoverflow.com/users/4556", "pm_score": 1, "selected": false, "text": "<p>The interval support is only available when you're using the graphical version of the date picker. Even then, there'...
2008/12/10
[ "https://Stackoverflow.com/questions/355486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188/" ]
I've got a Core Data application that has an Event class, which has a start date and a finish date. It's trivial to bind these to a pair of NSDatePicker widgets, but I wanted to make it work with the NSRangeDateMode available in Leopard. The NSDatePicker has a pair of methods that deal with timeInterval, but I don't s...
Sadly, no. The timeInterval property of the date picker is not even properly key-value observable. Basically, you're stuck either setting up an action method or using the delegate validation method to receive updates to its value. Also, you'll want to round it off to the nearest multiple of 86400.0 (i.e. the number of ...
355,492
<p>I have read the following properties from AD,</p> <pre><code>TerminalServicesProfilePath TerminalServicesHomeDirectory TerminalServicesHomeDrive </code></pre> <p>I've tried DirectoryEntry and DirectorySearcher. But they does not include the properties.</p> <p>I found some example in vbscript and VC to read them. ...
[ { "answer_id": 355513, "author": "chriscena", "author_id": 32671, "author_profile": "https://Stackoverflow.com/users/32671", "pm_score": 2, "selected": true, "text": "<p>I don't remember exactly, but it's something like this:</p>\n\n<pre><code>//user is a DirectoryEntry\nIADsTSUserEx ads...
2008/12/10
[ "https://Stackoverflow.com/questions/355492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40214/" ]
I have read the following properties from AD, ``` TerminalServicesProfilePath TerminalServicesHomeDirectory TerminalServicesHomeDrive ``` I've tried DirectoryEntry and DirectorySearcher. But they does not include the properties. I found some example in vbscript and VC to read them. However I failed to make it worki...
I don't remember exactly, but it's something like this: ``` //user is a DirectoryEntry IADsTSUserEx adsiUser = (IADsTSUserEx)user.NativeObject; ``` then you can get the TerminalServices properties you want via adsiUser. From my experience you're better off developing on a Windows Server with access to AD due to th...
355,508
<p>Sorry about the vague subject but I couldn't think what to put.</p> <p>Here's my problem, I'm doing a query on a table that returns me a count of items related to a day. I want to make sure that if I do a query on the DB, I always get a set number of rows. For example, imagine I have the following table that cont...
[ { "answer_id": 355519, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": true, "text": "<blockquote>\n <p>I imagine I could do this if I set up a table containing all the dates in a year and then using a ...
2008/12/10
[ "https://Stackoverflow.com/questions/355508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1900/" ]
Sorry about the vague subject but I couldn't think what to put. Here's my problem, I'm doing a query on a table that returns me a count of items related to a day. I want to make sure that if I do a query on the DB, I always get a set number of rows. For example, imagine I have the following table that contains a log o...
> > I imagine I could do this if I set up a table containing all the dates in a year and then using a left/right join but that's really messy way of doing it. > > > Nope. That's pretty much how to do it. On the other hand, you can use a temporary table and populate it with just the date range required. If only MS...
355,516
<p>When accessing my site, the user has to enter his credentials. They are basically plain directory access credentials. At a certain point I check if a certain file they want to download exists by calling</p> <pre><code>WebRequest req = HttpWebRequest.Create(checkUri.AbsoluteUri); WebResponse res = req.GetResponse();...
[ { "answer_id": 355522, "author": "mookid8000", "author_id": 6560, "author_profile": "https://Stackoverflow.com/users/6560", "pm_score": 3, "selected": false, "text": "<p>I think you want this:</p>\n\n<pre><code>req.Credentials = CredentialCache.DefaultCredentials;\n</code></pre>\n" }, ...
2008/12/10
[ "https://Stackoverflow.com/questions/355516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
When accessing my site, the user has to enter his credentials. They are basically plain directory access credentials. At a certain point I check if a certain file they want to download exists by calling ``` WebRequest req = HttpWebRequest.Create(checkUri.AbsoluteUri); WebResponse res = req.GetResponse(); ``` Althoug...
I think you want this: ``` req.Credentials = CredentialCache.DefaultCredentials; ```
355,526
<p>HI,</p> <p>I have a large table from which i can query to get the following table</p> <pre><code>type no of times type occurs 101 450 102 562 103 245 </code></pre> <p>also i can get another table</p> <pre><code>code no of times code occurs 0 1222 1 ...
[ { "answer_id": 355522, "author": "mookid8000", "author_id": 6560, "author_profile": "https://Stackoverflow.com/users/6560", "pm_score": 3, "selected": false, "text": "<p>I think you want this:</p>\n\n<pre><code>req.Credentials = CredentialCache.DefaultCredentials;\n</code></pre>\n" }, ...
2008/12/10
[ "https://Stackoverflow.com/questions/355526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
HI, I have a large table from which i can query to get the following table ``` type no of times type occurs 101 450 102 562 103 245 ``` also i can get another table ``` code no of times code occurs 0 1222 1 750 2 355 ``` but...
I think you want this: ``` req.Credentials = CredentialCache.DefaultCredentials; ```
355,531
<p>I am trying to understand if I really have any case for using git/mercurial.</p> <p>The projects I work are java and c# projects, usually with 5-20 people working towards a common goal (the "release"). Most of the developers are professional developers who refactor code <em>all of the time</em>. So where the typic...
[ { "answer_id": 355556, "author": "Robert Gould", "author_id": 15124, "author_profile": "https://Stackoverflow.com/users/15124", "pm_score": 2, "selected": false, "text": "<p>For one, if nothing else, you can use GIT offline, so people can continue working under source control even while ...
2008/12/10
[ "https://Stackoverflow.com/questions/355531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
I am trying to understand if I really have any case for using git/mercurial. The projects I work are java and c# projects, usually with 5-20 people working towards a common goal (the "release"). Most of the developers are professional developers who refactor code *all of the time*. So where the typical linux kernel h...
In terms of mentality, there is sometimes a benefit in being able to create a soft-branch, perform all the changes in the soft branch, test the result of the changes in the soft branch, and then when the soft-branch is "complete", reintegrate it with the main branch locally, retest it, and then propagate it. This in ...
355,533
<p>I have two unix partitions under debian which I would like to merge (disk space problems :/). What would be the easiest way to do it? I think it would be best to tar or copy files from one partition to the other, delete one and resize the other. I will use parted to resize but how should I copy the files? There are ...
[ { "answer_id": 355591, "author": "Anders Westrup", "author_id": 36845, "author_profile": "https://Stackoverflow.com/users/36845", "pm_score": 3, "selected": true, "text": "<p>You could run the following (as root) to copy the files. It works for symlinks, devices and ordinary files.</p>\n...
2008/12/10
[ "https://Stackoverflow.com/questions/355533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26943/" ]
I have two unix partitions under debian which I would like to merge (disk space problems :/). What would be the easiest way to do it? I think it would be best to tar or copy files from one partition to the other, delete one and resize the other. I will use parted to resize but how should I copy the files? There are lin...
You could run the following (as root) to copy the files. It works for symlinks, devices and ordinary files. ``` cd /partition2 tar cf - . | ( cd /partition1 && tar xf - ) ``` Another way is to use cpio, but I never remember the correct syntax.
355,538
<p>The client has asked for a number of tables to be extracted into csv's, all done no problem. They've just asked we make sure the files are always in UTF 8 format.</p> <p>How do I check this is actually the case. Or even better force it to be so, is it something i can set in a procedure before running a query perha...
[ { "answer_id": 355575, "author": "rics", "author_id": 21047, "author_profile": "https://Stackoverflow.com/users/21047", "pm_score": 4, "selected": true, "text": "<p>You can check the database character set with the following query:</p>\n\n<pre><code>select value from nls_database_paramet...
2008/12/10
[ "https://Stackoverflow.com/questions/355538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27412/" ]
The client has asked for a number of tables to be extracted into csv's, all done no problem. They've just asked we make sure the files are always in UTF 8 format. How do I check this is actually the case. Or even better force it to be so, is it something i can set in a procedure before running a query perhaps? The da...
You can check the database character set with the following query: ``` select value from nls_database_parameters where parameter='NLS_CHARACTERSET' ``` If it says AL32UTF8 then your database is in the format what you need and if the export does not impair it then your are done. You may read about Oracle globalizat...
355,539
<p>If I had a dictionary <code>dict</code> and I wanted to check for <code>dict['key']</code> I could either do so in a <code>try</code> block (bleh!) or use the <code>get()</code> method, with <code>False</code> as a default value.</p> <p>I'd like to do the same thing for <code>object.attribute</code>. That is, I alr...
[ { "answer_id": 355562, "author": "Zoomulator", "author_id": 44563, "author_profile": "https://Stackoverflow.com/users/44563", "pm_score": 4, "selected": false, "text": "<p>Do you mean <code>hasattr()</code> perhaps?</p>\n\n<pre><code>hasattr(object, \"attribute name\") #Returns True or F...
2008/12/10
[ "https://Stackoverflow.com/questions/355539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9106/" ]
If I had a dictionary `dict` and I wanted to check for `dict['key']` I could either do so in a `try` block (bleh!) or use the `get()` method, with `False` as a default value. I'd like to do the same thing for `object.attribute`. That is, I already have object to return `False` if it hasn't been set, but then that give...
A more direct analogue to `dict.get(key, default)` than `hasattr` is `getattr`. ``` val = getattr(obj, 'attr_to_check', default_value) ``` (Where `default_value` is optional, raising an exception on no attribute if not found.) For your example, you would pass `False`.
355,540
<p>I have a special url which I would want only few people to have access to. I have a list of super users stored as an array in the app.yml. How can I use this array in :requirements section of a specific route in the routes.rb file to allow only those super users access to this route? Thanks a lot.</p>
[ { "answer_id": 355562, "author": "Zoomulator", "author_id": 44563, "author_profile": "https://Stackoverflow.com/users/44563", "pm_score": 4, "selected": false, "text": "<p>Do you mean <code>hasattr()</code> perhaps?</p>\n\n<pre><code>hasattr(object, \"attribute name\") #Returns True or F...
2008/12/10
[ "https://Stackoverflow.com/questions/355540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44916/" ]
I have a special url which I would want only few people to have access to. I have a list of super users stored as an array in the app.yml. How can I use this array in :requirements section of a specific route in the routes.rb file to allow only those super users access to this route? Thanks a lot.
A more direct analogue to `dict.get(key, default)` than `hasattr` is `getattr`. ``` val = getattr(obj, 'attr_to_check', default_value) ``` (Where `default_value` is optional, raising an exception on no attribute if not found.) For your example, you would pass `False`.
355,550
<p>I have two arrays in PHP. The first array ($author_array) is comprised of user_ids in a particular order, like so: (8, 1, 6)</p> <p>The second array ($user_results) is comprised of an array of objects like so:</p> <pre><code>Array ( [0] =&gt; stdClass Object ( [ID] =&gt; 1 [user...
[ { "answer_id": 355583, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 6, "selected": true, "text": "<p>Use <a href=\"http://php.net/uksort\" rel=\"noreferrer\">usort</a> and provide a custom comparison function which uses ...
2008/12/10
[ "https://Stackoverflow.com/questions/355550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44919/" ]
I have two arrays in PHP. The first array ($author\_array) is comprised of user\_ids in a particular order, like so: (8, 1, 6) The second array ($user\_results) is comprised of an array of objects like so: ``` Array ( [0] => stdClass Object ( [ID] => 1 [user_login] => user1 ...
Use [usort](http://php.net/uksort) and provide a custom comparison function which uses the position of the key in your "ordering" array to determine the sort order, e.g. something like: ``` function cmp($a, $b) { global $author_array; $pos1=array_search ($a->ID, $author_array); $pos2=array_search ($b->ID, $...
355,560
<p>I have these values: <code>d1, d45, d79, d33, d100</code></p> <p>I want to sort these variables in ascending order from my table.</p> <p>What is the query to get the output as:</p> <pre><code>d1 d33 d45 d79 d100 </code></pre>
[ { "answer_id": 355598, "author": "Android", "author_id": 40673, "author_profile": "https://Stackoverflow.com/users/40673", "pm_score": 0, "selected": false, "text": "<p>Sorry, not SQL answer at all. :) For variant with one letter only order by length and alpha.</p>\n" }, { "answe...
2008/12/10
[ "https://Stackoverflow.com/questions/355560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have these values: `d1, d45, d79, d33, d100` I want to sort these variables in ascending order from my table. What is the query to get the output as: ``` d1 d33 d45 d79 d100 ```
What you want is called a "natural sort". For Microsoft SQL Server 2005, see [this question](https://stackoverflow.com/questions/34509/natural-human-alpha-numeric-sort-in-microsoft-sql-2005). For other languages, see (for example) [this other question](https://stackoverflow.com/questions/127913/sorting-strings-is-much-...
355,576
<p>I would like to get Binding object from web.config or app.config.</p> <p>So, this code works:</p> <pre><code>wcfTestClient = new TestServiceClient("my_endpoint", Url + "/TestService.svc"); </code></pre> <p>but I would like to do the following:</p> <pre><code>Binding binding = DoSomething(); wcfTestClient = new T...
[ { "answer_id": 355709, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "<p>One cheeky option might be to create an instance with the default constructor, to use as a template:</p>\n\n<pre><...
2008/12/10
[ "https://Stackoverflow.com/questions/355576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28912/" ]
I would like to get Binding object from web.config or app.config. So, this code works: ``` wcfTestClient = new TestServiceClient("my_endpoint", Url + "/TestService.svc"); ``` but I would like to do the following: ``` Binding binding = DoSomething(); wcfTestClient = new TestServiceClient(binding, Url + "/TestServic...
You can instantiate a binding giving a binding configuration name from App.config/Web.config. <http://msdn.microsoft.com/en-us/library/ms575163.aspx> > > Initializes a new instance of the WSHttpBinding class with a binding specified by its configuration name. > > > The following example shows how to initialize a n...
355,628
<p>I'm working on a design for a hierarchical database structure which models a catalogue containing products (this is similar to <a href="https://stackoverflow.com/questions/112866/database-schema-for-a-hierarchial-groups">this question</a>). The database platform is SQL Server 2005 and the catalogue is quite large (7...
[ { "answer_id": 355747, "author": "Mladen Prajdic", "author_id": 31345, "author_profile": "https://Stackoverflow.com/users/31345", "pm_score": 0, "selected": false, "text": "<p>you might be able to solve the customer groups problem with roles and treeId's but you'll have to provide us wit...
2008/12/10
[ "https://Stackoverflow.com/questions/355628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38911/" ]
I'm working on a design for a hierarchical database structure which models a catalogue containing products (this is similar to [this question](https://stackoverflow.com/questions/112866/database-schema-for-a-hierarchial-groups)). The database platform is SQL Server 2005 and the catalogue is quite large (750,000 product...
Use a closure table. If your basic structure is a parent-child with the fields ID and ParentID, then the structure for a closure table is ID and DescendantID. In other words, a closure table is an ancestor-descendant table, where each possible ancestor is associated with all descendants. You may include a LevelsBetween...
355,632
<p>On a website I'm working we have an onsite login and a private login, the problem I'm having is that Firefox doesn't seem to be able to differentiate between these login forms.</p> <p>Does anybody know how I can make clear that these are different logins?</p> <p>I already tried giving the form fields different nam...
[ { "answer_id": 355734, "author": "dragonlord21", "author_id": 44931, "author_profile": "https://Stackoverflow.com/users/44931", "pm_score": 1, "selected": false, "text": "<p>I've not yet heard about a multiple form problem in Firefox.\nBut it could be that Firefox mixed up your 2 login f...
2008/12/10
[ "https://Stackoverflow.com/questions/355632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074/" ]
On a website I'm working we have an onsite login and a private login, the problem I'm having is that Firefox doesn't seem to be able to differentiate between these login forms. Does anybody know how I can make clear that these are different logins? I already tried giving the form fields different names and ids, ex: o...
Apparently this is not possible due to the way Firefox stores its passwords. A password-manager entry is stored with the following data * The username (encrypted and secured with Firefox Master Password). * The password (encrypted and secured with Firefox Master Password). * The hostname of the webpage containing the...
355,633
<p>I was reading up on Ruby, and learned about its mixins pattern, but couldn't think of many useful mixin functionality (because I'm not used to thinking that way most likely). So I was wondering what would be good examples of useful Mixin functionality?</p> <p>Thanks</p> <p>Edit: A bit of background. I'm Coming fro...
[ { "answer_id": 355642, "author": "J Cooper", "author_id": 38803, "author_profile": "https://Stackoverflow.com/users/38803", "pm_score": 1, "selected": false, "text": "<p>It is largely used as one might use multiple inheritance in C++ or implementing interfaces in Java/C#. I'm not sure wh...
2008/12/10
[ "https://Stackoverflow.com/questions/355633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
I was reading up on Ruby, and learned about its mixins pattern, but couldn't think of many useful mixin functionality (because I'm not used to thinking that way most likely). So I was wondering what would be good examples of useful Mixin functionality? Thanks Edit: A bit of background. I'm Coming from C++, and other ...
Well the usual example I think is Persistence ``` module Persistence def load sFileName puts "load code to read #{sFileName} contents into my_data" end def save sFileName puts "Uber code to persist #{@my_data} to #{sFileName}" end end class BrandNewClass include Persistenc...
355,636
<p>I have a problem that I feel is best implimented in a stand alone windows application, but needs to pass data to a web page that is already open. </p> <p>Is it possible to pass the data directly to the web page?</p> <p>If so, what is the best way to go about it?</p> <p>(Its my first question, so go easy on me!)</...
[ { "answer_id": 355642, "author": "J Cooper", "author_id": 38803, "author_profile": "https://Stackoverflow.com/users/38803", "pm_score": 1, "selected": false, "text": "<p>It is largely used as one might use multiple inheritance in C++ or implementing interfaces in Java/C#. I'm not sure wh...
2008/12/10
[ "https://Stackoverflow.com/questions/355636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44914/" ]
I have a problem that I feel is best implimented in a stand alone windows application, but needs to pass data to a web page that is already open. Is it possible to pass the data directly to the web page? If so, what is the best way to go about it? (Its my first question, so go easy on me!)
Well the usual example I think is Persistence ``` module Persistence def load sFileName puts "load code to read #{sFileName} contents into my_data" end def save sFileName puts "Uber code to persist #{@my_data} to #{sFileName}" end end class BrandNewClass include Persistenc...
355,638
<p>I'm using Jquery's toggle event to do some stuff when a user clicks a checkbox, like this:</p> <pre><code>$('input#myId').toggle( function(){ //do stuff }, function(){ //do other stuff } ); </code></pre> <p>The problem is that the checkbox isn't being ticked when I click on the checkbox. (All the stuff I've ...
[ { "answer_id": 355664, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 7, "selected": true, "text": "<p>Use the <code>change</code> event instead of the <code>toggle</code> event, like such:</p>\n\n<pre><code>$('input#...
2008/12/10
[ "https://Stackoverflow.com/questions/355638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22946/" ]
I'm using Jquery's toggle event to do some stuff when a user clicks a checkbox, like this: ``` $('input#myId').toggle( function(){ //do stuff }, function(){ //do other stuff } ); ``` The problem is that the checkbox isn't being ticked when I click on the checkbox. (All the stuff I've put into the toggle event ...
Use the `change` event instead of the `toggle` event, like such: ``` $('input#myId').change(function () { if ($(this).attr("checked")) { //do the stuff that you would do when 'checked' return; } //Here do the stuff you want to do when 'unchecked' }); ```
355,670
<p>Myself and a colleague have a dispute about which of the following is more elegant. I won't say who's who, so it is impartial. Which is more elegant?</p> <pre><code>public function set hitZone(target:DisplayObject):void { if(_hitZone != target) { _hitZone.removeEventL...
[ { "answer_id": 355684, "author": "xsl", "author_id": 11387, "author_profile": "https://Stackoverflow.com/users/11387", "pm_score": 5, "selected": false, "text": "<p>In most cases, returning early reduces the complexity and makes the code more readable.</p>\n\n<p>It's also one of the tech...
2008/12/10
[ "https://Stackoverflow.com/questions/355670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11911/" ]
Myself and a colleague have a dispute about which of the following is more elegant. I won't say who's who, so it is impartial. Which is more elegant? ``` public function set hitZone(target:DisplayObject):void { if(_hitZone != target) { _hitZone.removeEventListener(MouseE...
This is one of those cases where it's ok to break the rules (i.e. best practices). In general you want to have as few return points in a function as possible. The practical reason for this is that it simplifies your reading of the code, since you can just always assume that each and every function will take its argumen...
355,673
<p>This is probably a simple question but I am not an ASP.NET developer and I am quite stuck.</p> <p>I have a simple search routine that returns between zero and several hundred results. Each of these must be added to the page as a button and I want to set the text of the button and the CommandArgument property so tha...
[ { "answer_id": 355683, "author": "Ian Oxley", "author_id": 1904, "author_profile": "https://Stackoverflow.com/users/1904", "pm_score": 0, "selected": false, "text": "<p>I think you need to use the OnCommand event handler, rather than the OnClick i.e. try changing this:</p>\n\n<pre><code>...
2008/12/10
[ "https://Stackoverflow.com/questions/355673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44938/" ]
This is probably a simple question but I am not an ASP.NET developer and I am quite stuck. I have a simple search routine that returns between zero and several hundred results. Each of these must be added to the page as a button and I want to set the text of the button and the CommandArgument property so that when the...
You mentioned in another answer that you are adding these when a button is clicked. Looking at your code, I would suggest that you try setting a unique ID for each button added, then ensure that on loading the page that buttons with the same IDs and CommandArgument values are reloaded. When a dynamically loaded button ...
355,691
<p>I've got an extremely long XML file, like</p> <pre><code>&lt;Root&gt; &lt;ele1&gt; &lt;child1&gt;context1&lt;/child1&gt; &lt;child2&gt;test1&lt;/child2&gt; &lt;child1&gt;context1&lt;/child1&gt; &lt;/ele1&gt; &lt;ele2&gt; &lt;child1&gt;context2&lt;/child1&gt; &lt;child2&gt;tes...
[ { "answer_id": 355713, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": -1, "selected": false, "text": "<p>Your xml and question are kind of unclear, but what you're looking for is commonly called the <a href=\"http://www.je...
2008/12/10
[ "https://Stackoverflow.com/questions/355691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've got an extremely long XML file, like ``` <Root> <ele1> <child1>context1</child1> <child2>test1</child2> <child1>context1</child1> </ele1> <ele2> <child1>context2</child1> <child2>test2</child2> <child1>context2</child1> </ele2> <ele3>...........<elen> </Root> `...
**This question requires a little bit more detailed answer** than just pointing to a good [**Muenchian Grouping**](http://dpawson.co.uk/xsl/sect2/N4486.html#d6060e85) source. The reason is that **the needed grouping requires to identify both the names of all children of an "ele[SomeString]" element and their parent**....
355,700
<p>I want to embed a link to a controller action in my page so I can use it from javascript. Something like</p> <pre><code>var pollAction = '/Mycontroller/CheckStatus' </code></pre> <p>Now I am happy to hardcode it, but it would be really nice if there were a method I could use to create the URL. The AjaxHelper/HtmlE...
[ { "answer_id": 355736, "author": "mapache", "author_id": 41422, "author_profile": "https://Stackoverflow.com/users/41422", "pm_score": 5, "selected": true, "text": "<p>Have you tried something along these lines?</p>\n\n<pre><code>var pollAction = '&lt;%=Url.Action(\"CheckStatus\", \"MyCo...
2008/12/10
[ "https://Stackoverflow.com/questions/355700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22360/" ]
I want to embed a link to a controller action in my page so I can use it from javascript. Something like ``` var pollAction = '/Mycontroller/CheckStatus' ``` Now I am happy to hardcode it, but it would be really nice if there were a method I could use to create the URL. The AjaxHelper/HtmlExtensions contain methods ...
Have you tried something along these lines? ``` var pollAction = '<%=Url.Action("CheckStatus", "MyController") %>'; ```
355,723
<p>I'm trying in vain to write a regular expression to match valid ssh connection strings.</p> <p>I really only need to recognise strings of the format:</p> <ul> <li>user@hostname:/some/path</li> </ul> <p>but it would be nice to also match an implicit home directory:</p> <ul> <li>user@hostname:</li> </ul> <p>I've ...
[ { "answer_id": 355744, "author": "Nietzche-jou", "author_id": 39892, "author_profile": "https://Stackoverflow.com/users/39892", "pm_score": 0, "selected": false, "text": "<p>Bracket expressions go inside their own brackets. You are matching any one of colon, 'a', 'l', 'm', 'n', or 'u'.</...
2008/12/10
[ "https://Stackoverflow.com/questions/355723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying in vain to write a regular expression to match valid ssh connection strings. I really only need to recognise strings of the format: * user@hostname:/some/path but it would be nice to also match an implicit home directory: * user@hostname: I've so-far come up with this regex: ``` /^[:alnum:]+\@\:(\/[:al...
Your supplied regex doesn't have the hostname section. Try: ``` /^[:alnum:]+\@[:alnum:\.]\:(\/[:alnum:]+)*$/ ``` or ``` /^[A-Za-z][A-Za-z0-9_]*\@[A-Za-z][A-Za-z0-9_\.]*\:(\/[A-Za-z][A-Za-z0-9_]*)*$/ ``` since I don't trust alnum without double brackets. Also, :alnum: may not give you the required range for your ...
355,724
<p>Is it possible to embed a DOS console in a Windows Form or User Control in C# 2.0?</p> <p>We have a legacy DOS product that my Windows app has to interact with, and it's been requested that an instance of the legacy product should run within the Windows application.</p> <p>At the moment, I'm using the user32.dll t...
[ { "answer_id": 355745, "author": "Frans-Willem", "author_id": 34014, "author_profile": "https://Stackoverflow.com/users/34014", "pm_score": 1, "selected": false, "text": "<p>You can use the CreateProcess function and the hStdInput, Output, and Error members of the STARTUPINFO argument, t...
2008/12/10
[ "https://Stackoverflow.com/questions/355724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18895/" ]
Is it possible to embed a DOS console in a Windows Form or User Control in C# 2.0? We have a legacy DOS product that my Windows app has to interact with, and it's been requested that an instance of the legacy product should run within the Windows application. At the moment, I'm using the user32.dll to locate the wind...
It's possible to redirect the standard input/output of console/dos applications using the Process class. It might look something like this: ``` var processStartInfo = new ProcessStartInfo("someoldapp.exe", "-p someparameters"); processStartInfo.UseShellExecute = false; processStartInfo.ErrorDialog = false; processSt...
355,730
<p>What is the best way to store instances of a class to file/database?</p> <p>We have a base class called Command and loads of derived classes. Users create instances of these classes by adding commands to a graphical designer where they can configure them. (Set the properties).</p> <p>We then need a way to store th...
[ { "answer_id": 355751, "author": "Florian Greinacher", "author_id": 31985, "author_profile": "https://Stackoverflow.com/users/31985", "pm_score": 2, "selected": false, "text": "<p>Pretty blurry question, why don't you just use .NET's built-in serialization possibilities (e.g. XmlSerializ...
2008/12/10
[ "https://Stackoverflow.com/questions/355730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28149/" ]
What is the best way to store instances of a class to file/database? We have a base class called Command and loads of derived classes. Users create instances of these classes by adding commands to a graphical designer where they can configure them. (Set the properties). We then need a way to store these "commands" to...
serialization does the trick! Serialization is nothing more than converting an object or a connected graph of objects into a stream of bytes (in order to persist the current state of the object). This can be a binary stream, XML or whatever. You don't have to do this conversion by your own since .Net has great support ...
355,737
<p>How can I rotate the Apache Access and Error logs on a Window 2000 box?</p> <p>I include my batch file below as an answer.</p> <p>Is there a way of doing this directly via the Apache config file? I'm currently using the following customlog command to generate daily logs.</p> <p>CustomLog '|" "*Apache-Path/bin/ro...
[ { "answer_id": 355792, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 0, "selected": false, "text": "<p>As stated I don't think this is strictly a programming question, but AFAIK there is no built-in functionality in ...
2008/12/10
[ "https://Stackoverflow.com/questions/355737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39447/" ]
How can I rotate the Apache Access and Error logs on a Window 2000 box? I include my batch file below as an answer. Is there a way of doing this directly via the Apache config file? I'm currently using the following customlog command to generate daily logs. CustomLog '|" "\*Apache-Path/bin/rotatelogs.exe" "\*Apache-...
Here's the DOS batch file, modified as annotated. I run it weekly and it keeps 8 weeks of zipped backups. You'll need to install 7 zip. I haven't parametrised the paths, feel free to. --- ``` @echo off :: Name - svrlogmng.bat :: Description - Server Log File Manager :: :: History :: Date Authory Change :...
355,775
<p>I'm writing a JavaSCript class that has a method that recursively calls itself.</p> <pre><code>Scheduler.prototype.updateTimer = function () { document.write( this._currentTime ); this._currentTime -= 1000; // recursively calls itself this._updateUITimerHandler = window.setTimeout( arguments.callee ...
[ { "answer_id": 355790, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 1, "selected": false, "text": "<p>Well the first thing to say is that if you're calling setTimeout but not changing the interval, you should be using se...
2008/12/10
[ "https://Stackoverflow.com/questions/355775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9394/" ]
I'm writing a JavaSCript class that has a method that recursively calls itself. ``` Scheduler.prototype.updateTimer = function () { document.write( this._currentTime ); this._currentTime -= 1000; // recursively calls itself this._updateUITimerHandler = window.setTimeout( arguments.callee , 1000 ); } `...
Try this:- ``` Scheduler.prototype.startTimer = function() { var self = this; function updateTimer() { this._currentTime -= 1000; self.hTimer = window.setTimeout(updateTimer, 1000) self.tick() } this.hTimer = window.setTimeout(updateTimer, 1000) } Scheduler.prototype.stopTimer = function() { if...
355,787
<p>This is something I'm not much consistent about and always curious about what other people do.</p> <p>How do you access internal properties (private or public)? </p> <p>For example you've got this property :</p> <pre><code>Private _Name As String Public Property Name() As String Get Return _Name ...
[ { "answer_id": 355797, "author": "bezmax", "author_id": 43677, "author_profile": "https://Stackoverflow.com/users/43677", "pm_score": 1, "selected": false, "text": "<p>I prefer:</p>\n\n<pre><code>Name = \"Johny\"\n</code></pre>\n\n<p>For me, reason is quite simple, if something bad happe...
2008/12/10
[ "https://Stackoverflow.com/questions/355787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40322/" ]
This is something I'm not much consistent about and always curious about what other people do. How do you access internal properties (private or public)? For example you've got this property : ``` Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value ...
Personally I prefer to use the property where possible. This means you still get the validation, and you can easily put breakpoints on the property access. This *doesn't* work where you're trying to make a change to two properties which validate against each other - for instance, a "min and max" pair, where each has a ...
355,796
<p>My relative is studying programming and has a hard time understanding classes. He has trouble understanding for example that you need to instantiate it, that methods cannot access variables in other methods and if you change a variable in one instance of a class it doesn't change for other instances.</p> <p>I've tr...
[ { "answer_id": 355810, "author": "Robert Gould", "author_id": 15124, "author_profile": "https://Stackoverflow.com/users/15124", "pm_score": 5, "selected": true, "text": "<p>Seriously use Animals, it works great. And that's what nailed the concept for me years ago. Just found this C# code...
2008/12/10
[ "https://Stackoverflow.com/questions/355796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33468/" ]
My relative is studying programming and has a hard time understanding classes. He has trouble understanding for example that you need to instantiate it, that methods cannot access variables in other methods and if you change a variable in one instance of a class it doesn't change for other instances. I've tried to use...
Seriously use Animals, it works great. And that's what nailed the concept for me years ago. Just found this C# code. It seems good ``` // Assembly: Common Classes // Namespace: CommonClasses public interface IAnimal { string Name { get; } string Talk(); ...
355,802
<p>Is there some standard way or has anyone written something that allows you to log a message and have it be displayed either in a small scrolling section on the iphone screen or in a separate window in the iphone simulator?</p> <p>Update: For noobs like me and don't know, use the NSLog methods as decribed below and ...
[ { "answer_id": 355819, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>Use NSLog(@\"Log message\");</p>\n" }, { "answer_id": 355861, "author": "adam", "author_id": 33604, "au...
2008/12/10
[ "https://Stackoverflow.com/questions/355802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36510/" ]
Is there some standard way or has anyone written something that allows you to log a message and have it be displayed either in a small scrolling section on the iphone screen or in a separate window in the iphone simulator? Update: For noobs like me and don't know, use the NSLog methods as decribed below and make sure ...
The Objective-C (more correct, really) method is ``` NSLog(@"message"); ``` But the standard C method will work also ``` printf("message"); ```
355,813
<p>I've got some entities which have decimal properties on them. These entities' properties are displayed in multiple places throughout my UI.</p> <p>Currently I'm finding myself doing:</p> <pre><code>litWeight.Text = person.Weight.ToString("0.00"); </code></pre> <p>all over the place. Now I know for a fact that in ...
[ { "answer_id": 355852, "author": "Toni Ruža", "author_id": 6267, "author_profile": "https://Stackoverflow.com/users/6267", "pm_score": 3, "selected": true, "text": "<p>The simplest solution would be to make a utility class with static methods that appropriately format different types of ...
2008/12/10
[ "https://Stackoverflow.com/questions/355813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
I've got some entities which have decimal properties on them. These entities' properties are displayed in multiple places throughout my UI. Currently I'm finding myself doing: ``` litWeight.Text = person.Weight.ToString("0.00"); ``` all over the place. Now I know for a fact that in several instances, and am suspici...
The simplest solution would be to make a utility class with static methods that appropriately format different types of values and call them. For example: ``` litWeight.Text = Utility.FormatWeight(person.Weight); ```
355,816
<p>I am using a global named mutex for file access synchronization between an ASP.NET application and a console application.</p> <p>While running the ASP.NET application, the console application fails to acquire mutex - as expected. While running the console application, the ASP.NET application throws <code>Unauthoriz...
[ { "answer_id": 355829, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "<p>do you have the right user set up to access to the resources? using </p>\n\n<pre><code>MutexSecurity and MutexAccessRule ?\n...
2008/12/10
[ "https://Stackoverflow.com/questions/355816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19756/" ]
I am using a global named mutex for file access synchronization between an ASP.NET application and a console application. While running the ASP.NET application, the console application fails to acquire mutex - as expected. While running the console application, the ASP.NET application throws `UnauthorizedAccessExcepti...
do you have the right user set up to access to the resources? using ``` MutexSecurity and MutexAccessRule ? ``` try looking at this on MSDN <http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.mutexsecurity.aspx> and <http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.mutexacce...
355,818
<pre><code>ScalarQuery&lt;int&gt; query = new ScalarQuery&lt;int&gt;(typeof(Role), "select count(role.RoleId) from Role as role"); return query.Execute(); </code></pre> <p>It fails with the invalidcast exception but succeeds when count is replaced with max. </p>
[ { "answer_id": 355837, "author": "gcores", "author_id": 40256, "author_profile": "https://Stackoverflow.com/users/40256", "pm_score": 2, "selected": true, "text": "<p><strong>Edit</strong>: Some databases will return long for count queries. For example SQL Server.</p>\n\n<pre><code>Scala...
2008/12/10
[ "https://Stackoverflow.com/questions/355818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38807/" ]
``` ScalarQuery<int> query = new ScalarQuery<int>(typeof(Role), "select count(role.RoleId) from Role as role"); return query.Execute(); ``` It fails with the invalidcast exception but succeeds when count is replaced with max.
**Edit**: Some databases will return long for count queries. For example SQL Server. ``` ScalarQuery<long> query = new ScalarQuery<long>(typeof(Role), "select count(r) from Role r"); return query.Execute(); ```
355,830
<p>I would like to create a cache for my php pages on my site. I did find too many solutions but what I want is a script which can generate an HTML page from my database ex:</p> <p>I have a page for categories which grabs all the categories from the DB, so the script should be able to generate an HTML page of the sort...
[ { "answer_id": 355858, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 2, "selected": false, "text": "<p>I use <a href=\"http://uk3.php.net/apc\" rel=\"nofollow noreferrer\">APC</a> for all my PHP caching (on an Apache server)<...
2008/12/10
[ "https://Stackoverflow.com/questions/355830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would like to create a cache for my php pages on my site. I did find too many solutions but what I want is a script which can generate an HTML page from my database ex: I have a page for categories which grabs all the categories from the DB, so the script should be able to generate an HTML page of the sort: my-categ...
check ob\_start() function ``` ob_start(); echo 'some_output'; $content = ob_get_contents(); ob_end_clean(); echo 'Content generated :'.$content; ```
355,842
<p>I have the following HandleError filter on my controller:</p> <pre>[HandleError(ExceptionType = typeof(ArgumentException), View = "DestinationError")]</pre> <p>I've set-up the Web.Config so that customErrors are on. The problem I'm having is that the HandleError filter is working fine, when I run the app locally ...
[ { "answer_id": 355913, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>To answer my own question the magic is to turn off HTTP Errors in IIS. I'm not delighted in this workaround, so if anyone ...
2008/12/10
[ "https://Stackoverflow.com/questions/355842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following HandleError filter on my controller: ``` [HandleError(ExceptionType = typeof(ArgumentException), View = "DestinationError")] ``` I've set-up the Web.Config so that customErrors are on. The problem I'm having is that the HandleError filter is working fine, when I run the app locally out of Visual ...
To answer my own question the magic is to turn off HTTP Errors in IIS. I'm not delighted in this workaround, so if anyone has any better ideas, I'd love to hear them.
355,848
<p>How can I emulate classes (and namespaces) in JavaScript?</p> <p>I need to create a JavaScript library and have limited experience with the language. I always thought that it had native support for classes, but it is less related to Java than I had assumed. It seems that everything in JavaScript is actually a funct...
[ { "answer_id": 355878, "author": "mepcotterell", "author_id": 43312, "author_profile": "https://Stackoverflow.com/users/43312", "pm_score": 5, "selected": true, "text": "<ul>\n<li><a href=\"http://www.phpied.com/3-ways-to-define-a-javascript-class/\" rel=\"noreferrer\">3 ways to define a...
2008/12/10
[ "https://Stackoverflow.com/questions/355848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39277/" ]
How can I emulate classes (and namespaces) in JavaScript? I need to create a JavaScript library and have limited experience with the language. I always thought that it had native support for classes, but it is less related to Java than I had assumed. It seems that everything in JavaScript is actually a function. What...
* [3 ways to define a JavaScript class](http://www.phpied.com/3-ways-to-define-a-javascript-class/) * [Object-oriented JavaScript](http://www.xml.com/pub/a/2006/06/07/object-oriented-javascript.html) * [JavaScript Tutorial: Functions and Classes](http://www.webdevelopersjournal.com/articles/jsintro3/js_begin3.html)
355,865
<p>I have the following code, which is the core part of my small AJAX application. I am not getting any errors, it is just that nothing happens. I am guessing there is a more efficient way to do what I am trying to do.</p> <p>Here is the code:</p> <pre><code>var xmlHttp var layername function update(layer, part, pk...
[ { "answer_id": 355935, "author": "Stoo", "author_id": 27425, "author_profile": "https://Stackoverflow.com/users/27425", "pm_score": 1, "selected": false, "text": "<p>I'd check the HTML the PHP is generating. Assuming $pk is a string it looks like you're missing an opening quote. Try this...
2008/12/10
[ "https://Stackoverflow.com/questions/355865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have the following code, which is the core part of my small AJAX application. I am not getting any errors, it is just that nothing happens. I am guessing there is a more efficient way to do what I am trying to do. Here is the code: ``` var xmlHttp var layername function update(layer, part, pk, query) { if (part...
Looks like you may have some javascript errors: ``` if (part=="1") { $url "get_auction.php?cmd=GetAuctionData&pk="+pk+"&sid="+Math.random() } else if (part=="2") { var url "get_records.php?cmd=GetRecordSet&query="+query+"&sid="+Math.random() } ``` Use Firefox and Open the javascript console to get the javasc...
355,875
<p>I think I am having a mental block but can someone please enlighten me on how to combine these two LINQ statements into one? </p> <pre><code>/// &lt;summary&gt; /// Returns an array of Types that implement the supplied generic interface in the /// current AppDomain. /// &lt;/summary&gt; /// &lt;param name="interfac...
[ { "answer_id": 355936, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 1, "selected": false, "text": "<p>will this do:</p>\n\n<pre><code> public static Type[] GetTypesImplementingGenericInterface(Type interfaceType, bool inclu...
2008/12/10
[ "https://Stackoverflow.com/questions/355875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38041/" ]
I think I am having a mental block but can someone please enlighten me on how to combine these two LINQ statements into one? ``` /// <summary> /// Returns an array of Types that implement the supplied generic interface in the /// current AppDomain. /// </summary> /// <param name="interfaceType">Type of generic interf...
After a short discussion with Jon Skeet and a bit more thought, I have posted the following answer. I altered the method to utilise GetGenericTypeDefinition rather than FullName.Contains, this would be a more robust solution. I also altered the LINQ query Where clauses for IsAbstract and IsInterface as these did not ex...
355,879
<p>I have the following code:</p> <p><a href="http://www.nomorepasting.com/getpaste.php?pasteid=22615" rel="nofollow noreferrer">http://www.nomorepasting.com/getpaste.php?pasteid=22615</a></p> <p>Which is called by the javascript mentioned in <a href="https://stackoverflow.com/questions/355865/javascript-function-not...
[ { "answer_id": 356019, "author": "spelley", "author_id": 41654, "author_profile": "https://Stackoverflow.com/users/41654", "pm_score": 0, "selected": false, "text": "<p>In the code you linked to, I do not see where $searchString is declared? In the aforementioned PHP, I see these two sep...
2008/12/10
[ "https://Stackoverflow.com/questions/355879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have the following code: <http://www.nomorepasting.com/getpaste.php?pasteid=22615> Which is called by the javascript mentioned in [this question](https://stackoverflow.com/questions/355865/javascript-function-not-responsive): My problem is that I do not seem to be able to pass $query, as in nothing seemingly happe...
I think you want to replace this (line 36): ``` $rows = getRowsByArticleSearch($searchString, $table); ``` with this: ``` $rows = getRowsByArticleSearch($query, $table); ``` And for security concerns, the least you should do is the mysql\_real\_escape\_string stuff from spelley's post.
355,899
<pre><code> String fullName = PATH + "." + name; Class cl= Class.forName(fullName); if(name.equalsIgnoreCase("MobileSearch")){ if(msearchType==null){ msearchType=(SearchInterface)cl.newInstance(); } return msearchType; } if(name...
[ { "answer_id": 355922, "author": "Jacob Schoen", "author_id": 3340, "author_profile": "https://Stackoverflow.com/users/3340", "pm_score": 0, "selected": false, "text": "<p>Are you just returning an instance of a SearchInterface? If so why not:</p>\n\n<pre><code>String fullName = PATH + \...
2008/12/10
[ "https://Stackoverflow.com/questions/355899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` String fullName = PATH + "." + name; Class cl= Class.forName(fullName); if(name.equalsIgnoreCase("MobileSearch")){ if(msearchType==null){ msearchType=(SearchInterface)cl.newInstance(); } return msearchType; } if(name.equals...
Use a Map: ``` if (!searchInstances.containsKey(name)) { searchInstances.put( name, (SearchInterface)Class.forName(PATH + "." + name).newInstance() ); } return searchInstances.get(name); ```
355,907
<p>I'm aware that in Vim I can often repeat a command by simply adding a number in front of it. For example, one can delete 5 lines by:</p> <pre><code>5dd </code></pre> <p>It's also often possible to specify a range of lines to apply a command to, for example</p> <pre><code>:10,20s:hello:goodbye:gc </code></pre> <p...
[ { "answer_id": 355921, "author": "Svante", "author_id": 31615, "author_profile": "https://Stackoverflow.com/users/31615", "pm_score": 8, "selected": true, "text": "<p><code>:10,20s/^/,/</code></p>\n\n<p>Or use a macro, record with:</p>\n\n<p><code>q a i , ESC j h q</code></p>\n\n<p>use w...
2008/12/10
[ "https://Stackoverflow.com/questions/355907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37984/" ]
I'm aware that in Vim I can often repeat a command by simply adding a number in front of it. For example, one can delete 5 lines by: ``` 5dd ``` It's also often possible to specify a range of lines to apply a command to, for example ``` :10,20s:hello:goodbye:gc ``` How can I perform a 'vertical edit'? I'd like to...
`:10,20s/^/,/` Or use a macro, record with: `q a i , ESC j h q` use with: `@ a` Explanation: `q a` starts recording a macro to register `a`, `q` ends recording. There are registers `a` to `z` available for this.
355,933
<p>I have a ASP.NET project, in which I have a method with 10 local variables. This method calls about 10 other methods. 3 of the called methods need all the variables. Is it considered good practice to turn all those variables into global members, and then they don't have to passed as parameters?</p>
[ { "answer_id": 355941, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 2, "selected": false, "text": "<p>Well, it depends entirely on what you mean by \"global members\".</p>\n\n<p>If, considering you're writing an ASP....
2008/12/10
[ "https://Stackoverflow.com/questions/355933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/278/" ]
I have a ASP.NET project, in which I have a method with 10 local variables. This method calls about 10 other methods. 3 of the called methods need all the variables. Is it considered good practice to turn all those variables into global members, and then they don't have to passed as parameters?
create a structure instead and pass the structure instead of passing those 10 parameters Eg : ``` public struct user { public string FirstName; public string LastName; public string zilionotherproperties; public bool SearchByLastNameOnly; public datetime date1; } ```
355,937
<p>I have Widget.title, Widget.publish_ at, and Widget.unpublish_ at. It's a rails app with thinking_sphinx running, indexing once a night. I want to find all Widgets that have 'foo' in the title, and are published (publish _at &lt; Time.now, unpublish _at > Time.now). </p> <p>To get pagination to work properly, I rea...
[ { "answer_id": 356028, "author": "Michael", "author_id": 35500, "author_profile": "https://Stackoverflow.com/users/35500", "pm_score": 3, "selected": false, "text": "<p>Yep, easily possible, just make sure you're covering the times in your indexes:</p>\n\n<pre><code>class Widget &lt; Act...
2008/12/10
[ "https://Stackoverflow.com/questions/355937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18666/" ]
I have Widget.title, Widget.publish\_ at, and Widget.unpublish\_ at. It's a rails app with thinking\_sphinx running, indexing once a night. I want to find all Widgets that have 'foo' in the title, and are published (publish \_at < Time.now, unpublish \_at > Time.now). To get pagination to work properly, I really want...
Yep, easily possible, just make sure you're covering the times in your indexes: ``` class Widget < ActiveRecord::Base define_index do indexes title has publish_at has unpublish_at ... end ``` To pull it based purely off the dates, a small amount of trickery is required due to sphinx requiring a b...
355,945
<p>Is there a quick and nice way using linq?</p>
[ { "answer_id": 355977, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "<p>How about:</p>\n\n<pre><code>var most = list.GroupBy(i=&gt;i).OrderByDescending(grp=&gt;grp.Count())\n .Select...
2008/12/10
[ "https://Stackoverflow.com/questions/355945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there a quick and nice way using linq?
How about: ``` var most = list.GroupBy(i=>i).OrderByDescending(grp=>grp.Count()) .Select(grp=>grp.Key).First(); ``` or in query syntax: ``` var most = (from i in list group i by i into grp orderby grp.Count() descending select grp.Key).First(); ``` Of course, if you will ...
355,958
<p>i have little problem with boost::asio library. My app receive and process data asynchronously, it create threads and run io_service.run() on each of them.</p> <pre><code>boost::asio::io_service io; boost::thread_group thread_pool; ... int cpu_cnt = get_cpu_count(); for (int i = 0; i &lt; cpu_cnt; ++i) { thread...
[ { "answer_id": 356861, "author": "PiNoYBoY82", "author_id": 13646, "author_profile": "https://Stackoverflow.com/users/13646", "pm_score": 0, "selected": false, "text": "<p>I'm going to assume your io->run() does some sort of loop to wait for the asio to complete. I'm also going to assume...
2008/12/10
[ "https://Stackoverflow.com/questions/355958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42371/" ]
i have little problem with boost::asio library. My app receive and process data asynchronously, it create threads and run io\_service.run() on each of them. ``` boost::asio::io_service io; boost::thread_group thread_pool; ... int cpu_cnt = get_cpu_count(); for (int i = 0; i < cpu_cnt; ++i) { thread_pool.create_thr...
I may be wrong, but would the use an io\_service per thread solve your problem? Another idea: post `cpu_cnt` times `reply_to_supervisor` calls that use a little `sleep()` - not nice, but should work
355,967
<p>The following code calls the builtin functions for clz/ctz in GCC and, on other systems, has C versions. Obviously, the C versions are a bit suboptimal if the system has a builtin clz/ctz instruction, like x86 and ARM.</p> <pre><code>#ifdef __GNUC__ #define clz(x) __builtin_clz(x) #define ctz(x) __builtin_ctz(x) #...
[ { "answer_id": 356898, "author": "Ana Betts", "author_id": 5728, "author_profile": "https://Stackoverflow.com/users/5728", "pm_score": 0, "selected": false, "text": "<p>If MSVC has a compiler intrinsic for this, it'll be here:</p>\n\n<p><a href=\"https://msdn.microsoft.com/en-us/library/...
2008/12/10
[ "https://Stackoverflow.com/questions/355967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11206/" ]
The following code calls the builtin functions for clz/ctz in GCC and, on other systems, has C versions. Obviously, the C versions are a bit suboptimal if the system has a builtin clz/ctz instruction, like x86 and ARM. ``` #ifdef __GNUC__ #define clz(x) __builtin_clz(x) #define ctz(x) __builtin_ctz(x) #else static uin...
Bouncing from sh0dan code, the implementation should be corrected like this : ``` #ifdef _MSC_VER #include <intrin.h> uint32_t __inline ctz( uint32_t value ) { DWORD trailing_zero = 0; if ( _BitScanForward( &trailing_zero, value ) ) { return trailing_zero; } else { // This is ...
355,986
<p>How do we assign null value to int column in LINQ. eg.</p> <pre><code> SQLDBDataContext sqlD = new SQLDBDataContext(); var result = from p in sqlD.loadsRadius(Convert.ToInt32(Request["radius"]), ..... </code></pre> <p>here if Request["radius"] is null gives an error.</p> <p>I could pass 0 via this but I need to ...
[ { "answer_id": 356112, "author": "CodeChef", "author_id": 21786, "author_profile": "https://Stackoverflow.com/users/21786", "pm_score": 2, "selected": false, "text": "<p>If the exception is a FormatException, my guess is that the value returned by Request[\"radius\"] is actually the stri...
2008/12/10
[ "https://Stackoverflow.com/questions/355986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do we assign null value to int column in LINQ. eg. ``` SQLDBDataContext sqlD = new SQLDBDataContext(); var result = from p in sqlD.loadsRadius(Convert.ToInt32(Request["radius"]), ..... ``` here if Request["radius"] is null gives an error. I could pass 0 via this but I need to change in many already existing p...
If the exception is a FormatException, my guess is that the value returned by Request["radius"] is actually the string "null". If Request["radius"] actually returned null, Convert.ToInt32() would return zero. You may try using using int.TryParse() to avoid the exception.
355,988
<p>I'm trying to do this:</p> <pre><code>cmd.exe /C "C:\Program Files\Somewhere\SomeProgram.exe" &gt; "C:\temp\Folder Containing Spaces\SomeProgram.out" </code></pre> <p>However, I have problems which are down to the way cmd.exe works. If you read the help for it, it handles " characters in a special way. See the hel...
[ { "answer_id": 356014, "author": "Scott Langham", "author_id": 11898, "author_profile": "https://Stackoverflow.com/users/11898", "pm_score": 8, "selected": true, "text": "<p>Ah. doh. Think I've answered my own question.</p>\n\n<p>If you use /S, and wrap the whole thing in quotes, it just...
2008/12/10
[ "https://Stackoverflow.com/questions/355988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11898/" ]
I'm trying to do this: ``` cmd.exe /C "C:\Program Files\Somewhere\SomeProgram.exe" > "C:\temp\Folder Containing Spaces\SomeProgram.out" ``` However, I have problems which are down to the way cmd.exe works. If you read the help for it, it handles " characters in a special way. See the help at the end of question. So,...
Ah. doh. Think I've answered my own question. If you use /S, and wrap the whole thing in quotes, it just removes those outer quotes. ``` cmd.exe /S /C " do what you like here, quotes within the outermost quotes will be preserved " ```
356,000
<p>I'd like to drop a user in a SQL Server script but I'll need to test for existence first or I'll get script errors. When dropping tables or stored procs, I check the sysobjects table like so:</p> <pre><code>IF EXISTS ( SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[up_SetMedOptions]') ...
[ { "answer_id": 356021, "author": "edosoft", "author_id": 6399, "author_profile": "https://Stackoverflow.com/users/6399", "pm_score": 2, "selected": false, "text": "<p>In SQL 2005:</p>\n\n<pre><code>select * from sys.sysusers\n</code></pre>\n\n<p>In SQL 2000:</p>\n\n<pre><code>select * fr...
2008/12/10
[ "https://Stackoverflow.com/questions/356000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15592/" ]
I'd like to drop a user in a SQL Server script but I'll need to test for existence first or I'll get script errors. When dropping tables or stored procs, I check the sysobjects table like so: ``` IF EXISTS ( SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[up_SetMedOptions]') AND OBJECTP...
SSMS scripts it in the following way: For SQL 2005/2008 and later: ``` IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'username') DROP USER [username] ``` For SQL 2000: ``` IF EXISTS (SELECT * FROM dbo.sysusers WHERE name = N'username') EXEC dbo.sp_revokedbaccess N'username' ```
356,002
<p>So I'm trying to get rid of my std::vector's by using boost::ptr_vector. Now I'm trying to remove an element from one, and have the removed element deleted as well. The most obvious thing to me was to do:</p> <pre><code>class A { int m; }; boost::ptr_vector&lt;A&gt; vec; A* a = new A; vec.push_back(a); vec.erase(a...
[ { "answer_id": 356016, "author": "Evgeny Lazin", "author_id": 42371, "author_profile": "https://Stackoverflow.com/users/42371", "pm_score": 1, "selected": false, "text": "<p>You can use erase_if template method.</p>\n\n<pre><code>vec.erase_if( predicate() );\n</code></pre>\n" }, { ...
2008/12/10
[ "https://Stackoverflow.com/questions/356002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11449/" ]
So I'm trying to get rid of my std::vector's by using boost::ptr\_vector. Now I'm trying to remove an element from one, and have the removed element deleted as well. The most obvious thing to me was to do: ``` class A { int m; }; boost::ptr_vector<A> vec; A* a = new A; vec.push_back(a); vec.erase(a); ``` But this w...
Well you can do that with a std::vector either. In both cases erase takes an iterator as a parameter. So before you can erase something from a vector (or a ptr\_vector) you need to locate it. Also note that the ptr\_vector treats its content as if you have stored an object not a pointer. So any searching is done v...
356,004
<p>Is it possible to have a singleton in a factory method? I have many domains using the factory method. How do I work around with this. Please help me with an example.</p>
[ { "answer_id": 356018, "author": "mepcotterell", "author_id": 43312, "author_profile": "https://Stackoverflow.com/users/43312", "pm_score": 2, "selected": false, "text": "<p>\"...create an interface for objects that create instances of the Singleton class. This is essentially a combinati...
2008/12/10
[ "https://Stackoverflow.com/questions/356004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to have a singleton in a factory method? I have many domains using the factory method. How do I work around with this. Please help me with an example.
In this example, I believe you would want to synchronize your getInstance() method to ensure two threads do not simultaneously enter it. Otherwise two threads can end up inside the block where the singleton is instantiated which is very problematic. The only issue with this solution is you pay a premium for the synchro...
356,035
<p>I have a 2D area with "dots" distributed on this area. I now am trying to detect "clusters" of dots, that is, areas with a certain high density of dots.</p> <p>Any thoughts on (or links to articles with thoughts on) how to elegantly detect these areas?</p>
[ { "answer_id": 356042, "author": "mepcotterell", "author_id": 43312, "author_profile": "https://Stackoverflow.com/users/43312", "pm_score": 3, "selected": false, "text": "<p>You could try creating a <a href=\"http://en.wikipedia.org/wiki/Quadtree\" rel=\"noreferrer\">Quadtree</a> represe...
2008/12/10
[ "https://Stackoverflow.com/questions/356035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I have a 2D area with "dots" distributed on this area. I now am trying to detect "clusters" of dots, that is, areas with a certain high density of dots. Any thoughts on (or links to articles with thoughts on) how to elegantly detect these areas?
How about defining an arbitrary resolution for your space, and calculate for each point in that matrix, a measure of the distance from that point to all dots, then you could make a "heat graph" and use a threshold to define the clusters. It's a nice exercise for processing, maybe later I will post a solution. EDIT: ...
356,039
<p>For a stylesheet I'm writing (actually for a set of them, each generating a different output format), I have the need to evaluate whether a certain value is present in a list of values. In this case, the value being tested is taken from an element's attribute. The list it is to be tested against comes from the invoc...
[ { "answer_id": 356077, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": false, "text": "<p>Actually, using XPath string functions is the right way to do it. All you have to make sure is that you test for the de...
2008/12/10
[ "https://Stackoverflow.com/questions/356039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6421/" ]
For a stylesheet I'm writing (actually for a set of them, each generating a different output format), I have the need to evaluate whether a certain value is present in a list of values. In this case, the value being tested is taken from an element's attribute. The list it is to be tested against comes from the invocati...
Actually, using XPath string functions is the right way to do it. All you have to make sure is that you test for the delimiters as well: ``` contains(concat(',' $list, ','), concat(',', $value, ',')) ``` would return a Boolean value. Or you might use one of these: ``` substring-before(concat('|,' $list, ',|'), conc...
356,060
<p>I have using the following code for developing tabs.</p> <pre><code>$(document).ready(function() { $('#container-1').tabs(); } .... &lt;div id="container-1"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#fragment-1"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#fragmen...
[ { "answer_id": 356136, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 0, "selected": false, "text": "<p>If you want the tab click event, you would do something like one of the following.</p>\n\n<pre><code>$(\"#tabid\").click(f...
2008/12/10
[ "https://Stackoverflow.com/questions/356060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I have using the following code for developing tabs. ``` $(document).ready(function() { $('#container-1').tabs(); } .... <div id="container-1"> <ul> <li><a href="#fragment-1"><span>Home</span></a></li> <li><a href="#fragment-2"><span>Contact</span></a></li> </ul> </div> ... ``` It works...
Personally, I'd handle it all in the tab configuration itself rather than adding click events to the elements which ultimately will be the clickable part of the tab. If you do it via the tab config, then all of your tab logic is centralized thus making things cleaner and you don't need to be familiar with the implement...
356,090
<p>I need a way to compute the nth root of a long integer in Python. </p> <p>I tried <code>pow(m, 1.0/n)</code>, but it doesn't work:</p> <blockquote> <p>OverflowError: long int too large to convert to float</p> </blockquote> <p>Any ideas?</p> <p>By long integer I mean REALLY long integers like:</p> <blockquote>...
[ { "answer_id": 356102, "author": "Manuel Ferreria", "author_id": 4749, "author_profile": "https://Stackoverflow.com/users/4749", "pm_score": -1, "selected": false, "text": "<p>Try converting the exponent to a floating number, as the default behaviour of / in Python is integer division</p...
2008/12/10
[ "https://Stackoverflow.com/questions/356090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44988/" ]
I need a way to compute the nth root of a long integer in Python. I tried `pow(m, 1.0/n)`, but it doesn't work: > > OverflowError: long int too large to convert to float > > > Any ideas? By long integer I mean REALLY long integers like: > > 11968003966030964356885611480383408833172346450467339251 > 19609314...
You can make it run slightly faster by avoiding the while loops in favor of setting low to 10 \*\* (len(str(x)) / n) and high to low \* 10. Probably better is to replace the len(str(x)) with the bitwise length and using a bit shift. Based on my tests, I estimate a 5% speedup from the first and a 25% speedup from the se...
356,100
<p>How to wait in a bash script for several subprocesses spawned from that script to finish, and then return exit code <code>!=0</code> when any of the subprocesses ends with code <code>!=0</code>?</p> <p>Simple script:</p> <pre><code>#!/bin/bash for i in `seq 0 9`; do doCalculations $i &amp; done wait </code></pre> ...
[ { "answer_id": 356154, "author": "Luca Tettamanti", "author_id": 42448, "author_profile": "https://Stackoverflow.com/users/42448", "pm_score": 10, "selected": true, "text": "<p><a href=\"https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html#index-wait\" rel=\"noref...
2008/12/10
[ "https://Stackoverflow.com/questions/356100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42201/" ]
How to wait in a bash script for several subprocesses spawned from that script to finish, and then return exit code `!=0` when any of the subprocesses ends with code `!=0`? Simple script: ``` #!/bin/bash for i in `seq 0 9`; do doCalculations $i & done wait ``` The above script will wait for all 10 spawned subproc...
[`wait`](https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html#index-wait) also (optionally) takes the `PID` of the process to wait for, and with `$!` you get the `PID` of the last command launched in the background. Modify the loop to store the `PID` of each spawned sub-process into an array, an...
356,121
<p>I want to refactor this mumbo jumbo of a method to make it more readible, it has way to many nested IF's for my liking.</p> <p>How would you refactor this?</p> <pre><code>public static void HandleUploadedFile(string filename) { try { if(IsValidFileFormat(filename) { int folderID = GetFolderIDFrom...
[ { "answer_id": 356141, "author": "Jordan Parmer", "author_id": 20133, "author_profile": "https://Stackoverflow.com/users/20133", "pm_score": 1, "selected": false, "text": "<p>One possible approach is to have single if statements that check for when the condition isn't true. Have a retur...
2008/12/10
[ "https://Stackoverflow.com/questions/356121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
I want to refactor this mumbo jumbo of a method to make it more readible, it has way to many nested IF's for my liking. How would you refactor this? ``` public static void HandleUploadedFile(string filename) { try { if(IsValidFileFormat(filename) { int folderID = GetFolderIDFromFilename(filename); ...
I would reverse the conditions in the test to *if bad then deleteAndLog* as the example below. This prevent nesting and puts the action near the test. ``` try{ if(IsValidFileFormat(filename) == false){ DeleteFile(filename); LogError("invalid file format"); return; } int folderID = ...
356,122
<p>I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let's call it SDK.dll) depends on other DLLs in order to be loaded.</p> <p>When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens...
[ { "answer_id": 356142, "author": "Oliver Friedrich", "author_id": 44532, "author_profile": "https://Stackoverflow.com/users/44532", "pm_score": 0, "selected": false, "text": "<p>to register your assembly in GAC it must have be signed with a <a href=\"http://msdn.microsoft.com/en-us/libra...
2008/12/10
[ "https://Stackoverflow.com/questions/356122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12818/" ]
I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let's call it SDK.dll) depends on other DLLs in order to be loaded. When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens because a...
You can handle this at runtime by subscribing to this event: ``` AppDomain.CurrentDomain.AssemblyResolve ``` It's fired when the runtime fails to resolve an assembly. In your event handler method, write your logic to find the assembly and load it using Assembly.LoadFrom(). It would look something like this: ``` pub...
356,126
<p>I am getting 'trailing whitespace' errors trying to commit some files in Git.</p> <p>I want to remove these trailing whitespace characters automatically right before I save Python files.</p> <p>Can you configure Vim to do this? If so, how?</p>
[ { "answer_id": 356130, "author": "Paul D. Eden", "author_id": 3045, "author_profile": "https://Stackoverflow.com/users/3045", "pm_score": 9, "selected": true, "text": "<p>I found the answer <a href=\"https://vim.fandom.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_w...
2008/12/10
[ "https://Stackoverflow.com/questions/356126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3045/" ]
I am getting 'trailing whitespace' errors trying to commit some files in Git. I want to remove these trailing whitespace characters automatically right before I save Python files. Can you configure Vim to do this? If so, how?
I found the answer [here](https://vim.fandom.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_whitespace). Adding the following to my .vimrc file did the trick: ```vim autocmd BufWritePre *.py :%s/\s\+$//e ``` The `e` flag at the end means that the command doesn't issue an error message if the se...
356,128
<p>If I have several classes with functions that I need but want to store separately for organisation, can I extend a class to have both?</p> <p>i.e. <code>class a extends b extends c</code></p> <p>edit: I know how to extend classes one at a time, but I'm looking for a method to instantly extend a class using multipl...
[ { "answer_id": 356153, "author": "Tader", "author_id": 30700, "author_profile": "https://Stackoverflow.com/users/30700", "pm_score": 0, "selected": false, "text": "<p>PHP does not yet support multiple class inheritance, it does however support multiple interface inheritance.</p>\n\n<p>Se...
2008/12/10
[ "https://Stackoverflow.com/questions/356128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24416/" ]
If I have several classes with functions that I need but want to store separately for organisation, can I extend a class to have both? i.e. `class a extends b extends c` edit: I know how to extend classes one at a time, but I'm looking for a method to instantly extend a class using multiple base classes - AFAIK you c...
If you really want to fake multiple inheritance in PHP 5.3, you can use the magic function \_\_call(). This is ugly though it works from class A user's point of view : ``` class B { public function method_from_b($s) { echo $s; } } class C { public function method_from_c($s) { echo $s; ...
356,138
<p>I'm having a very peculiar problem in my Python FastCGI code - sys.stdout has a file descriptor of '-1', so I can't write to it. I'm checking this at the first line of my program, so I know it's not any of my code changing it.</p> <p>I've tried <code>sys.stdout = os.fdopen(1, 'w')</code>, but anything written there...
[ { "answer_id": 359330, "author": "Jason Baker", "author_id": 2147, "author_profile": "https://Stackoverflow.com/users/2147", "pm_score": 1, "selected": false, "text": "<p>Forgive me if this is a dumb question, but I notice this line in your config file:</p>\n\n<blockquote>\n <p>Argument...
2008/12/10
[ "https://Stackoverflow.com/questions/356138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44992/" ]
I'm having a very peculiar problem in my Python FastCGI code - sys.stdout has a file descriptor of '-1', so I can't write to it. I'm checking this at the first line of my program, so I know it's not any of my code changing it. I've tried `sys.stdout = os.fdopen(1, 'w')`, but anything written there won't get to my brow...
Forgive me if this is a dumb question, but I notice this line in your config file: > > Arguments=-u C:\app\app\_wsgi.py > > > Are you running a WSGI application or a FastCGI app? There *is* a difference. In WSGI, writing to stdout isn't a good idea. Your program should have an application object that can be calle...
356,144
<p>I want to use the GridView mode of a ListView to display a set of data that my program will be receiving from an external source. The data will consist of two arrays, one of column names and one of strings values to populate the control.</p> <p>I don't see how to create a suitable class that I can use as the Item ...
[ { "answer_id": 357306, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 5, "selected": true, "text": "<p>You can add GridViewColumns to the GridView dynamically given the first array using a method like this:</p>\n\n<pr...
2008/12/10
[ "https://Stackoverflow.com/questions/356144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7989/" ]
I want to use the GridView mode of a ListView to display a set of data that my program will be receiving from an external source. The data will consist of two arrays, one of column names and one of strings values to populate the control. I don't see how to create a suitable class that I can use as the Item in a ListVi...
You can add GridViewColumns to the GridView dynamically given the first array using a method like this: ``` private void AddColumns(GridView gv, string[] columnNames) { for (int i = 0; i < columnNames.Length; i++) { gv.Columns.Add(new GridViewColumn { Header = columnNames[i], ...
356,164
<p>Image i have a view that is cached with the OutputCache attribute but i still need to increment a counter that records that the page has been viewed, how could i do it?</p> <p>I thought about creating my own Custom ActionFilterAttribute, and using Action Filter Order of Execution to record this .. but i'm not sure ...
[ { "answer_id": 356212, "author": "PhilPursglove", "author_id": 1738, "author_profile": "https://Stackoverflow.com/users/1738", "pm_score": 0, "selected": false, "text": "<p>I don't know about the MVC side but if I was doing this in WebForms this sounds like it would be a candidate for <a...
2008/12/10
[ "https://Stackoverflow.com/questions/356164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30674/" ]
Image i have a view that is cached with the OutputCache attribute but i still need to increment a counter that records that the page has been viewed, how could i do it? I thought about creating my own Custom ActionFilterAttribute, and using Action Filter Order of Execution to record this .. but i'm not sure it will wo...
Well, you have a few options. Donut caching ------------- One server-side option is 'Donut caching'. **Donut caching** allows most of the page to be cached, and portions of the page to be not cached (the hole in the middle of the donut). Donut caching [is described here](http://haacked.com/archive/2008/11/05/donut-c...
356,174
<p><strong>Dup of <a href="https://stackoverflow.com/questions/330709/some-basic-php-questions#330829">Some Basic PHP Questions</a></strong></p> <p>Hello,</p> <p>I have a heap of tinyint fields in a mysql database I need to show with PHP. At the moment I am doing something like this:</p> <pre><code>if ($row['PAYPAL_...
[ { "answer_id": 356182, "author": "lpfavreau", "author_id": 35935, "author_profile": "https://Stackoverflow.com/users/35935", "pm_score": 2, "selected": false, "text": "<p>Try if you want:</p>\n\n<pre><code>$paypal = $row['PAYPAL_ACCEPT'] ? 'YES' : 'NO';\n</code></pre>\n" }, { "an...
2008/12/10
[ "https://Stackoverflow.com/questions/356174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
**Dup of [Some Basic PHP Questions](https://stackoverflow.com/questions/330709/some-basic-php-questions#330829)** Hello, I have a heap of tinyint fields in a mysql database I need to show with PHP. At the moment I am doing something like this: ``` if ($row['PAYPAL_ACCEPT'] == "1"){ $paypal = "Yes"; else $paypal =...
Building on what's already been suggested: ``` // $columns = string array of column names // $columns = array('PAYPAL_ACCEPT' ... ); foreach($columns as $column) { $$column = $row[$column] ? 'YES' : 'NO'; } ``` then you can access variables using the column names as variable names: ``` print $PAYPAL_ACCEPT; ```
356,180
<p>Suppose to feed the filter standard input with these line:</p> <pre><code>line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 </code></pre> <p>It would be nicer if someone tell me how to write a script that prints only every 4 lines, in the case of the example input above:</p> <pre><code>line...
[ { "answer_id": 356198, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 5, "selected": true, "text": "<pre><code>$ yes | cat -n | head -10 | awk 'NR % 4 == 1'\n 1 y\n 5 y\n 9 y\n</code></pre>\n\n<p>That is, your an...
2008/12/10
[ "https://Stackoverflow.com/questions/356180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36131/" ]
Suppose to feed the filter standard input with these line: ``` line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 ``` It would be nicer if someone tell me how to write a script that prints only every 4 lines, in the case of the example input above: ``` line 1 line 5 line 9 ```
``` $ yes | cat -n | head -10 | awk 'NR % 4 == 1' 1 y 5 y 9 y ``` That is, your answer is "`awk 'NR % 4 == 1'`".
356,194
<p>I know that I can make a setter that checks to see if a value is NULL and do something. Example:</p> <pre><code>&lt;TextBlock&gt; &lt;TextBlock.Style&gt; &lt;Style&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding SomeField}" Value="{x:Null}"&gt; &lt;Setter Property="TextBlo...
[ { "answer_id": 356681, "author": "J c", "author_id": 25837, "author_profile": "https://Stackoverflow.com/users/25837", "pm_score": 6, "selected": true, "text": "<p>I ran into a similar limitation with DataTriggers, and it would seem that you can only check for equality. The closest thing...
2008/12/10
[ "https://Stackoverflow.com/questions/356194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11917/" ]
I know that I can make a setter that checks to see if a value is NULL and do something. Example: ``` <TextBlock> <TextBlock.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding SomeField}" Value="{x:Null}"> <Setter Property="TextBlock.Text" Value="It's NULL Baby!" /> </D...
I ran into a similar limitation with DataTriggers, and it would seem that you can only check for equality. The closest thing I've seen that might help you is a technique for doing other types of comparisons other than equality. [This blog post](http://blogs.msdn.com/mikehillberg/archive/2008/09/30/ComparableDataTrigge...
356,217
<p>I keep seeing code that does checks like this</p> <pre><code>if (IsGood == false) { DoSomething(); } </code></pre> <p>or this</p> <pre><code>if (IsGood == true) { DoSomething(); } </code></pre> <p>I hate this syntax, and always use the following syntax.</p> <pre><code>if (IsGood) { DoSomething(); } </c...
[ { "answer_id": 356223, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 2, "selected": false, "text": "<p>I prefer <code>!IsGood</code> because to me, it is more clear and consise. Checking if a <code>boolean == true</code> is redundan...
2008/12/10
[ "https://Stackoverflow.com/questions/356217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23855/" ]
I keep seeing code that does checks like this ``` if (IsGood == false) { DoSomething(); } ``` or this ``` if (IsGood == true) { DoSomething(); } ``` I hate this syntax, and always use the following syntax. ``` if (IsGood) { DoSomething(); } ``` or ``` if (!IsGood) { DoSomething(); } ``` Is there...
I follow the same syntax as you, it's less verbose. People (more beginner) prefer to use `== true` just to be sure that it's what they want. They are used to use operator in their conditional... they found it more readable. But once you got more advanced, you found it irritating because it's too verbose.
356,219
<p>Suppose you need to run a program on the world’s fastest supercomputer which will take 10 years to complete. You could:</p> <ul> <li>Spend $250M now</li> <li>Program for 9 years, <a href="http://en.wikipedia.org/wiki/Moore%27s_Law" rel="nofollow noreferrer">Moore’s law</a> speedup (4,000x faster), spend $1M in 10ye...
[ { "answer_id": 356249, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 0, "selected": false, "text": "<p>But Moore's law does not speed up programming. </p>\n\n<p>9 years of programming will never be condensed into 2 weeks.</p>...
2008/12/10
[ "https://Stackoverflow.com/questions/356219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
Suppose you need to run a program on the world’s fastest supercomputer which will take 10 years to complete. You could: * Spend $250M now * Program for 9 years, [Moore’s law](http://en.wikipedia.org/wiki/Moore%27s_Law) speedup (4,000x faster), spend $1M in 10years, complete in 2 weeks. **What is the optimum strategy?...
**Assuming** the program is infinitely parallelizable (so it can always take advantage of all cores of all CPUs available)... **Assuming** the program cannot be paused and moved to a different machine in mid-run... **Assuming** time is the only issue (maybe we have a big research grant and we always use the best ...
356,243
<p>What I want to do is basically this: on <strong>ONE</strong> page, my customers can click a <strong>VIEW CART</strong> link and the contents of their cart shows below on that same page. Here is my basic link form:</p> <pre><code> &lt;FORM METHOD=post ACTION="http://www.123websiteservices.com/cgi-bin/cybercart.pl"&g...
[ { "answer_id": 356272, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 1, "selected": false, "text": "<p>This should get you started on how to show the cart when the viewcart.gif has been clicked.</p>\n\n<pre><code>&l...
2008/12/10
[ "https://Stackoverflow.com/questions/356243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45002/" ]
What I want to do is basically this: on **ONE** page, my customers can click a **VIEW CART** link and the contents of their cart shows below on that same page. Here is my basic link form: ``` <FORM METHOD=post ACTION="http://www.123websiteservices.com/cgi-bin/cybercart.pl"> <INPUT TYPE=hidden NAME=merchant VALUE="je...
This should get you started on how to show the cart when the viewcart.gif has been clicked. ``` < script> function ShowScript() { // Do Your Show cart stuff here return false } < /script> ... < input type="image" src="viewcart.gif" onClick="return ShowScript();" /> ```
356,294
<p>Say you have a class who's job it is to connect to a remote server. I want to abstract this class to provide two versions, one that connects through UDP and the other through TCP. I want to build the leanest runtime code possible and instead of using polymorphism I am considering templates. Here is what I'm envision...
[ { "answer_id": 356318, "author": "Edouard A.", "author_id": 41363, "author_profile": "https://Stackoverflow.com/users/41363", "pm_score": 2, "selected": false, "text": "<p>I would use the curious recuring template pattern, aka Five Point Palm Exploding Alexandrescu Technique:</p>\n\n<pre...
2008/12/10
[ "https://Stackoverflow.com/questions/356294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44996/" ]
Say you have a class who's job it is to connect to a remote server. I want to abstract this class to provide two versions, one that connects through UDP and the other through TCP. I want to build the leanest runtime code possible and instead of using polymorphism I am considering templates. Here is what I'm envisioning...
This can be best done using a policy for the transport protocol: ``` template<typename Transport> class service : Transport { public: typedef Transport transport_type; // common code void do_something() { this->send(....); } }; class tcp { public: void send(....) { } }; class udp {...
356,297
<p>I've read a lot of comments mention in passing that the BlackBerry threading model deviates from the Java standard and can cause issues, but no amount of googling has enlightened me on what this means exactly.</p> <p>I've been developing a fairly large business application for the BlackBerry and, although I don't r...
[ { "answer_id": 364003, "author": "Richard", "author_id": 7740, "author_profile": "https://Stackoverflow.com/users/7740", "pm_score": 0, "selected": false, "text": "<p>The only issue I can think of is discussed in the answer to <a href=\"https://stackoverflow.com/questions/292587/interact...
2008/12/10
[ "https://Stackoverflow.com/questions/356297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/270/" ]
I've read a lot of comments mention in passing that the BlackBerry threading model deviates from the Java standard and can cause issues, but no amount of googling has enlightened me on what this means exactly. I've been developing a fairly large business application for the BlackBerry and, although I don't really have...
1.UI User interface operations **always** need to run in the UI thread. To execute such functions like `LabelField.setText("foo");` you need to do: ``` UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ myLabelField.setText("foo"); myLabelField.setDirty(true); } }); ``` Prett...
356,298
<p>I am using GWT (Google Web Toolkit) 1.5.3 et GXT (ExtJS) 1.2 I just want to create a simple form with some radio buttons generated after a RPC call, to get some values</p> <p>Code:</p> <pre><code>final FormPanel simple = new FormPanel(); simple.setFrame(true); simple.setWidth(350); simple.s...
[ { "answer_id": 356859, "author": "user18714", "author_id": 18714, "author_profile": "https://Stackoverflow.com/users/18714", "pm_score": 0, "selected": false, "text": "<p>Using radioButton.setItemId() and getItemId() resolve it.</p>\n" }, { "answer_id": 1687944, "author": "us...
2008/12/10
[ "https://Stackoverflow.com/questions/356298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18714/" ]
I am using GWT (Google Web Toolkit) 1.5.3 et GXT (ExtJS) 1.2 I just want to create a simple form with some radio buttons generated after a RPC call, to get some values Code: ``` final FormPanel simple = new FormPanel(); simple.setFrame(true); simple.setWidth(350); simple.setHeaderVisible(false...
Create radio ``` Radio radio = new Radio(); radio.setBoxLabel("Si"); radio.setValue(true); radio.setValueAttribute("true"); Radio radio2 = new Radio(); radio2.setBoxLabel("No"); radio2.setValueAttribute("false"); RadioGroup radioGroup = new RadioGroup(); radioGroup.setFieldLabel("Afecto"); radioGroup.add(r...