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
205,522
<p>I have image data and i want to get a sub image of that to use as an opengl texture. </p> <pre><code>glGenTextures(1, &amp;m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &amp;oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2...
[ { "answer_id": 205569, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "<p><strong>Edit:</strong> Use glPixelStorei. You use it to set <code>GL_UNPACK_ROW_LENGTH</code> to the width (in pixels) of th...
2008/10/15
[ "https://Stackoverflow.com/questions/205522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25893/" ]
I have image data and i want to get a sub image of that to use as an opengl texture. ``` glGenTextures(1, &m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILT...
**Edit:** Use glPixelStorei. You use it to set `GL_UNPACK_ROW_LENGTH` to the width (in pixels) of the entire image. Then you call glTexImage2D (or whatever), passing it a pointer to the first pixel of the subimage and the width and height of the subimage. Don't forget to restore `GL_UNPACK_ROW_LENGTH` to 0 when you're...
205,526
<p>I'm working on an application for work that is going to query our employee database. The end users want the ability to search based on the standard name/department criteria, but they also want the flexibility to query for all people with the first name of "James" that works in the Health Department. The one thing I ...
[ { "answer_id": 205537, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": -1, "selected": false, "text": "<p>My first thought was to write a query something like this...</p>\n\n<pre><code>SELECT EmpId, NameLast, NameMiddle, NameFirs...
2008/10/15
[ "https://Stackoverflow.com/questions/205526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71/" ]
I'm working on an application for work that is going to query our employee database. The end users want the ability to search based on the standard name/department criteria, but they also want the flexibility to query for all people with the first name of "James" that works in the Health Department. The one thing I wan...
While the `COALESCE` trick is neat, my preferred method is: ``` CREATE PROCEDURE ps_Customers_SELECT_NameCityCountry @Cus_Name varchar(30) = NULL ,@Cus_City varchar(30) = NULL ,@Cus_Country varchar(30) = NULL ,@Dept_ID int = NULL ,@Dept_ID_partial varchar(10) = NULL AS SELECT Cus_Name ,Cus_C...
205,529
<p>Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function?</p> <p>Example:</p> <pre><code>void format_string(char *fmt, ...); void debug_print(int db...
[ { "answer_id": 205584, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 9, "selected": true, "text": "<p>To pass the ellipses on, you initialize a <code>va_list</code> as usual and simply pass it to your second function. You do...
2008/10/15
[ "https://Stackoverflow.com/questions/205529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4381/" ]
Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function? Example: ``` void format_string(char *fmt, ...); void debug_print(int dbg_lvl, char *fmt, ......
To pass the ellipses on, you initialize a `va_list` as usual and simply pass it to your second function. You don't use `va_arg()`. Specifically; ``` void format_string(char *fmt,va_list argptr, char *formatted_string); void debug_print(int dbg_lvl, char *fmt, ...) { char formatted_string[MAX_FMT_SIZE]; va_lis...
205,555
<p>During my work with databases I noticed that I write query strings and in this strings I have to put several restrictions in the where-clause from a list/array/collection. Should look like this:</p> <pre><code>select * from customer where customer.id in (34, 26, ..., 2); </code></pre> <p>You can simplify this by ...
[ { "answer_id": 205596, "author": "Dónal", "author_id": 2648, "author_profile": "https://Stackoverflow.com/users/2648", "pm_score": 1, "selected": false, "text": "<p>I'm not sure how \"sophisticated\" this is, but it's certainly a bit shorter. It will work with various different types of ...
2008/10/15
[ "https://Stackoverflow.com/questions/205555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038/" ]
During my work with databases I noticed that I write query strings and in this strings I have to put several restrictions in the where-clause from a list/array/collection. Should look like this: ``` select * from customer where customer.id in (34, 26, ..., 2); ``` You can simplify this by reducing this to the quest...
Note: This answers was good when it was written 11 years ago, but now there are far better options to do this more cleanly in a single line, both using only Java built-in classes or using a utility library. See other answers below. --- Since strings are immutable, you may want to use the StringBuilder class if you're...
205,557
<p>If you develop for ATG Dynamo, how do you structure your modules and dependencies?</p> <p>How do you structure the projects? source directories, JARs configs etc.</p> <p>How do you build and deploy? What tools do you use?</p>
[ { "answer_id": 271071, "author": "talanb", "author_id": 20103, "author_profile": "https://Stackoverflow.com/users/20103", "pm_score": 3, "selected": false, "text": "<p>We have a monolithic architecture with a single ATG module. We originally developed this site with JHTML and have since ...
2008/10/15
[ "https://Stackoverflow.com/questions/205557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15452/" ]
If you develop for ATG Dynamo, how do you structure your modules and dependencies? How do you structure the projects? source directories, JARs configs etc. How do you build and deploy? What tools do you use?
We have a monolithic architecture with a single ATG module. We originally developed this site with JHTML and have since created a (monolithic) J2EE web app within this ATG module and converted all of our JHTML to JSP. Our project on disk looks like this: ``` root deploy class (compile java to here) config (...
205,568
<p>There's a lot of advice out there that you shouldn't expose your fields publically, and instead use trivial properties. I see it over &amp; over.</p> <p>I understand the arguments, but <a href="https://stackoverflow.com/questions/174198/c35-automatic-properties-why-not-access-the-field-directly#205567">I don't thi...
[ { "answer_id": 205577, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 3, "selected": false, "text": "<p>Part of the idea is that those properties may not be trivial in the future - if you bound external code to a field ...
2008/10/15
[ "https://Stackoverflow.com/questions/205568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5314/" ]
There's a lot of advice out there that you shouldn't expose your fields publically, and instead use trivial properties. I see it over & over. I understand the arguments, but [I don't think it's good advice in most cases](https://stackoverflow.com/questions/174198/c35-automatic-properties-why-not-access-the-field-direc...
It may be hard to make code work in an uncertain future, but that's no excuse to be lazy. Coding a property over a field is convention and it's pragmatic. Call it defensive programming. Other people will also complain that there's a speed issue, but the JIT'er is smart enough to make it just about as fast as exposing...
205,573
<p>I want to do something like this:</p> <pre><code>List&lt;Animal&gt; animals = new ArrayList&lt;Animal&gt;(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c() ); </code></pre> <p>So, I want to look at all of the classes in my application's universe, and when ...
[ { "answer_id": 205738, "author": "thoroughly", "author_id": 8943, "author_profile": "https://Stackoverflow.com/users/8943", "pm_score": 2, "selected": false, "text": "<p>Java dynamically loads classes, so your universe of classes would be only those that have already been loaded (and not...
2008/10/15
[ "https://Stackoverflow.com/questions/205573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9648/" ]
I want to do something like this: ``` List<Animal> animals = new ArrayList<Animal>(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c() ); ``` So, I want to look at all of the classes in my application's universe, and when I find one that descends from Animal, ...
I use [org.reflections](https://github.com/ronmamo/reflections): ``` Reflections reflections = new Reflections("com.mycompany"); Set<Class<? extends MyInterface>> classes = reflections.getSubTypesOf(MyInterface.class); ``` Another example: ``` public static void main(String[] args) throws IllegalAccessException...
205,582
<p>The new ASP.NET routing is great for simple path style URL's but if you want to use a url such as:</p> <p><a href="http://example.com/items/search.xhtml?term=Text+to+find&amp;page=2" rel="nofollow noreferrer">http://example.com/items/search.xhtml?term=Text+to+find&amp;page=2</a></p> <p>Do you have to use a catch a...
[ { "answer_id": 205620, "author": "Duncan", "author_id": 25035, "author_profile": "https://Stackoverflow.com/users/25035", "pm_score": 2, "selected": false, "text": "<p>You can match querystring parameters with routes as well, if you want to just capture everything you need to add a param...
2008/10/15
[ "https://Stackoverflow.com/questions/205582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16340/" ]
The new ASP.NET routing is great for simple path style URL's but if you want to use a url such as: <http://example.com/items/search.xhtml?term=Text+to+find&page=2> Do you have to use a catch all parameter with a validation?
Any view data items that are not listed in the route are automatically mapped to the querystring, so if you map "items/search.xhtml" to an action: ``` Search(string term, int page) ``` Then you should get the results you are looking for.
205,583
<p>I need to reproduce a bug, and a guy from the other team has sent me a .mdf and .ldf files from his sql server 2005 instance. When I attach the database, all I get is empty tables, even though file is 2 mb large. The db contains 2 tables that have, among other thing, a varbinary(max) field. At the same time another ...
[ { "answer_id": 205620, "author": "Duncan", "author_id": 25035, "author_profile": "https://Stackoverflow.com/users/25035", "pm_score": 2, "selected": false, "text": "<p>You can match querystring parameters with routes as well, if you want to just capture everything you need to add a param...
2008/10/15
[ "https://Stackoverflow.com/questions/205583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17481/" ]
I need to reproduce a bug, and a guy from the other team has sent me a .mdf and .ldf files from his sql server 2005 instance. When I attach the database, all I get is empty tables, even though file is 2 mb large. The db contains 2 tables that have, among other thing, a varbinary(max) field. At the same time another dat...
Any view data items that are not listed in the route are automatically mapped to the querystring, so if you map "items/search.xhtml" to an action: ``` Search(string term, int page) ``` Then you should get the results you are looking for.
205,594
<p>I use Visual Studio's "Code Snippet" feature pretty heavily while editing c# code. I always wished I could use them while typing out my aspx markup. </p> <p>Is there a way to enable code snippet use in an aspx file editor window?</p> <p>Are there any third party tools that perform this?</p> <p>If you're familia...
[ { "answer_id": 205622, "author": "harriyott", "author_id": 5744, "author_profile": "https://Stackoverflow.com/users/5744", "pm_score": 2, "selected": false, "text": "<p>That would be brilliant! I'd recommend the <a href=\"http://secretgeek.net/wscg.htm\" rel=\"nofollow noreferrer\">worl...
2008/10/15
[ "https://Stackoverflow.com/questions/205594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/946/" ]
I use Visual Studio's "Code Snippet" feature pretty heavily while editing c# code. I always wished I could use them while typing out my aspx markup. Is there a way to enable code snippet use in an aspx file editor window? Are there any third party tools that perform this? If you're familiar with code snippet defini...
Perhaps you might think of trying [Coderush](http://devexpress.com/coderush) which has a lot more to offer than the basic snippets found in VS. It's template facility can operate in vb, cs, aspx, html, xml and sql files.
205,614
<p>My initial installation for the <strong>MySQL</strong> had no password for root. I assigned a password for root and everything worked fine. Due to some reason (don't ask why) I had to revert back to the original settings where root didn't have any password.</p> <p>I changed the root password to <code>'' (empty stri...
[ { "answer_id": 205661, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": false, "text": "<p><strong>How to Reset MySQL root password:</strong></p>\n\n<p>To reset it, see <a href=\"http://dev.mysql.com/doc/refma...
2008/10/15
[ "https://Stackoverflow.com/questions/205614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13492/" ]
My initial installation for the **MySQL** had no password for root. I assigned a password for root and everything worked fine. Due to some reason (don't ask why) I had to revert back to the original settings where root didn't have any password. I changed the root password to `'' (empty string)`. The problem now is tha...
**How to Reset MySQL root password:** To reset it, see [How to Reset the Root Password](http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html) in the MySQL manual. **How to run MySQL without password controlled access** To run MySQL with the password controls disabled, check out the [--skip-grant-tables...
205,624
<p>I want to iterate through a contacts properties and add those that contain the word &quot;Number&quot; to a list with the value, i tries using reflection but it doesn't work.</p> <pre><code>using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using Microsoft.Office.Inter...
[ { "answer_id": 207432, "author": "IgorM", "author_id": 17823, "author_profile": "https://Stackoverflow.com/users/17823", "pm_score": 0, "selected": false, "text": "<p>Of cause it doesn't work - it's a COM object. You should use the properties from CDO space.</p>\n" }, { "answer_i...
2008/10/15
[ "https://Stackoverflow.com/questions/205624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to iterate through a contacts properties and add those that contain the word "Number" to a list with the value, i tries using reflection but it doesn't work. ``` using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using Microsoft.Office.Interop.Outlook; namespace ...
Try using MAPI CDO. Here's a microsoft site that might get you started: [How to use CDO to read MAPI Addresses](http://support.microsoft.com/default.aspx?scid=kb;EN-US;179083) Here's some MAPI Blogs to help as well: * [Steven Griffin](http://blogs.msdn.com/stephen_griffin/) * [Matt Stehle](http://blogs.msdn.com/mste...
205,631
<p>i got a client side javascript function which is triggered on a button click (basically, its a calculator!!). Sometimes, due to enormous data on the page, the javascript calculator function take to long &amp; makes the page appear inactive to the user. I was planning to display a transparent div over entire page, ma...
[ { "answer_id": 205648, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 2, "selected": false, "text": "<p>I would do something like:</p>\n\n<ol>\n<li>unhide a div (<code>display:inline</code>)</li>\n<li>make the <code>posi...
2008/10/15
[ "https://Stackoverflow.com/questions/205631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28321/" ]
i got a client side javascript function which is triggered on a button click (basically, its a calculator!!). Sometimes, due to enormous data on the page, the javascript calculator function take to long & makes the page appear inactive to the user. I was planning to display a transparent div over entire page, maybe wit...
Javacript to show a curtain: ``` function CalculateAmountOnClick () { var curtain = document.body.appendChild( document.createElement('div') ); curtain.id = "curtain"; curtain.onkeypress = curtain.onclick = function(){ return false; } try { // your operations } finally { curtain.parentNode.removeCh...
205,644
<p>I came across an issue that makes me think there is bug in the 3.0 framework. When I try to use extension methods I get the following error: </p> <pre><code>Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor' </code></pre> <p>When using this simple code:</p> <pre><code>publ...
[ { "answer_id": 205663, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 3, "selected": false, "text": "<p>Your framework isn't high enough for Extension Methods.<br>\nThat's a <a href=\"http://blogs.msdn.com/jaredpar/archive...
2008/10/15
[ "https://Stackoverflow.com/questions/205644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17902/" ]
I came across an issue that makes me think there is bug in the 3.0 framework. When I try to use extension methods I get the following error: ``` Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor' ``` When using this simple code: ``` public static class StringUtils { sta...
I just ran into this problem myself. In my case, it was because I converted a VS 2005/.Net 2.0 project to a VS 2008/.Net 3.5 project. The conversion tool kept references to System.Core 2.0, and I couldn't find an easy way to change the references to System.Core 3.5. I ended up re-creating the project in VS 2008 from s...
205,660
<p>It seems that Groovy does not support <code>break</code> and <code>continue</code> from within a closure. What is the best way to simulate this?</p> <pre><code>revs.eachLine { line -&gt; if (line ==~ /-{28}/) { // continue to next line... } } </code></pre>
[ { "answer_id": 205764, "author": "shemnon", "author_id": 8020, "author_profile": "https://Stackoverflow.com/users/8020", "pm_score": 7, "selected": true, "text": "<p>You can only support continue cleanly, not break. Especially with stuff like eachLine and each. The inability to support...
2008/10/15
[ "https://Stackoverflow.com/questions/205660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20103/" ]
It seems that Groovy does not support `break` and `continue` from within a closure. What is the best way to simulate this? ``` revs.eachLine { line -> if (line ==~ /-{28}/) { // continue to next line... } } ```
You can only support continue cleanly, not break. Especially with stuff like eachLine and each. The inability to support break has to do with how those methods are evaluated, there is no consideration taken for not finishing the loop that can be communicated to the method. Here's how to support continue -- Best approa...
205,666
<p>I have an alert script that I am trying to keep from spamming me so I'd like to place a condition that if an alert has been sent within, say the last hour, to not send another alert. Now I have a cron job that checks the condition every minute because I need to be alerted quickly when the condition is met but I don...
[ { "answer_id": 205681, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 4, "selected": false, "text": "<p>Use \"test\":</p>\n\n<pre><code>if test file1 -nt file2; then\n # file1 is newer than file2\nfi\n</code></pre>\n\n<p>...
2008/10/15
[ "https://Stackoverflow.com/questions/205666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27247/" ]
I have an alert script that I am trying to keep from spamming me so I'd like to place a condition that if an alert has been sent within, say the last hour, to not send another alert. Now I have a cron job that checks the condition every minute because I need to be alerted quickly when the condition is met but I don't n...
By far the easiest is to store time stamps as modification times of dummy files. GNU `touch` and `date` commands can set/get these times and perform date calculations. Bash has tests to check whether a file is newer than (`-nt`) or older than (`-ot`) another. For example, to only send a notification if the last notifi...
205,668
<p>I'm copying a file from folder A to folder B and then trying to copy the file permissions. Here are the basic steps I'm using:</p> <ol> <li>CopyFile(source, target)</li> <li>GetNamedSecurityInfo(source, GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION)</li> <li>Print source SD using ConvertSecurityDescriptorT...
[ { "answer_id": 206671, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": true, "text": "<p><code>SHFileOperation</code> can copy files together with their security attributes, but from <a href=\"https://stackoverfl...
2008/10/15
[ "https://Stackoverflow.com/questions/205668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24898/" ]
I'm copying a file from folder A to folder B and then trying to copy the file permissions. Here are the basic steps I'm using: 1. CopyFile(source, target) 2. GetNamedSecurityInfo(source, GROUP\_SECURITY\_INFORMATION | DACL\_SECURITY\_INFORMATION) 3. Print source SD using ConvertSecurityDescriptorToStringSecurityDescri...
`SHFileOperation` can copy files together with their security attributes, but from [your other question](https://stackoverflow.com/questions/202031/using-shfileoperation-within-a-windows-service) I see you're concerned that this won't work within a service. Maybe the following newsgroup discussions will provide some us...
205,688
<p>What is the best technique for catching ALL exceptions thrown within JavaScript?</p> <p>Obviously, the best technique is to use try...catch. But with ansynchronous callbacks and so forth, that can get tricky.</p> <p>I know IE and Gecko browsers support window.onerror, but what about Opera and Safari?</p> <p>Here...
[ { "answer_id": 205884, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 4, "selected": false, "text": "<p>WebKit (Safari, Chrome, etc) now appears to support <code>onerror</code>.</p>\n\n<p>Original post: As far as I k...
2008/10/15
[ "https://Stackoverflow.com/questions/205688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26259/" ]
What is the best technique for catching ALL exceptions thrown within JavaScript? Obviously, the best technique is to use try...catch. But with ansynchronous callbacks and so forth, that can get tricky. I know IE and Gecko browsers support window.onerror, but what about Opera and Safari? Here are a bunch of test-case...
If you use a library like [jQuery](http://jquery.com/) for assigning all your event handlers, you can use a combination of `window.onerror` and wrapping the jQuery event handler code and on ready function with an error handling function (see: [JavaScript Error Tracking: Why window.onerror Is Not Enough](http://blogs.co...
205,689
<p>Say I have a class that's meant to perform a single function. After performing the function, it can be destroyed. Is there any reason to prefer one of these approaches?</p> <pre><code>// Initialize arguments in constructor MyClass myObject = new MyClass(arg1, arg2, arg3); myObject.myMethod(); // Pass arguments to ...
[ { "answer_id": 205698, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 7, "selected": false, "text": "<p>I prefer the static way. Since the Class is not representing an object it doesn't make sense to make an instance of it.</...
2008/10/15
[ "https://Stackoverflow.com/questions/205689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4321/" ]
Say I have a class that's meant to perform a single function. After performing the function, it can be destroyed. Is there any reason to prefer one of these approaches? ``` // Initialize arguments in constructor MyClass myObject = new MyClass(arg1, arg2, arg3); myObject.myMethod(); // Pass arguments to method MyClass...
I used to love utility classes filled up with static methods. They made a great consolidation of helper methods that would otherwise lie around causing redundancy and maintenance hell. They're very easy to use, no instantiation, no disposal, just fire'n'forget. I guess this was my first unwitting attempt at creating a ...
205,691
<p>Whats the benefit of:</p> <pre><code>public string User {get; set;} </code></pre> <p>over</p> <pre><code>public string User; </code></pre> <p>Since you can't access the private member in the first case, how is it any different that just making your property public?</p>
[ { "answer_id": 205714, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "<p>The second example is making the <em>field</em> public, not a property (your question). This provides a simple way...
2008/10/15
[ "https://Stackoverflow.com/questions/205691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Whats the benefit of: ``` public string User {get; set;} ``` over ``` public string User; ``` Since you can't access the private member in the first case, how is it any different that just making your property public?
The second example is making the *field* public, not a property (your question). This provides a simple way of making simple properties. Properties should be your default, not public fields; the list of reasons is endless, but starts with: * encapsulation * ability to add notification * encapsulation * ability to do v...
205,697
<p>I have a query that has a list of base values and a list of language values. Each value has a key that matches to the other. The base values are stored in one table and the language values in another. My problem is that I need to get all matching base values removed from the QUERY except for one. Then, I export ...
[ { "answer_id": 205798, "author": "Ben Doom", "author_id": 12267, "author_profile": "https://Stackoverflow.com/users/12267", "pm_score": 0, "selected": false, "text": "<p>If you need to remove all matches except for one, why not delete all the matching ... matches ... we need better terms...
2008/10/15
[ "https://Stackoverflow.com/questions/205697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16631/" ]
I have a query that has a list of base values and a list of language values. Each value has a key that matches to the other. The base values are stored in one table and the language values in another. My problem is that I need to get all matching base values removed from the QUERY except for one. Then, I export that qu...
Hey thanks for that update! Looking at that and adding it into a previous post I finally came up with this: ``` <cfquery name="getRows" datasource="XXXX"> SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN resource_shortstrings rs ON pe.p...
205,711
<p>I've been struggling with a problem for the past couple days and haven't found a solution.</p> <p>I have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the first project.</p> <p>I initi...
[ { "answer_id": 205719, "author": "DamienG", "author_id": 5720, "author_profile": "https://Stackoverflow.com/users/5720", "pm_score": 2, "selected": true, "text": "<p>I think the problem you might be getting is that the assembly/class library containing your classes hasn't been loaded int...
2008/10/15
[ "https://Stackoverflow.com/questions/205711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13616/" ]
I've been struggling with a problem for the past couple days and haven't found a solution. I have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the first project. I initially wrote the bu...
I think the problem you might be getting is that the assembly/class library containing your classes hasn't been loaded into memory at this stage? Try accessing a class in the library before instantiating the data context to see if that works.
205,731
<p>I need the values of form inputs to be populated by the sql database. My code works great for all text and textarea inputs but I can't figure out how to assign the database value to the drop down lists eg. 'Type of property' below. It revolves around getting the 'option selected' to represent the value held in the d...
[ { "answer_id": 205778, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 3, "selected": false, "text": "<p>using your current code:</p>\n\n<pre><code>&lt;?php\n $options = array('House', 'Bungalow', 'Flat/Apartment', 'Studio', 'Vi...
2008/10/15
[ "https://Stackoverflow.com/questions/205731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need the values of form inputs to be populated by the sql database. My code works great for all text and textarea inputs but I can't figure out how to assign the database value to the drop down lists eg. 'Type of property' below. It revolves around getting the 'option selected' to represent the value held in the data...
using your current code: ``` <?php $options = array('House', 'Bungalow', 'Flat/Apartment', 'Studio', 'Villa', 'Any'); foreach($options as $option) { if ($option == $row['req_type']) { print '<option selected="selected">'.$option.'</option>'."\n"; } else { print '<option>'.$option.'</option>'."...
205,733
<p>Is it possible to call a class's static property to set the navigateurl property?</p> <blockquote> <pre><code>&lt;asp:HyperLink ID="hlRegister" NavigateUrl="&lt;%= SomeClass.Property %&gt;" runat="server" /&gt; </code></pre> </blockquote> <p><b>without using codebehind ofcourse!</b></p>
[ { "answer_id": 205742, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 0, "selected": false, "text": "<p>sure, in the code behind:</p>\n\n<pre><code>hl.NavigateUrl = Class.Static().ToString();\n</code></pre>\n" }, {...
2008/10/15
[ "https://Stackoverflow.com/questions/205733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to call a class's static property to set the navigateurl property? > > > ``` > <asp:HyperLink ID="hlRegister" NavigateUrl="<%= SomeClass.Property %>" runat="server" /> > > ``` > > **without using codebehind ofcourse!**
You don't need code behind. You can just try it, like i just did. I created a simple page with exactly the code you have, and then created a class called SomeClass with a property named Property. It worked fine for me the way that you have it set up above. Edit: Ok, it didn't compile with an error.. but It's giving m...
205,735
<p>My knowledge of matlab is merely on a need to know basis, so this is probably an elementary question. Nevertheless here it comes:</p> <p>I have got a file containing data (16-bit integers) stored in binary format. How do I read it into a vector /an array in matlab? How do I write this data to a file in matlab? Is t...
[ { "answer_id": 205777, "author": "Anthony Potts", "author_id": 22777, "author_profile": "https://Stackoverflow.com/users/22777", "pm_score": 0, "selected": false, "text": "<p>I usually hate seeing links in a response, but this looks pretty close:</p>\n\n<p><a href=\"http://www.mathworks....
2008/10/15
[ "https://Stackoverflow.com/questions/205735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4044/" ]
My knowledge of matlab is merely on a need to know basis, so this is probably an elementary question. Nevertheless here it comes: I have got a file containing data (16-bit integers) stored in binary format. How do I read it into a vector /an array in matlab? How do I write this data to a file in matlab? Is there any s...
As [Bill the Lizard](https://stackoverflow.com/questions/205735/read-and-write-fromto-a-binary-file-in-matlab#205819) wrote you can use fread to load the data into a vector. I just want to expand a little on his answer. ### Reading Data ``` >> fid=fopen('data.bin','rb') % opens the file for reading >> A = fread(fid,...
205,736
<p>How do I query an Oracle database to display the names of all tables in it?</p>
[ { "answer_id": 205746, "author": "Justin Cave", "author_id": 10397, "author_profile": "https://Stackoverflow.com/users/10397", "pm_score": 11, "selected": true, "text": "<pre><code>SELECT owner, table_name\n FROM dba_tables\n</code></pre>\n\n<p>This is assuming that you have access to t...
2008/10/15
[ "https://Stackoverflow.com/questions/205736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1287/" ]
How do I query an Oracle database to display the names of all tables in it?
``` SELECT owner, table_name FROM dba_tables ``` This is assuming that you have access to the `DBA_TABLES` data dictionary view. If you do not have those privileges but need them, you can request that the DBA explicitly grants you privileges on that table, or, that the DBA grants you the `SELECT ANY DICTIONARY` pri...
205,793
<p>I need to make changes to an in-use production database. Just adding a few columns. I've made the changes to the dev database with migrations. What is the best way to update the production database while preserving the existing data and not disrupting operation too much?</p> <p>It's MYSQL and I will be needing t...
[ { "answer_id": 205823, "author": "Matt", "author_id": 17803, "author_profile": "https://Stackoverflow.com/users/17803", "pm_score": 2, "selected": false, "text": "<p>Is there a reason you are not using the same migrations you used in your dev environment?</p>\n" }, { "answer_id":...
2008/10/15
[ "https://Stackoverflow.com/questions/205793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6805/" ]
I need to make changes to an in-use production database. Just adding a few columns. I've made the changes to the dev database with migrations. What is the best way to update the production database while preserving the existing data and not disrupting operation too much? It's MYSQL and I will be needing to add data to...
It sounds like you're in a state where the production db schema doesn't exactly match what you're using in dev (although it's not totally clear). I would draw a line in the sand, and get that prod db in a better state. Essentially what you want to do is make sure that the prod db has a "schema\_info" table that lists a...
205,794
<p>For my C# RichTextBox, I want to programmatically do the same thing as clicking the up arrow at the top of a vertical scroll bar, which moves the RichTextBox display up by one line. What is the code for this? Thanks!</p>
[ { "answer_id": 205832, "author": "Ray Jezek", "author_id": 28309, "author_profile": "https://Stackoverflow.com/users/28309", "pm_score": 0, "selected": false, "text": "<p>window.scrollBy(0,20); </p>\n\n<p>This will scroll the window. 20 is an approximate value I have used in the past th...
2008/10/15
[ "https://Stackoverflow.com/questions/205794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27109/" ]
For my C# RichTextBox, I want to programmatically do the same thing as clicking the up arrow at the top of a vertical scroll bar, which moves the RichTextBox display up by one line. What is the code for this? Thanks!
Here's what I do: ``` using System.Runtime.InteropServices; [DllImport("user32.dll")] static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam); ``` then call: ``` SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1)); ``` Seems to wo...
205,797
<p>I have a database with DateTime fields that are currently stored in local time. An upcoming project will require all these dates to be converted to universal time. Rather than writing a c# app to convert these times to universal time, I'd rather use available sqlserver/sql features to accurately convert these date...
[ { "answer_id": 205832, "author": "Ray Jezek", "author_id": 28309, "author_profile": "https://Stackoverflow.com/users/28309", "pm_score": 0, "selected": false, "text": "<p>window.scrollBy(0,20); </p>\n\n<p>This will scroll the window. 20 is an approximate value I have used in the past th...
2008/10/15
[ "https://Stackoverflow.com/questions/205797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18313/" ]
I have a database with DateTime fields that are currently stored in local time. An upcoming project will require all these dates to be converted to universal time. Rather than writing a c# app to convert these times to universal time, I'd rather use available sqlserver/sql features to accurately convert these dates to ...
Here's what I do: ``` using System.Runtime.InteropServices; [DllImport("user32.dll")] static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam); ``` then call: ``` SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1)); ``` Seems to wo...
205,853
<p>I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?</p> <p>(I'm not asking about <code>$('p.foo')</code> syntax that you see in jQuery and others, but normal variables like <code>$name</code> and <code>$order</code>)</p>
[ { "answer_id": 205881, "author": "Ryan Abbott", "author_id": 27908, "author_profile": "https://Stackoverflow.com/users/27908", "pm_score": 0, "selected": false, "text": "<p>While you can simply use it to prefix your identifiers, it's supposed to be used for generated code, such as replac...
2008/10/15
[ "https://Stackoverflow.com/questions/205853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20074/" ]
I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way? (I'm not asking about `$('p.foo')` syntax that you see in jQuery and others, but normal variables like `$name` and `$order`)
Very common use in **jQuery** is to distinguish **jQuery** objects stored in variables from other variables. For example, I would define: ``` var $email = $("#email"); // refers to the jQuery object representation of the dom object var email_field = $("#email").get(0); // refers to the dom object itself ``` I find...
205,911
<p>I had a nasty typo that wasted my time and my colleague's time, it was something like this:</p> <pre><code>for (i = 0; i &lt; blah; i++); // &lt;- I had a semi-colon here, that's the bug! { // Some awesome logic here } </code></pre> <p>First of all, it's very embarrassing, second thing, I should never repeat thi...
[ { "answer_id": 205919, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 5, "selected": true, "text": "<p>Yes, <a href=\"http://www.gimpel.com/\" rel=\"nofollow noreferrer\">PC-Lint</a> is probably the best tool available.</p>\n"...
2008/10/15
[ "https://Stackoverflow.com/questions/205911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7205/" ]
I had a nasty typo that wasted my time and my colleague's time, it was something like this: ``` for (i = 0; i < blah; i++); // <- I had a semi-colon here, that's the bug! { // Some awesome logic here } ``` First of all, it's very embarrassing, second thing, I should never repeat this. I'm relatively new to C. In J...
Yes, [PC-Lint](http://www.gimpel.com/) is probably the best tool available.
205,923
<p>We have a high security application and we want to allow users to enter URLs that other users will see.</p> <p>This introduces a high risk of XSS hacks - a user could potentially enter javascript that another user ends up executing. Since we hold sensitive data it's essential that this never happens.</p> <p>What a...
[ { "answer_id": 205924, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": -1, "selected": false, "text": "<p>Allowing a URL and allowing JavaScript are 2 different things.</p>\n" }, { "answer_id": 205929, "aut...
2008/10/15
[ "https://Stackoverflow.com/questions/205923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
We have a high security application and we want to allow users to enter URLs that other users will see. This introduces a high risk of XSS hacks - a user could potentially enter javascript that another user ends up executing. Since we hold sensitive data it's essential that this never happens. What are the best pract...
If you think URLs can't contain code, think again! <https://owasp.org/www-community/xss-filter-evasion-cheatsheet> Read that, and weep. Here's how we do it on Stack Overflow: ``` /// <summary> /// returns "safe" URL, stripping anything outside normal charsets for URL /// </summary> public static string SanitizeUrl(...
205,950
<p>I'm writing SQL (for Oracle) like:</p> <pre> INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; </pre> <p>where Schema1.tableA and Schema2.tableA have the same columns. However, it seems like this is unsafe, since the order of the columns coming back in the SELECT is undefined. What I should be doing is:</p>...
[ { "answer_id": 205971, "author": "Eddie Awad", "author_id": 17273, "author_profile": "https://Stackoverflow.com/users/17273", "pm_score": 1, "selected": false, "text": "<p>You may need to construct the insert statements dynamically using <a href=\"http://download.oracle.com/docs/cd/B2835...
2008/10/15
[ "https://Stackoverflow.com/questions/205950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25915/" ]
I'm writing SQL (for Oracle) like: ``` INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; ``` where Schema1.tableA and Schema2.tableA have the same columns. However, it seems like this is unsafe, since the order of the columns coming back in the SELECT is undefined. What I should be doing is: ``` INSERT INT...
This PL/SQL should do it: ``` declare l_cols long; l_sql long; begin for r in (select column_name from all_tab_columns where table_name = 'TABLEA' and owner = 'SCHEMA1' ) loop l_cols := l_cols || ',' || r.column_name; end loop; -- Remove lea...
205,977
<p><a href="https://stackoverflow.com/questions/205887/postback-security">Related Article</a></p> <p>On a similar topic to the above article, but of a more specific note. How exactly do you handle items that are in the viewstate (so they are included on submit), but can also be changed via AJAX. For instance, say we h...
[ { "answer_id": 206101, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 0, "selected": false, "text": "<p>why not validating onChange even in the dropdownlist?</p>\n\n<p>just add the script manager and add that property to...
2008/10/15
[ "https://Stackoverflow.com/questions/205977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8873/" ]
[Related Article](https://stackoverflow.com/questions/205887/postback-security) On a similar topic to the above article, but of a more specific note. How exactly do you handle items that are in the viewstate (so they are included on submit), but can also be changed via AJAX. For instance, say we had a dropdown list th...
You're not validating the dropdown list are you? You're validating the value a user selected. It's pretty much the same advice as the other post, since javascript or other tools can alter the html or create their own POST's, you *must always* validate on the server side. Assume all client requests can be tampered with,...
205,986
<p>I'm using the following syntax to loop through a list collection:</p> <pre><code>For Each PropertyActor As JCPropertyActor In MyProperty.PropertyActors i = IndexOf(PropertyActor) Next </code></pre> <p>How do I get the index of the current object within the loop? I'm using IndexOf(PropertyActor) but this seems...
[ { "answer_id": 205994, "author": "sebagomez", "author_id": 23893, "author_profile": "https://Stackoverflow.com/users/23893", "pm_score": 2, "selected": false, "text": "<p>just initialize an integer variable before entering the loop and iterate it...</p>\n\n<pre><code>Dim i as Integer \nF...
2008/10/15
[ "https://Stackoverflow.com/questions/205986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20048/" ]
I'm using the following syntax to loop through a list collection: ``` For Each PropertyActor As JCPropertyActor In MyProperty.PropertyActors i = IndexOf(PropertyActor) Next ``` How do I get the index of the current object within the loop? I'm using IndexOf(PropertyActor) but this seems inefficient as it searche...
An index doesn't have any meaning to an IEnumerable, which is what the foreach construct uses. That's important because `foreach` may not enumerate in index order, if your particular collection type implements IEnumerable in an odd way. If you have an object that can be accessed by index *and* you care about the index ...
206,009
<p>I have SQL data that looks like this:</p> <pre><code>events id name capacity 1 Cooking 10 2 Swimming 20 3 Archery 15 registrants id name 1 Jimmy 2 Billy 3 Sally registrant_event registrant_id event_id 1 3 2 3 3 2 </code></pre...
[ { "answer_id": 206017, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 5, "selected": true, "text": "<pre><code>SELECT e.*, ISNULL(ec.TotalRegistrants, 0) FROM events e LEFT OUTER JOIN\n(\n SELECT event_id, Count(reg...
2008/10/15
[ "https://Stackoverflow.com/questions/206009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3238/" ]
I have SQL data that looks like this: ``` events id name capacity 1 Cooking 10 2 Swimming 20 3 Archery 15 registrants id name 1 Jimmy 2 Billy 3 Sally registrant_event registrant_id event_id 1 3 2 3 3 2 ``` I would like to sel...
``` SELECT e.*, ISNULL(ec.TotalRegistrants, 0) FROM events e LEFT OUTER JOIN ( SELECT event_id, Count(registrant_id) AS TotalRegistrants FROM registrant_event GROUP BY event_id ) ec ON e.id = ec.event_id ```
206,024
<p>I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains a TreeView. The second panel contains a label and is triggered by a selection in the tree. When I select a node the label gets updated as expected and the <code>TreeNode</code> that I clicked on becomes highlighted and the previously...
[ { "answer_id": 207382, "author": "Jason Kealey", "author_id": 20893, "author_profile": "https://Stackoverflow.com/users/20893", "pm_score": 1, "selected": false, "text": "<p>You need to set the selection to false for all nodes. </p>\n\n<p>I use something like this for one of my applicati...
2008/10/15
[ "https://Stackoverflow.com/questions/206024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains a TreeView. The second panel contains a label and is triggered by a selection in the tree. When I select a node the label gets updated as expected and the `TreeNode` that I clicked on becomes highlighted and the previously selected node...
This may be a bit of a hack but this will clear the selection on the client and avoid updating the panel. ``` Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function BeginRequestHandler(sender, args) { var elem = args.get_postBackElement(); var selectedClassName = elem.id + '_1'; ...
206,045
<p>I have code like this:</p> <pre><code>template &lt;typename T, typename U&gt; struct MyStruct { T aType; U anotherType; }; class IWantToBeFriendsWithMyStruct { friend struct MyStruct; //what is the correct syntax here ? }; </code></pre> <p>What is the correct syntax to give friendship to the template ...
[ { "answer_id": 206054, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 5, "selected": true, "text": "<pre><code>class IWantToBeFriendsWithMyStruct\n{\n template &lt;typename T, typename U&gt;\n friend struct MyStruct;...
2008/10/15
[ "https://Stackoverflow.com/questions/206045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28275/" ]
I have code like this: ``` template <typename T, typename U> struct MyStruct { T aType; U anotherType; }; class IWantToBeFriendsWithMyStruct { friend struct MyStruct; //what is the correct syntax here ? }; ``` What is the correct syntax to give friendship to the template ?
``` class IWantToBeFriendsWithMyStruct { template <typename T, typename U> friend struct MyStruct; }; ``` Works in VS2008, and allows MyStruct to access the class.
206,055
<p>I am a SQL Server user .</p> <p>I am on a project that is using oracle (which I rarely use) I need to create an ODBC connection so I can access the some data via MS Access I have a application on my machine called oraHome90. It seems to allow a configuration of something called a listener in a “net configuration u...
[ { "answer_id": 206066, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 3, "selected": false, "text": "<p>from <a href=\"http://ora-12154.ora-code.com\" rel=\"noreferrer\">http://ora-12154.ora-code.com</a></p>\n\n<p><strong>ORA-...
2008/10/15
[ "https://Stackoverflow.com/questions/206055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26883/" ]
I am a SQL Server user . I am on a project that is using oracle (which I rarely use) I need to create an ODBC connection so I can access the some data via MS Access I have a application on my machine called oraHome90. It seems to allow a configuration of something called a listener in a “net configuration utility”, I...
from <http://ora-12154.ora-code.com> **ORA-12154**: TNS:could not resolve the connect identifier specified *Cause*: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming metho...
206,059
<p>I've been looking for a simple regex for URLs, does anybody have one handy that works well? I didn't find one with the zend framework validation classes and have seen several implementations.</p>
[ { "answer_id": 206087, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 7, "selected": true, "text": "<p>I used this on a few projects, I don't believe I've run into issues, but I'm sure it's not exhaustive:</p>\n<pre><code>$text ...
2008/10/15
[ "https://Stackoverflow.com/questions/206059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26577/" ]
I've been looking for a simple regex for URLs, does anybody have one handy that works well? I didn't find one with the zend framework validation classes and have seen several implementations.
I used this on a few projects, I don't believe I've run into issues, but I'm sure it's not exhaustive: ``` $text = preg_replace( '#((https?|ftp)://(\S*?\.\S*?))([\s)\[\]{},;"\':<]|\.\s|$)#i', "'<a href=\"$1\" target=\"_blank\">$3</a>$4'", $text ); ``` Most of the random junk at the end is to deal with situatio...
206,062
<p>In MySQL 5.0 why does the following error occur when trying to create a view with a subquery in the FROM clause?</p> <blockquote> <p>ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause</p> </blockquote> <p>If this is a limitation of the MySQL engine, then why haven't they implemented this fe...
[ { "answer_id": 206118, "author": "Nikki9696", "author_id": 456669, "author_profile": "https://Stackoverflow.com/users/456669", "pm_score": 3, "selected": false, "text": "<p>It appears to be a known issue.</p>\n\n<p><a href=\"http://dev.mysql.com/doc/refman/5.1/en/unnamed-views.html\" rel...
2008/10/15
[ "https://Stackoverflow.com/questions/206062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8784/" ]
In MySQL 5.0 why does the following error occur when trying to create a view with a subquery in the FROM clause? > > ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause > > > If this is a limitation of the MySQL engine, then why haven't they implemented this feature yet? Also, what are some ...
Couldn't your query just be written as: ``` SELECT u1.name as UserName from Message m1, User u1 WHERE u1.uid = m1.UserFromID GROUP BY u1.name HAVING count(m1.UserFromId)>3 ``` That should also help with the known speed issues with subqueries in MySQL
206,106
<p><em>[This question is related to but not the same as <a href="https://stackoverflow.com/questions/206564/what-is-the-performance-implication-of-converting-to-bool-in-c">this one</a>.]</em></p> <p>If I try to use values of certain types as boolean expressions, I get a warning. Rather than suppress the warning, I so...
[ { "answer_id": 206120, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "<p>All valid techniques, all will generate the same code.</p>\n\n<p>Personally, I just disable the warning so I can use the cl...
2008/10/15
[ "https://Stackoverflow.com/questions/206106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10559/" ]
*[This question is related to but not the same as [this one](https://stackoverflow.com/questions/206564/what-is-the-performance-implication-of-converting-to-bool-in-c).]* If I try to use values of certain types as boolean expressions, I get a warning. Rather than suppress the warning, I sometimes use the ternary opera...
The argument of the ! operator and the first argument of the ternary operator are both implicitly converted to bool, so !! and ?: are IMO silly redundant decorations of the cast. I vote for ``` b = (t != 0); ``` No implicit conversions.
206,114
<p>How you can read a file (text or binary) from a batch file? There is a way to read it in a binary mode or text mode?</p>
[ { "answer_id": 206137, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 6, "selected": false, "text": "<p>Under NT-style cmd.exe, you can loop through the lines of a text file with</p>\n<pre><code>FOR /F %%i IN (file.txt) DO @e...
2008/10/15
[ "https://Stackoverflow.com/questions/206114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20601/" ]
How you can read a file (text or binary) from a batch file? There is a way to read it in a binary mode or text mode?
You can use the for command: ``` FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k ``` Type ``` for /? ``` at the command prompt. Also, you can [parse ini files](http://www.ericphelps.com/batch/samples/getini.txt)!
206,132
<p>Platform: IIS 6, ASP.Net 2.0 (.Net 3.5), Server 2003.</p> <p>I'm building an application that accepts files from a user, processes them, and returns a result. The file is uploaded using HTTP POST to an ASP.Net web form. The application is expecting some large files (hundreds of MB).</p> <p>I'm using SWFUpload to a...
[ { "answer_id": 206141, "author": "Chris Roland", "author_id": 27975, "author_profile": "https://Stackoverflow.com/users/27975", "pm_score": 2, "selected": false, "text": "<p>When we ran into this issue we had to increase the buffer size limit according to this KB article:\n<a href=\"http...
2008/10/15
[ "https://Stackoverflow.com/questions/206132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28358/" ]
Platform: IIS 6, ASP.Net 2.0 (.Net 3.5), Server 2003. I'm building an application that accepts files from a user, processes them, and returns a result. The file is uploaded using HTTP POST to an ASP.Net web form. The application is expecting some large files (hundreds of MB). I'm using SWFUpload to accomplish the upl...
Urlscan was active on all websites, and has it's own request entity length limit. I wasn't aware that Urlscan was running on our server because it was a global ISAPI filter, not running on my individual website. Note: to locate global ISAPI filters, right click on the Web Sites folder in IIS Admin and click Propertie...
206,142
<p>I have a full text catalog with two tables in it.</p> <p>tableA has 4 columns (a1, a2, a3, a4) of which 3 are indexed in the catalog, a2,a3,a4. a1 is the primary key.</p> <p>tableB has 3 columns (b1, b2, b3, b4), two of which are indexed in the catalog, b3 and b4. b1 is the PK of this table, b2 is the FK to tableA.<...
[ { "answer_id": 209763, "author": "Dave_H", "author_id": 17109, "author_profile": "https://Stackoverflow.com/users/17109", "pm_score": 2, "selected": false, "text": "<p>I'm not positive that I understood what you were trying to do. I interpreted your question as you want to return all it...
2008/10/15
[ "https://Stackoverflow.com/questions/206142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1741868/" ]
I have a full text catalog with two tables in it. tableA has 4 columns (a1, a2, a3, a4) of which 3 are indexed in the catalog, a2,a3,a4. a1 is the primary key. tableB has 3 columns (b1, b2, b3, b4), two of which are indexed in the catalog, b3 and b4. b1 is the PK of this table, b2 is the FK to tableA. I want to do s...
I'm not positive that I understood what you were trying to do. I interpreted your question as you want to return all items in Table A that matched the search term. Furthermore you wanted to sum the rank from the item in TableA plus the matching items in TableB. The best way I can think to do this is to use a table var...
206,161
<p>How would I get the length of an <code>ArrayList</code> using a JSF EL expression? </p> <pre><code>#{MyBean.somelist.length} </code></pre> <p>does not work.</p>
[ { "answer_id": 206252, "author": "billjamesdev", "author_id": 13824, "author_profile": "https://Stackoverflow.com/users/13824", "pm_score": 8, "selected": true, "text": "<p>Yes, since some genius in the Java API creation committee decided that, even though certain classes have <code>size...
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
Yes, since some genius in the Java API creation committee decided that, even though certain classes have `size()` members or `length` attributes, they won't implement `getSize()` or `getLength()` which JSF and most other standards require, you can't do what you want. There's a couple ways to do this. One: add a funct...
206,183
<p>I want subversion to commit a file even if it's unchanged. Is there a way to do this?</p>
[ { "answer_id": 206196, "author": "rslite", "author_id": 15682, "author_profile": "https://Stackoverflow.com/users/15682", "pm_score": 0, "selected": false, "text": "<p>I don't think that's possible, but first of all why do you need to do that? If a file is unchanged it shouldn't be commi...
2008/10/15
[ "https://Stackoverflow.com/questions/206183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15992/" ]
I want subversion to commit a file even if it's unchanged. Is there a way to do this?
If you want the file contents to remain unchanged (meaning that you can't merely change whitespace as johnstok suggested) you can always change one of the properties on the file. eg. ``` svn propset dummyproperty 1 yourfile svn commit yourfile ``` That will perform a commit without having to change the file. Just...
206,198
<p>i have a class with a static public property called "Info". via reflection i want to get this properties value, so i call:</p> <pre><code>PropertyInfo pi myType.GetProperty("Info"); string info = (string) pi.GetValue(null, null); </code></pre> <p>this works fine as long as the property is of type string. but actu...
[ { "answer_id": 206227, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>Could you create a short but complete program that demonstrates the problem?</p>\n\n<p>Given that you're talking about...
2008/10/15
[ "https://Stackoverflow.com/questions/206198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6368/" ]
i have a class with a static public property called "Info". via reflection i want to get this properties value, so i call: ``` PropertyInfo pi myType.GetProperty("Info"); string info = (string) pi.GetValue(null, null); ``` this works fine as long as the property is of type string. but actually my property is of typ...
Could you create a short but complete program that demonstrates the problem? Given that you're talking about plugins, my *guess* is that you've got the problem of having IPluginInfo defined in two different assemblies. See if [this article](http://pobox.com/~skeet/csharp/plugin.html) helps at all. The easiest way to ...
206,221
<p>I've successfully used the Windows SendMessage method to help me do various things in my text editor, but each time I am just copying and pasting code suggested by others, and I don't really know what it means. There is always a cryptic message number that is a parameter. How do I know what these code numbers mean...
[ { "answer_id": 206260, "author": "Francesca", "author_id": 9842, "author_profile": "https://Stackoverflow.com/users/9842", "pm_score": 3, "selected": true, "text": "<p>This is the windows message code.<br>\nThey are defined in the header files, and generally available translated as an in...
2008/10/15
[ "https://Stackoverflow.com/questions/206221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27109/" ]
I've successfully used the Windows SendMessage method to help me do various things in my text editor, but each time I am just copying and pasting code suggested by others, and I don't really know what it means. There is always a cryptic message number that is a parameter. How do I know what these code numbers mean so t...
This is the windows message code. They are defined in the header files, and generally available translated as an include of some sort with different languages. example: WM\_MOUSEMOVE = &H200 MK\_CONTROL = &H8 MK\_LBUTTON = &H1 MK\_MBUTTON = &H10 MK\_RBUTTON = &H2 MK\_SHIFT = &H4 MK\_XBUTTON1 =...
206,222
<p>I'm attempting to fulfill a rather difficult reporting request from a client, and I need to find away to get the difference between two DateTime columns in minutes. I've attempted to use trunc and round with various <a href="http://www.ss64.com/orasyntax/fmt.html" rel="noreferrer">formats</a> and can't seem to come...
[ { "answer_id": 206229, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://asktom.oracle.com/tkyte/Misc/DateDiff.html\" rel=\"nofollow noreferrer\">http://asktom.oracle.com/tk...
2008/10/15
[ "https://Stackoverflow.com/questions/206222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27457/" ]
I'm attempting to fulfill a rather difficult reporting request from a client, and I need to find away to get the difference between two DateTime columns in minutes. I've attempted to use trunc and round with various [formats](http://www.ss64.com/orasyntax/fmt.html) and can't seem to come up with a combination that make...
``` SELECT date1 - date2 FROM some_table ``` returns a difference in days. Multiply by 24 to get a difference in hours and 24\*60 to get minutes. So ``` SELECT (date1 - date2) * 24 * 60 difference_in_minutes FROM some_table ``` should be what you're looking for
206,224
<p>I'm trying to emulate the file upload code from the grails website, and I'm running into some problems. I'm using the same code as found <a href="http://grails.org/Controllers+-+File+Uploads" rel="nofollow noreferrer">here</a>. Here is my code:</p> <pre><code> &lt;g:form action="upload" method="post" enctype="...
[ { "answer_id": 206259, "author": "codeLes", "author_id": 3030, "author_profile": "https://Stackoverflow.com/users/3030", "pm_score": 2, "selected": false, "text": "<p>make sure you update the html (your gsp with the form to upload from) to have the <strong>enctype</strong> as they show:<...
2008/10/15
[ "https://Stackoverflow.com/questions/206224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21832/" ]
I'm trying to emulate the file upload code from the grails website, and I'm running into some problems. I'm using the same code as found [here](http://grails.org/Controllers+-+File+Uploads). Here is my code: ``` <g:form action="upload" method="post" enctype="multipart/form-data"> <input type="file" name="m...
Problem solved! I was using the example code for uploading files to Grails differently than the original author probably intended. The problem is that when the *upload* method of the controller was called, it was sometimes for the original render of the Upload page. The request in that method was was not of type Multi...
206,257
<p>I am declaring an array of void pointers. Each of which points to a value of arbitary type.<br> <code>void **values; // Array of void pointers to each value of arbitary type</code></p> <p>Initializing values as follows:</p> <pre><code> values = (void**)calloc(3,sizeof(void*)); //can initialize va...
[ { "answer_id": 206289, "author": "billjamesdev", "author_id": 13824, "author_profile": "https://Stackoverflow.com/users/13824", "pm_score": 0, "selected": false, "text": "<p>You'd have to keep track of how many void* were originally calloc'd, and iterate over them, free-ing each one, the...
2008/10/15
[ "https://Stackoverflow.com/questions/206257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27221/" ]
I am declaring an array of void pointers. Each of which points to a value of arbitary type. `void **values; // Array of void pointers to each value of arbitary type` Initializing values as follows: ``` values = (void**)calloc(3,sizeof(void*)); //can initialize values as: values = new void* [3]; int iv...
You have 3 things that are dynamically allocated that need to be freed in 2 different ways: ``` delete reinterpret_cast<int*>( values[0]); delete reinterpret_cast<float*>( values[1]); free( values); // I'm not sure why this would have failed in your example, // but it would have leaked the 2 it...
206,320
<p>I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file with no file extention. </p> <p>How ...
[ { "answer_id": 206339, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": false, "text": "<pre><code>print \"$file is a directory\\n\" if ( -d $file );\n</code></pre>\n" }, { "answer_id": 206351, ...
2008/10/15
[ "https://Stackoverflow.com/questions/206320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21539/" ]
I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file with no file extention. How can I tell...
You can use a `-d` file test operator to check if something is a directory. Here's some of the commonly useful file test operators ``` -e File exists. -z File has zero size (is empty). -s File has nonzero size (returns size in bytes). -f File is a plain file. -d File is a directory. -l F...
206,323
<p>How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box.</p>
[ { "answer_id": 206340, "author": "Kon", "author_id": 22303, "author_profile": "https://Stackoverflow.com/users/22303", "pm_score": 2, "selected": false, "text": "<p>This may not be the best/easiest way, but may be an option:</p>\n\n<p>When you execute from your code, add \" > output.txt\...
2008/10/15
[ "https://Stackoverflow.com/questions/206323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958/" ]
How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box.
``` // Start the child process. Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "YOURBATCHFILE.bat"; p.Start(); // Do not wait for the child process to exit before // reading to ...
206,324
<p>I want to check for empty arrays. Google gave me varied solutions but nothing worked. Maybe I am not applying them correctly.</p> <pre><code>Function GetBoiler(ByVal sFile As String) As String 'Email Signature Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Se...
[ { "answer_id": 206523, "author": "Mike Spross", "author_id": 17862, "author_profile": "https://Stackoverflow.com/users/17862", "pm_score": 2, "selected": false, "text": "<p>This code doesn't do what you expect:</p>\n\n<pre><code>If Dir(SigString) &lt;&gt; \"\" Then\n Signature = GetBo...
2008/10/15
[ "https://Stackoverflow.com/questions/206324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26927/" ]
I want to check for empty arrays. Google gave me varied solutions but nothing worked. Maybe I am not applying them correctly. ``` Function GetBoiler(ByVal sFile As String) As String 'Email Signature Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.Get...
As you are dealing with a string array, have you considered Join? ``` If Len(Join(FileNamesList)) > 0 Then ```
206,384
<p>I'm taking my first crack at <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" rel="noreferrer">Ajax</a> with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like this:</p> <pre...
[ { "answer_id": 206398, "author": "johnstok", "author_id": 27929, "author_profile": "https://Stackoverflow.com/users/27929", "pm_score": 5, "selected": false, "text": "<p>There is no built in date type in <a href=\"http://www.json.org/\" rel=\"noreferrer\">JSON</a>. This looks like the nu...
2008/10/15
[ "https://Stackoverflow.com/questions/206384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
I'm taking my first crack at [Ajax](http://en.wikipedia.org/wiki/Ajax_%28programming%29) with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like this: ``` /Date(1224043200000)/ ``` From so...
`eval()` is not necessary. This will work fine: ``` var date = new Date(parseInt(jsonDate.substr(6))); ``` The `substr()` function takes out the `/Date(` part, and the `parseInt()` function gets the integer and ignores the `)/` at the end. The resulting number is passed into the `Date` constructor. --- I have inte...
206,401
<p>i want to call a series of .sql scripts to create the initial database structure</p> <ol> <li>script1.sql</li> <li>script2.sql etc.</li> </ol> <p>is there any way of doing this without sqlcmd or stored procedures <strong>or any other kind of code that is not sql</strong> ? just inside a .sql file.</p>
[ { "answer_id": 273079, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 2, "selected": false, "text": "<p>Sure. Just create a little app that pulls in all the .sql files you want and executes them. Do it in VB.NET as f...
2008/10/15
[ "https://Stackoverflow.com/questions/206401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15193/" ]
i want to call a series of .sql scripts to create the initial database structure 1. script1.sql 2. script2.sql etc. is there any way of doing this without sqlcmd or stored procedures **or any other kind of code that is not sql** ? just inside a .sql file.
you could try this: ``` exec master..xp_cmdshell 'osql -E -ix:\path\filename.sql' ``` osql must be in the path, the full filename must be known, and logins have to be set up correctly (options -E or -U)
206,402
<p>Every morning we have a process that issues numerous queries (~10000) to DB2 on an AS400/iSeries/i6 (whatever IBM calls it nowadays), in the last 2 months, the operators have been complaining that our query locks a couple of files preventing them from completing their nightly processing. The queries are very simplis...
[ { "answer_id": 206556, "author": "Mike Wills", "author_id": 2535, "author_profile": "https://Stackoverflow.com/users/2535", "pm_score": 3, "selected": true, "text": "<p>Try adding \"FOR READ ONLY\" to the query then it won't lock records as you retrieve them.</p>\n" }, { "answer_...
2008/10/15
[ "https://Stackoverflow.com/questions/206402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7280/" ]
Every morning we have a process that issues numerous queries (~10000) to DB2 on an AS400/iSeries/i6 (whatever IBM calls it nowadays), in the last 2 months, the operators have been complaining that our query locks a couple of files preventing them from completing their nightly processing. The queries are very simplisiti...
Try adding "FOR READ ONLY" to the query then it won't lock records as you retrieve them.
206,405
<p>I like to have my code warning free for VS.NET and GCC, and I like to have my code 64-bit ready.</p> <p>Today I wrote a little module that deals with in memory buffers and provides access to the data via a file-style interface (e.g. you can read bytes, write bytes, seek around etc.).</p> <p>As the data-type for cu...
[ { "answer_id": 206422, "author": "Nicholas Mancuso", "author_id": 8945, "author_profile": "https://Stackoverflow.com/users/8945", "pm_score": 3, "selected": false, "text": "<p><code>size_t</code> should be unsigned.</p>\n\n<p>It's typically defined as unsigned long.</p>\n\n<p>I've never ...
2008/10/15
[ "https://Stackoverflow.com/questions/206405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15955/" ]
I like to have my code warning free for VS.NET and GCC, and I like to have my code 64-bit ready. Today I wrote a little module that deals with in memory buffers and provides access to the data via a file-style interface (e.g. you can read bytes, write bytes, seek around etc.). As the data-type for current read positi...
Regarding the whether `size`\_t is signed or unsigned and GCC (from an old GCC manual - I'm not sure if it's still there): > > There is a potential problem with the > `size_t` type and versions of GCC prior > to release 2.4. ANSI C requires that > `size_t` always be an unsigned type. For > compatibility with exis...
206,447
<p>I am trying to use a class from a C# assembly in vb.net. The class has ambiguous members because vb.net is case insensitive. The class is something like this:</p> <pre> public class Foo { public enum FORMAT {ONE, TWO, THREE}; public FORMAT Format { get {...} set {...} } } </pre> <p>I try to access...
[ { "answer_id": 206475, "author": "Scott Dorman", "author_id": 1559, "author_profile": "https://Stackoverflow.com/users/1559", "pm_score": 4, "selected": true, "text": "<p>I don't think you can get around this. Get in touch with the author of the C# component you are trying to use and con...
2008/10/15
[ "https://Stackoverflow.com/questions/206447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10034/" ]
I am trying to use a class from a C# assembly in vb.net. The class has ambiguous members because vb.net is case insensitive. The class is something like this: ``` public class Foo { public enum FORMAT {ONE, TWO, THREE}; public FORMAT Format { get {...} set {...} } } ``` I try to access the enum: Fo...
I don't think you can get around this. Get in touch with the author of the C# component you are trying to use and convince them to fix their code. Incidentally, this is the primary reason behind the `CLSCompliant(true)` attribute, which if you are writing APIs or other code that has a high probability of being used by...
206,469
<p>Need a refresher on bits/bytes, hex notation and how it relates to programming (C# preferred).</p> <p>Looking for a good reading list (online preferably).</p>
[ { "answer_id": 206504, "author": "Ryan", "author_id": 17917, "author_profile": "https://Stackoverflow.com/users/17917", "pm_score": 0, "selected": false, "text": "<p>A bit is either 1 or 0.</p>\n\n<p>A byte is 8 bits. </p>\n\n<p>Each character in hex is 4 bits represented as 0-F</p>\n\n<...
2008/10/15
[ "https://Stackoverflow.com/questions/206469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Need a refresher on bits/bytes, hex notation and how it relates to programming (C# preferred). Looking for a good reading list (online preferably).
There are several layers to consider here: * Electronic In the electronic paradigm, everything is a wire. A single wire represents a single bit. 0 is the LOW voltage, 1 is the HIGH voltage. The voltages may be `[0,5], [-3.3, 3], [-5, 5], [0, 1.3]`, etc. The key thing is that there are only two voltage levels which...
206,473
<p>Is there a way to compile an Eclipse-based Java project from the command line? </p> <p>I'm trying to automate my build (using FinalBuilder not ant), and I'm neither a Java nor Eclipse expert. I can probably figure out how to do this with straight java command line options, but then the Eclipse project feels like a ...
[ { "answer_id": 206497, "author": "André", "author_id": 9683, "author_profile": "https://Stackoverflow.com/users/9683", "pm_score": 3, "selected": false, "text": "<p>The normal apporoach works the other way around: You create your build based upon <a href=\"http://maven.apache.org/\" rel=...
2008/10/15
[ "https://Stackoverflow.com/questions/206473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208/" ]
Is there a way to compile an Eclipse-based Java project from the command line? I'm trying to automate my build (using FinalBuilder not ant), and I'm neither a Java nor Eclipse expert. I can probably figure out how to do this with straight java command line options, but then the Eclipse project feels like a lot of was...
You can build an eclipse project via a workspace from the command line: ``` eclipsec.exe -noSplash -data "D:\Source\MyProject\workspace" -application org.eclipse.jdt.apt.core.aptBuild ``` It uses the `jdt apt` plugin to build your workspace automatically. This is also known as a 'Headless Build'. Damn hard to figure...
206,484
<p>I tried searching around, but I couldn't find anything that would help me out.</p> <p>I'm trying to do this in SQL:</p> <pre><code>declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 FROM viewWhatever WHERE CASE @locationType WHEN 'location' THEN account_location = @locationID ...
[ { "answer_id": 206500, "author": "Bob Probst", "author_id": 12424, "author_profile": "https://Stackoverflow.com/users/12424", "pm_score": 9, "selected": true, "text": "<pre><code>declare @locationType varchar(50);\ndeclare @locationID int;\n\nSELECT column1, column2\nFROM viewWhatever\nW...
2008/10/15
[ "https://Stackoverflow.com/questions/206484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21828/" ]
I tried searching around, but I couldn't find anything that would help me out. I'm trying to do this in SQL: ``` declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 FROM viewWhatever WHERE CASE @locationType WHEN 'location' THEN account_location = @locationID WHEN 'area' THEN ...
``` declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 FROM viewWhatever WHERE @locationID = CASE @locationType WHEN 'location' THEN account_location WHEN 'area' THEN xxx_location_area WHEN 'division' THEN xxx_location_division END ```
206,495
<p>I have a listbox containing and image and a button. By default the button is hidden. I want to make the button visible whenever I hover over an item in the listbox. The XAML I am using is below. Thanks</p> <pre><code>&lt;Window.Resources&gt; &lt;Style TargetType="{x:Type ListBox}"&gt; &lt;Setter Propert...
[ { "answer_id": 206537, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 6, "selected": false, "text": "<p>Ok, try this in your button declaration:</p>\n\n<pre><code>&lt;Button x:Name=\"sideButton\" Width=\"20\"&gt;\n &lt...
2008/10/15
[ "https://Stackoverflow.com/questions/206495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a listbox containing and image and a button. By default the button is hidden. I want to make the button visible whenever I hover over an item in the listbox. The XAML I am using is below. Thanks ``` <Window.Resources> <Style TargetType="{x:Type ListBox}"> <Setter Property="ItemTemplate"> ...
Ok, try this in your button declaration: ``` <Button x:Name="sideButton" Width="20"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Hidden" /> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mod...
206,512
<p>At work, we have a testing tool that is used to send queries to a data source. The tool takes in input as XML files. The XML files were simple and easy to parse as long as the data structures we tried to represent were one layer deep. But now these data structures are more complex and representing them in XML is get...
[ { "answer_id": 206524, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.yaml.org\" rel=\"nofollow noreferrer\">YAML</a> may be what you're looking for.</p>\n" }, { ...
2008/10/15
[ "https://Stackoverflow.com/questions/206512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28385/" ]
At work, we have a testing tool that is used to send queries to a data source. The tool takes in input as XML files. The XML files were simple and easy to parse as long as the data structures we tried to represent were one layer deep. But now these data structures are more complex and representing them in XML is gettin...
[YAML](http://www.yaml.org) may be what you're looking for.
206,528
<p>I have this function in my Javascript Code that updates html fields with their new values whenever it is called. The problem cannot be with the function itself because it works brilliantly in every section except for one. Here is the JS function:</p> <pre><code> function updateFields() { document.getElementB...
[ { "answer_id": 206569, "author": "Eric Wendelin", "author_id": 25066, "author_profile": "https://Stackoverflow.com/users/25066", "pm_score": 3, "selected": true, "text": "<p>I'm curious, is it possible that there are actually 2 elements with an id of \"cost\"? That could, by updating the...
2008/10/15
[ "https://Stackoverflow.com/questions/206528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27763/" ]
I have this function in my Javascript Code that updates html fields with their new values whenever it is called. The problem cannot be with the function itself because it works brilliantly in every section except for one. Here is the JS function: ``` function updateFields() { document.getElementById('bf').innerH...
I'm curious, is it possible that there are actually 2 elements with an id of "cost"? That could, by updating the first one it finds, cause this issue. Different browsers may have different ways of implementing document.getElementById() so you might get even more inconsistent results with different browsers if this is t...
206,532
<p>Is there any reason something like this would not work?</p> <p>This is the logic I have used many times to update a record in a table with LINQ:</p> <pre><code> DataClasses1DataContext db = new DataClasses1DataContext(); User updateUser = db.Users.Single(e =&gt; e.user == user); updateUser.InUse = !updateUser.In...
[ { "answer_id": 206561, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>Is the InUse property a \"normal\" one as far as LINQ is concerned? (e.g. it's not autogenerated or anything funky li...
2008/10/15
[ "https://Stackoverflow.com/questions/206532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6161/" ]
Is there any reason something like this would not work? This is the logic I have used many times to update a record in a table with LINQ: ``` DataClasses1DataContext db = new DataClasses1DataContext(); User updateUser = db.Users.Single(e => e.user == user); updateUser.InUse = !updateUser.InUse; db.Log = new Syste...
The table could not be updated properly because it had no primary key. (Actually it had the column but the constraint was not copied when I did a SELECT INTO my dev table). **The DataContext class requires a primary key for updates.**
206,558
<p>I continually get these errors when I try to update tables based on another table. I end up rewriting the query, change the order of joins, change some groupings and then it eventually works, but I just don't quite get it.</p> <p>What is a 'multi-part identifier'?<br> When is a 'multi-part identifier' not able to b...
[ { "answer_id": 206581, "author": "Mark S. Rasmussen", "author_id": 12469, "author_profile": "https://Stackoverflow.com/users/12469", "pm_score": 3, "selected": false, "text": "<p>Binding = your textual representation of a specific column gets mapped to a physical column in some table, in...
2008/10/15
[ "https://Stackoverflow.com/questions/206558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73794/" ]
I continually get these errors when I try to update tables based on another table. I end up rewriting the query, change the order of joins, change some groupings and then it eventually works, but I just don't quite get it. What is a 'multi-part identifier'? When is a 'multi-part identifier' not able to be bound? ...
A multipart identifier is any description of a field or table that contains multiple parts - for instance MyTable.SomeRow - if it can't be bound that means there's something wrong with it - either you've got a simple typo, or a confusion between table and column. It can also be caused by using reserved words in your ta...
206,564
<p><em>[This question is related to but not the same as <a href="https://stackoverflow.com/questions/206106/is-a-safe-way-to-convert-to-bool-in-c">this one</a>.]</em></p> <p>My compiler warns about implicitly converting or casting certain types to bool whereas explicit conversions do not produce a warning:</p> <pre><...
[ { "answer_id": 206570, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<p>The performance is identical across the board. It involves a couple of instructions on x86, maybe 3 on some other architect...
2008/10/15
[ "https://Stackoverflow.com/questions/206564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10559/" ]
*[This question is related to but not the same as [this one](https://stackoverflow.com/questions/206106/is-a-safe-way-to-convert-to-bool-in-c).]* My compiler warns about implicitly converting or casting certain types to bool whereas explicit conversions do not produce a warning: ``` long t = 0; bool b = false; b = t;...
I was puzzled by this behaviour, until I found this link: <http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99633> Apparently, coming from the Microsoft Developer who "owns" this warning: > > *This warning is surprisingly > helpful, and found a bug in my code > just yesterday. I th...
206,577
<p>We are trying to move from using SQL DMO to SMO in our COM+ based application, as we are dropping support for SQL Server 2000 and adding support for SQL Server 2008 in addition to SQL Server 2005. </p> <p>I have been reading around on this, and found this particular quip on <a href="http://forums.microsoft.com/MSDN...
[ { "answer_id": 206620, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": -1, "selected": false, "text": "<p>I haven't tried it, but you could probably write vb.net code to interact with SQL SMO, and then write a com...
2008/10/15
[ "https://Stackoverflow.com/questions/206577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12881/" ]
We are trying to move from using SQL DMO to SMO in our COM+ based application, as we are dropping support for SQL Server 2000 and adding support for SQL Server 2008 in addition to SQL Server 2005. I have been reading around on this, and found this particular quip on [this microsoft forum:](http://forums.microsoft.com...
Okay I figured out how to do this. The problem was that VB6 has no .Net 2.0 support and hence we cannot use SMO with VB6. To get around that, I wrote a COM wrapper in C# which uses SMO and maps (mostly) one-to-one with the kind of functionality I want from from my VB app. Basically, Create a C# project, add the SMO ...
206,595
<p>I have a page that contains a user control that is just a personalized dropdown list . I assign to each item the attribute <code>onClick=__doPostBack('actrl',0)</code>.</p> <p>when I click the page postback fine and I got the expected results. However in IE6 my page doesn't change to the new values loaded from the...
[ { "answer_id": 206605, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "<p>The problem is that IE6 is not reloading the page from the server (its just grabbing the cached copy), however on a form ...
2008/10/15
[ "https://Stackoverflow.com/questions/206595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10968/" ]
I have a page that contains a user control that is just a personalized dropdown list . I assign to each item the attribute `onClick=__doPostBack('actrl',0)`. when I click the page postback fine and I got the expected results. However in IE6 my page doesn't change to the new values loaded from the server. The weird th...
This is a known IE6 bug (#223) with magical HTTP get requests. See the bug here: <http://webbugtrack.blogspot.com/2007/09/bug-223-magical-http-get-requests-in.html> It happens when an inline event handler causes a page change in IE6.
206,600
<p>This is happening on Vista. I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both:</p> <pre><code>this-&gt;m_cedit1.SetLimitText(100000); UpdateData(FALSE); </code></pre> <p>and </p> <pre><code>sta...
[ { "answer_id": 421845, "author": "rec", "author_id": 14022, "author_profile": "https://Stackoverflow.com/users/14022", "pm_score": 4, "selected": true, "text": "<p>I contacted microsof support. </p>\n\n<p>The goal was to have approximately\n 240000 characters in one single\n editable lin...
2008/10/15
[ "https://Stackoverflow.com/questions/206600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14022/" ]
This is happening on Vista. I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both: ``` this->m_cedit1.SetLimitText(100000); UpdateData(FALSE); ``` and ``` static_cast<CEdit*>(GetDlgItem(IDC_EDIT1))-...
I contacted microsof support. The goal was to have approximately 240000 characters in one single editable line of text. I am able to reproduce the issue on Windows Vista (x64 and x32 both) but *not* on Windows XP. this code works fine in XP: ``` BOOL ClongeditXPDlg::OnInitDialog() { CDialog::OnInitDial...
206,608
<p>I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters.</p> <p>The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press ...
[ { "answer_id": 206649, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 3, "selected": false, "text": "<p>The call</p>\n\n<pre><code>CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator\n</code></pre>\n\n<p>gets the d...
2008/10/15
[ "https://Stackoverflow.com/questions/206608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters. The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press the period...
The call ``` CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator ``` gets the decimal separator for the current user interface culture. You can use other cultures to get the separator for other languages. --- EDIT From the 166 cultures that are reported in my system (`CultureInfo.GetCultures(CultureT...
206,611
<p>How can I setup a default value to a property defined as follow:</p> <pre><code>public int MyProperty { get; set; } </code></pre> <p>That is using "prop" [tab][tab] in VS2008 (code snippet).</p> <p>Is it possible without falling back in the "old way"?:</p> <pre><code>private int myProperty = 0; // default value ...
[ { "answer_id": 206615, "author": "Chris Pietschmann", "author_id": 7831, "author_profile": "https://Stackoverflow.com/users/7831", "pm_score": 4, "selected": true, "text": "<p>Just set the \"default\" value within your constructor.</p>\n\n<pre><code>public class Person\n{\n public Pers...
2008/10/15
[ "https://Stackoverflow.com/questions/206611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4386/" ]
How can I setup a default value to a property defined as follow: ``` public int MyProperty { get; set; } ``` That is using "prop" [tab][tab] in VS2008 (code snippet). Is it possible without falling back in the "old way"?: ``` private int myProperty = 0; // default value public int MyProperty { get { return myP...
Just set the "default" value within your constructor. ``` public class Person { public Person() { this.FirstName = string.Empty; } public string FirstName { get; set; } } ``` Also, they're called Automatic Properties.
206,614
<p><strong>Preface</strong></p> <p>I'm using the newly released Microsoft Virtual Earth SDK v6.2 which has built-in support for pushpin clustering. I realize there are custom ways of doing clustering where my question is easy to answer, but I'd like to leverage the built-in support as much as possible, so this questi...
[ { "answer_id": 206615, "author": "Chris Pietschmann", "author_id": 7831, "author_profile": "https://Stackoverflow.com/users/7831", "pm_score": 4, "selected": true, "text": "<p>Just set the \"default\" value within your constructor.</p>\n\n<pre><code>public class Person\n{\n public Pers...
2008/10/15
[ "https://Stackoverflow.com/questions/206614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25886/" ]
**Preface** I'm using the newly released Microsoft Virtual Earth SDK v6.2 which has built-in support for pushpin clustering. I realize there are custom ways of doing clustering where my question is easy to answer, but I'd like to leverage the built-in support as much as possible, so this question is specifically relat...
Just set the "default" value within your constructor. ``` public class Person { public Person() { this.FirstName = string.Empty; } public string FirstName { get; set; } } ``` Also, they're called Automatic Properties.
206,652
<p>I'm working on moving from using tables for layout purposes to using divs (yes, yes the great debate). I've got 3 divs, a header, content and footer. The header and footer are 50px each. How do I get the footer div to stay at the bottom of the page, and the content div to fill the space in between? I don't want ...
[ { "answer_id": 206693, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": -1, "selected": false, "text": "<p>if you are trying to maximize the height of your content div, in the CSS add </p>\n\n<p>height: 100%;</p>\n" ...
2008/10/15
[ "https://Stackoverflow.com/questions/206652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
I'm working on moving from using tables for layout purposes to using divs (yes, yes the great debate). I've got 3 divs, a header, content and footer. The header and footer are 50px each. How do I get the footer div to stay at the bottom of the page, and the content div to fill the space in between? I don't want to hard...
Flexbox solution ================ Using flex layout we can achieve this while allowing for natural height header and footer. Both the header and footer will stick to the top and bottom of the viewport respectively (much like a native mobile app) and the main content area will fill the remaining space, while any vertic...
206,659
<p>I am using ASP.NET to transmit a .jar file. This code works perfectly on IE. However on Firefox the file downloads, corrupt. What is the best way to fix it? Below is the code I am using.</p> <pre><code>private void TransferFile() { try { string filePath = Server.MapPath("SomeJarFIle.jar"); ...
[ { "answer_id": 206676, "author": "ine", "author_id": 4965, "author_profile": "https://Stackoverflow.com/users/4965", "pm_score": 3, "selected": true, "text": "<p>I don't see a case for \".jar\" in the ReturnExtension() function (which I think might be better off named \"ReturnMimetype\")...
2008/10/15
[ "https://Stackoverflow.com/questions/206659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469/" ]
I am using ASP.NET to transmit a .jar file. This code works perfectly on IE. However on Firefox the file downloads, corrupt. What is the best way to fix it? Below is the code I am using. ``` private void TransferFile() { try { string filePath = Server.MapPath("SomeJarFIle.jar"); FileInfo file ...
I don't see a case for ".jar" in the ReturnExtension() function (which I think might be better off named "ReturnMimetype"). Could that be the problem, or did you just forget to paste it in? The mimetype for .jar is supposed to be **application/java-archive**. Details here: <http://en.wikipedia.org/wiki/Jar-file> I th...
206,661
<p>Yes, <a href="http://en.wikipedia.org/wiki/There_is_more_than_one_way_to_do_it" rel="noreferrer">There's More Than One Way To Do It</a> but there must be a canonical or most efficient or most concise way. I'll add answers I know of and see what percolates to the top.</p> <p>To be clear, the question is how best to ...
[ { "answer_id": 206681, "author": "dreeves", "author_id": 4234, "author_profile": "https://Stackoverflow.com/users/4234", "pm_score": 5, "selected": false, "text": "<pre><code>open(my $f, '&lt;', $filename) or die \"OPENING $filename: $!\\n\";\n$string = do { local($/); &lt;$f&gt; };\nclo...
2008/10/15
[ "https://Stackoverflow.com/questions/206661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
Yes, [There's More Than One Way To Do It](http://en.wikipedia.org/wiki/There_is_more_than_one_way_to_do_it) but there must be a canonical or most efficient or most concise way. I'll add answers I know of and see what percolates to the top. To be clear, the question is how best to read the contents of a file into a str...
How about this: ``` use File::Slurp; my $text = read_file($filename); ``` ETA: note [Bug #83126 for File-Slurp: Security hole with encoding(UTF-8)](https://rt.cpan.org/Ticket/Display.html?id=83126). I now recommend using [File::Slurper](https://metacpan.org/pod/File::Slurper) (disclaimer: I wrote it), also because i...
206,689
<p>I have a menu that I am using and it will change the background color when I hover using <code>a:hover</code> but I want to know how to change the <code>class=line</code> so that it sticks. </p> <p>So from the home if they click contacts the home pages </p> <blockquote> <p>from (a href="#" class="clr") to (a hr...
[ { "answer_id": 206705, "author": "friol", "author_id": 23034, "author_profile": "https://Stackoverflow.com/users/23034", "pm_score": 1, "selected": false, "text": "<p>The way to change class (I assume you're talking of the DOM), in javascript is:</p>\n\n<pre><code>document.getElementById...
2008/10/15
[ "https://Stackoverflow.com/questions/206689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a menu that I am using and it will change the background color when I hover using `a:hover` but I want to know how to change the `class=line` so that it sticks. So from the home if they click contacts the home pages > > from (a href="#" class="clr") to (a href="#") > > > and Contacts would change > >...
I believe you are wanting to highlight the navigational item that you're on. My answer [here](https://stackoverflow.com/questions/188124/programmatic-solution-to-change-navigation-id-to-highlight-current-page-aspnet#189069) is fairly valid in this question as well, I believe: It's a better semantic match and likely an...
206,717
<p>How can I replace multiple spaces in a string with only one space in C#?</p> <p>Example:</p> <pre><code>1 2 3 4 5 </code></pre> <p>would be:</p> <pre><code>1 2 3 4 5 </code></pre>
[ { "answer_id": 206720, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 10, "selected": true, "text": "<pre><code>string sentence = \"This is a sentence with multiple spaces\";\nRegexOptions options = RegexOptio...
2008/10/15
[ "https://Stackoverflow.com/questions/206717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21386/" ]
How can I replace multiple spaces in a string with only one space in C#? Example: ``` 1 2 3 4 5 ``` would be: ``` 1 2 3 4 5 ```
``` string sentence = "This is a sentence with multiple spaces"; RegexOptions options = RegexOptions.None; Regex regex = new Regex("[ ]{2,}", options); sentence = regex.Replace(sentence, " "); ```
206,718
<p>I want to load the data into session so that when the next button is clicked in crystal report viewer then in should load the data from the datatable instead retrieving the data again from the database. Here goes my code... </p> <pre><code> ReportDocument rpt = new ReportDocument(); DataTable resultSet = new ...
[ { "answer_id": 206739, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 2, "selected": true, "text": "<p>I think you'd want to use the Cache object with a unique key for each user instead of Session here.</p>\n\n<p>Pseudo ...
2008/10/15
[ "https://Stackoverflow.com/questions/206718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14752/" ]
I want to load the data into session so that when the next button is clicked in crystal report viewer then in should load the data from the datatable instead retrieving the data again from the database. Here goes my code... ``` ReportDocument rpt = new ReportDocument(); DataTable resultSet = new DataTable(); ...
I think you'd want to use the Cache object with a unique key for each user instead of Session here. Pseudo code: ``` var data = Cache["Record_999"] as DataTable; if (data == null) { // get from db // insert into cache } SetDataSource(data); ```
206,719
<p>My junk mail folder has been filling up with messages composed in what appears to be the Cyrillic alphabet. If a message body or a message subject is in Cyrillic, I want to permanently delete it.</p> <p>On my screen I see Cyrillic characters, but when I iterate through the messages in VBA within Outlook, the "Subje...
[ { "answer_id": 206745, "author": "Jeff Atwood", "author_id": 1, "author_profile": "https://Stackoverflow.com/users/1", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>the \"Subject\" property of the message returns a bunch of question marks.</p>\n</blockquote>\n\n<p>A class...
2008/10/15
[ "https://Stackoverflow.com/questions/206719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16415/" ]
My junk mail folder has been filling up with messages composed in what appears to be the Cyrillic alphabet. If a message body or a message subject is in Cyrillic, I want to permanently delete it. On my screen I see Cyrillic characters, but when I iterate through the messages in VBA within Outlook, the "Subject" proper...
The `String` datatype in VB/VBA can handle Unicode characters, but the IDE itself has trouble displaying them (hence the question marks). I wrote an `IsCyrillic` function that might help you out. The function takes a single `String` argument and returns `True` if the string contains at least one Cyrillic character. I...
206,734
<p>The following seems strange.. Basically, the somedata attribute seems shared between all the classes that inherited from <code>the_base_class</code>.</p> <pre><code>class the_base_class: somedata = {} somedata['was_false_in_base'] = False class subclassthing(the_base_class): def __init__(self): ...
[ { "answer_id": 206765, "author": "Torsten Marek", "author_id": 9567, "author_profile": "https://Stackoverflow.com/users/9567", "pm_score": 6, "selected": true, "text": "<p>You are right, <code>somedata</code> is shared between all instances of the class and it's subclasses, because it is...
2008/10/15
[ "https://Stackoverflow.com/questions/206734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
The following seems strange.. Basically, the somedata attribute seems shared between all the classes that inherited from `the_base_class`. ``` class the_base_class: somedata = {} somedata['was_false_in_base'] = False class subclassthing(the_base_class): def __init__(self): print self.somedata ...
You are right, `somedata` is shared between all instances of the class and it's subclasses, because it is created at class *definition* time. The lines ``` somedata = {} somedata['was_false_in_base'] = False ``` are executed when the class is defined, i.e. when the interpreter encounters the `class` statement - **n...
206,735
<p>I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from the tables below. If any value is null, I need it to return the text “No Entry”.</p> <p><strong>ContactTable</strong></p> <ul> <li><em>ContactID</em></li> <li>ContactDate </li> <li>UserID </li> <li>Summary </li> <li>ContactT...
[ { "answer_id": 206752, "author": "Forgotten Semicolon", "author_id": 1960, "author_profile": "https://Stackoverflow.com/users/1960", "pm_score": 5, "selected": true, "text": "<pre><code>SELECT COALESCE(CAST(CONVERT(VARCHAR(10), ContactTable.ContactDate, 101) AS VARCHAR(10)), 'No Entry') ...
2008/10/15
[ "https://Stackoverflow.com/questions/206735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8900/" ]
I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from the tables below. If any value is null, I need it to return the text “No Entry”. **ContactTable** * *ContactID* * ContactDate * UserID * Summary * ContactType * SortName **UserTable** * *UserID* * FirstName * LastName * Addre...
``` SELECT COALESCE(CAST(CONVERT(VARCHAR(10), ContactTable.ContactDate, 101) AS VARCHAR(10)), 'No Entry') AS ContactDate, COALESCE(ContactTable.SortName, 'No Entry') AS SortName, COALESCE(AddressTable.City, 'No Entry') AS City, COALESCE(ContactTable.ContactType, 'No Entry') AS ContactType FROM Cont...
206,751
<p>I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc). Two questions:</p> <ol> <li><p>Why does it do that?</p></li> <li><p>Is that a pro...
[ { "answer_id": 206769, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 6, "selected": false, "text": "<p>Check to see the seed value of the autoincrement isn't set to 10.</p>\n\n<p>You can check by:</p>\n\n<pre><code>SELEC...
2008/10/15
[ "https://Stackoverflow.com/questions/206751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc). Two questions: 1. Why does it do that? 2. Is that a problem?
Check to see the seed value of the autoincrement isn't set to 10. You can check by: ``` SELECT Auto_increment FROM information_schema.tables WHERE table_name='the_table_you_want'; ``` As noted elsewhere you can change by using the system variable @@set\_auto\_increment\_increment ``` SET @@auto_increment_increment...
206,767
<p>I want to implement forms authentication on an ASP.NET website, the site should seek the user on the database to get some data and then authenticate against LDAP (Active Directory) to validate the user/password combo.</p> <p>After that I need to keep a instance of class that represents the user to use it in various...
[ { "answer_id": 206773, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": true, "text": "<p>I would use Windows Authentication as the main authentication provider, but roll my own simple database persistence for us...
2008/10/15
[ "https://Stackoverflow.com/questions/206767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23020/" ]
I want to implement forms authentication on an ASP.NET website, the site should seek the user on the database to get some data and then authenticate against LDAP (Active Directory) to validate the user/password combo. After that I need to keep a instance of class that represents the user to use it in various forms. I...
I would use Windows Authentication as the main authentication provider, but roll my own simple database persistence for user information. Your session method would work, you can adjust session timeout in IIS and match it to the authentication cookie timeout. Also, you can do something like this in a HTTPModule to cat...
206,770
<p>In a previous question, I learned how to keep a footer div at the bottom of the page. (<a href="https://stackoverflow.com/questions/206652/how-to-create-div-to-fill-all-space-between-header-and-footer-div">see other question</a>)</p> <p>Now I'm trying to vertically center content between the header and footer divs....
[ { "answer_id": 206812, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 0, "selected": false, "text": "<p>You need to either set the <code>height</code> of the div to fill the whole content area or its coordinates have to b...
2008/10/15
[ "https://Stackoverflow.com/questions/206770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
In a previous question, I learned how to keep a footer div at the bottom of the page. ([see other question](https://stackoverflow.com/questions/206652/how-to-create-div-to-fill-all-space-between-header-and-footer-div)) Now I'm trying to vertically center content between the header and footer divs. so what I've got is...
In CSS2: ``` html,body {height:100%;} body {display:table;} div {display:table-row;} #content { display:table-cell; vertical-align:middle; } ``` & ``` <body> <div>header</div> <div id="content">content</div> <div>footer</div> </body> ``` <http://codepen.io/anon/pen/doMwvJ> In old IE (<=7) you have to use...
206,775
<p>I am trying to detect which web in sharepoint that the user is looking at right now. One approach could be to read the URls from the browser and try to compare them to a reference URL to the sharepoint solution. I have not yet been able to locate any solution that works in both IE and Firefox.</p> <p>The idea is to...
[ { "answer_id": 206784, "author": "David Arno", "author_id": 7122, "author_profile": "https://Stackoverflow.com/users/7122", "pm_score": 1, "selected": false, "text": "<p>You are unlikely to find such an answer. All modern browsers restrict the ability of JavaScript on a page to access su...
2008/10/15
[ "https://Stackoverflow.com/questions/206775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23499/" ]
I am trying to detect which web in sharepoint that the user is looking at right now. One approach could be to read the URls from the browser and try to compare them to a reference URL to the sharepoint solution. I have not yet been able to locate any solution that works in both IE and Firefox. The idea is to write a s...
It is possible to do this in a very hacky and prone to breakage way using the Win32 API function FindWindow. The following C++ example that finds a running instance of the windows Calculator and gets the value of the edit field in it. You should be able to do something similar in C#. Disclaimer: I haven't actually che...
206,783
<p>I have a JavaScript resource that has the possibility of being edited at any time. Once it is edited I would want it to be propagated to the user's browser relatively quickly (like maybe 15 minutes or so), however, the frequency of this resource being editing is few and far between (maybe 2 a month).</p> <p>I'd rat...
[ { "answer_id": 206789, "author": "Craig", "author_id": 27294, "author_profile": "https://Stackoverflow.com/users/27294", "pm_score": 4, "selected": false, "text": "<p>Put a version on your javascript code like this that is updated when you make a change</p>\n\n<pre><code>&lt;script src=\...
2008/10/15
[ "https://Stackoverflow.com/questions/206783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4481/" ]
I have a JavaScript resource that has the possibility of being edited at any time. Once it is edited I would want it to be propagated to the user's browser relatively quickly (like maybe 15 minutes or so), however, the frequency of this resource being editing is few and far between (maybe 2 a month). I'd rather the re...
You may pass a version string as a get parameter to the URL of your script tag. The parameter won't be evaluated by the static JavaScript file but force the browser to get the new version. If you do not want to assign the version string every time you edited the source you may compute it based on the file system time...
206,788
<p>I've installed the Windows XAMPP package on three separate computers, 2 running Windows Vista 32 bit ( 1 Ultimate / 1 Home Premium ) and 1 running Windows Vista 64 Home Premium.</p> <p>After enabling xdebug in php.ini and restarting apache, viewing the default XAMPP localhost index causes apache to crash in the sam...
[ { "answer_id": 261492, "author": "user34052", "author_id": 34052, "author_profile": "https://Stackoverflow.com/users/34052", "pm_score": 1, "selected": false, "text": "<p>Via some other forum I found a possible hint - while generally apache on xampp uses the php.ini that is inside the ap...
2008/10/15
[ "https://Stackoverflow.com/questions/206788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've installed the Windows XAMPP package on three separate computers, 2 running Windows Vista 32 bit ( 1 Ultimate / 1 Home Premium ) and 1 running Windows Vista 64 Home Premium. After enabling xdebug in php.ini and restarting apache, viewing the default XAMPP localhost index causes apache to crash in the same way ever...
I'm running XAMPP for Windows Version 1.7.1 on my Win7 machine with xDebug and it works perfect. Check if you have SP1 installed, and then follow [these notes](http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development#Edit_PHP.INI_File): 1. Find the line containing `implicit_flush` and set it as foll...
206,793
<p>Why won't my connection string to SQL server work with Windows authentication? A sql user works fine, acme\administrator or administrator@acme.com won't work. This is a Win Form app written in C#.</p> <pre><code> { OdbcConnection cn = null; String connectionString; connectionString = ...
[ { "answer_id": 206804, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 4, "selected": false, "text": "<p>You are using SQL Server authentication.</p>\n\n<p>Windows authentication authenticates your connection with the Wind...
2008/10/15
[ "https://Stackoverflow.com/questions/206793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Why won't my connection string to SQL server work with Windows authentication? A sql user works fine, acme\administrator or administrator@acme.com won't work. This is a Win Form app written in C#. ``` { OdbcConnection cn = null; String connectionString; connectionString = "Driver={SQL S...
You are using SQL Server authentication. Windows authentication authenticates your connection with the Windows identity of the currently executing process or thread. You cannot set a username and password with Windows authentication. Instead, you set Integrated Security = SSPI.
206,805
<p>I'm trying to use <code>tasklist</code> to find out which process is consuming more than X percent of my CPU (to later kill it with <code>taskkill</code>.) </p> <p>How do I know what percent a time format represents?</p> <p>The documentations says:</p> <pre><code>TASKLIST options /FI filter </c...
[ { "answer_id": 206893, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": -1, "selected": true, "text": "<p>Tasklist's CPUTime is a measure of how much CPU time (cycles) have been used since the start of the process, so to conver...
2008/10/15
[ "https://Stackoverflow.com/questions/206805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
I'm trying to use `tasklist` to find out which process is consuming more than X percent of my CPU (to later kill it with `taskkill`.) How do I know what percent a time format represents? The documentations says: ``` TASKLIST options /FI filter ``` And one filter may be: ``` CPUTIME eq, ...
Tasklist's CPUTime is a measure of how much CPU time (cycles) have been used since the start of the process, so to convert that to a percent, it would be ``` (TotalProcessRuntime / CpuTime) / 100 ``` At least, thats what I gather :)
206,811
<p>My studio has a large codebase that has been developed over 10+ years. The coding standards that we started with were developed with few developers in house and long before we had to worry about any kind of standards related to C++.</p> <p>Recently, we started a small R&amp;D project in house and we updated our co...
[ { "answer_id": 206838, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 0, "selected": false, "text": "<p>I think renaming variables is going to be tricky - fortunately you're going from _ convention to Capitalised so it won...
2008/10/15
[ "https://Stackoverflow.com/questions/206811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4405/" ]
My studio has a large codebase that has been developed over 10+ years. The coding standards that we started with were developed with few developers in house and long before we had to worry about any kind of standards related to C++. Recently, we started a small R&D project in house and we updated our coding convention...
My process would be to rename each time someone touches a given module. Eventually, all modules would be refactored, but the incremental approach would result in less code breakage(assuming you have a complete set of tests. ;) )
206,820
<p>I would like to either prevent or handle a <code>StackOverflowException</code> that I am getting from a call to the <code>XslCompiledTransform.Transform</code> method within an <code>Xsl Editor</code> I am writing. The problem seems to be that the user can write an <code>Xsl script</code> that is infinitely recursiv...
[ { "answer_id": 206842, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 7, "selected": true, "text": "<p>From Microsoft:</p>\n\n<blockquote>\n <p>Starting with the .NET Framework\n version 2.0, a StackOverflowException\n obj...
2008/10/15
[ "https://Stackoverflow.com/questions/206820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27109/" ]
I would like to either prevent or handle a `StackOverflowException` that I am getting from a call to the `XslCompiledTransform.Transform` method within an `Xsl Editor` I am writing. The problem seems to be that the user can write an `Xsl script` that is infinitely recursive, and it just blows up on the call to the `Tra...
From Microsoft: > > Starting with the .NET Framework > version 2.0, a StackOverflowException > object cannot be caught by a try-catch > block and the corresponding process is > terminated by default. Consequently, > users are advised to write their code > to detect and prevent a stack > overflow. For example, ...
206,853
<p>I'm running a console app (myApp.exe) which outputs a pseudo localized (unicode) string to the standard output. If I run this in a regular command prompt(cmd.exe), the unicode data gets lost. If I run this in a unicode command prompt(cmd.exe /u) or set the properties of the console to "Lucida Console" then the unico...
[ { "answer_id": 207129, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 2, "selected": false, "text": "<p>It looks like you need to change the encoding on the StandardOutput stream from your console app, using the <a href=\"h...
2008/10/15
[ "https://Stackoverflow.com/questions/206853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/165305/" ]
I'm running a console app (myApp.exe) which outputs a pseudo localized (unicode) string to the standard output. If I run this in a regular command prompt(cmd.exe), the unicode data gets lost. If I run this in a unicode command prompt(cmd.exe /u) or set the properties of the console to "Lucida Console" then the unicode ...
It looks like you need to change the encoding on the StandardOutput stream from your console app, using the [StandardOutputEncoding](http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.standardoutputencoding.aspx) property on ProcessStartInfo. Try adding the following code inside your try/catch ...
206,857
<p>I would like to implement a producer/consumer scenario that obeys interfaces that are roughly:</p> <pre><code>class Consumer { private: vector&lt;char&gt; read(size_t n) { // If the internal buffer has `n` elements, then dequeue them // Otherwise wait for more data and try again } public: ...
[ { "answer_id": 206868, "author": "Paul Nathan", "author_id": 26227, "author_profile": "https://Stackoverflow.com/users/26227", "pm_score": 1, "selected": false, "text": "<p>I'll throw down some semi-pseudo-code. Here are my comments:</p>\n\n<p>1)Very large grains of locking here. If you ...
2008/10/15
[ "https://Stackoverflow.com/questions/206857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
I would like to implement a producer/consumer scenario that obeys interfaces that are roughly: ``` class Consumer { private: vector<char> read(size_t n) { // If the internal buffer has `n` elements, then dequeue them // Otherwise wait for more data and try again } public: void run() { ...
This code is not production ready. No error checking is done on the results of any library calls. I have wrapped the lock/unlock of the mutex in LockThread so it is exception safe. But that's about it. In addition if I was doing this seriously I would wrap the mutex and condition variables inside objects so they can ...
206,867
<p>I've done some research and I can't really find a preferred way to do updating of form controls from a worker thread in C#. I know about the BackgroundWorker component, but what is the best way to do it without using the BackgroundWorker component?</p>
[ { "answer_id": 206871, "author": "Mark", "author_id": 26310, "author_profile": "https://Stackoverflow.com/users/26310", "pm_score": 3, "selected": false, "text": "<p>Why dont you want to do it using the BackgroundWorker? It has a fantastic callback event called ProgressChanged which lets...
2008/10/15
[ "https://Stackoverflow.com/questions/206867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12172/" ]
I've done some research and I can't really find a preferred way to do updating of form controls from a worker thread in C#. I know about the BackgroundWorker component, but what is the best way to do it without using the BackgroundWorker component?
There's a general rule of thumb that says don't update the UI from any thread other than the UI thread itself. Using the features of the BackgroundWorker is a good idea, but you don't want to and something is happening on a different thread, you should do an "Invoke" or BeginInvoke to force the delegate to execute the ...
206,885
<p>Let's say I've got some Perl code that increments a column in a specific row of a database each time it's hit, and I'm expecting it to be hit pretty frequently, so I'd like to optimize it with FCGI. Right now, I basically wrapped most of the code in something like this:</p> <pre><code>while (FCGI::accept() &gt;= 0...
[ { "answer_id": 206896, "author": "zigdon", "author_id": 4913, "author_profile": "https://Stackoverflow.com/users/4913", "pm_score": 1, "selected": false, "text": "<p>You would still gain from FCGI even if you do keep your DB connection in the loop - but you would gain even more if you mo...
2008/10/15
[ "https://Stackoverflow.com/questions/206885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Let's say I've got some Perl code that increments a column in a specific row of a database each time it's hit, and I'm expecting it to be hit pretty frequently, so I'd like to optimize it with FCGI. Right now, I basically wrapped most of the code in something like this: ``` while (FCGI::accept() >= 0) { [code which c...
bmdhacks is right that if you're using MySQL or PostgreSQL it doesn't matter as much since connections are pretty cheap. But no matter your database you will have speed gains by using persistent connections. But if you do decide to go with persistent connections you will need to worry about connection timeouts. These ...
206,916
<p>I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget. The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last ...
[ { "answer_id": 207018, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 3, "selected": true, "text": "<p>At first, after you do the deletion, the event goes on with its normal processing, i.e. the character gets inserted. You need...
2008/10/15
[ "https://Stackoverflow.com/questions/206916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget. The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last typ...
At first, after you do the deletion, the event goes on with its normal processing, i.e. the character gets inserted. You need to signal to Tkinter that the event should be ignored. So in your code above, add the marked line: ``` if len(self.__value) > 2: widgetName.delete(2,4) return "break" # add this line ...
206,953
<p>I've got a collection (List&lt;Rectangle&gt;) which I need to sort left-right. That part's easy. Then I want to iterate through the Rectangles in their <em>original</em> order, but easily find their index in the sorted collection. indexOf() won't work, since I may have a number of equal objects. I can't help feeling...
[ { "answer_id": 206966, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 2, "selected": false, "text": "<p>If you don't have tens of thousands of objects, you could just store them in two separate collections, one origin...
2008/10/16
[ "https://Stackoverflow.com/questions/206953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26334/" ]
I've got a collection (List<Rectangle>) which I need to sort left-right. That part's easy. Then I want to iterate through the Rectangles in their *original* order, but easily find their index in the sorted collection. indexOf() won't work, since I may have a number of equal objects. I can't help feeling there should be...
I've found a solution - but perhaps there is a neater/more optimal one out there. ``` List<Rectangle> originalRects = ...; /* record index of each rectangle object. * Using a hash map makes lookups efficient, * and using an IdentityHashMap means we lookup by object identity * not value. */ IdentityHashMap<Rectang...