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
229,765
<p>In cleaning up <a href="https://stackoverflow.com/questions/229447/how-to-create-a-two-sided-unique-index-on-two-fields#229521">this answer</a> I learnt a bit about <code>TRIGGER</code>s and stored procedures in MySQL, but was stunned that, while <code>BEFORE INSERT</code> and <code>BEFORE UPDATE</code> triggers cou...
[ { "answer_id": 229802, "author": "Esteban Brenes", "author_id": 14177, "author_profile": "https://Stackoverflow.com/users/14177", "pm_score": 5, "selected": true, "text": "<p>From this <a href=\"https://web.archive.org/web/20180330233216/http://www.brokenbuild.com/blog/2006/08/15/mysql-t...
2008/10/23
[ "https://Stackoverflow.com/questions/229765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
In cleaning up [this answer](https://stackoverflow.com/questions/229447/how-to-create-a-two-sided-unique-index-on-two-fields#229521) I learnt a bit about `TRIGGER`s and stored procedures in MySQL, but was stunned that, while `BEFORE INSERT` and `BEFORE UPDATE` triggers could modify data, they seemingly couldn't cause t...
From this [blog post](https://web.archive.org/web/20180330233216/http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/) > > MySQL Triggers: How do you abort an INSERT, UPDATE or DELETE with a > trigger? On EfNet’s #mysql someone > asked: > > > *How d...
229,824
<p>Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005?</p> <p>I don't want to use a CLR procedure or function. Just straight TSQL.</p> <p>Has anybody tackled this already?</p>
[ { "answer_id": 229955, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 7, "selected": true, "text": "<p><em>Very</em> basic would be:</p>\n\n<pre><code>SELECT\n EmailAddress, \n CASE WHEN EmailAddress LIKE '%_@_%_.__%' \n ...
2008/10/23
[ "https://Stackoverflow.com/questions/229824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219/" ]
Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005? I don't want to use a CLR procedure or function. Just straight TSQL. Has anybody tackled this already?
*Very* basic would be: ``` SELECT EmailAddress, CASE WHEN EmailAddress LIKE '%_@_%_.__%' AND EmailAddress NOT LIKE '%[any obviously invalid characters]%' THEN 'Could be' ELSE 'Nope' END Validates FROM Table ``` This matches everything with an @ in the middle, preceded by at least one ch...
229,851
<p>Is there a way to unlock Windows files without downloading a utility?</p> <p>I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message:</p> <pre> Cannot delete FILENAME.zip: It is being used by another person or program Close any...
[ { "answer_id": 229859, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 1, "selected": false, "text": "<p>If you reboot and the files are still locked, then there is some process on your machine that <strong>is</strong> still u...
2008/10/23
[ "https://Stackoverflow.com/questions/229851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8344/" ]
Is there a way to unlock Windows files without downloading a utility? I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message: ``` Cannot delete FILENAME.zip: It is being used by another person or program Close any programs that m...
I've successfully used Process Explorer to find out which process has the file open. It saves a reboot that may not fix the problem anyway. In process explorer: Find > Handle or DLL... then search for the name of the folder/file, then double click one of the search results. It'll select a handle in the main window, wh...
229,856
<p>What is the best way to save enums into a database?</p> <p>I know Java provides <code>name()</code> and <code>valueOf()</code> methods to convert enum values into a String and back. But are there any other (flexible) options to store these values?</p> <p>Is there a smart way to make enums into unique numbers (<code>...
[ { "answer_id": 229902, "author": "oxbow_lakes", "author_id": 16853, "author_profile": "https://Stackoverflow.com/users/16853", "pm_score": 3, "selected": false, "text": "<p>I would argue that the only safe mechanism here is to use the String <code>name()</code> value. When writing to the...
2008/10/23
[ "https://Stackoverflow.com/questions/229856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20298/" ]
What is the best way to save enums into a database? I know Java provides `name()` and `valueOf()` methods to convert enum values into a String and back. But are there any other (flexible) options to store these values? Is there a smart way to make enums into unique numbers (`ordinal()` is not safe to use)? #### Upda...
We *never* store enumerations as numerical ordinal values anymore; it makes debugging and support way too difficult. We store the actual enumeration value converted to string: ``` public enum Suit { Spade, Heart, Diamond, Club } Suit theSuit = Suit.Heart; szQuery = "INSERT INTO Customers (Name, Suit) " + "...
229,865
<p>I have some simple .doc files I made in Word 2007 where I changed the text color and used highlights to compare some similar texts. What I'd like to do is change any instances of green text or gray highlighting to different respective colors for each.</p> <p>I'm sure there is a simple way to do this with VBA but an...
[ { "answer_id": 230305, "author": "buti-oxa", "author_id": 2515, "author_profile": "https://Stackoverflow.com/users/2515", "pm_score": 1, "selected": false, "text": "<p>You can always save the file as HTML, and replace colors there. Color is represented with </p>\n\n<pre><code>&lt;span st...
2008/10/23
[ "https://Stackoverflow.com/questions/229865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25680/" ]
I have some simple .doc files I made in Word 2007 where I changed the text color and used highlights to compare some similar texts. What I'd like to do is change any instances of green text or gray highlighting to different respective colors for each. I'm sure there is a simple way to do this with VBA but any other so...
This is not from 2007, but the idea should suit. This example changes any current highlight to the new default highlight (wdBrightGreen) and any green text to red. ``` Sub ChangeColor Options.DefaultHighlightColorIndex = wdBrightGreen Selection.Find.ClearFormatting Selection.Find.Highlight = True Selectio...
229,870
<p>I have a gridview containing some data from db, and after a check I want to see a small cross/tick image in each row, due to the result of the check.How can I change the image url dynamically? </p>
[ { "answer_id": 251638, "author": "gfrizzle", "author_id": 23935, "author_profile": "https://Stackoverflow.com/users/23935", "pm_score": 0, "selected": false, "text": "<pre><code>&lt;Columns&gt;\n &lt;asp:TemplateField&gt;\n &lt;ItemTemplate&gt;\n &lt;asp:Image ID=\"c...
2008/10/23
[ "https://Stackoverflow.com/questions/229870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a gridview containing some data from db, and after a check I want to see a small cross/tick image in each row, due to the result of the check.How can I change the image url dynamically?
You could either use inline statement like `<%#Eval("check").ToString() == "1" ? "images/checked.gif" : "images/unchceked.gif")%>` or use a function to get the result as follows: ``` <%# getImageUrl(Eval("value")) %> Public Function getImageUrl(ByVal value As Integer) As String If value = 0 Then Return "...
229,886
<p>I have heard mixed opinions over the amount of memory that a byte takes up in a java program.</p> <p>I am aware you can store no more than +127 in a java byte, and the <a href="http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html" rel="noreferrer">documentation</a> says that a byte is only 8 bit...
[ { "answer_id": 229912, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 3, "selected": false, "text": "<p>Java is never implementation or platform specific (at least as far as <a href=\"http://java.sun.com/docs/books/tu...
2008/10/23
[ "https://Stackoverflow.com/questions/229886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29924/" ]
I have heard mixed opinions over the amount of memory that a byte takes up in a java program. I am aware you can store no more than +127 in a java byte, and the [documentation](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html) says that a byte is only 8 bits but [here](http://www.jguru.com/faq/...
Okay, there's been a lot of discussion and not a lot of code :) Here's a quick benchmark. It's got the normal caveats when it comes to this kind of thing - testing memory has oddities due to JITting etc, but with suitably large numbers it's useful anyway. It has two types, each with 80 members - LotsOfBytes has 80 byt...
229,887
<p>Can a flash front end talk to a .net backend?</p>
[ { "answer_id": 229901, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 3, "selected": false, "text": "<p>Yes.</p>\n\n<p>We use <a href=\"http://www.adobe.com/products/flex/\" rel=\"nofollow noreferrer\">Adobe Flex</a> to talk to ....
2008/10/23
[ "https://Stackoverflow.com/questions/229887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can a flash front end talk to a .net backend?
Yes. We use [Adobe Flex](http://www.adobe.com/products/flex/) to talk to .Net XML web services. Be careful with complex serialised .Net types (for instance DataSets) - ActionScript can't handle them. Instead produce simple XML with primitive types. See also: [Flex and ADO.NET Data Services...anyone done it?](https...
229,889
<p>What are the dangerous characters that should be replaced in user input when the users' input will be inserted in a MySQL query? I know about quotes, double quotes, \r and \n. Are there others?<br><sub>(I don't have the option of using a smart connector that accepts parameters so I have to build the query myself and...
[ { "answer_id": 229941, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 2, "selected": false, "text": "<p>What languages do you need to support? It is much better to use a language's built-in sanitization than to write...
2008/10/23
[ "https://Stackoverflow.com/questions/229889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26155/" ]
What are the dangerous characters that should be replaced in user input when the users' input will be inserted in a MySQL query? I know about quotes, double quotes, \r and \n. Are there others? (I don't have the option of using a smart connector that accepts parameters so I have to build the query myself and this wil...
[mysql\_real\_escape\_string()](http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html) from mysql.com docs: > > *The string in from is encoded to an escaped SQL string, taking into account the current character set of the connection. The result is placed in to and a terminating null byte is appended. C...
229,924
<p>What translation occurs when writing to a file that was opened in text mode that does not occur in binary mode? Specifically in MS Visual C.</p> <pre><code>unsigned char buffer[256]; for (int i = 0; i &lt; 256; i++) buffer[i]=i; int size = 1; int count = 256; </code></pre> <p>Binary mode:</p> <pre><code>FILE *fp...
[ { "answer_id": 229971, "author": "Zebra North", "author_id": 17440, "author_profile": "https://Stackoverflow.com/users/17440", "pm_score": 5, "selected": false, "text": "<p>In text mode, a newline \"\\n\" may be converted to a carriage return + newline \"\\r\\n\"</p>\n\n<p>Usually you'll...
2008/10/23
[ "https://Stackoverflow.com/questions/229924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5065/" ]
What translation occurs when writing to a file that was opened in text mode that does not occur in binary mode? Specifically in MS Visual C. ``` unsigned char buffer[256]; for (int i = 0; i < 256; i++) buffer[i]=i; int size = 1; int count = 256; ``` Binary mode: ``` FILE *fp_binary = fopen(filename, "wb"); fwrite(...
I believe that most platforms will ignore the "t" option or the "text-mode" option when dealing with streams. On windows, however, this is not the case. If you take a look at the description of the fopen() function at: [MSDN](http://msdn.microsoft.com/en-us/library/yeby3zcb(vs.71).aspx), you will see that specifying th...
229,925
<p>Using the following code I get a nice formatted string:</p> <pre><code>Request.QueryString.ToString </code></pre> <p>Gives me something like: &amp;hello=world&amp;microsoft=sucks</p> <p>But when I use this code to clone the collection to another object (of the same type) I get the Type() back from the ToString()...
[ { "answer_id": 229964, "author": "Johannes Hädrich", "author_id": 18246, "author_profile": "https://Stackoverflow.com/users/18246", "pm_score": 2, "selected": false, "text": "<p>Why do you want to copy the QueryString collection into a new NameValueCollection?</p>\n\n<pre><code> if (!...
2008/10/23
[ "https://Stackoverflow.com/questions/229925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258/" ]
Using the following code I get a nice formatted string: ``` Request.QueryString.ToString ``` Gives me something like: &hello=world&microsoft=sucks But when I use this code to clone the collection to another object (of the same type) I get the Type() back from the ToString() method instead. ``` System.Collections....
You can also use Reflector to extract the `HttpValueCollection` class into your own, and use it then.
229,935
<p>OK, first for context look at the Windows desktop; You can take items (folders, files) on the desktop and drag them around to different places and they "stay" where you dragged them. This seems to be a pretty useful feature to offer users so as to allow them to create their own "groupings" of items.</p> <p>My que...
[ { "answer_id": 229982, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "<p>I think the closest would the ListView control, but even that is more like an explorer window. You might be able t...
2008/10/23
[ "https://Stackoverflow.com/questions/229935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13776/" ]
OK, first for context look at the Windows desktop; You can take items (folders, files) on the desktop and drag them around to different places and they "stay" where you dragged them. This seems to be a pretty useful feature to offer users so as to allow them to create their own "groupings" of items. My question is thu...
You can do this with a standard ListView control by implementing drag-and-drop. Here's a sample control that does this: ``` using System; using System.Drawing; using System.Windows.Forms; public class MyListView : ListView { private Point mItemStartPos; private Point mMouseStartPos; public MyListView() { t...
229,944
<p>I have a search box that doesn't have a submit button, I need to be able to hit enter and then execute a method, how do I do this?</p>
[ { "answer_id": 229958, "author": "Chris Cudmore", "author_id": 18907, "author_profile": "https://Stackoverflow.com/users/18907", "pm_score": 0, "selected": false, "text": "<p>Use the TextChanged event, and set the AutoPostBack property to true.</p>\n" }, { "answer_id": 230345, ...
2008/10/23
[ "https://Stackoverflow.com/questions/229944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29445/" ]
I have a search box that doesn't have a submit button, I need to be able to hit enter and then execute a method, how do I do this?
you could also do something simple like this with CSS: ``` <asp:Panel DefaultButton="myButton" runat="server"> <asp:TextBox ID="myTextBox" runat="server" /> <asp:Button ID="myButton" runat="server" onclick="myButton_Click" style="display: none; " /> </asp:Panel> ``` The panel may or may not be necessary dep...
229,959
<p>This question is related to a previous post of mine <a href="https://stackoverflow.com/questions/227225/is-injecting-dao-into-entities-a-bad-thing">Here</a>. Basically, I want to inject a DAO into an entity i.e. </p> <pre><code>public class User { IUserDAO userDAO; public User() { userDAO = IoCCon...
[ { "answer_id": 229958, "author": "Chris Cudmore", "author_id": 18907, "author_profile": "https://Stackoverflow.com/users/18907", "pm_score": 0, "selected": false, "text": "<p>Use the TextChanged event, and set the AutoPostBack property to true.</p>\n" }, { "answer_id": 230345, ...
2008/10/23
[ "https://Stackoverflow.com/questions/229959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425/" ]
This question is related to a previous post of mine [Here](https://stackoverflow.com/questions/227225/is-injecting-dao-into-entities-a-bad-thing). Basically, I want to inject a DAO into an entity i.e. ``` public class User { IUserDAO userDAO; public User() { userDAO = IoCContainer.Resolve<IUserDAO>;...
you could also do something simple like this with CSS: ``` <asp:Panel DefaultButton="myButton" runat="server"> <asp:TextBox ID="myTextBox" runat="server" /> <asp:Button ID="myButton" runat="server" onclick="myButton_Click" style="display: none; " /> </asp:Panel> ``` The panel may or may not be necessary dep...
229,998
<p>I want to copy all of the columns of a row, but not have to specify every column. I am aware of the syntax at <a href="http://dev.mysql.com/doc/refman/5.1/en/insert-select.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.1/en/insert-select.html</a> but I see no way to ignore a column.</p> <p>For my example,...
[ { "answer_id": 230009, "author": "Josh Bush", "author_id": 1672, "author_profile": "https://Stackoverflow.com/users/1672", "pm_score": 2, "selected": false, "text": "<p>You'll need to list out the columns that you want to select if you aren't selecting them all. Copy/Paste is your frien...
2008/10/23
[ "https://Stackoverflow.com/questions/229998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to copy all of the columns of a row, but not have to specify every column. I am aware of the syntax at <http://dev.mysql.com/doc/refman/5.1/en/insert-select.html> but I see no way to ignore a column. For my example, I am trying to copy all the columns of a row to a new row, except for the primary key. Is there...
If your `id` or primary key column is an `auto_increment` you can use a temp table: ``` CREATE TEMPORARY TABLE temp_table AS SELECT * FROM source_table WHERE id='7'; UPDATE temp_table SET id='100' WHERE id='7'; INSERT INTO source_table SELECT * FROM temp_table; DROP TEMPORARY TABLE temp_table; ``` so in this way ...
230,014
<p>I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in <a href="http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/" rel="noreferrer">http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/</a></p> <p><strong>All works fi...
[ { "answer_id": 230022, "author": "Mischa Kroon", "author_id": 30600, "author_profile": "https://Stackoverflow.com/users/30600", "pm_score": -1, "selected": false, "text": "<p>Are you using safari as a browser? if so then this will probably be a problem with a large float. Remove that flo...
2008/10/23
[ "https://Stackoverflow.com/questions/230014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in <http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/> **All works fine**, I have custom SEO urls and even the postback works. **But there is a case where the postback always fails** and I get a: *V...
I worked around this by having my view user control inherit from this class instead of `ViewUserControl<T>` (it's kind of a patch for RenderView). It did the trick for me, hopefully it works for you too. ``` public class ViewUserControlWithoutViewState<T> : ViewUserControl<T> where T : class { protected override v...
230,037
<p>I am trying to figure out the best way to use Ant to precompile JSPs that will be deployed to an Oracle application server. Even though I am deploying to an Oracle app server I would like to avoid using Oracle's version of Ant.</p>
[ { "answer_id": 230112, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 2, "selected": false, "text": "<p>I'm not sure what you mean by Oracle's version of Ant but as I understand it you will need the oracle's ant t...
2008/10/23
[ "https://Stackoverflow.com/questions/230037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25502/" ]
I am trying to figure out the best way to use Ant to precompile JSPs that will be deployed to an Oracle application server. Even though I am deploying to an Oracle app server I would like to avoid using Oracle's version of Ant.
Oracle's JSP compiler is available in your oc4j install at ORACLE\_HOME/j2ee/home/jsp/bin/ojspc Assuming your classpath is correct at the compand line you would run: ojspc your.war The war will get updated and place a jar in the WEB-INF/lib containing the pre-compiled JSPs. Note that if your pre-compiling JSPs you s...
230,062
<p>Is there a better way than simply trying to open the file?</p> <pre><code>int exists(const char *fname) { FILE *file; if ((file = fopen(fname, "r"))) { fclose(file); return 1; } return 0; } </code></pre>
[ { "answer_id": 230067, "author": "Mecki", "author_id": 15809, "author_profile": "https://Stackoverflow.com/users/15809", "pm_score": 5, "selected": false, "text": "<p>Yes. Use <code>stat()</code>. See the man page for<a href=\"http://linux.die.net/man/2/stat\" rel=\"noreferrer\"><code>st...
2008/10/23
[ "https://Stackoverflow.com/questions/230062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1248/" ]
Is there a better way than simply trying to open the file? ``` int exists(const char *fname) { FILE *file; if ((file = fopen(fname, "r"))) { fclose(file); return 1; } return 0; } ```
Look up the `access()` function, found in `unistd.h`. You can replace your function with ``` if (access(fname, F_OK) == 0) { // file exists } else { // file doesn't exist } ``` Under Windows (VC) `unistd.h` does not exist. To make it work it is necessary to define: ```c #ifdef WIN32 #include <io.h> #define ...
230,065
<p>Are there any good (and preferably free) code coverage tools out there for Perl?</p>
[ { "answer_id": 230083, "author": "Sherm Pendley", "author_id": 27631, "author_profile": "https://Stackoverflow.com/users/27631", "pm_score": 5, "selected": false, "text": "<p>As usual, CPAN is your friend: Have a look at <a href=\"https://metacpan.org/pod/Devel::Cover\" rel=\"nofollow no...
2008/10/23
[ "https://Stackoverflow.com/questions/230065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27687/" ]
Are there any good (and preferably free) code coverage tools out there for Perl?
Yes, [Devel::Cover](https://metacpan.org/pod/Devel::Cover) is the way to go. If you develop a module, and use [Module::Build](https://metacpan.org/pod/Module::Build) to manage the installation, you even have a `testcover` target: ``` perl Build.PL ./Build testcover ``` That runs the whole test suite, and makes a ...
230,081
<p>How do you find out the length/size of the data in an ntext column in SQL? - It's longer than 8000 bytes so I can't cast it to a varchar. Thanks.</p>
[ { "answer_id": 230097, "author": "korro", "author_id": 22650, "author_profile": "https://Stackoverflow.com/users/22650", "pm_score": 7, "selected": true, "text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/ms173486(SQL.90).aspx\" rel=\"noreferrer\">DataLength()</a></p>\n\n<...
2008/10/23
[ "https://Stackoverflow.com/questions/230081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14072/" ]
How do you find out the length/size of the data in an ntext column in SQL? - It's longer than 8000 bytes so I can't cast it to a varchar. Thanks.
Use [DataLength()](http://msdn.microsoft.com/en-us/library/ms173486(SQL.90).aspx) ``` SELECT * FROM YourTable WHERE DataLength(NTextFieldName) > 0 ```
230,085
<p>We use Grid Control 10.2.0.4, with a catalog repository database also at 10.2.0.4. It seems that after a week or two of being up, the response time of the web interface gets very poor (20+ seconds to navigate to a new page, when normally 2-3 seconds is seen). The only thing we've found to overcome it is a restart of...
[ { "answer_id": 230097, "author": "korro", "author_id": 22650, "author_profile": "https://Stackoverflow.com/users/22650", "pm_score": 7, "selected": true, "text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/ms173486(SQL.90).aspx\" rel=\"noreferrer\">DataLength()</a></p>\n\n<...
2008/10/23
[ "https://Stackoverflow.com/questions/230085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8670/" ]
We use Grid Control 10.2.0.4, with a catalog repository database also at 10.2.0.4. It seems that after a week or two of being up, the response time of the web interface gets very poor (20+ seconds to navigate to a new page, when normally 2-3 seconds is seen). The only thing we've found to overcome it is a restart of th...
Use [DataLength()](http://msdn.microsoft.com/en-us/library/ms173486(SQL.90).aspx) ``` SELECT * FROM YourTable WHERE DataLength(NTextFieldName) > 0 ```
230,105
<p>What's the best data type in SQL to represent Decimal in .NET?</p> <p>We want to store decimal numbers with up to 9 decimal place precision and want to avoid rounding errors etc on the front end.</p> <p>Reading about data types, it appears using Decimal in .NET is the best option because you will not get rounding ...
[ { "answer_id": 230118, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 3, "selected": false, "text": "<p>I would use the decimal type in SQL Server</p>\n\n<p>Take a look at <a href=\"http://msdn.microsoft.com/en-us/library/c...
2008/10/23
[ "https://Stackoverflow.com/questions/230105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30840/" ]
What's the best data type in SQL to represent Decimal in .NET? We want to store decimal numbers with up to 9 decimal place precision and want to avoid rounding errors etc on the front end. Reading about data types, it appears using Decimal in .NET is the best option because you will not get rounding errors, although ...
So we did some testing on SQL Server. It looks like the sql type `decimal` cannot completely store any .net decimal. SQL Server can store a number up to [38 decimal digits long](http://msdn.microsoft.com/en-us/library/ms187746.aspx). That's the total of the number of digits to the left and the right of the decimal pla...
230,111
<p>I am trying to manipulate a string using Jython, I have included below an example string:</p> <p>This would be a title for a website :: SiteName<br /> This would be a title for a website :: SiteName :: SiteName</p> <p>How to remove all instances of ":: Sitename" or ":: SiteName :: SiteName"?</p>
[ { "answer_id": 230240, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 3, "selected": true, "text": "<p>No different from regular Python:</p>\n\n<pre><code>&gt;&gt;&gt; str=\"This would be a title for a website :: SiteName\"\n&g...
2008/10/23
[ "https://Stackoverflow.com/questions/230111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30786/" ]
I am trying to manipulate a string using Jython, I have included below an example string: This would be a title for a website :: SiteName This would be a title for a website :: SiteName :: SiteName How to remove all instances of ":: Sitename" or ":: SiteName :: SiteName"?
No different from regular Python: ``` >>> str="This would be a title for a website :: SiteName" >>> str.replace(":: SiteName","") 'This would be a title for a website ' >>> str="This would be a title for a website :: SiteName :: SiteName" >>> str.replace(":: SiteName","") 'This would be a title for a website ' ```
230,126
<p>I have a Timestamp value that comes from my application. The user can be in any given local TimeZone.</p> <p>Since this date is used for a WebService that assumes the time given is always in GMT, I have a need to convert the user's parameter from say (EST) to (GMT). Here's the kicker: The user is oblivious to his T...
[ { "answer_id": 230313, "author": "Adam", "author_id": 30084, "author_profile": "https://Stackoverflow.com/users/30084", "pm_score": 2, "selected": false, "text": "<p>Something that has worked for me in the past was to determine the offset (in milliseconds) between the user's timezone and...
2008/10/23
[ "https://Stackoverflow.com/questions/230126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30825/" ]
I have a Timestamp value that comes from my application. The user can be in any given local TimeZone. Since this date is used for a WebService that assumes the time given is always in GMT, I have a need to convert the user's parameter from say (EST) to (GMT). Here's the kicker: The user is oblivious to his TZ. He ente...
Thank you all for responding. After a further investigation I got to the right answer. As mentioned by Skip Head, the TimeStamped I was getting from my application was being adjusted to the user's TimeZone. So if the User entered 6:12 PM (EST) I would get 2:12 PM (GMT). What I needed was a way to undo the conversion so...
230,128
<p>What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?</p>
[ { "answer_id": 230141, "author": "Nick", "author_id": 1490, "author_profile": "https://Stackoverflow.com/users/1490", "pm_score": 11, "selected": true, "text": "<p><strong>From .NET 4.5 on, there is the <a href=\"http://msdn.microsoft.com/en-us/library/system.io.stream.copytoasync.aspx\"...
2008/10/23
[ "https://Stackoverflow.com/questions/230128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341413/" ]
What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?
**From .NET 4.5 on, there is the [`Stream.CopyToAsync` method](http://msdn.microsoft.com/en-us/library/system.io.stream.copytoasync.aspx)** ``` input.CopyToAsync(output); ``` This will return a [`Task`](http://msdn.microsoft.com/en-us/library/system.threading.tasks.task.aspx) that can be continued on when completed,...
230,129
<p>I've been experimenting with fulltext search lately and am curious about the meaning of the Score value. For example I have the following query:</p> <pre><code>SELECT table. * , MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Term1)' ) AS Score FROM table WHERE MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Ter...
[ { "answer_id": 230219, "author": "Harrison Fisk", "author_id": 16111, "author_profile": "https://Stackoverflow.com/users/16111", "pm_score": 4, "selected": true, "text": "<p>Generally relevance is based on how many matches each row has to the words given to the search. The exact value w...
2008/10/23
[ "https://Stackoverflow.com/questions/230129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/538/" ]
I've been experimenting with fulltext search lately and am curious about the meaning of the Score value. For example I have the following query: ``` SELECT table. * , MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Term1)' ) AS Score FROM table WHERE MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Term1)' ) ``` I...
Generally relevance is based on how many matches each row has to the words given to the search. The exact value will depend on many things, but it really only matters for comparing to other relevance values in the same query. If you really want the math behind it, you can find it at the [internals manual](https://dev....
230,138
<p>I have a table that was imported as all UPPER CASE and I would like to turn it into Proper Case. What script have any of you used to complete this?</p>
[ { "answer_id": 230177, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 8, "selected": true, "text": "<p>Here's a UDF that will do the trick...</p>\n\n<pre><code>create function ProperCase(@Text as varchar(8000))\nreturns var...
2008/10/23
[ "https://Stackoverflow.com/questions/230138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7952/" ]
I have a table that was imported as all UPPER CASE and I would like to turn it into Proper Case. What script have any of you used to complete this?
Here's a UDF that will do the trick... ``` create function ProperCase(@Text as varchar(8000)) returns varchar(8000) as begin declare @Reset bit; declare @Ret varchar(8000); declare @i int; declare @c char(1); if @Text is null return null; select @Reset = 1, @i = 1, @Ret = ''; while (@i <= len(@Tex...
230,150
<p>Visual Studio 2008 w/Sp1</p> <p>To reproduce my problem I simply create a new .Net 2.0 web application and add a page with the following markup:</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//...
[ { "answer_id": 230177, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 8, "selected": true, "text": "<p>Here's a UDF that will do the trick...</p>\n\n<pre><code>create function ProperCase(@Text as varchar(8000))\nreturns var...
2008/10/23
[ "https://Stackoverflow.com/questions/230150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2424/" ]
Visual Studio 2008 w/Sp1 To reproduce my problem I simply create a new .Net 2.0 web application and add a page with the following markup: ``` <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...
Here's a UDF that will do the trick... ``` create function ProperCase(@Text as varchar(8000)) returns varchar(8000) as begin declare @Reset bit; declare @Ret varchar(8000); declare @i int; declare @c char(1); if @Text is null return null; select @Reset = 1, @i = 1, @Ret = ''; while (@i <= len(@Tex...
230,186
<p>I am trying to aid another programmer with a page called Default.aspx with a code-behind section, and unfortunately I am at a bit of a loss.</p> <pre><code> Partial Class _Default Inherits OverheadClass 'A bunch of global variables here' Private Sub page_load(ByVal sender As Object, ByVal e As System.Eventarts)...
[ { "answer_id": 230200, "author": "mattruma", "author_id": 1768, "author_profile": "https://Stackoverflow.com/users/1768", "pm_score": 5, "selected": true, "text": "<p>You should be able to override the OnLoad and call the base class's OnLoad first, then your class, for example:</p>\n\n<p...
2008/10/23
[ "https://Stackoverflow.com/questions/230186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12545/" ]
I am trying to aid another programmer with a page called Default.aspx with a code-behind section, and unfortunately I am at a bit of a loss. ``` Partial Class _Default Inherits OverheadClass 'A bunch of global variables here' Private Sub page_load(ByVal sender As Object, ByVal e As System.Eventarts) Handles Me.Lo...
You should be able to override the OnLoad and call the base class's OnLoad first, then your class, for example: C# Version ``` protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Do some stuff here } ``` VB Version ``` Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.On...
230,196
<p>I need write an update statement that used multiple tables to determine which rows to update, since in Oracle, multiple tables aren't allowed. The following query will return a "ORA-00971: Missing SET keyword" error</p> <pre><code>UPDATE TABLE1 a, TABLE2 b SET a.COL1 = 'VALUE' WHERE a.FK = b.PK AND b.COL...
[ { "answer_id": 230213, "author": "Chris Ammerman", "author_id": 2729, "author_profile": "https://Stackoverflow.com/users/2729", "pm_score": 0, "selected": false, "text": "<p>Each row in the result set of the query in your UPDATE clause must map back to one and only one row in the table y...
2008/10/23
[ "https://Stackoverflow.com/questions/230196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5129/" ]
I need write an update statement that used multiple tables to determine which rows to update, since in Oracle, multiple tables aren't allowed. The following query will return a "ORA-00971: Missing SET keyword" error ``` UPDATE TABLE1 a, TABLE2 b SET a.COL1 = 'VALUE' WHERE a.FK = b.PK AND b.COL2 IN ('SET OF V...
Another option: ``` UPDATE TABLE1 a SET a.COL1 = 'VALUE' WHERE a.FK IN ( SELECT b.PK FROM TABLE2 b WHERE b.COL2 IN ('SET OF VALUES') ) ``` Your second example would work if (a) the view included the **declared** PK of TABLE1: ``` UPDATE ( SELECT a.COL1, a.PKCOL FROM TABLE1 a, TABLE2 b ...
230,205
<p>I have a page that is supposed to launch the Print Preview page onload.</p> <p>I found this:</p> <pre><code>var OLECMDID = 7; /* OLECMDID values: * 6 - print * 7 - print preview * 1 - open window * 4 - Save As */ var PROMPT = 1; // 2 DONTPROMPTUSER var WebBrowser = '&lt;OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLA...
[ { "answer_id": 230231, "author": "svandragt", "author_id": 997, "author_profile": "https://Stackoverflow.com/users/997", "pm_score": 6, "selected": true, "text": "<p>You can't, Print Preview is a feature of a browser, and therefore should be protected from being called by JavaScript as i...
2008/10/23
[ "https://Stackoverflow.com/questions/230205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27482/" ]
I have a page that is supposed to launch the Print Preview page onload. I found this: ``` var OLECMDID = 7; /* OLECMDID values: * 6 - print * 7 - print preview * 1 - open window * 4 - Save As */ var PROMPT = 1; // 2 DONTPROMPTUSER var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340...
You can't, Print Preview is a feature of a browser, and therefore should be protected from being called by JavaScript as it would be a security risk. That's why your example uses Active X, which bypasses the JavaScript security issues. So instead use the print stylesheet that you already should have and show it for m...
230,241
<p>I have a table, call it TBL. It has two columns,call them A and B. Now in the query I require one column as A and other column should be a comma seprated list of all B's which are against A in TBL. e.g. TBL is like this</p> <p>1 Alpha</p> <p>2 Beta</p> <p>1 Gamma</p> <p>1 Delta</p> <p>Result of query s...
[ { "answer_id": 230278, "author": "Totty", "author_id": 30838, "author_profile": "https://Stackoverflow.com/users/30838", "pm_score": 2, "selected": false, "text": "<p>There is not a way that I know of to run stored procedures in an Access database. However, Access can execute stored pro...
2008/10/23
[ "https://Stackoverflow.com/questions/230241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6613/" ]
I have a table, call it TBL. It has two columns,call them A and B. Now in the query I require one column as A and other column should be a comma seprated list of all B's which are against A in TBL. e.g. TBL is like this 1 Alpha 2 Beta 1 Gamma 1 Delta Result of query should be 1 Alpha,Gamma,Delta 2 Beta This t...
You can concatenate the records with a User Defined Function (UDF). The code below can be pasted 'as is' into a standard module. The SQL for you example would be: ``` SELECT tbl.A, Concatenate("SELECT B FROM tbl WHERE A = " & [A]) AS ConcA FROM tbl GROUP BY tbl.A ``` This code is by DHookom, Access MVP, an...
230,245
<p>Should the "visibility" for the <code>__destruct()</code> function be public or something else? I'm trying to write a standards doc for my group and this question came up.</p>
[ { "answer_id": 230258, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 3, "selected": false, "text": "<p>I think it would need to be public in the case where a subclass needs to explicitly call the <strong>__destruct</strong> ...
2008/10/23
[ "https://Stackoverflow.com/questions/230245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25143/" ]
Should the "visibility" for the `__destruct()` function be public or something else? I'm trying to write a standards doc for my group and this question came up.
In Addition to Mark Biek's answer: The \_\_destruct() function must be declared public. Otherwise, the function will not be executed on script shutdown: ``` Warning: Call to protected MyChild1::__destruct() from context '' during shutdown ignored in Unknown on line 0 Warning: Call to private MyChild2::__destruct() fr...
230,248
<p>Oracle Forms10g provides a tool to convert the Oracle Forms modules, from the binary format (.FMB) that Oracle Forms Builder works with, to text format (.FMT).</p> <p>For example, if you create a module called <em>mymodule.fmb</em> with Oracle Forms Builder, and then invoke</p> <pre><code>frmcmp module=mymodule.fm...
[ { "answer_id": 231099, "author": "hamishmcn", "author_id": 3590, "author_profile": "https://Stackoverflow.com/users/3590", "pm_score": 0, "selected": false, "text": "<p>According to <a href=\"http://www.orafaq.com/usenet/comp.databases.oracle.tools/2004/03/31/0352.htm\" rel=\"nofollow no...
2008/10/23
[ "https://Stackoverflow.com/questions/230248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20037/" ]
Oracle Forms10g provides a tool to convert the Oracle Forms modules, from the binary format (.FMB) that Oracle Forms Builder works with, to text format (.FMT). For example, if you create a module called *mymodule.fmb* with Oracle Forms Builder, and then invoke ``` frmcmp module=mymodule.fmb script=yes batch=yes logon...
Along with the API, note that if you're working at the start of this process you'll probably be better off generating the XML version than the FMT version. The FMT is an older format kept for backward compatibility, and tools like the recently announced Forms -> Oracle APEX converter will want the XML. It's also easier...
230,250
<p>Exception is: 'Country' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value</p> <pre><code>UserService.DsUserAttributes dsCountry = us_service.GetUserAttributeDropDown(systemId, "Country"); Country.DataSource = dsCountry.tblDropDownValues; Country.DataTextFiel...
[ { "answer_id": 230284, "author": "Jay S", "author_id": 30440, "author_profile": "https://Stackoverflow.com/users/30440", "pm_score": 2, "selected": false, "text": "<p>Try binding the data on postback. It sounds like when the event handler is accessing the DropDownList, it hasn't been re...
2008/10/23
[ "https://Stackoverflow.com/questions/230250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24565/" ]
Exception is: 'Country' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value ``` UserService.DsUserAttributes dsCountry = us_service.GetUserAttributeDropDown(systemId, "Country"); Country.DataSource = dsCountry.tblDropDownValues; Country.DataTextField = "AttrValue...
Every time I got this error it was because the keys I was matching on to bind my data didn't match. The lines you showed may not be the problem. Look into when you are possibly loading a record from another table and binding their values into the dropdown list. For example, if you have a dropdown list on your page t...
230,262
<p>Is there a dialect of XML for defining the tables, indexes and relations of a relational database, and a "compiler" or stylesheet to transform that definition into SQL CREATE statements (DDL)?</p> <p>EG, something that might look like:</p> <pre><code>&lt;Table Name="orders"&gt; &lt;Column Name="order_id" Type=...
[ { "answer_id": 230291, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 0, "selected": false, "text": "<p>Sounds like XML based migrations, never seen one though. </p>\n\n<p>If you're into OR/M you could take a look ...
2008/10/23
[ "https://Stackoverflow.com/questions/230262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5548/" ]
Is there a dialect of XML for defining the tables, indexes and relations of a relational database, and a "compiler" or stylesheet to transform that definition into SQL CREATE statements (DDL)? EG, something that might look like: ``` <Table Name="orders"> <Column Name="order_id" Type="varchar" Size="20"/> ... ...
Something like [xml2ddl](http://xml2ddl.berlios.de/)?
230,266
<p>Using Vim, I'm trying to pipe text selected in visual mode to a UNIX command and have the output appended to the end of the current file. For example, say we have a SQL command such as:</p> <pre><code>SELECT * FROM mytable; </code></pre> <p>I want to do something like the following:</p> <pre><code>&lt;ESC&gt; V ...
[ { "answer_id": 230504, "author": "mweerden", "author_id": 4285, "author_profile": "https://Stackoverflow.com/users/4285", "pm_score": 4, "selected": true, "text": "<p>How about copying the selected text to the end of the file, select the copy and run the command? If you do not want to re...
2008/10/23
[ "https://Stackoverflow.com/questions/230266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8243/" ]
Using Vim, I'm trying to pipe text selected in visual mode to a UNIX command and have the output appended to the end of the current file. For example, say we have a SQL command such as: ``` SELECT * FROM mytable; ``` I want to do something like the following: ``` <ESC> V " select text :'<,'>!mysql -...
How about copying the selected text to the end of the file, select the copy and run the command? If you do not want to repeat the same commands over and over again, you can record the sequence by using `q` or add a new command. I have tried the latter as follows: ``` :com -range C <line1>,<line2>yank | $ | put | .,$ !...
230,270
<p>I'm searching for a <strong>PHP syntax highlighting engine</strong> that can be customized (i.e. I can provide my <strong>own tokenizers</strong> for new languages) and that can handle several languages <em>simultaneously</em> (i.e. on the same output page). This engine has to work well together with <strong>CSS cla...
[ { "answer_id": 230404, "author": "micahwittman", "author_id": 11181, "author_profile": "https://Stackoverflow.com/users/11181", "pm_score": 3, "selected": false, "text": "<p>[I marked this answer as <em>Community Wiki</em> because you're specifically <em>not</em> looking for Javascript]<...
2008/10/23
[ "https://Stackoverflow.com/questions/230270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1968/" ]
I'm searching for a **PHP syntax highlighting engine** that can be customized (i.e. I can provide my **own tokenizers** for new languages) and that can handle several languages *simultaneously* (i.e. on the same output page). This engine has to work well together with **CSS classes**, i.e. it should format the output b...
Since no existing tool satisfied my needs, I wrote my own. Lo and behold: [Hyperlight](https://github.com/klmr/hyperlight) ------------------------------------------------ Usage is extremely easy: just use ``` <?php hyperlight($code, 'php'); ?> ``` to highlight code. Writing new language definitions is relatively...
230,335
<p>I started a Rails project recently and decided to use RESTful controllers. I created controllers for my key entities (such as Country) and added <code>index</code>, <code>new</code>, <code>edit</code>, <code>create</code>, <code>show</code>, <code>update</code> and <code>delete</code>. I added my <code>map.resources...
[ { "answer_id": 230523, "author": "Codebeef", "author_id": 12037, "author_profile": "https://Stackoverflow.com/users/12037", "pm_score": 4, "selected": true, "text": "<p>If I go beyond the standard CRUD actions with my models, I normally just add the methods as required. Searching is some...
2008/10/23
[ "https://Stackoverflow.com/questions/230335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16779/" ]
I started a Rails project recently and decided to use RESTful controllers. I created controllers for my key entities (such as Country) and added `index`, `new`, `edit`, `create`, `show`, `update` and `delete`. I added my `map.resources :country` to my routes file and life was good. After development progressed a littl...
If I go beyond the standard CRUD actions with my models, I normally just add the methods as required. Searching is something I add to many controllers, but not every one, so I add it and maintain the routes normally: ``` map.resources :events, :collection => { :search => :get } ``` Moving these actions to an entirel...
230,337
<p>I'm making another app's window topmost to ensure that a click in my app brings the other's dialog into views. The problem I'm having is that I don't get focus back to my app after the call. If the other app has more windows one of them ends up with focus, and otherwise no window (looking at the taskbar only) gets f...
[ { "answer_id": 230349, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 3, "selected": true, "text": "<p>Related: <a href=\"https://stackoverflow.com/questions/48288/unexpected-behaviour-of-processmainwindowhandle\">Unexpect...
2008/10/23
[ "https://Stackoverflow.com/questions/230337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5472/" ]
I'm making another app's window topmost to ensure that a click in my app brings the other's dialog into views. The problem I'm having is that I don't get focus back to my app after the call. If the other app has more windows one of them ends up with focus, and otherwise no window (looking at the taskbar only) gets focu...
Related: [Unexpected behaviour of Process.MainWindowHandle](https://stackoverflow.com/questions/48288/unexpected-behaviour-of-processmainwindowhandle) Basically MainWindowHandle gives you the current top-most window of the process despite what the documentation says. That explains why the main window of your other pr...
230,348
<p>I see Oracle procedures sometimes written with "AS", and sometimes with "IS" keyword. </p> <pre><code>CREATE OR REPLACE Procedure TESTUSER.KILLINSTANCE (INSTANCEID integer) **AS** ... </code></pre> <p>vs.</p> <pre><code>CREATE OR REPLACE Procedure TESTUSER.KILLINSTANCE (INSTANCEID integer) **IS** ... </code></pre...
[ { "answer_id": 230388, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 7, "selected": true, "text": "<p>None whatsover. They are synonyms supplied to make your code more readable:</p>\n\n<p>FUNCTION f IS ...</p>\n\n<p>...
2008/10/23
[ "https://Stackoverflow.com/questions/230348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/227/" ]
I see Oracle procedures sometimes written with "AS", and sometimes with "IS" keyword. ``` CREATE OR REPLACE Procedure TESTUSER.KILLINSTANCE (INSTANCEID integer) **AS** ... ``` vs. ``` CREATE OR REPLACE Procedure TESTUSER.KILLINSTANCE (INSTANCEID integer) **IS** ... ``` Is there any difference between the two? -...
None whatsover. They are synonyms supplied to make your code more readable: FUNCTION f IS ... CREATE VIEW v AS SELECT ...
230,351
<p>When I am creating a new database table, what factors should I take into account for selecting the primary key's data type?</p>
[ { "answer_id": 230362, "author": "Ely", "author_id": 30488, "author_profile": "https://Stackoverflow.com/users/30488", "pm_score": 3, "selected": false, "text": "<p>If using a numeric key, make sure the datatype is giong to be large enough to hold the number of rows you might expect the ...
2008/10/23
[ "https://Stackoverflow.com/questions/230351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5618/" ]
When I am creating a new database table, what factors should I take into account for selecting the primary key's data type?
Sorry to do that, but I found that the answers I gave to related questions (you can check [this](https://stackoverflow.com/questions/159087/composite-primary-keys-versus-unique-object-id-field#164338) and [this](https://stackoverflow.com/questions/224576/will-sql-server-2005-penalize-me-for-using-an-nvarchar50-as-a-pri...
230,364
<p>I'm trying to link an RPATH containing the special string $ORIGIN into an executable built using GCC with the Code::Blocks IDE. I've specified</p> <pre><code>-Wl,-R$ORIGIN </code></pre> <p>in the linker options for the project, but the command line output to GCC is wrong (stripped for clarity):</p> <pre><code>g++...
[ { "answer_id": 230376, "author": "kbluck", "author_id": 13402, "author_profile": "https://Stackoverflow.com/users/13402", "pm_score": 6, "selected": true, "text": "<p>Whoever decided to make the token $ORIGIN is an evil bastard who deserves a special place in programmer hell. Since '$' i...
2008/10/23
[ "https://Stackoverflow.com/questions/230364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13402/" ]
I'm trying to link an RPATH containing the special string $ORIGIN into an executable built using GCC with the Code::Blocks IDE. I've specified ``` -Wl,-R$ORIGIN ``` in the linker options for the project, but the command line output to GCC is wrong (stripped for clarity): ``` g++ -Wl,-R ``` What is the correct way...
Whoever decided to make the token $ORIGIN is an evil bastard who deserves a special place in programmer hell. Since '$' is a special character for bash and other scripting languages like make, it screws everything up unless carefully escaped. Even worse, depending on which build environment you're using, the specifics ...
230,382
<p>The print functionality of Excel (using VBA) is extremely slow. I'm hoping someone has a way of speeding the printing up (without using the Excel 4 Macro trick). Here's how I do it now:</p> <pre><code>Application.ScreenUpdating = False With ActiveSheet.PageSetup -various setup statements which I've already min...
[ { "answer_id": 231145, "author": "Mike Rosenblum", "author_id": 10429, "author_profile": "https://Stackoverflow.com/users/10429", "pm_score": 4, "selected": true, "text": "<p>Yes, the PageSetup properties are very slow when you set them.</p>\n\n<p>You have already set <code>Application.S...
2008/10/23
[ "https://Stackoverflow.com/questions/230382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13295/" ]
The print functionality of Excel (using VBA) is extremely slow. I'm hoping someone has a way of speeding the printing up (without using the Excel 4 Macro trick). Here's how I do it now: ``` Application.ScreenUpdating = False With ActiveSheet.PageSetup -various setup statements which I've already minimized- End Wi...
Yes, the PageSetup properties are very slow when you set them. You have already set `Application.ScreenUpdating = False`, which is good, but an equally (or more) important step in this case is to set `Application.Calculation = xlCalculationManual`. (It is best if you save these settings and then restore them to the or...
230,389
<p>I am new to jmock and trying to mock an HttpSession. I am getting:</p> <p>java.lang.AssertionError: unexpected invocation: httpServletRequest.getSession() no expectations specified: did you... - forget to start an expectation with a cardinality clause? - call a mocked method to specify the parameter of an expecta...
[ { "answer_id": 230471, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 1, "selected": false, "text": "<p>I think you need to tell the JMock context how many times you expect the method to be called before you actually go ahead ...
2008/10/23
[ "https://Stackoverflow.com/questions/230389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3034/" ]
I am new to jmock and trying to mock an HttpSession. I am getting: java.lang.AssertionError: unexpected invocation: httpServletRequest.getSession() no expectations specified: did you... - forget to start an expectation with a cardinality clause? - call a mocked method to specify the parameter of an expectation? the...
You don't need to mock the request object. Since the method you're testing (`dwnLoadCel.doAuthorization()`) only depends on an `HttpSession` object, that is what you should mock. So your code would look like this: ``` public void testDoAuthorization(){ final HttpSession session = context.mock(HttpSession.class); ...
230,397
<p>I am writing a DB upgrade script that will check to see if an index has the right two columns defined. If it doesn't, or if it only has one of them, then I will DROP it (is there a way to ALTER an index?) and then recreate it with both.</p>
[ { "answer_id": 230442, "author": "Ed Altorfer", "author_id": 26552, "author_profile": "https://Stackoverflow.com/users/26552", "pm_score": 4, "selected": true, "text": "<p>I don't have a database immediately on-hand to test this, but you should be able to see if a column exists in an ind...
2008/10/23
[ "https://Stackoverflow.com/questions/230397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
I am writing a DB upgrade script that will check to see if an index has the right two columns defined. If it doesn't, or if it only has one of them, then I will DROP it (is there a way to ALTER an index?) and then recreate it with both.
I don't have a database immediately on-hand to test this, but you should be able to see if a column exists in an index by using the following IF EXISTS statement. I'm not sure whether you can alter an index on the fly. ``` IF EXISTS ( SELECT MyIndex.Name AS IndexName, Columns.name AS ColumnName FROM...
230,401
<p>I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint Server 2007 lists.asmx), but any call to a web service will really help as a first step in that direction.</p>
[ { "answer_id": 230408, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 3, "selected": false, "text": "<p>Here is an example to call your webservice using jQuery.get:</p>\n\n<pre><code>$.get(\"http://domain.com/webservice.a...
2008/10/23
[ "https://Stackoverflow.com/questions/230401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30867/" ]
I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint Server 2007 lists.asmx), but any call to a web service will really help as a first step in that direction.
I use this method as a wrapper so that I can send parameters. Also using the variables in the top of the method allows it to be minimized at a higher ratio and allows for some code reuse if making multiple similar calls. ``` function InfoByDate(sDate, eDate){ var divToBeWorkedOn = "#AjaxPlaceHolder"; var webMe...
230,409
<p>In my <a href="https://stackoverflow.com/questions/222442/sql-server-running-large-script-files">eternal</a> <a href="https://stackoverflow.com/questions/224830/how-do-i-set-a-sql-server-scripts-timeout-from-within-the-script">saga</a> to insert 1.4 million rows of data from a SQL script, I've written a basic WinFor...
[ { "answer_id": 230423, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/ms188365.aspx\" rel=\"noreferrer\">BULK INSERT</a> won't work for y...
2008/10/23
[ "https://Stackoverflow.com/questions/230409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
In my [eternal](https://stackoverflow.com/questions/222442/sql-server-running-large-script-files) [saga](https://stackoverflow.com/questions/224830/how-do-i-set-a-sql-server-scripts-timeout-from-within-the-script) to insert 1.4 million rows of data from a SQL script, I've written a basic WinForms app that takes each li...
[BULK INSERT](http://msdn.microsoft.com/en-us/library/ms188365.aspx) won't work for you? Or the SQL Server Import/Export Wizard ([here](http://www.databasejournal.com/features/mssql/article.php/3580216) or [here](http://technet.microsoft.com/en-us/library/ms141209.aspx))? I know import/export can turn off identity inse...
230,411
<p>I want yo use the EXSLT - DYN:EVALUATE in a style sheet. I have added the names pace but I don't know where the .xsl file I need to import is. I don't believe I have XALAN installed to point the import to. How would I install this? Once installed and I point it to the .xsl will it pick up the function and apply it? ...
[ { "answer_id": 232526, "author": "GerG", "author_id": 17249, "author_profile": "https://Stackoverflow.com/users/17249", "pm_score": 4, "selected": true, "text": "<p>Xalan has the EXSL dyn:evaluate function built-in, you don't need to import anything in order to use it. You just need to d...
2008/10/23
[ "https://Stackoverflow.com/questions/230411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want yo use the EXSLT - DYN:EVALUATE in a style sheet. I have added the names pace but I don't know where the .xsl file I need to import is. I don't believe I have XALAN installed to point the import to. How would I install this? Once installed and I point it to the .xsl will it pick up the function and apply it? I a...
Xalan has the EXSL dyn:evaluate function built-in, you don't need to import anything in order to use it. You just need to declare the namespace. I'll give a small example: *input.xml*: ``` <root> <foo>I am foo</foo> <bar>I am bar</bar> </root> ``` *dyn\_evaluate.xsl*: ``` <xsl:stylesheet version="1.0" ...
230,454
<p>What would be the best way to fill an array from user input?</p> <p>Would a solution be showing a prompt message and then get the values from from the user?</p>
[ { "answer_id": 230463, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 7, "selected": true, "text": "<pre><code>string []answer = new string[10];\nfor(int i = 0;i&lt;answer.length;i++)\n{\n answer[i]= Console.R...
2008/10/23
[ "https://Stackoverflow.com/questions/230454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30858/" ]
What would be the best way to fill an array from user input? Would a solution be showing a prompt message and then get the values from from the user?
``` string []answer = new string[10]; for(int i = 0;i<answer.length;i++) { answer[i]= Console.ReadLine(); } ```
230,522
<p>I have a table with multiple rows. Each row is a form. I want to use JQuery to submit all the forms that have the check box checked. The form is posting to an IFrame so there is not much need for AJAX.</p> <p>So far I have:</p> <pre><code> $("form").submit(); </code></pre> <p>which submits the form. but all...
[ { "answer_id": 230540, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 0, "selected": false, "text": "<p>This is kinda a guess since I'm not sure of your layout, but here goes....</p>\n\n<pre><code>$(\"td &gt; input:che...
2008/10/23
[ "https://Stackoverflow.com/questions/230522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
I have a table with multiple rows. Each row is a form. I want to use JQuery to submit all the forms that have the check box checked. The form is posting to an IFrame so there is not much need for AJAX. So far I have: ``` $("form").submit(); ``` which submits the form. but all forms. There is arbritary number...
Off the top of my head, you probably want something like this ``` $("input:checked").parent("form").submit(); ``` This will find the checked form fields, traverse up to find the parent form object and submit that.
230,585
<p>I have the following code:</p> <pre><code>class IncidentTag: def __init__(self,tag): self.tag = tag def equals(self,obj): return self.tag.equals(obj.tag) def hashCode(self): return self.tag.hashCode() from java.lang import String from java.util import HashMap from java.util i...
[ { "answer_id": 230656, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 1, "selected": false, "text": "<p>I wrote equivalent code in Java and it does produce true for all three contains() calls. So I think this must be an o...
2008/10/23
[ "https://Stackoverflow.com/questions/230585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432/" ]
I have the following code: ``` class IncidentTag: def __init__(self,tag): self.tag = tag def equals(self,obj): return self.tag.equals(obj.tag) def hashCode(self): return self.tag.hashCode() from java.lang import String from java.util import HashMap from java.util import HashSet ...
You shouldn't implemented the Java-Style equals and hashCode method, but instead the Python equivaltents `__eq__` and `__hash__`. Adding ``` def __hash__(self): return self.hashCode() def __eq__(self, o): return self.equals(o) ``` helps. These python methods are - as far as I know - dynamically bound to hash...
230,588
<p>I am trying to sort a list using delegates but I am getting a signature match error. The compiler says I cannot convert from an 'anonymous method' </p> <pre><code>List&lt;MyType&gt; myList = GetMyList(); myList.Sort( delegate (MyType t1, MyType t2) { return (t1.ID &lt; t2.ID); } ); </code></pre> <p>What am I missi...
[ { "answer_id": 230597, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 4, "selected": false, "text": "<p>The Sort doesn't take a binary predicate, it takes a <code>Comparison&lt;T&gt;</code> delegate which returns an <cod...
2008/10/23
[ "https://Stackoverflow.com/questions/230588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1632/" ]
I am trying to sort a list using delegates but I am getting a signature match error. The compiler says I cannot convert from an 'anonymous method' ``` List<MyType> myList = GetMyList(); myList.Sort( delegate (MyType t1, MyType t2) { return (t1.ID < t2.ID); } ); ``` What am I missing? Here are some references I fou...
I think you want: ``` myList.Sort( delegate (MyType t1, MyType t2) { return (t1.ID.CompareTo(t2.ID)); } ); ``` To sort you need something other than "true/false", you need to know if its equal to, greater than, or less than.
230,592
<p>Here's the XML code I'm working with:</p> <pre><code>&lt;inventory&gt; &lt;drink&gt; &lt;lemonade supplier="mother" id="1"&gt; &lt;price&gt;$2.50&lt;/price&gt; &lt;amount&gt;20&lt;/amount&gt; &lt;/lemonade&gt; &lt;lemonade supplier="mike" id="4"&gt; &l...
[ { "answer_id": 230609, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 6, "selected": true, "text": "<p>Try this: </p>\n\n<pre><code>//lemonade[@id=\"1\"]/price\n</code></pre>\n\n<p>or </p>\n\n<pre><code>//lemonade[@sup...
2008/10/23
[ "https://Stackoverflow.com/questions/230592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27090/" ]
Here's the XML code I'm working with: ``` <inventory> <drink> <lemonade supplier="mother" id="1"> <price>$2.50</price> <amount>20</amount> </lemonade> <lemonade supplier="mike" id="4"> <price>$3.00</price> <amount>20</amount> </lemonad...
Try this: ``` //lemonade[@id="1"]/price ``` or ``` //lemonade[@supplier="mother"]/price ``` Without the "@" it looks for child elements with that name instead of attributes.
230,636
<p>I am trying to implement the following functionality:</p> <pre><code>class WeightResolver { WeightMonitor _source; bool _cancelled; Weight _threshold; public Cancel() { _cancelled = true; } public Weight Resolve(){ _cancelled = false; while(_source.CurrentWeight &lt; threshold ) { ...
[ { "answer_id": 230654, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 1, "selected": false, "text": "<p>This might not work for you, but based on the information you've provided, I'd suggest looking at thread.Join(XXX) where ...
2008/10/23
[ "https://Stackoverflow.com/questions/230636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
I am trying to implement the following functionality: ``` class WeightResolver { WeightMonitor _source; bool _cancelled; Weight _threshold; public Cancel() { _cancelled = true; } public Weight Resolve(){ _cancelled = false; while(_source.CurrentWeight < threshold ) { if(_cancell...
This might not work for you, but based on the information you've provided, I'd suggest looking at thread.Join(XXX) where XXX is the number of milliseconds to wait. It'll greatly simplify your code. <http://msdn.microsoft.com/en-us/library/6b1kkss0.aspx> you can block the calling thread to the new thread for a specifi...
230,642
<p>On our live/production database I'm trying to add a trigger to a table, but have been unsuccessful. I have tried a few times, but it has taken more than 30 minutes for the create trigger statement to complete and I've cancelled it. </p> <p>The table is one that gets read/written to often by a couple different pro...
[ { "answer_id": 230719, "author": "Dave DuPlantis", "author_id": 8174, "author_profile": "https://Stackoverflow.com/users/8174", "pm_score": 2, "selected": false, "text": "<p>That's odd. An <code>AFTER UPDATE</code> trigger shouldn't need to check existing rows in the table. I suppose it'...
2008/10/23
[ "https://Stackoverflow.com/questions/230642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21353/" ]
On our live/production database I'm trying to add a trigger to a table, but have been unsuccessful. I have tried a few times, but it has taken more than 30 minutes for the create trigger statement to complete and I've cancelled it. The table is one that gets read/written to often by a couple different processes. I ha...
The problem may not be in the table itself, but in the system tables that have to be updated in order to create the trigger. If you're doing any other kind of DDL as part of your normal processes they could be holding it up. Use sp\_who to find out where the block is coming from then investigate from there.
230,643
<p>Is there any elegant way in the Android API for detecting new media when it is written to the device? I’m mainly interested in photos taken by the camera, video taken by the camera and audio recorded from the mic.</p> <p>My current thinking is to periodically scan each media content provider and filter based on las...
[ { "answer_id": 232115, "author": "Declan Shanaghy", "author_id": 21297, "author_profile": "https://Stackoverflow.com/users/21297", "pm_score": 2, "selected": false, "text": "<p>Aha!</p>\n\n<p>A <a href=\"http://code.google.com/android/reference/android/database/ContentObserver.html\" rel...
2008/10/23
[ "https://Stackoverflow.com/questions/230643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21297/" ]
Is there any elegant way in the Android API for detecting new media when it is written to the device? I’m mainly interested in photos taken by the camera, video taken by the camera and audio recorded from the mic. My current thinking is to periodically scan each media content provider and filter based on last scan tim...
There's a special broadcast Intent that should get called every time an application writes anything new to the Media Store: ``` Intent.ACTION_MEDIA_SCANNER_SCAN_FILE ``` The Broadcast Intent includes the path to the new file, accessible through the `Intent.getDataString()` method. To listen for it, just create a `B...
230,644
<p>I've got a tomcat instance with several apps running on it... I want the root of my new domain to go to one of these apps (context path of blah).. so I have the following set up:</p> <pre><code>&lt;Location /&gt; ProxyPass ajp://localhost:8025/blah ProxyPassReverse ajp://localhost:8025/blah &lt;/Location&gt...
[ { "answer_id": 231723, "author": "danb", "author_id": 2031, "author_profile": "https://Stackoverflow.com/users/2031", "pm_score": 0, "selected": false, "text": "<p>it looks like this is kind of a <a href=\"http://dltj.org/article/apache-httpd-and-tomcat/\" rel=\"nofollow noreferrer\">pai...
2008/10/23
[ "https://Stackoverflow.com/questions/230644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2031/" ]
I've got a tomcat instance with several apps running on it... I want the root of my new domain to go to one of these apps (context path of blah).. so I have the following set up: ``` <Location /> ProxyPass ajp://localhost:8025/blah ProxyPassReverse ajp://localhost:8025/blah </Location> ``` it kinda works... ...
If you're wanting to server the app the /, Tomcat expects the app to be mounted at /, and have the name of ROOT. At least that's how I've always handled the situation personally. Even if you just symlink the app into ROOT, that should mitigate your problems. If you have an app placed in ${tomcat\_home}/webapps/newapp, ...
230,649
<h2>Question</h2> <p>I'm looking for a Java in-memory object caching API. Any recommendations? What solutions have you used in the past?</p> <h2>Current</h2> <p>Right now, I'm just using a Map:</p> <pre><code>Map cache = new HashMap&lt;String, Object&gt;(); cache.put("key", value); </code></pre> <h2>Requirements</...
[ { "answer_id": 230659, "author": "Steve K", "author_id": 739, "author_profile": "https://Stackoverflow.com/users/739", "pm_score": 7, "selected": true, "text": "<p><a href=\"http://ehcache.sourceforge.net/\" rel=\"noreferrer\">EHCache</a> is very nice. You can create an in memory cache....
2008/10/23
[ "https://Stackoverflow.com/questions/230649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7679/" ]
Question -------- I'm looking for a Java in-memory object caching API. Any recommendations? What solutions have you used in the past? Current ------- Right now, I'm just using a Map: ``` Map cache = new HashMap<String, Object>(); cache.put("key", value); ``` Requirements ------------ I need to extend the cache t...
[EHCache](http://ehcache.sourceforge.net/) is very nice. You can create an in memory cache. Check out their [code samples](http://ehcache.sourceforge.net/documentation/samples.html) for an example of creating an in memory cache. You can specify a max size, and a time to live. EHCache does offer some advanced features,...
230,662
<p>I have a table that has a column with a default value:</p> <pre><code>create table t ( value varchar(50) default ('something') ) </code></pre> <p>I'm using a stored procedure to insert values into this table:</p> <pre><code>create procedure t_insert ( @value varchar(50) = null ) as insert into t (value) ...
[ { "answer_id": 230676, "author": "Brian Hasden", "author_id": 28926, "author_profile": "https://Stackoverflow.com/users/28926", "pm_score": 2, "selected": false, "text": "<p>As far as I know, the default value is only inserted when you don't specify a value in the insert statement. So, f...
2008/10/23
[ "https://Stackoverflow.com/questions/230662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2614/" ]
I have a table that has a column with a default value: ``` create table t ( value varchar(50) default ('something') ) ``` I'm using a stored procedure to insert values into this table: ``` create procedure t_insert ( @value varchar(50) = null ) as insert into t (value) values (@value) ``` The question is...
Try an if statement ... ``` if @value is null insert into t (value) values (default) else insert into t (value) values (@value) ```
230,687
<p>PHP has a very nice function, isset($variableName). It checks if $variableName is already defined in the program or not.</p> <p>Can we build similar feature for C/C++ (some kind of symbol table lookup)?</p>
[ { "answer_id": 230700, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 2, "selected": false, "text": "<p>Not really. You can't dynamically create variables (though you can dynamically create storage with malloc() e...
2008/10/23
[ "https://Stackoverflow.com/questions/230687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6561/" ]
PHP has a very nice function, isset($variableName). It checks if $variableName is already defined in the program or not. Can we build similar feature for C/C++ (some kind of symbol table lookup)?
I'm a C++ guy, but I remember in PHP isset is used to check if a variable contains a value when passed in through a get/post request (I'm sure there are other uses, but that's a common one I believe). You don't really have dynamic typing in C++. So you can't suddenly use a variable name that you haven't previously exp...
230,689
<p>I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from the env->ExceptionOccurred method, or explicitly by parameters, either way is good) and saves me looking up constructors every time I want to do this. All of the above is preferably in C,...
[ { "answer_id": 240506, "author": "Steven M. Cherry", "author_id": 24193, "author_profile": "https://Stackoverflow.com/users/24193", "pm_score": 7, "selected": true, "text": "<p>We just code utility methods for each of the types of exceptions we want to throw. Here are some examples:</p>...
2008/10/23
[ "https://Stackoverflow.com/questions/230689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23309/" ]
I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from the env->ExceptionOccurred method, or explicitly by parameters, either way is good) and saves me looking up constructors every time I want to do this. All of the above is preferably in C, alt...
We just code utility methods for each of the types of exceptions we want to throw. Here are some examples: ``` jint throwNoClassDefError( JNIEnv *env, char *message ) { jclass exClass; char *className = "java/lang/NoClassDefFoundError"; exClass = (*env)->FindClass( env, className); if (exClass == NULL...
230,715
<p>Alright, after doing a ton of research and trying almost every managed CPP Redist I can find as well as trying to copy my DLLs locally to the executing directory of the app I cannot figure out what dependencies i'm missing for this mixed mode library.</p> <p>Basically I have a large C# application and I'm trying to...
[ { "answer_id": 231117, "author": "Hans Passant", "author_id": 17034, "author_profile": "https://Stackoverflow.com/users/17034", "pm_score": 3, "selected": true, "text": "<p>Did you deploy the <a href=\"http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B...
2008/10/23
[ "https://Stackoverflow.com/questions/230715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12707/" ]
Alright, after doing a ton of research and trying almost every managed CPP Redist I can find as well as trying to copy my DLLs locally to the executing directory of the app I cannot figure out what dependencies i'm missing for this mixed mode library. Basically I have a large C# application and I'm trying to use a mix...
Did you deploy the [CRT libraries](http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en) on the target machine? Long shot: since you have a dependency on 32-bit code, you should set Target Platform in the Build property tab to x86. EDIT: trouble-shoot side-by-sid...
230,716
<p>I'm using C# &amp; .NEt 3.5. What is the difference between the OptionA and OptionB ?</p> <pre><code>class MyClass { private object m_Locker = new object(); private Dicionary&lt;string, object&gt; m_Hash = new Dictionary&lt;string, object&gt;(); public void OptionA() { lock(m_Locker){ ...
[ { "answer_id": 230752, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 2, "selected": false, "text": "<p>It's not what you're \"Locking\", its the code that's contained between the lock { ... } thats important and that...
2008/10/23
[ "https://Stackoverflow.com/questions/230716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17803/" ]
I'm using C# & .NEt 3.5. What is the difference between the OptionA and OptionB ? ``` class MyClass { private object m_Locker = new object(); private Dicionary<string, object> m_Hash = new Dictionary<string, object>(); public void OptionA() { lock(m_Locker){ // Do something with the...
Option B uses the object to be protected to create a critical section. In some cases, this more clearly communicates the intent. If used consistently, it guarantees only one critical section for the protected object will be active at a time: ``` lock (m_Hash) { // Across all threads, I can be in one and only one o...
230,718
<p>I was wondering if there's a way to see the output of any command, straight inside vim, rather than first redirecting it into a file and then opening that file.</p> <p>E.x. I need something like $ gvim &lt; <code>diff -r dir1/ dir2/</code></p> <p>This gives ambiguous redirect error message</p> <p>I just want to...
[ { "answer_id": 230731, "author": "Aditya Mukherji", "author_id": 25990, "author_profile": "https://Stackoverflow.com/users/25990", "pm_score": 2, "selected": false, "text": "<p>jst use gvimdiff instead<br>\nor vimdiff <br>\nto paste the output of a command straight into vim, for example ...
2008/10/23
[ "https://Stackoverflow.com/questions/230718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I was wondering if there's a way to see the output of any command, straight inside vim, rather than first redirecting it into a file and then opening that file. E.x. I need something like $ gvim < `diff -r dir1/ dir2/` This gives ambiguous redirect error message I just want to see the diffs between dir1 and dir2 str...
``` diff file1 file2 | vim -R - ``` The `-R` makes it read-only so you don't accidentally modify the input (which may or may not be your desired behavior). The single dash tells `vim` to reads its input over standard input. Works for other commands, too.
230,724
<p>I'm using a small site to experiment with the uploading of pictures and displaying them.</p> <p>When someone clicks "add a picture", they get taken to a page with a form on it. They can select a file and click the submit button.</p> <p>But what I want to do now is this: put a second submit button labeled "Cancel" ...
[ { "answer_id": 230748, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 4, "selected": true, "text": "<p>You can't look at the button with php - the whole request will have been sent before PHP gets that information.</p>\n\n<p>W...
2008/10/23
[ "https://Stackoverflow.com/questions/230724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11795/" ]
I'm using a small site to experiment with the uploading of pictures and displaying them. When someone clicks "add a picture", they get taken to a page with a form on it. They can select a file and click the submit button. But what I want to do now is this: put a second submit button labeled "Cancel" next to the norma...
You can't look at the button with php - the whole request will have been sent before PHP gets that information. What you could do is put the cancel button in a different `<form>`, like this: ``` <form> <input type="file> <input type="submit" value="upload"> </form> <form> <input type="submit" value="cancel"> </form> ...
230,736
<p>Is it possible for a generic interface's type to be based on a specific parent class?</p> <p>For example:</p> <pre><code>public interface IGenericFace&lt;T : BaseClass&gt; { } </code></pre> <p>Obviously the above code doesn't work but if it did, what I'm trying to tell the compiler is that <code>T</code> must be ...
[ { "answer_id": 230742, "author": "Ryan Lundy", "author_id": 5486, "author_profile": "https://Stackoverflow.com/users/5486", "pm_score": 8, "selected": true, "text": "<pre><code>public interface IGenericFace&lt;T&gt; where T : SomeBaseClass\n</code></pre>\n" }, { "answer_id": 2307...
2008/10/23
[ "https://Stackoverflow.com/questions/230736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9642/" ]
Is it possible for a generic interface's type to be based on a specific parent class? For example: ``` public interface IGenericFace<T : BaseClass> { } ``` Obviously the above code doesn't work but if it did, what I'm trying to tell the compiler is that `T` must be a sub-class of `BaseClass`. Can that be done, are ...
``` public interface IGenericFace<T> where T : SomeBaseClass ```
230,751
<p>How do I force Python's <code>print</code> function to flush the buffered output to the screen?</p>
[ { "answer_id": 230774, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 12, "selected": true, "text": "<p>In Python 3, <a href=\"https://docs.python.org/library/functions.html#print\" rel=\"noreferrer\"><code>print</code></a> ...
2008/10/23
[ "https://Stackoverflow.com/questions/230751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8835/" ]
How do I force Python's `print` function to flush the buffered output to the screen?
In Python 3, [`print`](https://docs.python.org/library/functions.html#print) can take an optional `flush` argument: ``` print("Hello, World!", flush=True) ``` In Python 2, after calling `print`, do: ``` import sys sys.stdout.flush() ``` By default, [`print`](https://docs.python.org/2/reference/simple_stmts.html#t...
230,788
<p>I need to select from a table and filter on dates greater than a specified date. </p> <p>The problem I'm having is that the dates are stored as nchar(20) and I can't seem to get it converted to date in the where clause. </p> <pre><code>SELECT CONVERT(DATETIME,log_time,20) from dbo.logs where CONVERT(DATETIME,lo...
[ { "answer_id": 230802, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 0, "selected": false, "text": "<p>try this:</p>\n\n<pre><code>select convert(datetime, cast(trim(log_time), nvarchar)) from dbo.logs\nwhere convert(dateti...
2008/10/23
[ "https://Stackoverflow.com/questions/230788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to select from a table and filter on dates greater than a specified date. The problem I'm having is that the dates are stored as nchar(20) and I can't seem to get it converted to date in the where clause. ``` SELECT CONVERT(DATETIME,log_time,20) from dbo.logs where CONVERT(DATETIME,log_time,20) > '10/20/2...
This should work. ``` select convert(datetime, cast(rtrim(log_time), nvarchar)) from dbo.logs where convert(datetime, cast(rtrim(log_time), nvarchar)) > '10/20/2008' ```
230,790
<p>I find that most books concerning C++ templates don't tell anything about whether it's possible or not to use initialization list in constructor of a template class.</p> <p>For example, I have code like this:</p> <pre><code>template &lt;class T&gt; class Stack { T* data; std::size_t count; std::size_t ...
[ { "answer_id": 230806, "author": "Jim Buck", "author_id": 2666, "author_profile": "https://Stackoverflow.com/users/2666", "pm_score": 3, "selected": true, "text": "<p>Yes. Did the compiler tell you otherwise?</p>\n" }, { "answer_id": 230836, "author": "chester89", "author...
2008/10/23
[ "https://Stackoverflow.com/questions/230790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
I find that most books concerning C++ templates don't tell anything about whether it's possible or not to use initialization list in constructor of a template class. For example, I have code like this: ``` template <class T> class Stack { T* data; std::size_t count; std::size_t capacity; enum {INIT = ...
Yes. Did the compiler tell you otherwise?
230,796
<p>I'm creating a table that looks something like this.</p> <pre><code>CREATE TABLE packages ( productCode char(2) , name nvarchar(100) , ... ) </code></pre> <p>How do I make sure the productCode is always one of two values <code>XJ</code> or <code>XD</code>?</p>
[ { "answer_id": 230819, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 4, "selected": true, "text": "<pre><code>ALTER TABLE packages\nADD CONSTRAINT constraintname CHECK (productCode in ('XJ', 'XD'))\n</code></pre>\n" }, { ...
2008/10/23
[ "https://Stackoverflow.com/questions/230796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437/" ]
I'm creating a table that looks something like this. ``` CREATE TABLE packages ( productCode char(2) , name nvarchar(100) , ... ) ``` How do I make sure the productCode is always one of two values `XJ` or `XD`?
``` ALTER TABLE packages ADD CONSTRAINT constraintname CHECK (productCode in ('XJ', 'XD')) ```
230,831
<p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Unbalanced_binary_tree.svg/251px-Unbalanced_binary_tree.svg.png" alt="alt text"></p> <p>The image above is from <a href="http://en.wikipedia.org/wiki/AVL_tree" rel="nofollow noreferrer">"Wikipedia's entry on AVL trees"</a> which Wikipedia indicates...
[ { "answer_id": 230841, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 4, "selected": false, "text": "<p>Node 76 is unbalanced, for example, because its right subtree is of height 0 and the left is of height 3.</p>\n" }, ...
2008/10/23
[ "https://Stackoverflow.com/questions/230831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412/" ]
![alt text](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Unbalanced_binary_tree.svg/251px-Unbalanced_binary_tree.svg.png) The image above is from ["Wikipedia's entry on AVL trees"](http://en.wikipedia.org/wiki/AVL_tree) which Wikipedia indicates is unbalanced. How is this tree not balanced already? Here'...
To be balanced, every node in the tree must, either, * have no children, (be a "leaf" node) * Have two children. * Or, if it has only one child, that child must be a leaf. In the chart you posted, 9, 54 & 76 violate the last rule. Properly balanced, the tree would look like: ``` Root: 23 (23) -> 14 & 67 (14) -> 12 ...
230,834
<p>This is a winforms application.</p> <p>In windows, I want the user to click and button, and then a popup should make the user select the path of where they want to save the file.</p>
[ { "answer_id": 230867, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 1, "selected": false, "text": "<p><code>StringBuilder.ToString()</code> can be passed to the <code>TextStream.Write()</code> method after creating the file.<...
2008/10/23
[ "https://Stackoverflow.com/questions/230834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is a winforms application. In windows, I want the user to click and button, and then a popup should make the user select the path of where they want to save the file.
You want the [WriteAllText](http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx) function. ``` using (SaveFileDialog dialog = new SaveFileDialog()) { if (dialog.ShowDialog(this) == DialogResult.OK) { File.WriteAllText(dialog.FileName, yourStringBuilder.ToString()); } } ```
230,842
<p>The first one is definitely something that works, but which one below is the efficient way?</p> <pre><code>switch($type) { case 1: print 'success'; break; case 2: print 'success'; break; case 3: print 'success'; break; case 4: print 'success for type 4'...
[ { "answer_id": 230857, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 5, "selected": true, "text": "<pre><code> switch($type) \n {\n case 1:\n case 2:\n case 3:\n print 'success';\n break;\n case ...
2008/10/23
[ "https://Stackoverflow.com/questions/230842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
The first one is definitely something that works, but which one below is the efficient way? ``` switch($type) { case 1: print 'success'; break; case 2: print 'success'; break; case 3: print 'success'; break; case 4: print 'success for type 4'; break; }...
``` switch($type) { case 1: case 2: case 3: print 'success'; break; case 4: print 'success for type 4'; break; } ``` Is the way to go!
230,845
<p>I'm writing a python script that executes a csh script in Solaris 10. The csh script prompts the user for the root password (which I know) but I'm not sure how to make the python script answer the prompt with the password. Is this possible? Here is what I'm using to execute the csh script:</p> <pre><code>import com...
[ { "answer_id": 230855, "author": "Owen", "author_id": 2109, "author_profile": "https://Stackoverflow.com/users/2109", "pm_score": 0, "selected": false, "text": "<p>Should be able to pass it as a parameter. something like:</p>\n\n<pre><code>commands.getoutput('server stop -p password')\n...
2008/10/23
[ "https://Stackoverflow.com/questions/230845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7949/" ]
I'm writing a python script that executes a csh script in Solaris 10. The csh script prompts the user for the root password (which I know) but I'm not sure how to make the python script answer the prompt with the password. Is this possible? Here is what I'm using to execute the csh script: ``` import commands command...
Have a look at the [pexpect](http://www.noah.org/wiki/Pexpect) module. It is designed to deal with interactive programs, which seems to be your case. Oh, and remember that hard-encoding root's password in a shell or python script is potentially a security hole :D
230,886
<p>I've seen this format used for comma-delimited lists in some C++ code (although this could apply to any language):</p> <pre><code>void function( int a , int b , int c ) </code></pre> <p>I was wondering why would someone use that over a more common format such as:</p> <pre...
[ { "answer_id": 230895, "author": "buti-oxa", "author_id": 2515, "author_profile": "https://Stackoverflow.com/users/2515", "pm_score": 2, "selected": false, "text": "<p>It is easier to add a parameter at the end starting by duplicating previous parameter (line).</p>\n\n<p>Make sense when ...
2008/10/23
[ "https://Stackoverflow.com/questions/230886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4086/" ]
I've seen this format used for comma-delimited lists in some C++ code (although this could apply to any language): ``` void function( int a , int b , int c ) ``` I was wondering why would someone use that over a more common format such as: ``` void function (int a, ...
That's a pretty common coding style when writing SQL statements: ``` SELECT field1 , field2 , field3 -- , field4 , field5 FROM tablename ``` Advantages: * Lets you add, remove, or rearrange fields easily without having to worry about that final trailing comma. * Lets you easily comment out a row (T...
230,892
<p>I have quickly read (and will read with more care soon) the article of Scott Allen concerning the possibility to use an other provider of the default SQL Express or SQL Server database to use the "<a href="http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication...
[ { "answer_id": 230895, "author": "buti-oxa", "author_id": 2515, "author_profile": "https://Stackoverflow.com/users/2515", "pm_score": 2, "selected": false, "text": "<p>It is easier to add a parameter at the end starting by duplicating previous parameter (line).</p>\n\n<p>Make sense when ...
2008/10/23
[ "https://Stackoverflow.com/questions/230892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I have quickly read (and will read with more care soon) the article of Scott Allen concerning the possibility to use an other provider of the default SQL Express or SQL Server database to use the "[Membership and Role Providers](http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-...
That's a pretty common coding style when writing SQL statements: ``` SELECT field1 , field2 , field3 -- , field4 , field5 FROM tablename ``` Advantages: * Lets you add, remove, or rearrange fields easily without having to worry about that final trailing comma. * Lets you easily comment out a row (T...
230,893
<p>What is the fastest way to load data from flatfiles into a MySQL database, and then create the relations between the tables via foreign keys? </p> <p>For example... I have a flat file in the format: </p> <pre><code>[INDIVIDUAL] [POP] [MARKER] [GENOTYPE] "INDIVIDUAL1", "CEU", "rs55555","AA" "INDIVIDUAL1", "C...
[ { "answer_id": 230913, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 3, "selected": false, "text": "<p>I would take a multiple step approach to do this.</p>\n\n<ol>\n<li>Load the data into a temporary table, that i...
2008/10/23
[ "https://Stackoverflow.com/questions/230893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30911/" ]
What is the fastest way to load data from flatfiles into a MySQL database, and then create the relations between the tables via foreign keys? For example... I have a flat file in the format: ``` [INDIVIDUAL] [POP] [MARKER] [GENOTYPE] "INDIVIDUAL1", "CEU", "rs55555","AA" "INDIVIDUAL1", "CEU", "rs535454","GA" ...
There is a simpler way. First, make sure you have a UNIQUE constraint on those columns that should have one (name, population, rsid). Then use something like the following: ``` LOAD DATA INFILE 'data.txt' IGNORE INTO TABLE POP FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ...
230,896
<p>I have a list of variable names, like this:</p> <pre><code>['foo', 'bar', 'baz'] </code></pre> <p>(I originally asked how I convert a list of variables. See Greg Hewgill's answer below.)</p> <p>How do I convert this to a dictionary where the keys are the variable names (as strings) and the values are the values ...
[ { "answer_id": 230907, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>Your original list <code>[foo, bar, baz]</code> doesn't contain the variable <em>names</em>, it just contains elements...
2008/10/23
[ "https://Stackoverflow.com/questions/230896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
I have a list of variable names, like this: ``` ['foo', 'bar', 'baz'] ``` (I originally asked how I convert a list of variables. See Greg Hewgill's answer below.) How do I convert this to a dictionary where the keys are the variable names (as strings) and the values are the values of the variables? ``` {'foo': foo...
Forget filtering `locals()`! The dictionary you give to the formatting string is allowed to contain unused keys: ``` >>> name = 'foo' >>> zip = 123 >>> unused = 'whoops!' >>> locals() {'name': 'foo', 'zip': 123, ... 'unused': 'whoops!', ...} >>> '%(name)s %(zip)i' % locals() 'foo 123' ``` With the new [f-string feat...
230,927
<p>I'm looking for best practices for establishing connections between Oracle 8 and Visual Studio 2005 applications. The target would be a Windows Forms application written in C# that hits the database once a second to monitor tables looking for their last inserted record. I'm considering using "Application settings" t...
[ { "answer_id": 231073, "author": "Loscas", "author_id": 22706, "author_profile": "https://Stackoverflow.com/users/22706", "pm_score": 2, "selected": true, "text": "<p>Based on my experience with Oracle 10g....</p>\n\n<p>I recommend using the Oracle data provider (ODP.Net) and not using t...
2008/10/23
[ "https://Stackoverflow.com/questions/230927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
I'm looking for best practices for establishing connections between Oracle 8 and Visual Studio 2005 applications. The target would be a Windows Forms application written in C# that hits the database once a second to monitor tables looking for their last inserted record. I'm considering using "Application settings" to s...
Based on my experience with Oracle 10g.... I recommend using the Oracle data provider (ODP.Net) and not using the Microsoft for Oracle data provider based on my experience with Oracle 10g. Microsoft's has not been updated in years and does not support everything in Oracle 10g, so I would definitely check into that for...
230,973
<p>I saw a code snippet yesterday in one of the responses here on StackOverflow that intrigued me. It was something like this:</p> <pre><code> List&lt;string&gt; myList = new List&lt;string&gt; {"aBc", "HELLO", "GoodBye"}; myList.ForEach(d=&gt;d.ToLower()); </code></pre> <p>I was hoping I could use it to convert al...
[ { "answer_id": 230991, "author": "marcumka", "author_id": 30761, "author_profile": "https://Stackoverflow.com/users/30761", "pm_score": 2, "selected": false, "text": "<pre><code>[TestMethod]\npublic void LinqStringTest()\n{\n List&lt;string&gt; myList = new List&lt;string&gt; { \"aBc\...
2008/10/23
[ "https://Stackoverflow.com/questions/230973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29662/" ]
I saw a code snippet yesterday in one of the responses here on StackOverflow that intrigued me. It was something like this: ``` List<string> myList = new List<string> {"aBc", "HELLO", "GoodBye"}; myList.ForEach(d=>d.ToLower()); ``` I was hoping I could use it to convert all items in myList to lowercase. However, ...
Easiest approach: ``` myList = myList.ConvertAll(d => d.ToLower()); ``` Not too much different than your example code. `ForEach` loops the original list whereas `ConvertAll` creates a new one which you need to reassign.
230,981
<p>I am working with some input that is in the possible forms</p> <pre><code>$1,200 20 cents/ inch $10 </code></pre> <p>Is there a way to parse these to numbers in VB? Also printing these numbers?</p> <p><strong>EDIT:</strong> Regular expressions would be great.</p> <p><strong>EDIT:</strong> VB 6 in particular</p>...
[ { "answer_id": 231025, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 2, "selected": true, "text": "<p>Ehh...Assuming all that you want is the digits, I would use a Regular Expression to simply replace any non-digit with \"\"...
2008/10/23
[ "https://Stackoverflow.com/questions/230981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17712/" ]
I am working with some input that is in the possible forms ``` $1,200 20 cents/ inch $10 ``` Is there a way to parse these to numbers in VB? Also printing these numbers? **EDIT:** Regular expressions would be great. **EDIT:** VB 6 in particular
Ehh...Assuming all that you want is the digits, I would use a Regular Expression to simply replace any non-digit with "". You would need to reference Microsoft VBScript Regular Expressions in your project. Then let's say that your text was in a variable called strTest. Here is some off the cuff untested code: ``` Dim...
230,985
<p>I have a Delphi Web Server setup and running, publishing Web Services, and I want to know some stuff on the calls to the web services:</p> <ul> <li>The IP address of the client who calls the web service.</li> <li>Some SOAP information on the call, such as username and password.</li> </ul> <p>How can I get this inf...
[ { "answer_id": 254898, "author": "Lars Truijens", "author_id": 1242, "author_profile": "https://Stackoverflow.com/users/1242", "pm_score": 3, "selected": true, "text": "<p>You should be able to get a <a href=\"http://docs.codegear.com/docs/radstudio/radstudio2007/RS2007_helpupdates/HUpda...
2008/10/23
[ "https://Stackoverflow.com/questions/230985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16732/" ]
I have a Delphi Web Server setup and running, publishing Web Services, and I want to know some stuff on the calls to the web services: * The IP address of the client who calls the web service. * Some SOAP information on the call, such as username and password. How can I get this information from within the service co...
You should be able to get a [TWebRequest](http://docs.codegear.com/docs/radstudio/radstudio2007/RS2007_helpupdates/HUpdate3/EN/html/delphivclwin32/HTTPApp_TWebRequest.html) from the Request property of the TWebModule object you get from calling [GetSOAPWebModule](http://docs.codegear.com/docs/radstudio/radstudio2007/RS...
230,992
<p>I'm trying to create a table under SQL Server 2008 containing a <strong>GEOMETRY</strong> column and a calculated variation thereof.</p> <p>Considering the following table where the calculated column returns a buffered geometry:</p> <pre><code>CREATE TABLE [dbo].[Test] ( [Geometry] GEOMETRY NOT NULL, ...
[ { "answer_id": 231758, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 2, "selected": false, "text": "<p>I guess you could use a trigger to calculate it and store it to the [BufferedGeometry] field</p>\n" }, { "answer_id...
2008/10/23
[ "https://Stackoverflow.com/questions/230992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28305/" ]
I'm trying to create a table under SQL Server 2008 containing a **GEOMETRY** column and a calculated variation thereof. Considering the following table where the calculated column returns a buffered geometry: ``` CREATE TABLE [dbo].[Test] ( [Geometry] GEOMETRY NOT NULL, [Buffer] FLOAT NOT...
I guess you could use a trigger to calculate it and store it to the [BufferedGeometry] field
231,023
<p>I'd like to align label/value pairs in the center using CSS without using absolute positioning or tables (see screen shot). In that screen shot I positioned the value (ie. $4,500/wk) absolute and then floated the label right up against it. But absolute doesn't work so well in IE and I've heard it's not a good tech...
[ { "answer_id": 231030, "author": "Jon Tackabury", "author_id": 343, "author_profile": "https://Stackoverflow.com/users/343", "pm_score": 4, "selected": false, "text": "<p>If you're showing tabular data there's no shame in using a table.</p>\n" }, { "answer_id": 231033, "autho...
2008/10/23
[ "https://Stackoverflow.com/questions/231023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6957/" ]
I'd like to align label/value pairs in the center using CSS without using absolute positioning or tables (see screen shot). In that screen shot I positioned the value (ie. $4,500/wk) absolute and then floated the label right up against it. But absolute doesn't work so well in IE and I've heard it's not a good technique...
I'm confused, what's tabular about that data? Where are the records? Rows of different fields do not really make a table in the traditional sense. (Nor hacking it to have two records per row for that matter) If we're entertaining this idea, then what's the difference between the left half of the table and the right? ...
231,027
<p>I make a request to an xml web service, and get back a response. This response, being a stream, is then saved to a string. The problem is, the response is full of tags, CDATA, etc (as you would expect). There is no line breaking either, as to be expected.</p> <p>I want to take this string, which represents an xml d...
[ { "answer_id": 231041, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 3, "selected": false, "text": "<p>This is exactly what XSLT is for! It transforms XML files into a different output. In your case, you could use a relati...
2008/10/23
[ "https://Stackoverflow.com/questions/231027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I make a request to an xml web service, and get back a response. This response, being a stream, is then saved to a string. The problem is, the response is full of tags, CDATA, etc (as you would expect). There is no line breaking either, as to be expected. I want to take this string, which represents an xml document, a...
This is exactly what XSLT is for! It transforms XML files into a different output. In your case, you could use a relatively simple XSL transformation to output a list. This might do it: records.xml: ``` <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> <Records> <Record> <name>adam</nam...
231,029
<p>I am trying to include a value from a database table within the value element of an input field.<br> This is what I have, but it is not working:</p> <pre><code>?&gt;&lt;input type="text" size="10" value="&lt;?= date("Y-m-d", strtotime($rowupd['upcoming_event_featured_date'])) ?&gt;" name="upcoming_event_featured_d...
[ { "answer_id": 231037, "author": "Devon", "author_id": 13850, "author_profile": "https://Stackoverflow.com/users/13850", "pm_score": 1, "selected": false, "text": "<p>You can use the <a href=\"http://us.php.net/manual/en/ini.core.php#ini.short-open-tag\" rel=\"nofollow noreferrer\">short...
2008/10/23
[ "https://Stackoverflow.com/questions/231029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
I am trying to include a value from a database table within the value element of an input field. This is what I have, but it is not working: ``` ?><input type="text" size="10" value="<?= date("Y-m-d", strtotime($rowupd['upcoming_event_featured_date'])) ?>" name="upcoming_event_featured_date" id="keys"/><?php ```...
It's a good idea to always use full PHP tags, because that will keep your app from breaking if you move to a different server or your config is changed not to allow short tags. ``` ?> <input type="text" size="10" value="<?php echo(date("Y-m-d", strtotime($rowupd['upcoming_event_featured_date']))); ?>"name="upcoming_ev...
231,051
<p>After reading <a href="http://www.javaworld.com/javaworld/javatips/jw-javatip130.html?page=2" rel="noreferrer">this old article</a> measuring the memory consumption of several object types, I was amazed to see how much memory <code>String</code>s use in Java:</p> <pre><code>length: 0, {class java.lang.String} size =...
[ { "answer_id": 231067, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "<p>Out of curiosity, is the few bytes saved really worth it?</p>\n\n<p>Normally, I suggest ditching strings for performance ...
2008/10/23
[ "https://Stackoverflow.com/questions/231051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21368/" ]
After reading [this old article](http://www.javaworld.com/javaworld/javatips/jw-javatip130.html?page=2) measuring the memory consumption of several object types, I was amazed to see how much memory `String`s use in Java: ``` length: 0, {class java.lang.String} size = 40 bytes length: 7, {class java.lang.String} size =...
With a Little Bit of Help From the JVM... ========================================= ***WARNING:** This solution is now obsolete in newer Java SE versions. See other ad-hoc solutions further below.* If you use an HotSpot JVM, since Java 6 update 21, you can use this command-line option: ``` -XX:+UseCompressedStrings ...
231,052
<p>I have a page where a few textboxes cannot be empty before clicking a Save button. </p> <pre><code>&lt;TextBox... &lt;TextBox.Text&gt; &lt;Binding Path ="LastName" UpdateSourceTrigger="PropertyChanged"&gt; &lt;Binding.ValidationRules&gt; ...
[ { "answer_id": 232548, "author": "Todd White", "author_id": 30833, "author_profile": "https://Stackoverflow.com/users/30833", "pm_score": 3, "selected": false, "text": "<p>You want to use <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.controls.validation.haserror.aspx\"...
2008/10/23
[ "https://Stackoverflow.com/questions/231052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
I have a page where a few textboxes cannot be empty before clicking a Save button. ``` <TextBox... <TextBox.Text> <Binding Path ="LastName" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <local:StringRequiredVa...
Here is the complete sample what you need. <http://codeblitz.wordpress.com/2009/05/08/wpf-validation-made-easy-with-idataerrorinfo/> <https://skydrive.live.com/?cid=2c6600f1c1d5e3be&id=2C6600F1C1D5E3BE%21203> ![enter image description here](https://i.stack.imgur.com/wRAT1.jpg)
231,057
<p>Is there any library function for this purpose, so I don't do it by hand and risk ending in TDWTF?</p> <pre><code>echo ceil(31497230840470473074370324734723042.6); // Expected result 31497230840470473074370324734723043 // Prints &lt;garbage&gt; </code></pre>
[ { "answer_id": 231171, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 4, "selected": true, "text": "<p>This will work for you:</p>\n\n<pre><code>$x = '31497230840470473074370324734723042.9';\n\nbcscale(100);\nvar_dump(bcFloor(...
2008/10/23
[ "https://Stackoverflow.com/questions/231057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13211/" ]
Is there any library function for this purpose, so I don't do it by hand and risk ending in TDWTF? ``` echo ceil(31497230840470473074370324734723042.6); // Expected result 31497230840470473074370324734723043 // Prints <garbage> ```
This will work for you: ``` $x = '31497230840470473074370324734723042.9'; bcscale(100); var_dump(bcFloor($x)); var_dump(bcCeil($x)); var_dump(bcRound($x)); function bcFloor($x) { $result = bcmul($x, '1', 0); if ((bccomp($result, '0', 0) == -1) && bccomp($x, $result, 1)) $result = bcsub($result, 1, 0)...
231,069
<p>I want to write a default structure, N times, to a file, using fwrite.</p> <pre><code>typedef struct foo_s { uint32 A; uint32 B; char desc[100]; }foo_t; void init_file(FILE *fp, int N) { foo_t foo_struct = {0}; foo_struct.A = -1; foo_struct.B = 1; fwrite(&amp;foo_struct, sizeof(foo_struct), N, f...
[ { "answer_id": 231083, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 2, "selected": false, "text": "<p>The only way to do this with a single fwrite is to replicate the foo_struct N times in RAM, then do a single fwri...
2008/10/23
[ "https://Stackoverflow.com/questions/231069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29405/" ]
I want to write a default structure, N times, to a file, using fwrite. ``` typedef struct foo_s { uint32 A; uint32 B; char desc[100]; }foo_t; void init_file(FILE *fp, int N) { foo_t foo_struct = {0}; foo_struct.A = -1; foo_struct.B = 1; fwrite(&foo_struct, sizeof(foo_struct), N, fp); } ``` The...
You can't with a single fwrite(). You'd have to use a loop: ``` int i; for (i = 0; i < N; ++i) fwrite(&foo_struct, sizeof(foo_struct), 1, fp); ``` The third parameter of fwrite() is the number of objects to write, not the number of times to write a single object.
231,098
<p>I'd like a loop that uses a UInt16 (ushort) to loop through all of its values. However, this doesn't do it:</p> <pre><code>for( ushort i = 0; i &lt; UInt16.MaxValue; i++ ) { // do something } </code></pre> <p>The problem is that the loop will quit when i == 0xFFFF and not "do something". If I change the 'for'...
[ { "answer_id": 231112, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 5, "selected": true, "text": "<p>Use a <code>do...while</code> loop</p>\n\n<pre><code>ushort i = 0;\ndo\n{\n // do something\n} while(i++ &lt; U...
2008/10/23
[ "https://Stackoverflow.com/questions/231098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9516/" ]
I'd like a loop that uses a UInt16 (ushort) to loop through all of its values. However, this doesn't do it: ``` for( ushort i = 0; i < UInt16.MaxValue; i++ ) { // do something } ``` The problem is that the loop will quit when i == 0xFFFF and not "do something". If I change the 'for' statement to "for(ushort i = ...
Use a `do...while` loop ``` ushort i = 0; do { // do something } while(i++ < UInt16.MaxValue); ``` There is an interesting discussion of testing loops at the top vs. the bottom [here](https://stackoverflow.com/questions/224059/do-your-loops-test-at-the-top-or-bottom).
231,126
<p>I'm terribly new to SQL, and cannot seem to get the desired information out, after trying a few different google searches, and reading through some SQL tutorials.</p> <p>I think it involves some sort of joins, but cannot get them straight.</p> <p>Given the following sample tables:</p> <p>Table 1(Activity This is ...
[ { "answer_id": 231139, "author": "Totty", "author_id": 30838, "author_profile": "https://Stackoverflow.com/users/30838", "pm_score": 2, "selected": false, "text": "<p>You will need to use a JOIN statement to retrieve fields from multiple tables.\n<a href=\"http://www.w3schools.com/Sql/sq...
2008/10/23
[ "https://Stackoverflow.com/questions/231126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30939/" ]
I'm terribly new to SQL, and cannot seem to get the desired information out, after trying a few different google searches, and reading through some SQL tutorials. I think it involves some sort of joins, but cannot get them straight. Given the following sample tables: Table 1(Activity This is updated every time a cha...
``` SELECT a1.Who, a1.What, a1.ID, c.When, c.Comment FROM Activity AS a1 JOIN Activity AS a2 ON (a1.ID = a2.ID AND a1.When > a2.When) JOIN Comments AS c ON (a1.ID = c.ID AND a.When = c.When); WHERE a2.What = 'Closed'; ``` I think you need some way to associate a row in Comments to the correct row in Activity. Rig...
231,132
<p>I'm trying to get Wininet to ignore Internet Explorer's "Work Offline" mode, for both HTTP and FTP.</p> <p>So I'm trying to use <code>InternetSetOption()</code> with <code>INTERNET_OPTION_IGNORE_OFFLINE</code>. The documentation says "This is used by <code>InternetQueryOption</code> and <code>InternetSetOption</co...
[ { "answer_id": 471159, "author": "michael", "author_id": 31207, "author_profile": "https://Stackoverflow.com/users/31207", "pm_score": 0, "selected": false, "text": "<p>Did you tried <code>GET</code> instead of <code>POST</code> which sends additional data in headers? </p>\n\n<p>For exam...
2008/10/23
[ "https://Stackoverflow.com/questions/231132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24267/" ]
I'm trying to get Wininet to ignore Internet Explorer's "Work Offline" mode, for both HTTP and FTP. So I'm trying to use `InternetSetOption()` with `INTERNET_OPTION_IGNORE_OFFLINE`. The documentation says "This is used by `InternetQueryOption` and `InternetSetOption` with a request handle." However, you can't get a re...
I checked use of `INTERNET_OPTION_IGNORE_OFFLINE` with the IE 9 version of WinInet and it does seem to work. Make sure you call InternetSetOption *before* you call HttpOpenRequest and pass in the hInternet handle instead. The option must be set before the request actually gets sent to the server. HttpOpenRequest +++ ...
231,146
<p>I'm trying to change user input in wildcard form <code>("*word*")</code> to a regular expression format. To that end, I'm using the code below to strip off the <code>'*'</code> at the beginning and end of the input so that I can add the regular expression characters on either end:</p> <pre><code>string::iterator ...
[ { "answer_id": 231173, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": true, "text": "<p>Try erasing them in the opposite order:</p>\n\n<pre><code>expressionBuilder.erase(iter_end);\nexpressionBuilder.erase(i...
2008/10/23
[ "https://Stackoverflow.com/questions/231146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1544/" ]
I'm trying to change user input in wildcard form `("*word*")` to a regular expression format. To that end, I'm using the code below to strip off the `'*'` at the beginning and end of the input so that I can add the regular expression characters on either end: ``` string::iterator iter_begin = expressionBuilder.begi...
Try erasing them in the opposite order: ``` expressionBuilder.erase(iter_end); expressionBuilder.erase(iter_begin); ``` After erasing the first \*, iter\_end refers to one character past the end of the string in your example. The [STL documentation](http://www.sgi.com/tech/stl/basic_string.html) indicates that itera...
231,158
<p>I'm writing an ASP.NET webforms app, and I'm using jQuery for my AJAX calls. This is working well, but on some occasions, the $.getJSON call is causing a full page postback. I am not using the ASP.NET AJAX library anywhere in the app. I can't reproduce the problem on a consistent basis, and am not sure what is causi...
[ { "answer_id": 231275, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 0, "selected": false, "text": "<p>Under some circumstances when jQuery can't do a AJAX call, so it creates a hidden iframe and does a normal submit ...
2008/10/23
[ "https://Stackoverflow.com/questions/231158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
I'm writing an ASP.NET webforms app, and I'm using jQuery for my AJAX calls. This is working well, but on some occasions, the $.getJSON call is causing a full page postback. I am not using the ASP.NET AJAX library anywhere in the app. I can't reproduce the problem on a consistent basis, and am not sure what is causing ...
How are you triggering that JavaScript function? If it's a client-side click handler on a control like a Button, you need to be sure to call preventDefault(). Otherwise, the browser will submit the form and cause a postback, even while the AJAX callback is in progress.
231,159
<p>I remember from C days that we were encouraged to use</p> <pre><code>i &gt; -1 </code></pre> <p>instead of</p> <pre><code>i &gt;= 0 </code></pre> <p>because of performance.</p> <p>Does this still apply in the C# .NET world? What are the performance implications of using one over the other with today's compilers...
[ { "answer_id": 231170, "author": "Epaga", "author_id": 6583, "author_profile": "https://Stackoverflow.com/users/6583", "pm_score": 3, "selected": false, "text": "<p>No you don't need to do this any more. Yes the compilers have become much smarter and the two expressions have no performan...
2008/10/23
[ "https://Stackoverflow.com/questions/231159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
I remember from C days that we were encouraged to use ``` i > -1 ``` instead of ``` i >= 0 ``` because of performance. Does this still apply in the C# .NET world? What are the performance implications of using one over the other with today's compilers? i.e. Is the compiler clever enough to optimize these for you...
No, there are no performance issues associated with comparison operators. And any good compiler would optimize something this trivial anyway. I'm not sure where you got the suggestion to use "i > -1" rather than "i >= 0". On the x86 architecture, it makes no difference which you use: either case takes exactly two inst...
231,175
<p>Where can I find comprehensive documentation for MOQ? I'm just starting with mocking and am having difficulty getting my head around it. I've read through all the links at <a href="http://code.google.com/p/moq/wiki/QuickStart" rel="noreferrer">http://code.google.com/p/moq/wiki/QuickStart</a> but can't seem to find a...
[ { "answer_id": 231194, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 4, "selected": false, "text": "<p>Have you watched <a href=\"http://dimecasts.net/Content/WatchEpisode/8\" rel=\"noreferrer\">Introduction to Mocki...
2008/10/23
[ "https://Stackoverflow.com/questions/231175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30046/" ]
Where can I find comprehensive documentation for MOQ? I'm just starting with mocking and am having difficulty getting my head around it. I've read through all the links at <http://code.google.com/p/moq/wiki/QuickStart> but can't seem to find a tutorial or gentle introduction. I have also looked briefly at Rhino Mocks ...
Moq's latest documentation is now available at github wiki page: <https://github.com/Moq/moq4/wiki/Quickstart> Previously they were on Google Code. As well as the wiki and other online resources, there's full documentation in Windows .CHM help-file format included in the [Moq binary download](https://github.com/Moq/m...
231,189
<p>What tool or method do you recommend to find and replace values in your code? If code is on Linux/Unix, are find and grep the best method?</p>
[ { "answer_id": 231210, "author": "biozinc", "author_id": 30698, "author_profile": "https://Stackoverflow.com/users/30698", "pm_score": 1, "selected": false, "text": "<p>I'm assuming you intend to rename a variable.</p>\n\n<p>It depends on what the body of code is. For C#, Visual Studio's...
2008/10/23
[ "https://Stackoverflow.com/questions/231189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26180/" ]
What tool or method do you recommend to find and replace values in your code? If code is on Linux/Unix, are find and grep the best method?
Take a look at [ack](http://petdance.com/ack/), which is designed for searching big codebases. For replacing, look at Perl's -i, -p and -e flags. You can do stuff like: ``` $ perl -i -p -e's/\bthisword\b/thatword/g' $(find . -name *.html) ``` to replace all instances of thisword with thatword in all .html files in ...
231,191
<p>Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but that isn't very smooth. How can I allo...
[ { "answer_id": 232829, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "<p>Couple of slightly hacky solutions:</p>\n\n<ul>\n<li>(Very hacky) use a <code>&lt;meta http-equiv=\"refresh\" content=\"5\...
2008/10/23
[ "https://Stackoverflow.com/questions/231191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but that isn't very smooth. How can I allow t...
**Update** As of Mojarra 2.1.19 / 2.2.0 you can now set the transient attribute of the `<f:view>` to true: ``` <f:view transient="true"> Your regular content </f:view> ``` You can read about in on [Balusc's](https://stackoverflow.com/users/157882/balusc) blog here: <http://balusc.blogspot.com.br/2013/02/state...